From: Dave Chinner <david@fromorbit.com>
To: fstests@vger.kernel.org
Subject: [PATCH 2/8] tests: convert various test dirs to setup preamble
Date: Wed, 27 Jun 2018 18:20:57 +1000 [thread overview]
Message-ID: <20180627082103.9662-3-david@fromorbit.com> (raw)
In-Reply-To: <20180627082103.9662-1-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
Convert all the test dirs with a very small number of tests in one
go.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
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(-)
diff --git a/tests/cifs/001 b/tests/cifs/001
index 193103bf8877..5bfc6ae46c92 100755
--- a/tests/cifs/001
+++ b/tests/cifs/001
@@ -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
diff --git a/tests/f2fs/001 b/tests/f2fs/001
index f9cd2cf089a3..c23c1cc6da36 100755
--- a/tests/f2fs/001
+++ b/tests/f2fs/001
@@ -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
diff --git a/tests/nfs/001 b/tests/nfs/001
index d7a79cb07d83..ca5d96093bf9 100755
--- a/tests/nfs/001
+++ b/tests/nfs/001
@@ -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
diff --git a/tests/ocfs2/001 b/tests/ocfs2/001
index af304b8281a3..ad4ed58cd875 100755
--- a/tests/ocfs2/001
+++ b/tests/ocfs2/001
@@ -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
diff --git a/tests/perf/001 b/tests/perf/001
index 5a6d9b29cb93..b28081eb1872 100755
--- a/tests/perf/001
+++ b/tests/perf/001
@@ -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
diff --git a/tests/udf/102 b/tests/udf/102
index acfa85c30387..e3ea7da75f64 100755
--- a/tests/udf/102
+++ b/tests/udf/102
@@ -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
--
2.17.0
next prev parent reply other threads:[~2018-06-27 8:21 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-27 8:20 [PATCH 0/6] fstests: start factoring test setup boilerplate Dave Chinner
2018-06-27 8:20 ` [PATCH 1/8] fstests: generic test setup preamble Dave Chinner
2018-06-27 11:07 ` Amir Goldstein
2018-06-27 8:20 ` Dave Chinner [this message]
2018-06-27 10:34 ` [PATCH 2/8] tests: convert various test dirs to " Amir Goldstein
2018-06-27 14:03 ` Dave Chinner
2018-06-27 8:20 ` [PATCH 3/8] shared: use new test " Dave Chinner
2018-06-27 10:56 ` Amir Goldstein
2018-06-27 14:27 ` Dave Chinner
2018-06-27 14:43 ` Amir Goldstein
2018-06-27 22:07 ` Dave Chinner
2018-06-28 4:12 ` Amir Goldstein
2018-06-27 8:20 ` [PATCH 4/8] generic: convert some tests to new " Dave Chinner
2018-06-27 11:08 ` Amir Goldstein
2018-07-07 11:28 ` Eryu Guan
2018-06-27 8:21 ` [PATCH 5/8] btrfs: " Dave Chinner
2018-06-27 11:30 ` Amir Goldstein
2018-06-27 14:34 ` Dave Chinner
2018-06-27 14:48 ` Amir Goldstein
2018-07-07 11:22 ` Eryu Guan
2018-06-27 8:21 ` [PATCH 6/8] ext4: " Dave Chinner
2018-06-27 11:34 ` Amir Goldstein
2018-07-07 11:25 ` Eryu Guan
2018-06-27 8:21 ` [PATCH 7/8] overlay: " Dave Chinner
2018-06-27 11:37 ` Amir Goldstein
2018-06-27 8:21 ` [PATCH 8/8] xfs: " Dave Chinner
2018-06-27 11:42 ` Amir Goldstein
2018-06-28 5:59 ` [PATCH 0/6] fstests: start factoring test setup boilerplate Eryu Guan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180627082103.9662-3-david@fromorbit.com \
--to=david@fromorbit.com \
--cc=fstests@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.