git: ea82362219ee - main - tests: Skip all tests that require mdconfig when /dev/mdctl missing
Date: Sat, 02 Sep 2023 19:40:06 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=ea82362219ee715cfbb195b2114e73fdc8599fa5
commit ea82362219ee715cfbb195b2114e73fdc8599fa5
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-09-02 19:12:31 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-09-02 19:16:22 +0000
tests: Skip all tests that require mdconfig when /dev/mdctl missing
When run in a jail, /dev/mdctl is missing. So skip any tests that use
mdconfig or mdmfs with md in this case: they can't possibly work. This
is in line with other tests that test for presence of required features
and skip if they aren't present. I did this instead of checking for
jails so they can still run in jails that allow creation of md devices.
Sponsored by: Netflix
---
tests/sys/acl/00.sh | 4 ++++
tests/sys/acl/01.sh | 4 ++++
tests/sys/acl/02.sh | 4 ++++
tests/sys/acl/03.sh | 4 ++++
tests/sys/acl/04.sh | 4 ++++
tests/sys/cddl/zfs/tests/cache/cache_test.sh | 1 +
tests/sys/geom/class/eli/conf.sh | 1 +
tests/sys/geom/class/geom_subr.sh | 1 +
tests/sys/geom/class/mirror/8_test.sh | 5 +++++
tests/sys/kern/sendfile_test.sh | 1 +
tests/sys/mac/bsdextended/matches_test.sh | 1 +
11 files changed, 30 insertions(+)
diff --git a/tests/sys/acl/00.sh b/tests/sys/acl/00.sh
index 42b06cb8c484..5853aac2cac8 100644
--- a/tests/sys/acl/00.sh
+++ b/tests/sys/acl/00.sh
@@ -43,6 +43,10 @@ if [ $(id -u) -ne 0 ]; then
echo "1..0 # SKIP you must be root"
exit 0
fi
+if [ ! -c /dev/mdctl ]; then
+ echo "1..0 # SKIP no /dev/mdctl to create md devices"
+ exit 0
+fi
echo "1..4"
diff --git a/tests/sys/acl/01.sh b/tests/sys/acl/01.sh
index 3521ef37e663..044d1b81ab68 100644
--- a/tests/sys/acl/01.sh
+++ b/tests/sys/acl/01.sh
@@ -45,6 +45,10 @@ if [ $(id -u) -ne 0 ]; then
echo "1..0 # SKIP you must be root"
exit 0
fi
+if [ ! -c /dev/mdctl ]; then
+ echo "1..0 # SKIP no /dev/mdctl to create md devices"
+ exit 0
+fi
echo "1..4"
diff --git a/tests/sys/acl/02.sh b/tests/sys/acl/02.sh
index 069995d9906f..98fe1345b069 100644
--- a/tests/sys/acl/02.sh
+++ b/tests/sys/acl/02.sh
@@ -43,6 +43,10 @@ if [ $(id -u) -ne 0 ]; then
echo "1..0 # SKIP you must be root"
exit 0
fi
+if [ ! -c /dev/mdctl ]; then
+ echo "1..0 # SKIP no /dev/mdctl to create md devices"
+ exit 0
+fi
echo "1..4"
diff --git a/tests/sys/acl/03.sh b/tests/sys/acl/03.sh
index 2de58e31ba3a..4c85638ca8db 100644
--- a/tests/sys/acl/03.sh
+++ b/tests/sys/acl/03.sh
@@ -40,6 +40,10 @@ if [ $(id -u) -ne 0 ]; then
echo "1..0 # SKIP you must be root"
exit 0
fi
+if [ ! -c /dev/mdctl ]; then
+ echo "1..0 # SKIP no /dev/mdctl to create md devices"
+ exit 0
+fi
echo "1..5"
diff --git a/tests/sys/acl/04.sh b/tests/sys/acl/04.sh
index 33ce5ab9bc17..cfe4b1cb08a8 100644
--- a/tests/sys/acl/04.sh
+++ b/tests/sys/acl/04.sh
@@ -37,6 +37,10 @@ if [ $(id -u) -ne 0 ]; then
echo "1..0 # SKIP you must be root"
exit 0
fi
+if [ ! -c /dev/mdctl ]; then
+ echo "1..0 # SKIP no /dev/mdctl to create md devices"
+ exit 0
+fi
echo "1..3"
diff --git a/tests/sys/cddl/zfs/tests/cache/cache_test.sh b/tests/sys/cddl/zfs/tests/cache/cache_test.sh
index 4d77d9fa56a7..79b09dd93183 100755
--- a/tests/sys/cddl/zfs/tests/cache/cache_test.sh
+++ b/tests/sys/cddl/zfs/tests/cache/cache_test.sh
@@ -280,6 +280,7 @@ cache_010_neg_body()
. $(atf_get_srcdir)/cache.kshlib
. $(atf_get_srcdir)/cache.cfg
+ [ -c /dev/mdctl ] || atf_skip "no /dev/mdctl to create md devices"
verify_disk_count "$DISKS" 1
ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
ksh93 $(atf_get_srcdir)/cache_010_neg.ksh || atf_fail "Testcase failed"
diff --git a/tests/sys/geom/class/eli/conf.sh b/tests/sys/geom/class/eli/conf.sh
index fe7c9c2528ea..a21e645f1637 100644
--- a/tests/sys/geom/class/eli/conf.sh
+++ b/tests/sys/geom/class/eli/conf.sh
@@ -8,6 +8,7 @@ attach_md()
{
local test_md
+ [ -c /dev/mdctl ] || atf_skip "no /dev/mdctl to create md devices"
test_md=$(mdconfig -a "$@") || atf_fail "failed to allocate md(4)"
echo $test_md >> $TEST_MDS_FILE || exit
echo $test_md
diff --git a/tests/sys/geom/class/geom_subr.sh b/tests/sys/geom/class/geom_subr.sh
index 7e572ccd5175..f8eca4c6b220 100644
--- a/tests/sys/geom/class/geom_subr.sh
+++ b/tests/sys/geom/class/geom_subr.sh
@@ -16,6 +16,7 @@ attach_md()
{
local test_md
+ [ -c /dev/mdctl ] || atf_skip "no /dev/mdctl to create md devices"
test_md=$(mdconfig -a "$@") || exit
echo $test_md >> $TEST_MDS_FILE || exit
echo $test_md
diff --git a/tests/sys/geom/class/mirror/8_test.sh b/tests/sys/geom/class/mirror/8_test.sh
index 21f6b83c85f7..5b3e5c3543a1 100644
--- a/tests/sys/geom/class/mirror/8_test.sh
+++ b/tests/sys/geom/class/mirror/8_test.sh
@@ -4,6 +4,11 @@
. `dirname $0`/conf.sh
+if ! [ -c /dev/mdctl ]; then
+ echo "1..0 # SKIP no /dev/mdctl to create md devices"
+ exit 0
+fi
+
echo 1..1
ddbs=2048
diff --git a/tests/sys/kern/sendfile_test.sh b/tests/sys/kern/sendfile_test.sh
index 03d2c882241c..2e9779d6779c 100755
--- a/tests/sys/kern/sendfile_test.sh
+++ b/tests/sys/kern/sendfile_test.sh
@@ -124,6 +124,7 @@ alloc_md()
{
local md
+ [ -c /dev/mdctl ] || atf_skip "no /dev/mdctl to create md devices"
md=$(mdconfig -a -t swap -s 256M) || atf_fail "mdconfig -a failed"
echo ${md} >> $MD_DEVS
echo ${md}
diff --git a/tests/sys/mac/bsdextended/matches_test.sh b/tests/sys/mac/bsdextended/matches_test.sh
index 40774594fd18..2a28be0f231b 100644
--- a/tests/sys/mac/bsdextended/matches_test.sh
+++ b/tests/sys/mac/bsdextended/matches_test.sh
@@ -27,6 +27,7 @@ setup()
{
check_ko
mkdir mnt
+ [ -c /dev/mdctl ] || atf_skip "no /dev/mdctl to create md devices"
mdmfs -s 25m md mnt \
|| atf_fail "failed to mount md device"
chmod a+rwx mnt