fstests: start factoring test setup boilerplate
cover fstests: start factoring test setup boilerplate
Hi folks,
These patches start the long process of factoring out most of the test setup boilerplate in each test. The first patch introduces the generic test setup include file, and the patches that follow start the process of converting tests over to use it.
Making infrastructure changes to fstests is hard because of the sheer number of tests. Abstracting out things like test setup will make it much easier in future to improve the test setup infrstructure as we won't need to modify every test to make the change. We only have to do the hard work once.
There is still some boiler plate in the preamble, but it is reduced significantly and only contains things that individual tests should be allowed to influence. i.e. the full output file and a cleanup function that is called on exit.
I've also replaced the test success suffix - instead of this boiler plate at the end of each test:
# success, all done
status=0
exit
This has been replaced with a single call to _success, which does all the things necessary for the test harness to know the test has exited successfully.
As an initial pass I've convert all the test directories with a small number of tests, and converted the first handful of tests in each of the major test directories. This is a slow process because it's mostly manual as every second test has some unique variation that makes automated replacement somewhat difficult.
As such, I've really only scratched the surface - this patchset changes over about 60 tests, and there are about 1200 more tests to convert. As such, my focus is going to be converting the generic tests first - this is the biggest chunk of the work that needs to be done.
Given there is still a large amount of conversion work to do, I would appreciate it if people regularly contributing to the other large test dirs (mainly overlay, btrfs, ext4 and xfs) would consider devoting an hour or two to converting some of those tests to the new setup preamble. The more people who do a bit, the faster the conversion will go and the better it will be for everyone.
Comments, thoughts?
-Dave.
PATCH 1/8 fstests: generic test setup preamble
From: Dave Chinner <[email protected]>
So many tests chop random bits out of the mandaotry test setup preamble which leads to subtle problems and stray files being dumped all over the place. Create a common test preamble with hooks for local cleanup functions so we can prevent this in future.
--- common/setup_test | 31 +++++++++++++++++++++++++++++++ new | 35 ++++++++--------------------------- soak | 19 +++++++------------ 3 files changed, 46 insertions(+), 39 deletions(-) create mode 100644 common/setup_test
common/setup_test new file +31 -0
@@ -0,0 +1,31 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# common test setup preamble +# test specific cleanup is done via the cleanup() function now. + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup_test; exit \$status" 0 1 2 3 15 + +_cleanup_test() +{ + # call local test cleanup function first, then cleanup tmp files + cleanup + cd / + rm -f $tmp.* +} + +_success() +{ + status=0 + exit +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter
new +8 -27
@@ -9,12 +9,11 @@ iam=new . ./common/test_names -trap "rm -f /tmp/$$.; exit" 0 1 2 3 15 -_cleanup() -{ - : +_cleanup() { + rm -f /tmp/$$. } +trap "_cleanup; exit" 0 1 2 3 15 SRC_GROUPS=`find tests -not -path tests -type d -printf "%f "` usage()
@@ -153,31 +152,15 @@ cat <<End-of-File >$tdir/$id # # what am I here for? # -seq=\`basename \$0\` -seqres=\$RESULT_DIR/\$seq -echo "QA output created by \$seq" - -here=\`pwd\` -tmp=/tmp/\$\$ -status=1 # failure is the default! -trap "_cleanup; exit \\\$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f \$tmp.* -} +. common/setup_test -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { :; } # remove previous \$seqres.full before test rm -f \$seqres.full -# real QA test starts here - -# Modify as appropriate. +# include test specific environments here _supported_fs generic _supported_os Linux _require_test
@@ -189,9 +172,7 @@ exit #echo #echo "If failure, check \$seqres.full (this) and \$seqres.full.ok (reference)" -# success, all done -status=0 -exit +_success End-of-File sleep 2 # latency to read messages to this point
soak +7 -12
@@ -3,21 +3,16 @@ # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. # -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +. common/setup_test -tmp=/tmp/$$ -seq=soak -status=1 # failure is the default! - -_cleanup() -{ - echo " *** umount" - _scratch_unmount >/dev/null 2>&1 +# test exit cleanup goes here +cleanup() { + echo " *** umount" + _scratch_unmount >/dev/null 2>&1 } -trap "_cleanup; exit \$status" 0 1 2 3 15 +# remove previous $seqres.full before test +rm -f $seqres.full ROOT="." LOG="$ROOT/soak.log"
Signature · 1 line
2.17.0
Re: [PATCH 1/8] fstests: generic test setup preamble
Quoted 60 lines · Dave Chinner
From: Dave Chinner <[email protected]>
So many tests chop random bits out of the mandaotry test setup preamble which leads to subtle problems and stray files being dumped all over the place. Create a common test preamble with hooks for local cleanup functions so we can prevent this in future.
Signed-off-by Dave Chinner <[email protected]>--- common/setup_test | 31 +++++++++++++++++++++++++++++++ new | 35 ++++++++--------------------------- soak | 19 +++++++------------ 3 files changed, 46 insertions(+), 39 deletions(-) create mode 100644 common/setup_testcommon/setup_test new file +31
-0@@ -0,0 +1,31 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# common test setup preamble +# test specific cleanup is done via the cleanup() function now. + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup_test; exit \$status" 0 1 2 3 15 + +_cleanup_test() +{ + # call local test cleanup function first, then cleanup tmp files + cleanup + cd / + rm -f $tmp.* +} + +_success() +{ + status=0 + exit +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filternew +0
-0@@ -9,12 +9,11 @@ iam=new . ./common/test_names
new line 17
Quoted 10 lines
new +3
-4-trap "rm -f /tmp/$$.; exit" 0 1 2 3 15 -_cleanup() -{ - : +_cleanup() { + rm -f /tmp/$$. } +trap "_cleanup; exit" 0 1 2 3 15
1. that looks like a bug in 'new' cleanup.
should be rm -f /tmp/$$.* (or /tmp/$$.group)
2. if we are going with convention that local cleanup is without _, may as well stick with this convention here as well even though we are not sourcing setup_test
Thanks,
Amir.
PATCH 2/8 tests: convert various test dirs to setup preamble
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Convert all the test dirs with a very small number of tests in one go.
--- tests/cifs/001 | 25 +++++++------------------ tests/f2fs/001 | 25 +++++++------------------ tests/nfs/001 | 28 +++++++--------------------- tests/ocfs2/001 | 29 +++++++---------------------- tests/perf/001 | 30 +++++++++++++----------------- tests/udf/102 | 29 ++++++++--------------------- 6 files changed, 49 insertions(+), 117 deletions(-)
tests/cifs/001 +7 -18
@@ -6,27 +6,17 @@ # # Sanity test for server-side copies initiated via CIFS_IOC_COPYCHUNK_FILE # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! - -_cleanup() -{ - rm -f $tmp.* +# test exit cleanup goes here +cleanup() { rm -rf $TEST_DIR/$$ } -trap "_cleanup ; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs cifs _supported_os Linux _require_cloner
@@ -49,5 +39,4 @@ for i in `seq 1 10`; do diff $TEST_DIR/$$/src/${i} $TEST_DIR/$$/dest/${i} done -status=0 -exit +_success
tests/f2fs/001 +7 -18
@@ -15,25 +15,15 @@ # In ext4, up to 132 bytes of data can be stored in 256 bytes-sized inode. # In f2fs, up to 3.4KB of data can be embedded into 4KB-sized inode block. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full +# include test specific environments here _supported_fs f2fs _supported_os Linux _require_scratch
@@ -65,5 +55,4 @@ hexdump -C $testfile rm $testfile rm $dummyfile -status=0 -exit +_success
tests/nfs/001 +7 -21
@@ -9,29 +9,17 @@ # ERANGE. Upstream commit ed92d8c137b7 ("NFSv4: fix getacl ERANGE for some ACL # buffer sizes") fixed this bug. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* $acltest.* -} +. common/setup_test -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { + rm -f $acltest.* +} # remove previous $seqres.full before test rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs nfs _supported_os Linux _require_test_nfs_version 4
@@ -57,6 +45,4 @@ $NFS4_SETFACL_PROG -S $acltest.list $acltest.file $NFS4_GETFACL_PROG $acltest.file >>$seqres.full 2>&1 $NFS4_GETFACL_PROG $acltest.file | wc -l -# success, all done -status=0 -exit +_success
tests/ocfs2/001 +7 -22
@@ -6,34 +6,21 @@ # # Ensure that reflink works correctly with inline-data files. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - cd / - rm -rf $tmp.* -} +# remove previous $seqres.full before test +rm -f $seqres.full -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# include test specific environments here . ./common/reflink - -# real QA test starts here _supported_os Linux _supported_fs ocfs2 _require_scratch_reflink _require_cp_reflink -rm -f $seqres.full - echo "Format and mount" _scratch_mkfs --fs-features=local,unwritten,refcount,inline-data > $seqres.full 2>&1 tunefs.ocfs2 --query '%H' $SCRATCH_DEV | grep -q 'inline-data' || \
@@ -69,6 +56,4 @@ echo "Verify the whole mess" _scratch_cycle_mount md5sum $testdir/file* | _filter_scratch -# success, all done -status=0 -exit +_success
tests/perf/001 +13 -17
@@ -6,30 +6,26 @@ # # Buffered random write performance test. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -fio_config=$tmp.fio -fio_results=$tmp.json -status=1 # failure is the default! -trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter -. ./common/perf +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here +. ./common/perf _supported_fs generic _supported_os Linux _require_scratch _require_block_device $SCRATCH_DEV _require_fio_results -rm -f $seqres.full +echo "Silence is golden" + +fio_config=$tmp.fio +fio_results=$tmp.json _size=$((16 * $LOAD_FACTOR)) cat >$fio_config <<EOF
@@ -60,5 +56,5 @@ $FIO_PROG --output-format=json --output=$fio_results $fio_config _scratch_unmount cat $fio_results >> $seqres.full _fio_results_compare $seq $fio_results -echo "Silence is golden" -status=0; exit + +_success
tests/udf/102 +8 -21
@@ -7,28 +7,17 @@ # This tests mkfs_udf/mkudffs and the device detection code # Modified from UDFQA test 031. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - rm -f $tmp.* - cd / -} -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here -_supported_fs udf +# include test specific environments here +_supported_fs udf _supported_os Linux - _require_scratch _setup_udf_scratchdir
@@ -37,6 +26,4 @@ _check_udf_filesystem $SCRATCH_DEV echo "Finished" -# success, all done -status=0 -exit +_success
Signature · 1 line
2.17.0
Re: [PATCH 2/8] tests: convert various test dirs to setup preamble
Quoted 7 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Convert all the test dirs with a very small number of tests in one go.
Signed-off-by Dave Chinner <[email protected]>---
[...]
Quoted 9 lines
tests/perf/001 +4
-1-rm -f $seqres.full +echo "Silence is golden" + +fio_config=$tmp.fio +fio_results=$tmp.json _size=$((16 * $LOAD_FACTOR)) cat >$fio_config <<EOF
tests/perf/001 $FIO_PROG --output-format=json --output=$fio_results $fio_config · line 60
Quoted 7 lines
tests/perf/001 +2
-2@@ -60,5 +56,5 @@ $FIO_PROG --output-format=json --output=$fio_results $fio_config _scratch_unmount cat $fio_results >> $seqres.full _fio_results_compare $seq $fio_results -echo "Silence is golden" -status=0; exit + +_success
I realize that without status=0 test will not pass, but it always annoys me that echo "Silence is golden" before the end of the test.
How about _success_silent to further reduce the boilerplate echo "Silence is golden"?
Thanks,
Amir.
Re: [PATCH 2/8] tests: convert various test dirs to setup preamble
Quoted 16 lines · Amir Goldstein
Quoted 7 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Convert all the test dirs with a very small number of tests in one go.
Signed-off-by Dave Chinner <[email protected]>---
[...]
Quoted 6 lines
tests/perf/001 +4
-1-rm -f $seqres.full +echo "Silence is golden" + +fio_config=$tmp.fio +fio_results=$tmp.json
Quoted 13 lines
tests/perf/001 $FIO_PROG --output-format=json --output=$fio_results $fio_config · line 60
Quoted 10 lines
_size=$((16 * $LOAD_FACTOR))
cat >$fio_config <<EOFtests/perf/001 +2
-2@@ -60,5 +56,5 @@ $FIO_PROG --output-format=json --output=$fio_results $fio_config _scratch_unmount cat $fio_results >> $seqres.full _fio_results_compare $seq $fio_results -echo "Silence is golden" -status=0; exit + +_successI realize that without status=0 test will not pass, but it always annoys me that echo "Silence is golden" before the end of the test.
That's because it's supposed to be at the start of the test, documenting the fact that any output from the test is expected to cause it to fail. That's generally important to know before you get ot the last line of the test code....
Quoted 2 lines
How about
_success_silentto further reduce the boilerplate echo "Silence is golden"?
No. Removing "silence is golden" (and all the variations that have crept in over the years) and replacing them with_success_silent can be mostly scripted once everything
has first been converted to call _success. IMO that's a relatively easy followup patchset, and it's precisely what this initial conversion is supposed to enable us to do. i.e. make codebase wide setup/completion maintenance much easier to perform.
So let's not make the hard part of converting 1260 tests to common setup infrastructure any harder than it already is going to be by adding lots of other random cleanups into it as well.....
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
PATCH 3/8 shared: use new test setup preamble
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- tests/shared/001 | 33 ++++++++++----------------------- tests/shared/002 | 40 ++++++++++++++-------------------------- tests/shared/003 | 35 ++++++++++------------------------- tests/shared/004 | 27 +++++++-------------------- tests/shared/005 | 30 ++++++++---------------------- tests/shared/006 | 35 +++++++++++------------------------ tests/shared/007 | 30 +++++++++--------------------- tests/shared/032 | 26 +++++++++----------------- tests/shared/272 | 34 ++++++++++++++-------------------- tests/shared/289 | 31 +++++++------------------------ tests/shared/298 | 48 ++++++++++++++++++++++-------------------------- 11 files changed, 121 insertions(+), 248 deletions(-)
tests/shared/001 +10 -23
@@ -9,31 +9,19 @@ # # 721e3eb ext4: lock i_mutex when truncating orphan inodes # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter - -# real QA test starts here +. common/setup_test + +# test exit cleanup goes here +cleanup() { :; } + +# remove previous $seqres.full before test +rm -f $seqres.full + +# include test specific environments here _supported_fs ext2 ext3 ext4 _supported_os Linux _require_scratch -rm -f $seqres.full echo "Silence is golden" _scratch_mkfs_sized $((16*1024*1024)) >>$seqres.full 2>&1
@@ -52,5 +40,4 @@ debugfs -w -R "set_super_value last_orphan $inode" $SCRATCH_DEV \ # mount again to truncate orphan inode, _check_dmesg will catch the WARNING _scratch_mount -status=0 -exit +_success
tests/shared/002 +14 -26
@@ -10,43 +10,32 @@ # fsync log/journal is replayed, the xattrs still exist and with the correct # values. # +# We create a lot of xattrs for a single file. Only btrfs and xfs are currently +# able to store such a large mount of xattrs per file, other filesystems such +# as ext3/4 and f2fs for example, fail with ENOSPC even if we attempt to add +# less than 1000 xattrs with very small values. +# # This test is motivated by a bug found in btrfs. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! - -_cleanup() -{ +# test exit cleanup goes here +cleanup() { _cleanup_flakey - rm -f $tmp.* } -trap "_cleanup; exit \$status" 0 1 2 3 15 -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full + +# include test specific environments here . ./common/dmflakey . ./common/attr - -# real QA test starts here - -# We create a lot of xattrs for a single file. Only btrfs and xfs are currently -# able to store such a large mount of xattrs per file, other filesystems such -# as ext3/4 and f2fs for example, fail with ENOSPC even if we attempt to add -# less than 1000 xattrs with very small values. -_supported_fs btrfs xfs _supported_os Linux +_supported_fs btrfs xfs _require_scratch _require_dm_target flakey _require_attrs -rm -f $seqres.full - _scratch_mkfs >> $seqres.full 2>&1 _require_metadata_journaling $SCRATCH_DEV _init_flakey
@@ -94,5 +83,4 @@ for ((i = 1; i <= $num_xattrs; i++)); do echo done -status=0 -exit +_success
tests/shared/003 +10 -25
@@ -11,34 +11,21 @@ # # Also test on ext2/3. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter - -# real QA test starts here +. common/setup_test + +# test exit cleanup goes here +cleanup() { :; } + +# remove previous $seqres.full before test +rm -f $seqres.full + +# include test specific environments here _supported_fs ext2 ext3 ext4 _supported_os Linux # nofsck as we modify sb via debugfs _require_scratch_nocheck -# remove previous $seqres.full before test -rm -f $seqres.full echo "Silence is golden" _scratch_mkfs >>$seqres.full 2>&1
@@ -50,6 +37,4 @@ debugfs -w -R "feature +needs_recovery" $SCRATCH_DEV \ # mount with noload option _try_scratch_mount "-o noload" >>$seqres.full 2>&1 -# success, all done -status=0 -exit +_success
tests/shared/004 +7 -20
@@ -7,31 +7,20 @@ # Regression test for commit: # c9eb13a ext4: fix hang when processing corrupted orphaned inode list # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs ext2 ext3 ext4 _supported_os Linux _require_scratch _require_command "$DEBUGFS_PROG" debugfs -# remove previous $seqres.full before test -rm -f $seqres.full echo "Silence is golden" # Although the bug only happens when last_orphan is set to 5
@@ -44,6 +33,4 @@ for i in {1..10}; do _scratch_unmount done -# success, all done -status=0 -exit +_success
tests/shared/005 +8 -22
@@ -13,33 +13,21 @@ # So, create this malformed inode and try a buffered append to make # sure we catch this situation. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -PIDS="" -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here -_supported_os Linux +# include test specific environments here _supported_fs ext2 ext3 ext4 +_supported_os Linux _require_scratch_nocheck _disable_dmesg_check _require_command "$DEBUGFS_PROG" -rm -f $seqres.full - echo "Format and mount" _scratch_mkfs >> $seqres.full 2>&1 _scratch_mount
@@ -60,6 +48,4 @@ _scratch_mount dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)." sync -# success, all done -status=0 -exit +_success
tests/shared/006 +11 -24
@@ -9,20 +9,18 @@ # Also a regression test for xfsprogs commit # d586858 xfs_repair: fix sibling pointer tests in verify_dir2_path() # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - cd / - rm -f $tmp.* -} +# remove previous $seqres.full before test +rm -f $seqres.full + +# include test specific environments here +_supported_fs ext4 ext3 ext2 xfs +_supported_os Linux +_require_scratch create_file() {
@@ -37,17 +35,7 @@ create_file() done } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter -# real QA test starts here -_supported_fs ext4 ext3 ext2 xfs -_supported_os Linux - -_require_scratch - -rm -f $seqres.full echo "Silence is golden" _scratch_mkfs_sized $((1024 * 1024 * 1024)) >>$seqres.full 2>&1
@@ -77,5 +65,4 @@ rm -rf $SCRATCH_MNT/testdir echo "Inode status after deleting all test files" >>$seqres.full $DF_PROG -i $SCRATCH_MNT >>$seqres.full -status=0 -exit +_success
tests/shared/007 +9 -21
@@ -13,32 +13,22 @@ # So, create this malformed inode and try a dio append to make sure we # catch this situation. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -PIDS="" -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - rm -f $tmp.* -} +# test exit cleanup goes here +cleanup() { :; } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here -_supported_os Linux +# include test specific environments here _supported_fs ext2 ext3 ext4 +_supported_os Linux _require_scratch_nocheck _disable_dmesg_check _require_command "$DEBUGFS_PROG" -rm -f $seqres.full +PIDS="" echo "Format and mount" _scratch_mkfs >> $seqres.full 2>&1
@@ -62,6 +52,4 @@ _scratch_mount dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=direct,append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)." sync -# success, all done -status=0 -exit +_success
tests/shared/032 +9 -17
@@ -6,34 +6,28 @@ # # cross check mkfs detection of foreign filesystems # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 -rm -f $seqres.full +# test exit cleanup goes here +cleanup() { :; } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs xfs btrfs _supported_os Linux - _require_scratch_nocheck _require_no_large_scratch_dev +echo "Silence is golden." + # mkfs.btrfs did not have overwrite detection at first if [ "$FSTYP" == "btrfs" ]; then grep -q 'force overwrite' `echo $MKFS_BTRFS_PROG | awk '{print $1}'` || \ _notrun "Installed mkfs.btrfs does not support -f option" fi -echo "Silence is golden." for fs in `echo ${MKFS_PROG}.* | sed -e "s:${MKFS_PROG}.::g"` do preop="" # for special input needs
@@ -75,6 +69,4 @@ do fi done -# success, all done -status=0 -exit +_success
tests/shared/272 +14 -20
@@ -6,21 +6,23 @@ # # Test data journaling flag switch for a single file # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } + +# remove previous $seqres.full before test +rm -f $seqres.full + +# include test specific environments here +_supported_fs ext3 ext4 +_supported_os Linux +_require_scratch +_exclude_scratch_mount_option dax # ext3 and ext4 don't support direct IO in journalling mode write_opt_list="iflag=noatime conv=notrunc conv=fsync" -# get standard environment, filters and checks -. ./common/rc -. ./common/filter _workout() { echo "Switch data journalling mode. Silence is golden."
@@ -32,7 +34,6 @@ _workout() idx=$((idx + 1)) for chattr_opt in $chattr_opt_list do - echo "OP write_opt: $write_opt 4M, \ chattr_opt: $chattr_opt" >>$seqres.full dd if=/dev/zero of=$SCRATCH_MNT/file.$idx \
@@ -63,13 +64,6 @@ chattr_opt: $chattr_opt" >>$seqres.full done } -# real QA test starts here -_supported_fs ext3 ext4 -_supported_os Linux -_require_scratch -_exclude_scratch_mount_option dax - -rm -f $seqres.full _scratch_mkfs_sized $((64 * 1024 * 1024)) >> $seqres.full 2>&1 _scratch_mount
@@ -86,5 +80,5 @@ if ! _scratch_unmount; then exit fi echo "Check filesystem" -status=0 -exit + +_success
tests/shared/289 +7 -24
@@ -6,34 +6,19 @@ # # Test overhead & df output for extN filesystems # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter - -# real QA test starts here +# remove previous $seqres.full before test +rm -f $seqres.full -# Modify as appropriate. +# include test specific environments here _supported_fs ext2 ext3 ext4 _supported_os Linux _require_scratch -rm -f $seqres.full - _scratch_mkfs >> $seqres.full 2>&1 # Get the honest truth about block counts straight from metadata on disk
@@ -79,6 +64,4 @@ _within_tolerance "minix f_blocks" $MINIX_F_BLOCKS $TOTAL_BLOCKS 0 -v # bsd should be within ... we'll say 1% for some slop _within_tolerance "bsd f_blocks" $BSD_F_BLOCKS $(($TOTAL_BLOCKS-$OVERHEAD)) 1% -v -# success, all done -status=0 -exit +_success
tests/shared/298 +22 -26
83 lines not on this page · raw message
Signature · 1 line
2.17.0
Re: [PATCH 3/8] shared: use new test setup preamble
Quoted 4 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Signed-off-by Dave Chinner <[email protected]>---
[...]
Quoted 38 lines
tests/shared/298 +13
-7@@ -6,15 +6,22 @@ # # Test that filesystem sends discard requests only on free blocks # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { + $UMOUNT_PROG $loop_dev &> /dev/null + _destroy_loop_device $loop_dev + if [ $status -eq 0 ]; then + rm $img_file + rm -rf $workdir + fi +} -. ./common/rc +# remove previous $seqres.full before test +rm -f $seqres.full +# include test specific environments here _supported_fs ext4 xfs _supported_os Linux _require_test@@ -24,15 +31,8 @@ _require_xfs_io_command "fiemap" _require_fs_space $TEST_DIR 307200 [ "$FSTYP" = "ext4" ] && _require_dumpe2fs -_cleanup()
tests/shared/298 _require_xfs_io_command "fiemap" · line 35
Quoted 10 lines
tests/shared/298 +2
-8-{ - $UMOUNT_PROG $loop_dev &> /dev/null - _destroy_loop_device $loop_dev - if [ $status -eq 0 ]; then - rm -rf $tmp - rm $img_file - fi -} +workdir=$TEST_DIR/$$ +mkdir -p $workdir
:-/ I don't like this s/tmp/workdir conversion and don't like the idea of having to do the same thing for 16 btrfs tests + 1 generic test. IIUC, you changed the test from using tmpdir under $here to tmpdir under $TEST_DIR. Why not change it to tmpdir under /tmp?
Only change you will need to do is:
-tmp=mktemp -d
+mkdir -p $tmp
Thanks,
Amir.
Re: [PATCH 3/8] shared: use new test setup preamble
Quoted 43 lines · Amir Goldstein
Quoted 4 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Signed-off-by Dave Chinner <[email protected]>---
[...]
Quoted 37 lines
tests/shared/298 +13
-6@@ -6,15 +6,22 @@ # # Test that filesystem sends discard requests only on free blocks # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { + $UMOUNT_PROG $loop_dev &> /dev/null + _destroy_loop_device $loop_dev + if [ $status -eq 0 ]; then + rm $img_file + rm -rf $workdir + fi +} -. ./common/rc +# remove previous $seqres.full before test +rm -f $seqres.full +# include test specific environments here _supported_fs ext4 xfs _supported_os Linux _require_test@@ -24,15 +31,8 @@ _require_xfs_io_command "fiemap" _require_fs_space $TEST_DIR 307200 [ "$FSTYP" = "ext4" ] && _require_dumpe2fs
Quoted 14 lines
tests/shared/298 _require_xfs_io_command "fiemap" · line 35
Quoted 11 lines
tests/shared/298 +2
-9-_cleanup() -{ - $UMOUNT_PROG $loop_dev &> /dev/null - _destroy_loop_device $loop_dev - if [ $status -eq 0 ]; then - rm -rf $tmp - rm $img_file - fi -} +workdir=$TEST_DIR/$$ +mkdir -p $workdir:-/ I don't like this s/tmp/workdir conversion and don't like the idea of having to do the same thing for 16 btrfs tests + 1 generic test.
Too bad, we're going to have to do that.
Quoted 2 lines
IIUC, you changed the test from using tmpdir under $here to tmpdir under $TEST_DIR.
Yes, because the usages of $tmp in this test (and all those other ones, too) is completely broken. You do realise that $here points at the xfstests source directory, and so tests like this are dumping crap in the source dir you run xfstests out of?
That's the sort of crap I'm trying to get rid of by moving to a common setup - no test should *ever* be writing to $here. They write temporary files the test needs to either /tmp (i.e. $tmp) or TEST_DIR. Redfining $tmp to whatever you want breaks assumptions in the infrastructure, and that's precisely the problems I'm trying to fix.
And that means we've got to do the hard work of fixing the crappy tests that have accumulated over the years. The btrfs stuff is simple to fix - there's 15+ years of technical debt in the old xfs and generic tests that I'm going to have to wade through to make this conversion work. I don't like having to do this but if we want to make things better then we have to fix them.
Review
Quoted 4 lines
Why not change it to tmpdir under /tmp?
Only change you will need to do is:(quoted diff) +1
-1-tmp=`mktemp -d` +mkdir -p $tmp
Because the test is creating image files in $tmp, and we've had problems in the past with tests running the root filesystems out of space because they put too much shit in /tmp or dump crap in $here. TEST_DIR is supposed to be used at the work dir for things like this
- we're trying to exercises the filesystem we are testing, not the root filesystem that hosts the fstests installation.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Re: [PATCH 3/8] shared: use new test setup preamble
Quoted 61 lines · Dave Chinner
Quoted 43 lines · Amir Goldstein
Quoted 4 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Signed-off-by Dave Chinner <[email protected]>---
[...]
Quoted 37 lines
tests/shared/298 +13
-6@@ -6,15 +6,22 @@ # # Test that filesystem sends discard requests only on free blocks # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { + $UMOUNT_PROG $loop_dev &> /dev/null + _destroy_loop_device $loop_dev + if [ $status -eq 0 ]; then + rm $img_file + rm -rf $workdir + fi +} -. ./common/rc +# remove previous $seqres.full before test +rm -f $seqres.full +# include test specific environments here _supported_fs ext4 xfs _supported_os Linux _require_test@@ -24,15 +31,8 @@ _require_xfs_io_command "fiemap" _require_fs_space $TEST_DIR 307200 [ "$FSTYP" = "ext4" ] && _require_dumpe2fsQuoted 14 lines
tests/shared/298 _require_xfs_io_command "fiemap" · line 35
Quoted 11 lines
tests/shared/298 +2
-9-_cleanup() -{ - $UMOUNT_PROG $loop_dev &> /dev/null - _destroy_loop_device $loop_dev - if [ $status -eq 0 ]; then - rm -rf $tmp - rm $img_file - fi -} +workdir=$TEST_DIR/$$ +mkdir -p $workdir:-/ I don't like this s/tmp/workdir conversion and don't like the idea of having to do the same thing for 16 btrfs tests + 1 generic test.
Too bad, we're going to have to do that.
Quoted 8 lines
Quoted 2 lines
IIUC, you changed the test from using tmpdir under $here to tmpdir under $TEST_DIR.
Yes, because the usages of $tmp in this test (and all those other ones, too) is completely broken. You do realise that $here points at the xfstests source directory, and so tests like this are dumping crap in the source dir you run xfstests out of?
Yes, I did not mean that $here was a good location for tmp files. Anyway I double checked what directory mktemp -d defaults to and it is /tmp, not $here.
"...If TEMPLATE is not specified, use tmp.XXXXXXXXXX, and
--tmpdir is implied"
--tmpdir is implied means /tmp/
and indeed this is what those tests do, at least with version of mktemp on my machine.
Quoted 13 lines
Review
Quoted 5 lines
Why not change it to tmpdir under /tmp?
Only change you will need to do is:(quoted diff) +1
-1-tmp=`mktemp -d` +mkdir -p $tmpBecause the test is creating image files in $tmp, and we've had problems in the past with tests running the root filesystems out of space because they put too much shit in /tmp or dump crap in $here.
TEST_DIRis supposed to be used at the work dir for things like this
- we're trying to exercises the filesystem we are testing, not the root filesystem that hosts the fstests installation.
I see. It might be better though to make this fix in a separate patch and keeping the conversion patch to the minimal change I suggested.
Thanks,
Amir.
Re: [PATCH 3/8] shared: use new test setup preamble
Quoted 11 lines · Amir Goldstein
Quoted 9 lines · Dave Chinner
Quoted 1 line · Amir Goldstein
On Wed, Jun 27, 2018 at 11:20 AM, Dave Chinner <[email protected]> wrote:
Because the test is creating image files in $tmp, and we've had problems in the past with tests running the root filesystems out of space because they put too much shit in /tmp or dump crap in $here.
TEST_DIRis supposed to be used at the work dir for things like this
- we're trying to exercises the filesystem we are testing, not the root filesystem that hosts the fstests installation.
Quoted 2 lines
I see. It might be better though to make this fix in a separate patch and keeping the conversion patch to the minimal change I suggested.
We can't make the conversion patch as you suggested because it's /doesn't fix the broken usage of $tmp/. That's the intent of this whole conversion - to fix these bugs by converting to common setup code. So we need to fix the bugs as we convert them, not slap a band-aid over them and then have to come back and fix them later (if we remember which of the many, many tests need fixing!).
Again, lets not ake this conversion harder than it needs to be by trying to split hairs over how individual bugs are fixed. There are /hundreds of bugs/ that need to be fixed during this conversion
- the cost of separating them out is prohibitive, and it makes no sense to add more change management time and overhead to an already resource intensive conversion process.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Re: [PATCH 3/8] shared: use new test setup preamble
Quoted 22 lines · Dave Chinner
Quoted 11 lines · Amir Goldstein
Quoted 9 lines · Dave Chinner
Quoted 1 line · Amir Goldstein
On Wed, Jun 27, 2018 at 11:20 AM, Dave Chinner <[email protected]> wrote:
Because the test is creating image files in $tmp, and we've had problems in the past with tests running the root filesystems out of space because they put too much shit in /tmp or dump crap in $here.
TEST_DIRis supposed to be used at the work dir for things like this
- we're trying to exercises the filesystem we are testing, not the root filesystem that hosts the fstests installation.Quoted 2 lines
I see. It might be better though to make this fix in a separate patch and keeping the conversion patch to the minimal change I suggested.
We can't make the conversion patch as you suggested because it's /doesn't fix the broken usage of $tmp/. That's the intent of this whole conversion - to fix these bugs by converting to common setup code. So we need to fix the bugs as we convert them, not slap a band-aid over them and then have to come back and fix them later (if we remember which of the many, many tests need fixing!).
Quoted 7 lines
Again, lets not ake this conversion harder than it needs to be by trying to split hairs over how individual bugs are fixed. There are /hundreds of bugs/ that need to be fixed during this conversion
- the cost of separating them out is prohibitive, and it makes no sense to add more change management time and overhead to an already resource intensive conversion process.
No worries. I'll stick to validating correctness in review. I realize how agonizing this conversion task can be.
Cheers,
Amir.
PATCH 4/8 generic: convert some tests to new setup preamble
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
--- tests/generic/001 | 49 +++++++++++++++++------------------------------ tests/generic/002 | 25 +++++++----------------- tests/generic/003 | 30 ++++++++--------------------- tests/generic/004 | 32 +++++++++---------------------- tests/generic/005 | 44 ++++++++++++++++-------------------------- tests/generic/006 | 34 ++++++++++++-------------------- tests/generic/007 | 29 ++++++++-------------------- tests/generic/008 | 27 +++++++++----------------- tests/generic/009 | 28 +++++++++------------------ 9 files changed, 97 insertions(+), 201 deletions(-)
tests/generic/001 +18 -31
@@ -15,25 +15,29 @@ # config has one line per file with filename and byte size, else use # the default one below. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { + if $done_cleanup ; then + : + elif [ $status -eq 0 ]; then + $verbose && echo "cleanup" + cd / + rm -rf $TEST_DIR/$$ + done_cleanup=true + fi +} -tmp=/tmp/$$ -here=`pwd` -status=1 -done_cleanup=false -trap "_cleanup; rm -f $tmp.*; exit \$status" 0 1 2 3 15 +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs generic _supported_os Linux _require_test +done_cleanup=false verbose=true verify=$here/verify_fill
@@ -260,25 +264,9 @@ _check() $verbose && echo } -_cleanup() -{ - # cleanup - # - if $done_cleanup - then - : - elif [ $status -eq 0 ] - then - $verbose && echo "cleanup" - cd / - rm -rf $TEST_DIR/$$ - done_cleanup=true - fi -} - rm -f $seqres.full status=0 -_cleanup +cleanup status=1 done_cleanup=false
@@ -299,5 +287,4 @@ do fi done -status=0 -exit +_success
tests/generic/002 +7 -18
@@ -6,31 +6,20 @@ # # simple inode link count test for a regular file # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { :; } -tmp=/tmp/$$ -here=`pwd` -status=0 # success is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 -_cleanup() -{ - rm -f $tmp.* -} +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs generic _supported_os Linux _require_test -rm -f $seqres.full - echo "Silence is goodness ..." # ensure target directory exists
@@ -62,4 +51,4 @@ do done # success, all done -exit +_success
tests/generic/003 +8 -22
@@ -9,34 +9,22 @@ # never updated on read-only subvolumes. (Regression test for bug fixed # with commit 93fd63c2f001ca6797c6b15b696a484b165b4800) # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -rf $tmp.* -} +. common/setup_test -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { :; } -# real QA test starts here +# remove previous $seqres.full before test +rm -f $seqres.full +# include test specific environments here _supported_fs generic _supported_os Linux _require_scratch _require_atime _require_relatime -rm -f $seqres.full +echo "Silence is golden" _stat() { stat -c "%x;%y;%z" $1
@@ -189,6 +177,4 @@ _compare_stat_times NNN "$file3_stat_before_ro_mount" \ # success, all done _scratch_unmount -echo "Silence is golden" -status=0 -exit +_success
tests/generic/004 +9 -23
@@ -6,35 +6,23 @@ # # Test O_TMPFILE opens, and linking them back into the namespace. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f ${testfile} +. common/setup_test + +# test exit cleanup goes here +cleanup() { + rm -f ${testfile} } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs generic _supported_os Linux - _require_test _require_xfs_io_command "-T" _require_xfs_io_command "flink" -rm -f $seqres.full - testfile="${TEST_DIR}/tst-tmpfile-flink" # test creating a r/w tmpfile, do I/O and link it into the namespace
@@ -49,6 +37,4 @@ rm ${testfile} # test creating a r/o tmpfile. Should fail $XFS_IO_PROG -Tr ${TEST_DIR} -c "close" 2>&1 | _filter_test_dir -# success, all done -status=0 -exit +_success
tests/generic/005 +17 -27
66 lines not on this page · raw message
tests/generic/006 +12 -22
@@ -6,22 +6,21 @@ # # permname # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=0 # success is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* +# test exit cleanup goes here +cleanup() { rm -rf $TEST_DIR/permname.$$ } +# remove previous $seqres.full before test +rm -f $seqres.full + +# include test specific environments here +_supported_fs generic +_supported_os Linux +_require_test + _count() { $AWK_PROG '
@@ -31,15 +30,6 @@ _count() ' } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter - -# real QA test starts here -_supported_fs generic -_supported_os Linux -_require_test - mkdir $TEST_DIR/permname.$$ echo ""
@@ -58,4 +48,4 @@ cd $TEST_DIR/permname.$$/b $here/src/permname -c 4 -l 6 -p 4 || echo "permname returned $?" find . | _count -exit +_success
tests/generic/007 +8 -21
@@ -9,32 +9,21 @@ # and checks that error codes make sense with its # memory of the files created. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=0 # success is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* - rm -rf $TEST_DIR/$seq +# test exit cleanup goes here +cleanup() { + rm -rf $TEST_DIR/$seq } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs generic _supported_os Linux _require_test -status=1 # default failure sourcefile=$tmp.nametest seed=1 iterations=100000
@@ -53,6 +42,4 @@ mkdir $TEST_DIR/$seq cd $TEST_DIR/$seq $here/src/nametest -l $sourcefile -s $seed -i $iterations -z -# success, all done -status=0 -exit +_success
tests/generic/008 +9 -18
@@ -9,25 +9,18 @@ # Primarily tests page boundries and boundries that are # off-by-one to ensure we're only tossing what's expected # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter -. ./common/punch - -# real QA test starts here +# remove previous $seqres.full before test +rm -f $seqres.full -# Modify as appropriate. +# include test specific environments here +. ./common/punch +_supported_fs generic _supported_os Linux - _require_xfs_io_command "fzero" _require_test
@@ -38,6 +31,4 @@ _test_block_boundaries 2048 fzero _filter_xfs_io_unique $testfile _test_block_boundaries 4096 fzero _filter_xfs_io_unique $testfile _test_block_boundaries 65536 fzero _filter_xfs_io_unique $testfile -# success, all done -status=0 -exit +_success
tests/generic/009 +9 -19
@@ -6,32 +6,22 @@ # # Test fallocate FALLOC_FL_ZERO_RANGE # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - rm -f $tmp.* -} +# remove previous $seqres.full before test +rm -f $seqres.full -trap "_cleanup ; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# include test specific environments here . ./common/punch - -# real QA test starts here +_supported_fs generic _supported_os Linux +_require_test _require_xfs_io_command "fzero" _require_xfs_io_command "fiemap" _require_xfs_io_command "falloc" -_require_test testfile=$TEST_DIR/009.$$
@@ -61,4 +51,4 @@ _test_generic_punch -k falloc fzero fzero fiemap _filter_fiemap $testfile # Delayed allocation multi zero range tests _test_generic_punch -d -k falloc fzero fzero fiemap _filter_fiemap $testfile -status=0 ; exit +_success
Signature · 1 line
2.17.0
Re: [PATCH 4/8] generic: convert some tests to new setup preamble
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
Signed-off-by Dave Chinner <[email protected]>---
Looks fine.
Thanks,
Amir.
Re: [PATCH 4/8] generic: convert some tests to new setup preamble
In reply to Dave ChinnerQuoted 274 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
Signed-off-by Dave Chinner <[email protected]>--- tests/generic/001 | 49 +++++++++++++++++------------------------------ tests/generic/002 | 25 +++++++----------------- tests/generic/003 | 30 ++++++++--------------------- tests/generic/004 | 32 +++++++++---------------------- tests/generic/005 | 44 ++++++++++++++++-------------------------- tests/generic/006 | 34 ++++++++++++-------------------- tests/generic/007 | 29 ++++++++-------------------- tests/generic/008 | 27 +++++++++----------------- tests/generic/009 | 28 +++++++++------------------ 9 files changed, 97 insertions(+), 201 deletions(-)tests/generic/001 +18
-31@@ -15,25 +15,29 @@ # config has one line per file with filename and byte size, else use # the default one below. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { + if $done_cleanup ; then + : + elif [ $status -eq 0 ]; then + $verbose && echo "cleanup" + cd / + rm -rf $TEST_DIR/$$ + done_cleanup=true + fi +} -tmp=/tmp/$$ -here=`pwd` -status=1 -done_cleanup=false -trap "_cleanup; rm -f $tmp.*; exit \$status" 0 1 2 3 15 +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs generic _supported_os Linux _require_test +done_cleanup=false verbose=true verify=$here/verify_fill@@ -260,25 +264,9 @@ _check() $verbose && echo } -_cleanup() -{ - # cleanup - # - if $done_cleanup - then - : - elif [ $status -eq 0 ] - then - $verbose && echo "cleanup" - cd / - rm -rf $TEST_DIR/$$ - done_cleanup=true - fi -} - rm -f $seqres.full status=0 -_cleanup +cleanup status=1 done_cleanup=false@@ -299,5 +287,4 @@ do fi done -status=0 -exit +_successtests/generic/002 +7
-18@@ -6,31 +6,20 @@ # # simple inode link count test for a regular file # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { :; } -tmp=/tmp/$$ -here=`pwd` -status=0 # success is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 -_cleanup() -{ - rm -f $tmp.* -} +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs generic _supported_os Linux _require_test -rm -f $seqres.full - echo "Silence is goodness ..." # ensure target directory exists@@ -62,4 +51,4 @@ do done # success, all done -exit +_successtests/generic/003 +8
-22@@ -9,34 +9,22 @@ # never updated on read-only subvolumes. (Regression test for bug fixed # with commit 93fd63c2f001ca6797c6b15b696a484b165b4800) # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -rf $tmp.* -} +. common/setup_test -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { :; } -# real QA test starts here +# remove previous $seqres.full before test +rm -f $seqres.full +# include test specific environments here _supported_fs generic _supported_os Linux _require_scratch _require_atime _require_relatime -rm -f $seqres.full +echo "Silence is golden" _stat() { stat -c "%x;%y;%z" $1@@ -189,6 +177,4 @@ _compare_stat_times NNN "$file3_stat_before_ro_mount" \ # success, all done _scratch_unmount -echo "Silence is golden" -status=0 -exit +_successtests/generic/004 +9
-23@@ -6,35 +6,23 @@ # # Test O_TMPFILE opens, and linking them back into the namespace. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f ${testfile} +. common/setup_test + +# test exit cleanup goes here +cleanup() { + rm -f ${testfile} } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs generic _supported_os Linux - _require_test _require_xfs_io_command "-T" _require_xfs_io_command "flink" -rm -f $seqres.full - testfile="${TEST_DIR}/tst-tmpfile-flink" # test creating a r/w tmpfile, do I/O and link it into the namespace@@ -49,6 +37,4 @@ rm ${testfile} # test creating a r/o tmpfile. Should fail $XFS_IO_PROG -Tr ${TEST_DIR} -c "close" 2>&1 | _filter_test_dir -# success, all done -status=0 -exit +_successtests/generic/005 +2
-6@@ -9,28 +9,29 @@ # # Note: On Linux, ELOOP limit used to be 32 but changed to 8, and lately # its become 5. Who knows what it might be next. -# +# # What we are looking for here is: no panic due to blowing the stack; # and that the ELOOP error code is returned at some point (the actual # limit point is unimportant, just checking that we do hit it). -# - -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +#
tests/generic/005 line 22
Quoted 10 lines
tests/generic/005 +5
-4+. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=0 # success is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { + rm -f $TEST_DIR/symlink_{0,1,2,3,4}{0,1,2,3,4,5,6,7,8,9} + rm -f $TEST_DIR/symlink_self empty_file
Looked like "empty_file" was not cleaned up, but it's removed correctly because test cd'ed into $TEST_DIR. IMHO, it's better to remove "empty_file" with full path name as all other files, really a minor issue though.
Thanks,
Eryu
PATCH 5/8 btrfs: convert some tests to new setup preamble
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
--- tests/btrfs/001 | 25 ++++++---------------- tests/btrfs/002 | 28 ++++++++---------------- tests/btrfs/003 | 41 ++++++++++++++--------------------- tests/btrfs/004 | 24 ++++++--------------- tests/btrfs/005 | 51 +++++++++++++++++-------------------------- tests/btrfs/006 | 30 ++++++-------------------- tests/btrfs/007 | 57 +++++++++++++++++++------------------------------ tests/btrfs/008 | 30 +++++++++----------------- tests/btrfs/009 | 29 +++++++------------------ 9 files changed, 105 insertions(+), 210 deletions(-)
tests/btrfs/001 +7 -18
@@ -6,27 +6,16 @@ # # Test btrfs's subvolume and snapshot support # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - rm -f $tmp.* -} +# remove previous $seqres.full before test +rm -f $seqres.full -trap "_cleanup ; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# include test specific environments here . ./common/filter.btrfs - -# real QA test starts here _supported_fs btrfs _supported_os Linux _require_scratch
@@ -90,4 +79,4 @@ _scratch_cycle_mount echo "List root dir" ls $SCRATCH_MNT -status=0 ; exit +_success
tests/btrfs/002 +9 -19
@@ -6,29 +6,21 @@ # # Extented btrfs snapshot test cases # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - rm -f $tmp.* -} - -trap "_cleanup ; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full +# include test specific environments here _supported_fs btrfs _supported_os Linux _require_scratch +echo "Silence is golden" + _scratch_mkfs > /dev/null 2>&1 || _fail "mkfs failed" _scratch_mount
@@ -169,6 +161,4 @@ _save_checksum $SNAPNAME $tmp.$tname.sum _verify_checksum $SNAPNAME $tmp.$tname.sum _scratch_unmount || _fail "unmount failed" - -echo "Silence is golden" -status=0; exit +_success
tests/btrfs/003 +16 -25
59 lines not on this page · raw message
tests/btrfs/004 +7 -17
@@ -9,28 +9,18 @@ # run filefrag to get the extent mapping and follow the backrefs. # We check to end up back at the original file with the correct offset. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 -noise_pid=0 - -_cleanup() -{ +# test exit cleanup goes here +cleanup() { rm $tmp.running wait - rm -f $tmp.* } -trap "_cleanup; exit \$status" 0 1 2 3 15 -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs btrfs _supported_os Linux _require_scratch
@@ -39,7 +29,7 @@ _require_btrfs_command inspect-internal logical-resolve _require_btrfs_command inspect-internal inode-resolve _require_command "$FILEFRAG_PROG" filefrag -rm -f $seqres.full +noise_pid=0 FILEFRAG_FILTER=' if (/blocks? of (\d+) bytes/) {
tests/btrfs/005 +19 -32
68 lines not on this page · raw message
tests/btrfs/006 +7 -23
@@ -7,35 +7,21 @@ # run basic btrfs information commands in various ways # sanity tests: filesystem show, label, sync, and device stats # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "== QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - cd / - rm -f $tmp.* -} +# remove previous $seqres.full before test +rm -f $seqres.full -# get standard environment, filters and checks -. ./common/rc +# include test specific environments here . ./common/filter.btrfs - -# real QA test starts here - -# Modify as appropriate. _supported_fs btrfs _supported_os Linux _require_scratch _require_scratch_dev_pool -rm -f $seqres.full - FIRST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'` LAST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $NF}'` TOTAL_DEVS=`echo $SCRATCH_DEV_POOL | wc -w`
@@ -83,6 +69,4 @@ $BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | \ sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g" | \ _filter_spaces -# success, all done -status=0 -exit +_success
tests/btrfs/007 +22 -35
95 lines not on this page · raw message
tests/btrfs/008 +10 -20
@@ -6,37 +6,27 @@ # # btrfs send ENOENT regression test, from a user report on linux-btrfs # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -tmp_dir=send_temp_$seq - -status=1 # failure is the default! - -_cleanup() -{ +# test exit cleanup goes here +cleanup() { $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send/snapshots/backup2 > /dev/null 2>&1 $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send/snapshots/backup3 > /dev/null 2>&1 $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send > /dev/null 2>&1 rm -rf $TEST_DIR/$tmp_dir - rm -f $tmp.* } -trap "_cleanup ; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs btrfs _supported_os Linux _require_test _require_scratch +echo "Silence is golden" + _scratch_mkfs > /dev/null 2>&1 #receive needs to be able to setxattrs, including the selinux context, if we use
@@ -46,6 +36,7 @@ export SELINUX_MOUNT_OPTIONS="" _scratch_mount +tmp_dir=send_temp_$seq mkdir $TEST_DIR/$tmp_dir $BTRFS_UTIL_PROG subvolume create $TEST_DIR/$tmp_dir/send \ > $seqres.full 2>&1 || _fail "failed subvol create"
@@ -66,5 +57,4 @@ $BTRFS_UTIL_PROG send -f $TEST_DIR/$tmp_dir/blah $work_dir/snapshots/backup3 \ $BTRFS_UTIL_PROG receive -vvvv -f $TEST_DIR/$tmp_dir/blah $SCRATCH_MNT \ >> $seqres.full 2>&1 || _fail "receive failed" -echo "Silence is golden" -status=0 ; exit +_success
tests/btrfs/009 +8 -21
@@ -6,32 +6,20 @@ # # Regression test to make sure we can't delete the default subvol # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ +# test exit cleanup goes here +cleanup() { :; } -status=1 # failure is the default! - -_cleanup() -{ - rm -f $tmp.* -} - -trap "_cleanup ; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs btrfs _supported_os Linux _require_scratch -rm -f $seqres.full +echo "Silence is golden" _scratch_mkfs > /dev/null 2>&1 _scratch_mount
@@ -45,5 +33,4 @@ $BTRFS_UTIL_PROG subvolume delete $SCRATCH_MNT/newvol >> $seqres.full 2>&1 _scratch_unmount _try_scratch_mount || _fail "mount should have succeeded" -echo "Silence is golden" -status=0 ; exit +_success
Signature · 1 line
2.17.0
Re: [PATCH 5/8] btrfs: convert some tests to new setup preamble
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
Signed-off-by Dave Chinner <[email protected]>---
[...]
Quoted 17 lines
tests/btrfs/007 +3
-5@@ -9,37 +9,23 @@ # (incr) and send both snapshots to a temp file. Remake the file # system and receive from the files. Check both states with fssum. # -# creator [email protected] +. common/setup_test -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +# test exit cleanup goes here +cleanup() { :; }
tests/btrfs/007 line 27
Quoted 10 lines
tests/btrfs/007 +0
-9-tmp=`mktemp -d` -status=1 - -_cleanup() -{ - echo "*** unmount" - _scratch_unmount 2>/dev/null - rm -f $tmp.* -}
Bug in existing test - it does not cleanup $tmp.
Quoted 53 lines
tests/btrfs/007 +11
-15-trap "_cleanup; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here +_supported_fs generic +_supported_os Linux _supported_fs btrfs _supported_os Linux _require_scratch _require_fssum _require_seek_data_hole -rm -f $seqres.full - workout() { fsz=$1@@ -57,18 +43,18 @@ workout() _run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/incr - echo "# $BTRFS_UTIL_PROG send $SCRATCH_MNT/base > $tmp/base.snap" \ + echo "# $BTRFS_UTIL_PROG send $SCRATCH_MNT/base > $tmp.base.snap" \ >> $seqres.full - $BTRFS_UTIL_PROG send $SCRATCH_MNT/base > $tmp/base.snap 2>> $seqres.full \ + $BTRFS_UTIL_PROG send $SCRATCH_MNT/base > $tmp.base.snap 2>> $seqres.full \ || _fail "failed: '$@'" echo "# $BTRFS_UTIL_PROG send -p $SCRATCH_MNT/base\ - $SCRATCH_MNT/incr > $tmp/incr.snap" >> $seqres.full + $SCRATCH_MNT/incr > $tmp.incr.snap" >> $seqres.full $BTRFS_UTIL_PROG send -p $SCRATCH_MNT/base \ - $SCRATCH_MNT/incr > $tmp/incr.snap 2>> $seqres.full \ + $SCRATCH_MNT/incr > $tmp.incr.snap 2>> $seqres.full \ || _fail "failed: '$@'" - run_check $FSSUM_PROG -A -f -w $tmp/base.fssum $SCRATCH_MNT/base - run_check $FSSUM_PROG -A -f -w $tmp/incr.fssum -x $SCRATCH_MNT/incr/base \ + run_check $FSSUM_PROG -A -f -w $tmp.base.fssum $SCRATCH_MNT/base + run_check $FSSUM_PROG -A -f -w $tmp.incr.fssum -x $SCRATCH_MNT/incr/base \ $SCRATCH_MNT/incr _scratch_unmount >/dev/null 2>&1@@ -78,11 +64,11 @@ workout() || _fail "size=$fsz mkfs failed" _scratch_mount "-o noatime" - _run_btrfs_util_prog receive $SCRATCH_MNT < $tmp/base.snap
tests/btrfs/007 workout() · line 73
Quoted 10 lines
tests/btrfs/007 +4
-3- run_check $FSSUM_PROG -r $tmp/base.fssum $SCRATCH_MNT/base + _run_btrfs_util_prog receive $SCRATCH_MNT < $tmp.base.snap + run_check $FSSUM_PROG -r $tmp.base.fssum $SCRATCH_MNT/base - _run_btrfs_util_prog receive $SCRATCH_MNT < $tmp/incr.snap - run_check $FSSUM_PROG -r $tmp/incr.fssum $SCRATCH_MNT/incr + _run_btrfs_util_prog receive $SCRATCH_MNT < $tmp.incr.snap + run_check $FSSUM_PROG -r $tmp.incr.fssum $SCRATCH_MNT/incr }
This is better than the s/tmp/workdir conversion in shared/298, but yet easier is to do:
cleanup() { rm -rf $tmp }
-tmp=mktemp -d
+mkdir -p $tmp
Thanks,
Amir.
Re: [PATCH 5/8] btrfs: convert some tests to new setup preamble
Quoted 26 lines · Amir Goldstein
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
Signed-off-by Dave Chinner <[email protected]>---
[...]
Quoted 18 lines
tests/btrfs/007 +3
-5@@ -9,37 +9,23 @@ # (incr) and send both snapshots to a temp file. Remake the file # system and receive from the files. Check both states with fssum. # -# creator [email protected] +. common/setup_test -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +# test exit cleanup goes here +cleanup() { :; }
Quoted 11 lines
tests/btrfs/007 line 27
Quoted 9 lines
tests/btrfs/007 +0
-9-tmp=`mktemp -d` -status=1 - -_cleanup() -{ - echo "*** unmount" - _scratch_unmount 2>/dev/null - rm -f $tmp.* -}Bug in existing test - it does not cleanup $tmp.
Yup, because it creates a non-standard $tmp but then uses code that assumes that tmp is the standard name prefix definition, not a directory. This is exactly the sort of bug I'm trying to eradicate.
And, FWIW, because the test is only using tmp files, it doesn't need to use TEST_DIR to store them so no need for a working directory to be defined.
Review
Quoted 4 lines
cleanup(){ rm -rf $tmp }(quoted diff) +1
-1-tmp=`mktemp -d` +mkdir -p $tmp
Again, no. $tmp is not a directory and there's infrastructure that assumes it is not a directory.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Re: [PATCH 5/8] btrfs: convert some tests to new setup preamble
Quoted 47 lines · Dave Chinner
Quoted 26 lines · Amir Goldstein
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
Signed-off-by Dave Chinner <[email protected]>---
[...]
Quoted 18 lines
tests/btrfs/007 +3
-5@@ -9,37 +9,23 @@ # (incr) and send both snapshots to a temp file. Remake the file # system and receive from the files. Check both states with fssum. # -# creator [email protected] +. common/setup_test -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +# test exit cleanup goes here +cleanup() { :; }Quoted 11 lines
tests/btrfs/007 line 27
Quoted 9 lines
tests/btrfs/007 +0
-9-tmp=`mktemp -d` -status=1 - -_cleanup() -{ - echo "*** unmount" - _scratch_unmount 2>/dev/null - rm -f $tmp.* -}Bug in existing test - it does not cleanup $tmp.
Yup, because it creates a non-standard $tmp but then uses code that assumes that tmp is the standard name prefix definition, not a directory. This is exactly the sort of bug I'm trying to eradicate.
And, FWIW, because the test is only using tmp files, it doesn't need to use
TEST_DIRto store them so no need for a working directory to be defined.
Quoted 8 lines
Review
Quoted 4 lines
cleanup(){ rm -rf $tmp }(quoted diff) +1
-1-tmp=`mktemp -d` +mkdir -p $tmpAgain, no. $tmp is not a directory and there's infrastructure that assumes it is not a directory.
Ok, I see the logic in that argument.
16 more mktemp tests to go...
Thanks,
Amir.
Re: [PATCH 5/8] btrfs: convert some tests to new setup preamble
In reply to Dave ChinnerQuoted 305 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
Signed-off-by Dave Chinner <[email protected]>--- tests/btrfs/001 | 25 ++++++---------------- tests/btrfs/002 | 28 ++++++++---------------- tests/btrfs/003 | 41 ++++++++++++++--------------------- tests/btrfs/004 | 24 ++++++--------------- tests/btrfs/005 | 51 +++++++++++++++++-------------------------- tests/btrfs/006 | 30 ++++++-------------------- tests/btrfs/007 | 57 +++++++++++++++++++------------------------------ tests/btrfs/008 | 30 +++++++++----------------- tests/btrfs/009 | 29 +++++++------------------ 9 files changed, 105 insertions(+), 210 deletions(-)tests/btrfs/001 +7
-18@@ -6,27 +6,16 @@ # # Test btrfs's subvolume and snapshot support # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - rm -f $tmp.* -} +# remove previous $seqres.full before test +rm -f $seqres.full -trap "_cleanup ; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# include test specific environments here . ./common/filter.btrfs - -# real QA test starts here _supported_fs btrfs _supported_os Linux _require_scratch@@ -90,4 +79,4 @@ _scratch_cycle_mount echo "List root dir" ls $SCRATCH_MNT -status=0 ; exit +_successtests/btrfs/002 +9
-19@@ -6,29 +6,21 @@ # # Extented btrfs snapshot test cases # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - rm -f $tmp.* -} - -trap "_cleanup ; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full +# include test specific environments here _supported_fs btrfs _supported_os Linux _require_scratch +echo "Silence is golden" + _scratch_mkfs > /dev/null 2>&1 || _fail "mkfs failed" _scratch_mount@@ -169,6 +161,4 @@ _save_checksum $SNAPNAME $tmp.$tname.sum _verify_checksum $SNAPNAME $tmp.$tname.sum _scratch_unmount || _fail "unmount failed" - -echo "Silence is golden" -status=0; exit +_successtests/btrfs/003 +16
-25@@ -6,31 +6,20 @@ # # btrfs vol tests # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -dev_removed=0 -removed_dev_htl="" -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* - if [ $dev_removed == 1 ]; then - _scratch_unmount - _devmgt_add "${removed_dev_htl}" - fi +. common/setup_test + +# test exit cleanup goes here +cleanup() { + if [ $dev_removed == 1 ]; then + _scratch_unmount + _devmgt_add "${removed_dev_htl}" + fi } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full +# include test specific environments here _supported_fs btrfs _supported_os Linux _require_scratch@@ -38,7 +27,10 @@ _require_scratch_dev_pool 4 _require_deletable_scratch_dev_pool _require_command "$WIPEFS_PROG" wipefs -rm -f $seqres.full +echo "Silence is golden" + +dev_removed=0 +removed_dev_htl="" # Test cases related to raid in btrfs _test_raid0()@@ -172,5 +164,4 @@ _test_add _test_replace _test_remove -echo "Silence is golden" -status=0; exit +_successtests/btrfs/004 +7
-17@@ -9,28 +9,18 @@ # run filefrag to get the extent mapping and follow the backrefs. # We check to end up back at the original file with the correct offset. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 -noise_pid=0 - -_cleanup() -{ +# test exit cleanup goes here +cleanup() { rm $tmp.running wait - rm -f $tmp.* } -trap "_cleanup; exit \$status" 0 1 2 3 15 -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs btrfs _supported_os Linux _require_scratch@@ -39,7 +29,7 @@ _require_btrfs_command inspect-internal logical-resolve _require_btrfs_command inspect-internal inode-resolve _require_command "$FILEFRAG_PROG" filefrag -rm -f $seqres.full +noise_pid=0 FILEFRAG_FILTER=' if (/blocks? of (\d+) bytes/) {tests/btrfs/005 +19
-32@@ -6,22 +6,26 @@ # # Btrfs Online defragmentation tests # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" -here="`pwd`" -tmp=/tmp/$$ -cnt=119 -filesize=48000 +. common/setup_test -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - cd / - rm -f $tmp.* -} +# remove previous $seqres.full before test +rm -f $seqres.full + +# include test specific environments here +. ./common/defrag +_supported_fs btrfs +_supported_os Linux +_require_scratch + +_scratch_mkfs >/dev/null 2>&1 +_scratch_mount +_require_defrag + +cnt=119 +filesize=48000 _create_file() {@@ -111,22 +115,6 @@ _rundefrag() _check_scratch_fs } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter -. ./common/defrag - -# real QA test starts here -_supported_fs btrfs -_supported_os Linux -_require_scratch - -rm -f $seqres.full - -_scratch_mkfs >/dev/null 2>&1 -_scratch_mount -_require_defrag - echo "defrag object | defragment range | defragment compress" echo "a single file | default | off" _rundefrag 1 1 1@@ -155,5 +143,4 @@ _rundefrag 2 1 1 echo "a filesystem | default | off" _rundefrag 3 1 1 -status=0 -exit +_successtests/btrfs/006 +0
-0
tests/btrfs/006 line 12
Quoted 6 lines
tests/btrfs/006 +0
-3@@ -7,35 +7,21 @@ # run basic btrfs information commands in various ways # sanity tests: filesystem show, label, sync, and device stats # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "== QA output created by $seq"
This test uses a customized .out file header (the leading "== "), the .out file should be updated too when converting to the new setup preamble.
Quoted 57 lines
tests/btrfs/006 +7
-20+. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - cd / - rm -f $tmp.* -} +# remove previous $seqres.full before test +rm -f $seqres.full -# get standard environment, filters and checks -. ./common/rc +# include test specific environments here . ./common/filter.btrfs - -# real QA test starts here - -# Modify as appropriate. _supported_fs btrfs _supported_os Linux _require_scratch _require_scratch_dev_pool -rm -f $seqres.full - FIRST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'` LAST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $NF}'` TOTAL_DEVS=`echo $SCRATCH_DEV_POOL | wc -w`@@ -83,6 +69,4 @@ $BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | \ sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g" | \ _filter_spaces -# success, all done -status=0 -exit +_successtests/btrfs/007 +1
-4@@ -9,37 +9,23 @@ # (incr) and send both snapshots to a temp file. Remake the file # system and receive from the files. Check both states with fssum. # -# creator [email protected] +. common/setup_test -seq=`basename $0` -seqres=$RESULT_DIR/$seq
tests/btrfs/007 line 24
Quoted 10 lines
tests/btrfs/007 +2
-7-echo "QA output created by $seq" +# test exit cleanup goes here +cleanup() { :; } -tmp=`mktemp -d` -status=1 - -_cleanup() -{ - echo "*** unmount"
Originally _cleanup was called on exit, so this "umount" message was the last message printed, but...
Quoted 68 lines
tests/btrfs/007 +15
-21- _scratch_unmount 2>/dev/null - rm -f $tmp.* -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here +_supported_fs generic +_supported_os Linux _supported_fs btrfs _supported_os Linux _require_scratch _require_fssum _require_seek_data_hole -rm -f $seqres.full - workout() { fsz=$1@@ -57,18 +43,18 @@ workout() _run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/incr - echo "# $BTRFS_UTIL_PROG send $SCRATCH_MNT/base > $tmp/base.snap" \ + echo "# $BTRFS_UTIL_PROG send $SCRATCH_MNT/base > $tmp.base.snap" \ >> $seqres.full - $BTRFS_UTIL_PROG send $SCRATCH_MNT/base > $tmp/base.snap 2>> $seqres.full \ + $BTRFS_UTIL_PROG send $SCRATCH_MNT/base > $tmp.base.snap 2>> $seqres.full \ || _fail "failed: '$@'" echo "# $BTRFS_UTIL_PROG send -p $SCRATCH_MNT/base\ - $SCRATCH_MNT/incr > $tmp/incr.snap" >> $seqres.full + $SCRATCH_MNT/incr > $tmp.incr.snap" >> $seqres.full $BTRFS_UTIL_PROG send -p $SCRATCH_MNT/base \ - $SCRATCH_MNT/incr > $tmp/incr.snap 2>> $seqres.full \ + $SCRATCH_MNT/incr > $tmp.incr.snap 2>> $seqres.full \ || _fail "failed: '$@'" - run_check $FSSUM_PROG -A -f -w $tmp/base.fssum $SCRATCH_MNT/base - run_check $FSSUM_PROG -A -f -w $tmp/incr.fssum -x $SCRATCH_MNT/incr/base \ + run_check $FSSUM_PROG -A -f -w $tmp.base.fssum $SCRATCH_MNT/base + run_check $FSSUM_PROG -A -f -w $tmp.incr.fssum -x $SCRATCH_MNT/incr/base \ $SCRATCH_MNT/incr _scratch_unmount >/dev/null 2>&1@@ -78,11 +64,11 @@ workout() || _fail "size=$fsz mkfs failed" _scratch_mount "-o noatime" - _run_btrfs_util_prog receive $SCRATCH_MNT < $tmp/base.snap - run_check $FSSUM_PROG -r $tmp/base.fssum $SCRATCH_MNT/base + _run_btrfs_util_prog receive $SCRATCH_MNT < $tmp.base.snap + run_check $FSSUM_PROG -r $tmp.base.fssum $SCRATCH_MNT/base - _run_btrfs_util_prog receive $SCRATCH_MNT < $tmp/incr.snap - run_check $FSSUM_PROG -r $tmp/incr.fssum $SCRATCH_MNT/incr + _run_btrfs_util_prog receive $SCRATCH_MNT < $tmp.incr.snap + run_check $FSSUM_PROG -r $tmp.incr.fssum $SCRATCH_MNT/incr } echo "*** test send / receive"
tests/btrfs/007 fssize=`expr 2000 \* 1024 \* 1024` · line 82
Quoted 7 lines
tests/btrfs/007 +2
-1@@ -91,7 +77,8 @@ fssize=`expr 2000 \* 1024 \* 1024` ops=200 workout $fssize $ops - +echo "*** unmount" +_scratch_unmount 2>/dev/null echo "*** done"
.. now "umount" is printed before "done". The order in btrfs/007.out should be updated too.
Thanks,
Eryu
Quoted 127 lines
tests/btrfs/007 +2
-2-status=0 -exit + +_successtests/btrfs/008 +10
-20@@ -6,37 +6,27 @@ # # btrfs send ENOENT regression test, from a user report on linux-btrfs # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -tmp_dir=send_temp_$seq - -status=1 # failure is the default! - -_cleanup() -{ +# test exit cleanup goes here +cleanup() { $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send/snapshots/backup2 > /dev/null 2>&1 $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send/snapshots/backup3 > /dev/null 2>&1 $BTRFS_UTIL_PROG subvolume delete $TEST_DIR/$tmp_dir/send > /dev/null 2>&1 rm -rf $TEST_DIR/$tmp_dir - rm -f $tmp.* } -trap "_cleanup ; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs btrfs _supported_os Linux _require_test _require_scratch +echo "Silence is golden" + _scratch_mkfs > /dev/null 2>&1 #receive needs to be able to setxattrs, including the selinux context, if we use@@ -46,6 +36,7 @@ export SELINUX_MOUNT_OPTIONS="" _scratch_mount +tmp_dir=send_temp_$seq mkdir $TEST_DIR/$tmp_dir $BTRFS_UTIL_PROG subvolume create $TEST_DIR/$tmp_dir/send \ > $seqres.full 2>&1 || _fail "failed subvol create"@@ -66,5 +57,4 @@ $BTRFS_UTIL_PROG send -f $TEST_DIR/$tmp_dir/blah $work_dir/snapshots/backup3 \ $BTRFS_UTIL_PROG receive -vvvv -f $TEST_DIR/$tmp_dir/blah $SCRATCH_MNT \ >> $seqres.full 2>&1 || _fail "receive failed" -echo "Silence is golden" -status=0 ; exit +_successtests/btrfs/009 +8
-21@@ -6,32 +6,20 @@ # # Regression test to make sure we can't delete the default subvol # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ +# test exit cleanup goes here +cleanup() { :; } -status=1 # failure is the default! - -_cleanup() -{ - rm -f $tmp.* -} - -trap "_cleanup ; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs btrfs _supported_os Linux _require_scratch -rm -f $seqres.full +echo "Silence is golden" _scratch_mkfs > /dev/null 2>&1 _scratch_mount@@ -45,5 +33,4 @@ $BTRFS_UTIL_PROG subvolume delete $SCRATCH_MNT/newvol >> $seqres.full 2>&1 _scratch_unmount _try_scratch_mount || _fail "mount should have succeeded" -echo "Silence is golden" -status=0 ; exit +_successSignature · 6 lines
2.17.0 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/8 ext4: convert some tests to new setup preamble
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
--- tests/ext4/001 | 26 +++++++------------------- tests/ext4/002 | 41 +++++++++++++---------------------------- tests/ext4/003 | 25 +++++++------------------ tests/ext4/004 | 46 ++++++++++++++++------------------------------ tests/ext4/005 | 29 +++++++---------------------- tests/ext4/006 | 38 +++++++++++++------------------------- tests/ext4/007 | 34 ++++++++++------------------------ tests/ext4/008 | 28 +++++++--------------------- tests/ext4/009 | 34 ++++++++++------------------------ 9 files changed, 90 insertions(+), 211 deletions(-)
tests/ext4/001 +7 -19
@@ -6,28 +6,16 @@ # # Test fallocate FALLOC_FL_ZERO_RANGE # -seqfull=$0 -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - rm -f $tmp.* -} +# remove previous $seqres.full before test +rm -f $seqres.full -trap "_cleanup ; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# include test specific environments here . ./common/punch - -# real QA test starts here _supported_fs ext4 _supported_os Linux _require_xfs_io_command "fzero"
@@ -50,4 +38,4 @@ _test_generic_punch -k falloc fzero fzero fiemap _filter_fiemap $testfile # Delayed allocation multi zero range tests _test_generic_punch -d -k falloc fzero fzero fiemap _filter_fiemap $testfile -status=0 ; exit +_success
tests/ext4/002 +13 -28
62 lines not on this page · raw message
tests/ext4/003 +7 -18
@@ -8,30 +8,20 @@ # b5b6077 ext4: fix wrong assert in ext4_mb_normalize_request() # This testcase checks whether this bug has been fixed. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - _scratch_unmount -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs ext4 _supported_os Linux - _require_scratch _require_scratch_ext4_feature "bigalloc" -rm -f $seqres.full - $MKFS_EXT4_PROG -F -O bigalloc -C 65536 -g 256 $SCRATCH_DEV 512m \ >> $seqres.full 2>&1 _scratch_mount
@@ -39,5 +29,4 @@ _scratch_mount $XFS_IO_PROG -f -c "pwrite 0 256m -b 1M" $SCRATCH_MNT/testfile 2>&1 | \ _filter_xfs_io -status=0 -exit +_success
tests/ext4/004 +16 -30
66 lines not on this page · raw message
tests/ext4/005 +7 -22
@@ -11,33 +11,20 @@ # ext4: be more strict when migrating to non-extent based file # ext4: correctly migrate a file with a hole at the beginning # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs ext4 _supported_os Linux _require_scratch _require_command "$CHATTR_PROG" chattr -rm -f $seqres.full - echo "Silence is golden" _scratch_mkfs >>$seqres.full 2>&1
@@ -63,6 +50,4 @@ $CHATTR_PROG -e $testfile >>$seqres.full 2>&1 # results in i_blocks corruption $XFS_IO_PROG -c "pwrite 0 4k" $testfile >>$seqres.full 2>&1 -# success, all done -status=0 -exit +_success
tests/ext4/006 +13 -25
@@ -8,40 +8,30 @@ # the kernel reacts, how e2fsck fares in fixing the mess, and then # try more kernel accesses to see if it really fixed things. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - #rm -f $tmp.* -} +. common/setup_test + +# test exit cleanup goes here +cleanup() { :; } + +# remove previous $seqres.full before test +rm -f $seqres.full -# get standard environment, filters and checks +# include test specific environments here . ./common/rc . ./common/filter . ./common/attr . ./common/populate . ./common/fuzzy - -if [ ! -x "$(which e2fuzz)" ]; then - _notrun "Couldn't find e2fuzz" -fi - -# real QA test starts here _supported_fs ext4 _supported_os Linux - _require_scratch _require_attrs _require_populate_commands +if [ ! -x "$(which e2fuzz)" ]; then + _notrun "Couldn't find e2fuzz" +fi + repair_scratch() { fsck_pass="$1"
@@ -75,7 +65,6 @@ repair_scratch() { return 1 } -rm -f $seqres.full echo "See interesting results in $seqres.full" | sed -e "s,$RESULT_DIR,RESULT_DIR,g" SRCDIR=`pwd` test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-b 32 -v"
@@ -144,5 +133,4 @@ if [ "$(wc -l < "$ROUND2_LOG")" -ne 8 ]; then fi echo "finished fuzzing" | tee -a "$seqres.full" -status=0 -exit +_success
tests/ext4/007 +10 -24
@@ -7,35 +7,22 @@ # Create and populate an ext4 filesystem, corrupt the primary superblock, then # see how the kernel and e2fsck deal with it. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - #rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter -. ./common/attr +. common/setup_test + +# test exit cleanup goes here +cleanup() { :; } + +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here +. ./common/attr _supported_fs ext4 _supported_os Linux - _require_scratch test -n "${FORCE_FUZZ}" || _require_scratch_ext4_crc _require_attrs -rm -f $seqres.full TESTDIR="${SCRATCH_MNT}/scratchdir" TESTFILE="${TESTDIR}/testfile"
@@ -103,5 +90,4 @@ umount "${SCRATCH_MNT}" echo "+ check fs (2)" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail" -status=0 -exit +_success
tests/ext4/008 +7 -21
@@ -7,35 +7,22 @@ # Create and populate an ext4 filesystem, corrupt a group descriptor, then # see how the kernel and e2fsck deal with it. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - cd / - #rm -f $tmp.* -} +# remove previous $seqres.full before test +rm -f $seqres.full -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# include test specific environments here . ./common/attr - -# real QA test starts here _supported_fs ext4 _supported_os Linux - _require_scratch test -n "${FORCE_FUZZ}" || _require_scratch_ext4_crc _require_attrs -rm -f $seqres.full TESTDIR="${SCRATCH_MNT}/scratchdir" TESTFILE="${TESTDIR}/testfile"
@@ -84,5 +71,4 @@ umount "${SCRATCH_MNT}" echo "+ check fs (2)" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail" -status=0 -exit +_success
tests/ext4/009 +10 -24
@@ -7,36 +7,23 @@ # Create and populate an ext4 filesystem, corrupt a block bitmap, then # see how the kernel and e2fsck deal with it. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - #rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter -. ./common/attr +. common/setup_test + +# test exit cleanup goes here +cleanup() { :; } + +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here +. ./common/attr _supported_fs ext4 _supported_os Linux - _require_xfs_io_command "falloc" _require_scratch test -n "${FORCE_FUZZ}" || _require_scratch_ext4_crc _require_attrs -rm -f $seqres.full TESTDIR="${SCRATCH_MNT}/scratchdir" TESTFILE="${TESTDIR}/testfile"
@@ -94,5 +81,4 @@ umount "${SCRATCH_MNT}" echo "+ check fs (2)" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail" -status=0 -exit +_success
Signature · 1 line
2.17.0
Re: [PATCH 6/8] ext4: convert some tests to new setup preamble
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
Signed-off-by Dave Chinner <[email protected]>---
Looks fine.
Thanks,
Amir.
Re: [PATCH 6/8] ext4: convert some tests to new setup preamble
In reply to Dave ChinnerQuoted 22 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
Signed-off-by Dave Chinner <[email protected]>--- tests/ext4/001 | 26 +++++++------------------- tests/ext4/002 | 41 +++++++++++++---------------------------- tests/ext4/003 | 25 +++++++------------------ tests/ext4/004 | 46 ++++++++++++++++------------------------------ tests/ext4/005 | 29 +++++++---------------------- tests/ext4/006 | 38 +++++++++++++------------------------- tests/ext4/007 | 34 ++++++++++------------------------ tests/ext4/008 | 28 +++++++--------------------- tests/ext4/009 | 34 ++++++++++------------------------ 9 files changed, 90 insertions(+), 211 deletions(-)tests/ext4/001 +0
-0
tests/ext4/001 line 9
Quoted 4 lines
tests/ext4/001 +0
-1@@ -6,28 +6,16 @@ # # Test fallocate FALLOC_FL_ZERO_RANGE # -seqfull=$0
This is needed and used by _link_out_file_named(), without defining it test is unable to find .cfg file to do the .out file link.
How about making "seqfull" part of the test setup preamble?
Thanks,
Eryu
PATCH 7/8 overlay: convert some tests to new setup preamble
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
--- tests/overlay/001 | 26 +++++--------------------- tests/overlay/002 | 26 +++++--------------------- tests/overlay/003 | 31 +++++++------------------------ tests/overlay/004 | 26 +++++--------------------- tests/overlay/005 | 32 ++++++++------------------------ tests/overlay/006 | 27 ++++++--------------------- tests/overlay/007 | 26 ++++++-------------------- tests/overlay/008 | 27 ++++++--------------------- tests/overlay/009 | 29 ++++++++--------------------- 9 files changed, 56 insertions(+), 194 deletions(-)
tests/overlay/001 +5 -21
@@ -9,29 +9,15 @@ # Kernel commit 0480334fa604 ("ovl: use O_LARGEFILE in ovl_copy_up()") # fixed bug when copying up large file from lower dir. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { :; } # remove previous $seqres.full before test rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs overlay _supported_os Linux _require_scratch
@@ -60,6 +46,4 @@ for f in $SCRATCH_MNT/*; do $XFS_IO_PROG -c "open" $f >>$seqres.full done -# success, all done -status=0 -exit +_success
tests/overlay/002 +5 -21
@@ -11,29 +11,15 @@ # memory access) when the lower or upper directory belonged to a btrfs file # system. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { :; } # remove previous $seqres.full before test rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs overlay _supported_os Linux _require_scratch
@@ -52,6 +38,4 @@ _scratch_mount # This should work and not result in a crash. $XFS_IO_PROG -c "pwrite 0 64k" -c "fsync" $SCRATCH_MNT/foobar | _filter_xfs_io -# success, all done -status=0 -exit +_success
tests/overlay/003 +7 -24
@@ -12,35 +12,21 @@ # prevents mounting overlayfs like this since v4.6-rc1. # No harm to keep this test as a sanity check. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { :; } # remove previous $seqres.full before test rm -f $seqres.full -# real QA test starts here - -# Modify as appropriate. +# include test specific environments here _supported_fs overlay _supported_os Linux _require_scratch +echo "Silence is golden" + # Remove all files from previous tests _scratch_mkfs
@@ -77,7 +63,4 @@ ls ${SCRATCH_MNT}/ # unmount overlayfs but not base fs $UMOUNT_PROG $SCRATCH_MNT -echo "Silence is golden" -# success, all done -status=0 -exit +_success
tests/overlay/004 +5 -21
@@ -6,29 +6,15 @@ # # Test file copy up on overlayfs by changing mode bits. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { :; } # remove previous $seqres.full before test rm -f $seqres.full -# Modify as appropriate. +# include test specific environments here _supported_fs overlay _supported_os Linux _require_scratch
@@ -78,6 +64,4 @@ $UMOUNT_PROG $SCRATCH_MNT stat -c %a ${upperdir}/attr_file1 ls ${upperdir}/ -# success, all done -status=0 -exit +_success
tests/overlay/005 +8 -24
@@ -8,35 +8,20 @@ # when unmount the underlying fs. # Kernel commit ab79efab0 fixed this issue. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* +. common/setup_test + +# test exit cleanup goes here +cleanup() { _destroy_loop_device $fs_loop_dev _destroy_loop_device $upper_loop_dev rm -f $lower_img rm -f $upper_img } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter - # remove previous $seqres.full before test rm -f $seqres.full -# real QA test starts here - -# Modify as appropriate. +# include test specific environments here _supported_fs overlay _supported_os Linux # Use non-default scratch underlying overlay dirs, we need to check
@@ -44,6 +29,8 @@ _supported_os Linux _require_scratch_nocheck _require_loop +echo "Silence is golden" + # Remove all files from previous tests _scratch_mkfs
@@ -96,7 +83,4 @@ _overlay_check_scratch_dirs $lowerd $upperd $workd $UMOUNT_PROG ${OVL_BASE_SCRATCH_MNT}/uppermnt $UMOUNT_PROG ${OVL_BASE_SCRATCH_MNT}/lowermnt -# success, all done -echo "Silence is golden" -status=0 -exit +_success
tests/overlay/006 +6 -21
@@ -10,28 +10,15 @@ # Upstream commit 45d117389696 ("ovl: ignore lower entries when checking purity # of non-directory entries") fixed the issue # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { :; } +# remove previous $seqres.full before test rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs overlay _supported_os Linux _require_scratch
@@ -57,6 +44,4 @@ rm $SCRATCH_MNT/uppertestdir/lowertestfile # no file no whiteout file in upptestdir ls $SCRATCH_MNT/uppertestdir -# success, all done -status=0 -exit +_success
tests/overlay/007 +6 -20
@@ -9,29 +9,17 @@ # Upstream commit ce9113bbcbf4 ("ovl: fix getcwd() failure after unsuccessful # rmdir") fixed this issue # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* +# test exit cleanup goes here +cleanup() { rm -rf $TEST_DIR/$seq } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter - +# remove previous $seqres.full before test rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs overlay _supported_os Linux _require_test
@@ -46,6 +34,4 @@ rmdir ../$seq >>$seqres.full 2>&1 # getcwd should return the correct current dir pwd | _filter_test_dir -# success, all done -status=0 -exit +_success
tests/overlay/008 +6 -21
@@ -10,28 +10,15 @@ # This upstream kernel patch fixed the issue # d0e13f5 ovl: fix uid/gid when creating over whiteout # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { :; } +# remove previous $seqres.full before test rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs overlay _supported_os Linux _require_scratch
@@ -65,6 +52,4 @@ rm -f $SCRATCH_MNT/testfile _user_do "mkdir $SCRATCH_MNT/testfile" stat -c %U:%G-%F $SCRATCH_MNT/testfile -# success, all done -status=0 -exit +_success
tests/overlay/009 +8 -21
@@ -9,32 +9,21 @@ # This is fixed by kernel commit named as # ovl: fix dentry leak for default_permissions # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { :; } +# remove previous $seqres.full before test rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs overlay _supported_os Linux _require_scratch +echo "Silence is golden" + # Remove all files from previous tests _scratch_mkfs
@@ -48,6 +37,4 @@ _scratch_mount -o default_permissions cat $SCRATCH_MNT/testfile # overlay will be unmounted by test harness and kernel BUG if dentry leaked -echo "Silence is golden" -status=0 -exit +_success
Signature · 1 line
2.17.0
Re: [PATCH 7/8] overlay: convert some tests to new setup preamble
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
Signed-off-by Dave Chinner <[email protected]>---
Looks fine.
I can convert the rest of overlayfs tests once this batch is merged.
Thanks,
Amir.
PATCH 8/8 xfs: convert some tests to new setup preamble
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
--- tests/xfs/001 | 38 ++++++++++++-------------------------- tests/xfs/002 | 35 ++++++++++------------------------- tests/xfs/003 | 19 ++++++++----------- tests/xfs/004 | 43 ++++++++++++++----------------------------- tests/xfs/005 | 30 +++++++----------------------- tests/xfs/006 | 27 ++++++--------------------- tests/xfs/007 | 30 +++++++----------------------- tests/xfs/008 | 42 +++++++++++++++--------------------------- tests/xfs/009 | 46 +++++++++++++++++++--------------------------- 9 files changed, 98 insertions(+), 212 deletions(-)
tests/xfs/001 +12 -26
@@ -8,20 +8,19 @@ # write the value 0, each bit and finally the entry beyond the maximum legal # value. Also makes sure a core write and hex input still work. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - cd / - rm -f $tmp.* -} +# remove previous $seqres.full before test +rm -f $seqres.full + +# include test specific environments here +_supported_fs xfs +_supported_os Linux +_require_scratch_nocheck +_require_xfs_mkfs_crc _do_bit_test() {
@@ -39,18 +38,6 @@ _do_bit_test() echo } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter - -# real QA test starts here - -# Modify as appropriate. -_supported_fs xfs -_supported_os Linux -_require_scratch_nocheck -_require_xfs_mkfs_crc - _scratch_mkfs -m crc=0 >/dev/null 2>&1 _scratch_mount
@@ -79,5 +66,4 @@ _scratch_xfs_db -x -c "inode $FILE_INO" -c "write core.gen 0xa5" _scratch_xfs_db -x -c "inode $FILE_INO" -c "write core.gen 0" _scratch_xfs_db -x -c "inode $FILE_INO" -c "write core.gen #5a5a" _scratch_xfs_db -x -c "inode $FILE_INO" -c "write core.gen #a5a5" -status=0 -exit +_success
tests/xfs/002 +10 -25
@@ -13,26 +13,15 @@ # for further explanation. (NB: while the commit log was good, the # patch had a bug which was subsequently fixed) # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter - -# Modify as appropriate. +. common/setup_test + +# test exit cleanup goes here +cleanup() { :; } + +# remove previous $seqres.full before test +rm -f $seqres.full + +# include test specific environments here _supported_fs xfs _supported_os Linux _require_scratch_nocheck
@@ -41,8 +30,6 @@ _require_no_large_scratch_dev # So we can explicitly turn it _off_: _require_xfs_mkfs_crc -rm -f $seqres.full - _scratch_mkfs_xfs -m crc=0 -d size=128m >> $seqres.full 2>&1 || _fail "mkfs failed" # Scribble past a couple V4 secondary superblocks to populate sb_crc
@@ -56,6 +43,4 @@ _scratch_mount # This should pass $XFS_GROWFS_PROG $SCRATCH_MNT >> $seqres.full 2>&1 || _fail "growfs failed" -# success, all done -status=0 -exit +_success
tests/xfs/003 +8 -11
@@ -6,20 +6,15 @@ # # exercise xfs_db bug #784078 # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# test exit cleanup goes here +cleanup() { :; } -tmp=/tmp/$$ -here=`pwd` -status=0 # success is the default! -trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 +# remove previous $seqres.full before test +rm -f $seqres.full -# real QA test starts here +# include test specific environments here _supported_fs xfs _supported_os Linux _require_test
@@ -67,3 +62,5 @@ test_done echo "=== TEST 7 ===" xfs_db -r -c 'ring' $TEST_DEV test_done + +_success
tests/xfs/004 +14 -29
68 lines not on this page · raw message
tests/xfs/005 +7 -23
@@ -10,34 +10,20 @@ # inadvertently caused primary SB CRC failures to not error out, this # is a regression test for that fix. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# remove previous $seqres.full before test +rm -f $seqres.full -# Modify as appropriate. +# include test specific environments here _supported_fs xfs _supported_os Linux - _require_scratch_nocheck _require_xfs_mkfs_crc -rm -f $seqres.full - _scratch_mkfs_xfs -m crc=1 >> $seqres.full 2>&1 || _fail "mkfs failed" # Zap the crc. xfs_db updates the CRC post-write, so poke it directly
@@ -46,6 +32,4 @@ $XFS_IO_PROG -c "pwrite 224 4" -c fsync $SCRATCH_DEV | _filter_xfs_io # should FAIL, the crc is bad; golden output contains mount failure _try_scratch_mount 2>&1 | _filter_error_mount -# success, all done -status=0 -exit +_success
tests/xfs/006 +6 -21
@@ -7,31 +7,18 @@ # Test xfs' "fail at unmount" error handling configuration. Stop # XFS from retrying to writeback forever at unmount. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* +# test exit cleanup goes here +cleanup() { _dmerror_cleanup } -# get standard environment, filters and checks -. ./common/rc -. ./common/filter -. ./common/dmerror - # remove previous $seqres.full before test rm -f $seqres.full -# real QA test starts here +# include test specific environments here +. ./common/dmerror _supported_fs xfs _supported_os Linux _require_scratch
@@ -83,6 +70,4 @@ _dmerror_load_working_table _dmerror_mount _dmerror_unmount -# success, all done -status=0 -exit +_success
tests/xfs/007 +7 -23
@@ -6,35 +6,21 @@ # # Test to verify Q_XQUOTARM functionality. # -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" +. common/setup_test -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 +# test exit cleanup goes here +cleanup() { :; } -_cleanup() -{ - cd / - rm -f $tmp.* -} +# remove previous $seqres.full before test +rm -f $seqres.full -# get standard environment, filters and checks -. ./common/rc -. ./common/filter +# include test specific environments here . ./common/quota - -# Modify as appropriate. _supported_fs xfs _supported_os Linux - _require_scratch _require_xfs_quota -rm -f $seqres.full - _scratch_mkfs_xfs | _filter_mkfs > /dev/null 2> $tmp.mkfs . $tmp.mkfs
@@ -83,6 +69,4 @@ _qmount _require_prjquota $SCRATCH_DEV do_test uquotino $PQUOTINO up -# success, all done -status=0 -exit +_success
tests/xfs/008 +15 -27
69 lines not on this page · raw message
tests/xfs/009 +19 -27
64 lines not on this page · raw message
Signature · 1 line
2.17.0
Re: [PATCH 8/8] xfs: convert some tests to new setup preamble
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Small initial batch to demonstrate conversion.
Signed-off-by Dave Chinner <[email protected]>---
Looks fine.
Thanks,
Amir.
Quoted 29 lines · Dave Chinner
Hi folks,
These patches start the long process of factoring out most of the test setup boilerplate in each test. The first patch introduces the generic test setup include file, and the patches that follow start the process of converting tests over to use it.
Making infrastructure changes to fstests is hard because of the sheer number of tests. Abstracting out things like test setup will make it much easier in future to improve the test setup infrstructure as we won't need to modify every test to make the change. We only have to do the hard work once.
There is still some boiler plate in the preamble, but it is reduced significantly and only contains things that individual tests should be allowed to influence. i.e. the full output file and a cleanup function that is called on exit.
I've also replaced the test success suffix - instead of this boiler plate at the end of each test:
# success, all done
status=0
exitThis has been replaced with a single call to
_success, which does all the things necessary for the test harness to know the test has exited successfully.
Quoted 5 lines
As an initial pass I've convert all the test directories with a small number of tests, and converted the first handful of tests in each of the major test directories. This is a slow process because it's mostly manual as every second test has some unique variation that makes automated replacement somewhat difficult.
Sounds good to me. I'll continue commit in new tests using old template until this patchset goes in. Once these patches are upstream, all new tests should use new template, I'll convert the pending new tests on commit or ask the author to do so.
Quoted 7 lines
As such, I've really only scratched the surface - this patchset changes over about 60 tests, and there are about 1200 more tests to convert. As such, my focus is going to be converting the generic tests first - this is the biggest chunk of the work that needs to be done.
Quoted 6 lines
Given there is still a large amount of conversion work to do, I would appreciate it if people regularly contributing to the other large test dirs (mainly overlay, btrfs, ext4 and xfs) would consider devoting an hour or two to converting some of those tests to the new setup preamble. The more people who do a bit, the faster the conversion will go and the better it will be for everyone.
Agreed. And manual conversion also means all the converted tests need careful review and testings, I'll take some time reviewing & testing this first batch.
Thanks a lot for doing the hard work in converting the tests!
Eryu
Quoted 10 lines
Comments, thoughts?
-Dave.
--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html