From: Dave Chinner <david@fromorbit.com>
To: fstests@vger.kernel.org
Subject: [PATCH 1/3] common: add _require_test_swapfile
Date: Mon, 3 Dec 2018 17:42:54 +1100 [thread overview]
Message-ID: <20181203064256.26768-2-david@fromorbit.com> (raw)
In-Reply-To: <20181203064256.26768-1-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
Because we can host swap files on the test device, not just the
scratch device.
Also, move the tests for the utilities needed to manipulate swap
files into the functions that test whether swap files are supported
so they are checked for existence /before/ we try to us them. This
fixes all the tests that currently check for these utilities
manually /after/ checking if swapfiles are supported.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
common/rc | 29 +++++++++++++++++++++--------
tests/generic/472 | 2 --
tests/generic/495 | 2 --
tests/generic/496 | 2 --
tests/generic/497 | 2 --
5 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/common/rc b/common/rc
index ecb17380bad8..5b344b25012b 100644
--- a/common/rc
+++ b/common/rc
@@ -2214,22 +2214,35 @@ _format_swapfile() {
}
# Check that the filesystem supports swapfiles
-_require_scratch_swapfile()
+_require_swapfile()
{
- _require_scratch
+ dir=$1
- _scratch_mkfs >/dev/null
- _scratch_mount
+ # fstests also has custom binaries for mkswap/swapon
+ _require_test_program mkswap
+ _require_test_program swapon
# Minimum size for mkswap is 10 pages
- _format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10))
+ _format_swapfile "$dir/swap" $(($(get_page_size) * 10))
- if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then
- _scratch_unmount
+ if ! swapon "$dir/swap" >/dev/null 2>&1; then
_notrun "swapfiles are not supported"
fi
- swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1
+ swapoff "$dir/swap" >/dev/null 2>&1
+}
+
+_require_test_swapfile()
+{
+ _require_swapfile $TEST_DIR
+}
+
+_require_scratch_swapfile()
+{
+ _require_scratch
+ _scratch_mkfs >/dev/null
+ _scratch_mount
+ _require_swapfile $SCRATCH_MNT
_scratch_unmount
}
diff --git a/tests/generic/472 b/tests/generic/472
index aba4a00719bc..d598eef37997 100755
--- a/tests/generic/472
+++ b/tests/generic/472
@@ -33,8 +33,6 @@ rm -f $seqres.full
_supported_fs generic
_supported_os Linux
_require_scratch_swapfile
-_require_test_program mkswap
-_require_test_program swapon
rm -f $seqres.full
_scratch_mkfs >>$seqres.full 2>&1
diff --git a/tests/generic/495 b/tests/generic/495
index 88df26c78ec2..63f45cf4b336 100755
--- a/tests/generic/495
+++ b/tests/generic/495
@@ -31,8 +31,6 @@ rm -f $seqres.full
_supported_fs generic
_supported_os Linux
_require_scratch_swapfile
-_require_test_program mkswap
-_require_test_program swapon
_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount
diff --git a/tests/generic/496 b/tests/generic/496
index 3083eef0bebc..0e214909f596 100755
--- a/tests/generic/496
+++ b/tests/generic/496
@@ -34,8 +34,6 @@ rm -f $seqres.full
_supported_fs generic
_supported_os Linux
_require_scratch_swapfile
-_require_test_program mkswap
-_require_test_program swapon
_require_xfs_io_command "falloc"
rm -f $seqres.full
diff --git a/tests/generic/497 b/tests/generic/497
index 3d5502ef7c08..d9f9b7521eff 100755
--- a/tests/generic/497
+++ b/tests/generic/497
@@ -34,8 +34,6 @@ rm -f $seqres.full
_supported_fs generic
_supported_os Linux
_require_scratch_swapfile
-_require_test_program mkswap
-_require_test_program swapon
_require_xfs_io_command "fcollapse"
rm -f $seqres.full
--
2.19.1
next prev parent reply other threads:[~2018-12-03 6:43 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 6:42 [PATCH 0/3] fstests: copy_file_range() bounds testing Dave Chinner
2018-12-03 6:42 ` Dave Chinner [this message]
2018-12-03 16:43 ` [PATCH 1/3] common: add _require_test_swapfile Darrick J. Wong
2018-12-13 12:16 ` Xiao Yang
2018-12-18 21:54 ` Dave Chinner
2018-12-03 6:42 ` [PATCH 2/3] generic/43[014]: copy_range beyond source EOF should fail Dave Chinner
2018-12-03 7:30 ` Amir Goldstein
2018-12-03 8:10 ` Dave Chinner
2018-12-03 16:47 ` Darrick J. Wong
2018-12-05 22:23 ` Dave Chinner
2018-12-03 6:42 ` [PATCH 3/3] generic: copy_file_range bounds test Dave Chinner
2018-12-03 7:25 ` Amir Goldstein
2018-12-03 8:17 ` Dave Chinner
2018-12-03 9:22 ` Amir Goldstein
2018-12-03 13:15 ` Amir Goldstein
2019-05-13 6:03 ` Amir Goldstein
2018-12-03 16:58 ` Darrick J. Wong
2019-05-21 5:33 ` Amir Goldstein
2018-12-03 16:41 ` [PATCH 0/3] fstests: copy_file_range() bounds testing Darrick J. Wong
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=20181203064256.26768-2-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.