Skip to contentSkip to conversation

generic: clean up tests using fio

PATCH New Theodore Ts'o 1 participant 1 message Mar 8, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generic: clean up tests using fio

During the code review for a test to exercises AIO/DIO into unwritten space, a number of changes were requested that were also applicable to generic/299 and generic/300 (from which the aforementioned test was patterned). For example, the use of run_check, which is deprecated, was dropped. In addition, we now rely on the test runner to unmount the scratch file system.

Also fix a nit I found in generic/095, which resulted in debugging information in the $seqres.full to get lost when "fio ... --output=$seqres.full" is run.

---
 tests/generic/095 |  4 ++-
 tests/generic/299 | 73 ++++++++++++++++++++++-------------------------
 tests/generic/300 | 33 +++++++++------------
 3 files changed, 51 insertions(+), 59 deletions(-)
tests/generic/095 +3 -1
index 30fe77a5..97757957 100755
@@ -34,6 +34,7 @@ iodepth=$((16 * LOAD_FACTOR))
 iodepth_batch=$((8 * LOAD_FACTOR))
 numjobs=$((5 * LOAD_FACTOR))
 fio_config=$tmp.fio
+fio_out=$tmp.fio.out
 cat >$fio_config <<EOF
 [global]
 bs=8k
@@ -101,7 +102,8 @@ _scratch_mount
 # There's a known EIO failure to report collisions between directio and buffered
 # writes to userspace, refer to upstream linux 5a9d929d6e13. So ignore EIO error
 # at here.
-$FIO_PROG $fio_config --ignore_error=,EIO --output=$seqres.full
+$FIO_PROG $fio_config --ignore_error=,EIO --output=$fio_out
+cat $fio_out >> $seqres.full
 echo "Silence is golden"
 
 # xfs generates WARNINGs on purpose when applications mix buffered/mmap IO with
tests/generic/299 +34 -39

95 lines not on this page · raw message

tests/generic/300 +14 -19
index f7a99d4a..2fe5ac6e 100755
@@ -15,8 +15,14 @@ echo "QA output created by $seq"
 here=`pwd`
 tmp=/tmp/$$
 fio_config=$tmp.fio
+fio_out=$tmp.fio.out
 status=1	# failure is the default!
-trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    rm -f $tmp.*
+}
 
 # get standard environment, filters and checks
 . ./common/rc
@@ -26,6 +32,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 _supported_fs generic
 _require_scratch
 _require_odirect
+_require_aio
 _require_block_device $SCRATCH_DEV
 
 # xfs_io is not required for this test, but it's the best way to verify
@@ -115,29 +122,17 @@ rw=randwrite
 filename=aio-dio-verifier
 EOF
 
-_workout()
-{
-	echo ""
-	echo "Run fio with random aio-dio pattern"
-	echo ""
-	cat $fio_config >>  $seqres.full
-	run_check $FIO_PROG $fio_config
-}
-
 _require_fio $fio_config
 
 _scratch_mkfs_sized $FS_SIZE >> $seqres.full 2>&1
 _scratch_mount
 
-if ! _workout; then
-	_scratch_unmount 2>/dev/null
-	exit
-fi
+echo ""
+echo "Run fio with random aio-dio pattern"
+echo ""
+cat $fio_config >>  $seqres.full
+$FIO_PROG $fio_config --output=$fio_out
+cat $fio_out >> $seqres.full
 
-if ! _scratch_unmount; then
-	echo "failed to umount"
-	status=1
-	exit
-fi
 status=0
 exit
Signature · 1 line
2.30.0