diff mbox series

[2/3] common/rc: refactor _require_{ext2,tmpfs} helpers

Message ID 161647321164.3430465.14482552330781743925.stgit@magnolia (mailing list archive)
State Accepted
Headers show
Series fstests: test kernel regressions fixed in 5.12 | expand

Commit Message

Darrick J. Wong March 23, 2021, 4:20 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Combine these two helpers into a single generic function so that we can
use it in the next patch to test a regression when running overlayfs
atop xfs.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 common/rc         |   23 +++++------------------
 tests/overlay/025 |    2 +-
 tests/overlay/106 |    2 +-
 tests/overlay/107 |    2 +-
 tests/overlay/108 |    2 +-
 tests/overlay/109 |    2 +-
 tests/xfs/049     |    2 +-
 7 files changed, 11 insertions(+), 24 deletions(-)
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 6d1757da..434cd583 100644
--- a/common/rc
+++ b/common/rc
@@ -1766,26 +1766,13 @@  _require_loop()
     fi
 }
 
-# this test requires ext2 filesystem support
+# this test requires kernel support for a secondary filesystem
 #
-_require_ext2()
+_require_extra_fs()
 {
-    modprobe ext2 >/dev/null 2>&1
-    if grep ext2 /proc/filesystems >/dev/null 2>&1
-    then
-	:
-    else
-	_notrun "This test requires ext2 filesystem support"
-    fi
-}
-
-# this test requires tmpfs filesystem support
-#
-_require_tmpfs()
-{
-	modprobe tmpfs >/dev/null 2>&1
-	grep -q tmpfs /proc/filesystems ||
-		_notrun "this test requires tmpfs support"
+	modprobe "$1" >/dev/null 2>&1
+	grep -q -w "$1" /proc/filesystems ||
+		_notrun "this test requires $1 support"
 }
 
 # this test requires that (large) loopback device files are not in use
diff --git a/tests/overlay/025 b/tests/overlay/025
index 979bd98e..c5f328c8 100755
--- a/tests/overlay/025
+++ b/tests/overlay/025
@@ -42,7 +42,7 @@  rm -f $seqres.full
 # Modify as appropriate.
 _supported_fs overlay
 _require_user
-_require_tmpfs
+_require_extra_fs tmpfs
 
 # create a tmpfs in $TEST_DIR
 tmpfsdir=$TEST_DIR/tmpfs
diff --git a/tests/overlay/106 b/tests/overlay/106
index 28e9a819..0b3e0c98 100755
--- a/tests/overlay/106
+++ b/tests/overlay/106
@@ -27,7 +27,7 @@  rm -f $seqres.full
 # real QA test starts here
 
 _supported_fs overlay
-_require_tmpfs
+_require_extra_fs tmpfs
 _require_test
 _require_scratch
 _require_unionmount_testsuite
diff --git a/tests/overlay/107 b/tests/overlay/107
index 733a5556..89fde9de 100755
--- a/tests/overlay/107
+++ b/tests/overlay/107
@@ -27,7 +27,7 @@  rm -f $seqres.full
 # real QA test starts here
 
 _supported_fs overlay
-_require_tmpfs
+_require_extra_fs tmpfs
 _require_test
 _require_scratch
 _require_unionmount_testsuite
diff --git a/tests/overlay/108 b/tests/overlay/108
index e757e0e4..ae367a5c 100755
--- a/tests/overlay/108
+++ b/tests/overlay/108
@@ -27,7 +27,7 @@  rm -f $seqres.full
 # real QA test starts here
 
 _supported_fs overlay
-_require_tmpfs
+_require_extra_fs tmpfs
 _require_test
 _require_scratch
 _require_unionmount_testsuite
diff --git a/tests/overlay/109 b/tests/overlay/109
index d49080be..df036616 100755
--- a/tests/overlay/109
+++ b/tests/overlay/109
@@ -27,7 +27,7 @@  rm -f $seqres.full
 # real QA test starts here
 
 _supported_fs overlay
-_require_tmpfs
+_require_extra_fs tmpfs
 _require_test
 _require_scratch
 _require_unionmount_testsuite
diff --git a/tests/xfs/049 b/tests/xfs/049
index 67739265..16bc788d 100755
--- a/tests/xfs/049
+++ b/tests/xfs/049
@@ -46,7 +46,7 @@  _require_nonexternal
 _require_scratch_nocheck
 _require_no_large_scratch_dev
 _require_loop
-_require_ext2
+_require_extra_fs ext2
 
 rm -f $seqres.full