* [PATCH] generic/402: update test script style
@ 2019-10-23 22:04 Deepa Dinamani
2019-10-24 16:01 ` Eryu Guan
0 siblings, 1 reply; 2+ messages in thread
From: Deepa Dinamani @ 2019-10-23 22:04 UTC (permalink / raw)
To: fstests, guaneryu; +Cc: arnd, deepa.kernel, y2038
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(-)
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] generic/402: update test script style
2019-10-23 22:04 [PATCH] generic/402: update test script style Deepa Dinamani
@ 2019-10-24 16:01 ` Eryu Guan
0 siblings, 0 replies; 2+ messages in thread
From: Eryu Guan @ 2019-10-24 16:01 UTC (permalink / raw)
To: Deepa Dinamani; +Cc: fstests, arnd, y2038
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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-24 16:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23 22:04 [PATCH] generic/402: update test script style Deepa Dinamani
2019-10-24 16:01 ` Eryu Guan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).