From: Dave Chinner <david@fromorbit.com>
To: fstests@vger.kernel.org
Subject: [PATCH 7/8] overlay: convert some tests to new setup preamble
Date: Wed, 27 Jun 2018 18:21:02 +1000 [thread overview]
Message-ID: <20180627082103.9662-8-david@fromorbit.com> (raw)
In-Reply-To: <20180627082103.9662-1-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
Small initial batch to demonstrate conversion.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
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(-)
diff --git a/tests/overlay/001 b/tests/overlay/001
index ade7a73a6cb2..4f2131ac0b49 100755
--- a/tests/overlay/001
+++ b/tests/overlay/001
@@ -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
diff --git a/tests/overlay/002 b/tests/overlay/002
index dd96cf0d3ab4..c677db1c6ffe 100755
--- a/tests/overlay/002
+++ b/tests/overlay/002
@@ -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
diff --git a/tests/overlay/003 b/tests/overlay/003
index 878ecbe7e974..5f753546242d 100755
--- a/tests/overlay/003
+++ b/tests/overlay/003
@@ -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
diff --git a/tests/overlay/004 b/tests/overlay/004
index 216df203fe50..03115bb8ffd8 100755
--- a/tests/overlay/004
+++ b/tests/overlay/004
@@ -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
diff --git a/tests/overlay/005 b/tests/overlay/005
index 902eda18c8fe..13733c8ee50d 100755
--- a/tests/overlay/005
+++ b/tests/overlay/005
@@ -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
diff --git a/tests/overlay/006 b/tests/overlay/006
index 72aa451a3c0b..ab48d70c36e7 100755
--- a/tests/overlay/006
+++ b/tests/overlay/006
@@ -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
diff --git a/tests/overlay/007 b/tests/overlay/007
index 5dffc83276bb..1f9366dd8ed4 100755
--- a/tests/overlay/007
+++ b/tests/overlay/007
@@ -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
diff --git a/tests/overlay/008 b/tests/overlay/008
index 29fa509bd8cf..a12bc792ee08 100755
--- a/tests/overlay/008
+++ b/tests/overlay/008
@@ -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
diff --git a/tests/overlay/009 b/tests/overlay/009
index 7fe25f2da172..d9e37313bbe8 100755
--- a/tests/overlay/009
+++ b/tests/overlay/009
@@ -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
--
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 ` [PATCH 2/8] tests: convert various test dirs to " Dave Chinner
2018-06-27 10:34 ` 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 ` Dave Chinner [this message]
2018-06-27 11:37 ` [PATCH 7/8] overlay: " 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-8-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.