mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-10 20:31:27 +01:00
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
This commit is contained in:
parent
32988c1499
commit
ea82362219
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
1
tests/sys/cddl/zfs/tests/cache/cache_test.sh
vendored
1
tests/sys/cddl/zfs/tests/cache/cache_test.sh
vendored
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user