Message ID | 20191023220401.12335-1-deepa.kernel@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | generic/402: update test script style | expand |
On Wed, Oct 23, 2019 at 03:04:01PM -0700, Deepa Dinamani wrote: > Removed test result checking, as test result already depends on > output diff comparison with the golden output. > > Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Thanks! I've folded this into original patch. Thanks, Eryu > --- > tests/generic/402 | 33 +++++++-------------------------- > tests/generic/402.out | 2 +- > 2 files changed, 8 insertions(+), 27 deletions(-) > > diff --git a/tests/generic/402 b/tests/generic/402 > index dd136ec2..0392c258 100755 > --- a/tests/generic/402 > +++ b/tests/generic/402 > @@ -44,14 +44,11 @@ check_stat() > prev_timestamp="$timestamp;$timestamp" > if [ $prev_timestamp != $stat_timestamp ]; then > echo "$prev_timestamp != $stat_timestamp" | tee -a $seqres.full > - return 1 > fi > - return 0 > } > > run_test_individual() > { > - fail=0 > file=$1 > timestamp=$2 > update_time=$3 > @@ -62,33 +59,24 @@ run_test_individual() > $XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file > if [ $? -ne 0 ]; then > echo "Failed to update times on $file" | tee -a $seqres.full > - fail=1 > fi > fi > > tsclamp=$((timestamp<tsmin?tsmin:timestamp>tsmax?tsmax:timestamp)) > echo "Checking file: $file Updated timestamp is $tsclamp" >> $seqres.full > - if ! check_stat $file $tsclamp; then > - fail=1 > - fi > - return $fail > + check_stat $file $tsclamp > } > > run_test() > { > - fail=0 > update_time=$1 > > n=1 > > for TIME in "${TIMESTAMPS[@]}"; do > - if ! run_test_individual ${SCRATCH_MNT}/test_$n $TIME $update_time; then > - fail=1 > - fi > + run_test_individual ${SCRATCH_MNT}/test_$n $TIME $update_time > ((n++)) > done > - > - return $fail > } > > _scratch_mkfs &>> $seqres.full 2>&1 || _fail "mkfs failed" > @@ -108,8 +96,7 @@ declare -a TIMESTAMPS=( > $((tsmax+1)) > ) > > -_scratch_mount > -result=$? > +_scratch_mount || _fail "scratch mount failed" > > status=0 > > @@ -119,9 +106,7 @@ echo "In memory timestamps update test start" >> $seqres.full > # update time on the file > update_time=1 > > -if ! run_test $update_time; then > - status=1 > -fi > +run_test $update_time > > echo "In memory timestamps update complete" >> $seqres.full > > @@ -140,13 +125,9 @@ update_time=0 > echo "On disk timestamps update test start" >> $seqres.full > > # Re-run test > -if ! run_test $update_time; then > - status=1 > -fi > +run_test $update_time > > echo "On disk timestamps update test complete" >> $seqres.full > > -echo "inode timestamp tests completed status $status" > - > -# success, all done > -exit $status > +echo Silence is golden > +exit > diff --git a/tests/generic/402.out b/tests/generic/402.out > index 4500e6c7..28e1501c 100644 > --- a/tests/generic/402.out > +++ b/tests/generic/402.out > @@ -1,2 +1,2 @@ > QA output created by 402 > -inode timestamp tests completed status 0 > +Silence is golden > -- > 2.17.1 >
diff --git a/tests/generic/402 b/tests/generic/402 index dd136ec2..0392c258 100755 --- a/tests/generic/402 +++ b/tests/generic/402 @@ -44,14 +44,11 @@ check_stat() prev_timestamp="$timestamp;$timestamp" if [ $prev_timestamp != $stat_timestamp ]; then echo "$prev_timestamp != $stat_timestamp" | tee -a $seqres.full - return 1 fi - return 0 } run_test_individual() { - fail=0 file=$1 timestamp=$2 update_time=$3 @@ -62,33 +59,24 @@ run_test_individual() $XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file if [ $? -ne 0 ]; then echo "Failed to update times on $file" | tee -a $seqres.full - fail=1 fi fi tsclamp=$((timestamp<tsmin?tsmin:timestamp>tsmax?tsmax:timestamp)) echo "Checking file: $file Updated timestamp is $tsclamp" >> $seqres.full - if ! check_stat $file $tsclamp; then - fail=1 - fi - return $fail + check_stat $file $tsclamp } run_test() { - fail=0 update_time=$1 n=1 for TIME in "${TIMESTAMPS[@]}"; do - if ! run_test_individual ${SCRATCH_MNT}/test_$n $TIME $update_time; then - fail=1 - fi + run_test_individual ${SCRATCH_MNT}/test_$n $TIME $update_time ((n++)) done - - return $fail } _scratch_mkfs &>> $seqres.full 2>&1 || _fail "mkfs failed" @@ -108,8 +96,7 @@ declare -a TIMESTAMPS=( $((tsmax+1)) ) -_scratch_mount -result=$? +_scratch_mount || _fail "scratch mount failed" status=0 @@ -119,9 +106,7 @@ echo "In memory timestamps update test start" >> $seqres.full # update time on the file update_time=1 -if ! run_test $update_time; then - status=1 -fi +run_test $update_time echo "In memory timestamps update complete" >> $seqres.full @@ -140,13 +125,9 @@ update_time=0 echo "On disk timestamps update test start" >> $seqres.full # Re-run test -if ! run_test $update_time; then - status=1 -fi +run_test $update_time echo "On disk timestamps update test complete" >> $seqres.full -echo "inode timestamp tests completed status $status" - -# success, all done -exit $status +echo Silence is golden +exit diff --git a/tests/generic/402.out b/tests/generic/402.out index 4500e6c7..28e1501c 100644 --- a/tests/generic/402.out +++ b/tests/generic/402.out @@ -1,2 +1,2 @@ QA output created by 402 -inode timestamp tests completed status 0 +Silence is golden
Removed test result checking, as test result already depends on output diff comparison with the golden output. Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> --- tests/generic/402 | 33 +++++++-------------------------- tests/generic/402.out | 2 +- 2 files changed, 8 insertions(+), 27 deletions(-)