[PATCH] generic/094: fix test ignoring failures

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



From: Filipe Manana <fdmanana@xxxxxxxx>

The test is ignoring failures completely:

1) If mounting the scratch device fails it redirects both stdout and
   stderr to /dev/null, so it gets unnoticed and the test runs against
   a different fs than expected (in my test environment $SCRATCH_MNT
   points to a directory in an ext4 fs for example but I want to test
   btrfs);

2) We are redirecting the stdout and stderr of fiemap-tester to the
   $seqres.full file, so if it fails it gets completely unnoticed and
   the test succeeds.

For the first issue fix this by not even using the scratch filesystem and
use instead the test filesystem, since the test creates a 2M file which
is small enough.

For the second issue simply don't redirect the stdout and stderr, so that
if the test program fails it causes a mismatch with the golden output,
making the test fail.

Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx>
---
 tests/generic/094 | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/tests/generic/094 b/tests/generic/094
index c82efced..6ae417c3 100755
--- a/tests/generic/094
+++ b/tests/generic/094
@@ -9,18 +9,22 @@
 . ./common/preamble
 _begin_fstest auto quick prealloc fiemap
 
+_cleanup()
+{
+	cd /
+	rm -fr $tmp.*
+	rm -f $fiemapfile
+}
+
 # Import common functions.
 . ./common/filter
 
-_require_scratch
+_require_test
 _require_odirect
 _require_xfs_io_command "fiemap"
 _require_xfs_io_command "falloc"
 
-_scratch_mkfs > /dev/null 2>&1
-_scratch_mount > /dev/null 2>&1
-
-fiemapfile=$SCRATCH_MNT/$seq.fiemap
+fiemapfile=$TEST_DIR/$seq.fiemap
 
 _require_test_program "fiemap-tester"
 
@@ -29,12 +33,10 @@ seed=`date +%s`
 echo "using seed $seed" >> $seqres.full
 
 echo "fiemap run with sync"
-$here/src/fiemap-tester -q -S -s $seed -r 200 $fiemapfile 2>&1 | \
-	tee -a $seqres.full
+$here/src/fiemap-tester -q -S -s $seed -r 200 $fiemapfile
 
 echo "fiemap run without sync"
-$here/src/fiemap-tester -q -s $seed -r 200 $fiemapfile 2>&1 | \
-	tee -a $seqres.full
+$here/src/fiemap-tester -q -s $seed -r 200 $fiemapfile
 
 status=0
 exit
-- 
2.47.2





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux