aboutsummaryrefslogtreecommitdiff
path: root/tests/sys/geom
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sys/geom')
-rw-r--r--tests/sys/geom/Makefile1
-rw-r--r--tests/sys/geom/class/Makefile2
-rw-r--r--tests/sys/geom/class/Makefile.inc1
-rw-r--r--tests/sys/geom/class/concat/Makefile1
-rw-r--r--tests/sys/geom/class/eli/Makefile1
-rw-r--r--tests/sys/geom/class/eli/attach_test.sh29
-rw-r--r--tests/sys/geom/class/gate/Makefile1
-rw-r--r--tests/sys/geom/class/gate/ggate_test.sh12
-rw-r--r--tests/sys/geom/class/mirror/Makefile1
-rw-r--r--tests/sys/geom/class/multipath/Makefile1
-rw-r--r--tests/sys/geom/class/nop/Makefile5
-rw-r--r--tests/sys/geom/class/part/Makefile1
-rw-r--r--tests/sys/geom/class/raid3/Makefile1
-rw-r--r--tests/sys/geom/class/shsec/Makefile1
-rw-r--r--tests/sys/geom/class/stripe/Makefile1
-rw-r--r--tests/sys/geom/class/virstor/Makefile9
-rw-r--r--tests/sys/geom/class/virstor/conf.sh31
-rw-r--r--tests/sys/geom/class/virstor/virstor_test.sh73
18 files changed, 153 insertions, 19 deletions
diff --git a/tests/sys/geom/Makefile b/tests/sys/geom/Makefile
index 7e6e7cd2bb65..78257e180cf9 100644
--- a/tests/sys/geom/Makefile
+++ b/tests/sys/geom/Makefile
@@ -1,4 +1,3 @@
-
TESTSDIR= ${TESTSBASE}/sys/geom
TESTS_SUBDIRS+= class
diff --git a/tests/sys/geom/class/Makefile b/tests/sys/geom/class/Makefile
index 10b01a043ddf..3cf3a15273ac 100644
--- a/tests/sys/geom/class/Makefile
+++ b/tests/sys/geom/class/Makefile
@@ -1,4 +1,3 @@
-
.include <src.opts.mk>
PACKAGE= tests
@@ -19,6 +18,7 @@ TESTS_SUBDIRS+= shsec
TESTS_SUBDIRS+= stripe
TESTS_SUBDIRS+= union
TESTS_SUBDIRS+= uzip
+TESTS_SUBDIRS+= virstor
${PACKAGE}FILES+= geom_subr.sh
diff --git a/tests/sys/geom/class/Makefile.inc b/tests/sys/geom/class/Makefile.inc
index 03efce15f856..cec69b26e149 100644
--- a/tests/sys/geom/class/Makefile.inc
+++ b/tests/sys/geom/class/Makefile.inc
@@ -1,2 +1 @@
-
.include "${SRCTOP}/tests/Makefile.inc0"
diff --git a/tests/sys/geom/class/concat/Makefile b/tests/sys/geom/class/concat/Makefile
index 335c7632c6e5..d5457b64bd2a 100644
--- a/tests/sys/geom/class/concat/Makefile
+++ b/tests/sys/geom/class/concat/Makefile
@@ -1,4 +1,3 @@
-
PACKAGE= tests
TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T}
diff --git a/tests/sys/geom/class/eli/Makefile b/tests/sys/geom/class/eli/Makefile
index d8faff182ac4..e1a28f39d5d2 100644
--- a/tests/sys/geom/class/eli/Makefile
+++ b/tests/sys/geom/class/eli/Makefile
@@ -1,4 +1,3 @@
-
.PATH: ${SRCTOP}/sys/geom/eli ${SRCTOP}/sys/crypto/sha2
PACKAGE= tests
diff --git a/tests/sys/geom/class/eli/attach_test.sh b/tests/sys/geom/class/eli/attach_test.sh
index eb59234f014b..b6b1848f2d37 100644
--- a/tests/sys/geom/class/eli/attach_test.sh
+++ b/tests/sys/geom/class/eli/attach_test.sh
@@ -39,6 +39,34 @@ attach_d_cleanup()
geli_test_cleanup
}
+atf_test_case atach_multiple_fails cleanup
+attach_multiple_fails_head()
+{
+ atf_set "descr" "test multiple failed attach of geli provider"
+ atf_set "require.user" "root"
+}
+attach_multiple_fails_body()
+{
+ geli_test_setup
+
+ sectors=1000
+ attach_md md -t malloc -s `expr $sectors + 1`
+ atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none
+
+ atf_check geli init -B none -P -K keyfile ${md}
+ atf_check geli attach -d -p -k keyfile ${md}
+
+ for i in $(jot 100); do
+ atf_check -s not-exit:0 -e ignore -- geli attach -d -p -k keyfile ${md}
+ done
+ atf_check -o ignore -- newfs ${md}.eli
+}
+attach_multiple_fails_cleanup()
+{
+ geli_test_cleanup
+}
+
+
atf_test_case attach_r cleanup
attach_r_head()
{
@@ -125,5 +153,6 @@ atf_init_test_cases()
atf_add_test_case attach_d
atf_add_test_case attach_r
atf_add_test_case attach_multiple
+ atf_add_test_case attach_multiple_fails
atf_add_test_case nokey
}
diff --git a/tests/sys/geom/class/gate/Makefile b/tests/sys/geom/class/gate/Makefile
index a51c983f5cf6..5ebc1d9304e0 100644
--- a/tests/sys/geom/class/gate/Makefile
+++ b/tests/sys/geom/class/gate/Makefile
@@ -1,4 +1,3 @@
-
PACKAGE= tests
TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T}
diff --git a/tests/sys/geom/class/gate/ggate_test.sh b/tests/sys/geom/class/gate/ggate_test.sh
index 3ca5c3a2531a..4cbc5d80ae89 100644
--- a/tests/sys/geom/class/gate/ggate_test.sh
+++ b/tests/sys/geom/class/gate/ggate_test.sh
@@ -1,7 +1,5 @@
-
PIDFILE=ggated.pid
PLAINFILES=plainfiles
-PORT=33080
CONF=gg.exports
atf_test_case ggatec_trim cleanup
@@ -17,13 +15,14 @@ ggatec_trim_body()
{
load_ggate
+ port=33080
us=$(alloc_ggate_dev)
work=$(alloc_md)
atf_check -e ignore -o ignore dd if=/dev/random of=/dev/$work bs=1m count=1 conv=notrunc
echo $CONF >> $PLAINFILES
echo "localhost RW /dev/$work" > $CONF
- atf_check ggated -p $PORT -F $PIDFILE $CONF
- atf_check ggatec create -p $PORT -u $us localhost /dev/$work
+ atf_check ggated -p $port -F $PIDFILE $CONF
+ atf_check ggatec create -p $port -u $us localhost /dev/$work
ggate_dev=/dev/ggate${us}
wait_for_ggate_device ${ggate_dev}
@@ -55,6 +54,7 @@ ggated_body()
load_ggate
+ port=33081
us=$(alloc_ggate_dev)
work=$(alloc_md)
src=$(alloc_md)
@@ -67,8 +67,8 @@ ggated_body()
echo $CONF >> $PLAINFILES
echo "127.0.0.1 RW /dev/$work" > $CONF
- atf_check ggated -p $PORT -F $PIDFILE $CONF
- atf_check ggatec create -p $PORT -u $us 127.0.0.1 /dev/$work
+ atf_check ggated -p $port -F $PIDFILE $CONF
+ atf_check ggatec create -p $port -u $us 127.0.0.1 /dev/$work
ggate_dev=/dev/ggate${us}
diff --git a/tests/sys/geom/class/mirror/Makefile b/tests/sys/geom/class/mirror/Makefile
index fdef410ab974..635288cc3d53 100644
--- a/tests/sys/geom/class/mirror/Makefile
+++ b/tests/sys/geom/class/mirror/Makefile
@@ -1,4 +1,3 @@
-
PACKAGE= tests
TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T}
diff --git a/tests/sys/geom/class/multipath/Makefile b/tests/sys/geom/class/multipath/Makefile
index 9a2a9a29ec38..1246015e8fc4 100644
--- a/tests/sys/geom/class/multipath/Makefile
+++ b/tests/sys/geom/class/multipath/Makefile
@@ -1,4 +1,3 @@
-
PACKAGE= tests
TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T}
diff --git a/tests/sys/geom/class/nop/Makefile b/tests/sys/geom/class/nop/Makefile
index 54b41584d441..e2cb249bcf56 100644
--- a/tests/sys/geom/class/nop/Makefile
+++ b/tests/sys/geom/class/nop/Makefile
@@ -1,8 +1,11 @@
-
PACKAGE= tests
TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T}
ATF_TESTS_SH+= nop_test
+# Some tests make use of the "disks" property and kyua may schedule
+# them to run at the time time, which the tests do not expect.
+TEST_METADATA.nop_test+= is_exclusive="true"
+
.include <bsd.test.mk>
diff --git a/tests/sys/geom/class/part/Makefile b/tests/sys/geom/class/part/Makefile
index 6ca33655c805..0d7d86224437 100644
--- a/tests/sys/geom/class/part/Makefile
+++ b/tests/sys/geom/class/part/Makefile
@@ -1,4 +1,3 @@
-
PACKAGE= tests
TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T}
diff --git a/tests/sys/geom/class/raid3/Makefile b/tests/sys/geom/class/raid3/Makefile
index 97b9cd34b8f0..8f398a0f5fec 100644
--- a/tests/sys/geom/class/raid3/Makefile
+++ b/tests/sys/geom/class/raid3/Makefile
@@ -1,4 +1,3 @@
-
PACKAGE= tests
TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T}
diff --git a/tests/sys/geom/class/shsec/Makefile b/tests/sys/geom/class/shsec/Makefile
index 7615142f605f..500c14cca51a 100644
--- a/tests/sys/geom/class/shsec/Makefile
+++ b/tests/sys/geom/class/shsec/Makefile
@@ -1,4 +1,3 @@
-
PACKAGE= tests
TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T}
diff --git a/tests/sys/geom/class/stripe/Makefile b/tests/sys/geom/class/stripe/Makefile
index 7615142f605f..500c14cca51a 100644
--- a/tests/sys/geom/class/stripe/Makefile
+++ b/tests/sys/geom/class/stripe/Makefile
@@ -1,4 +1,3 @@
-
PACKAGE= tests
TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T}
diff --git a/tests/sys/geom/class/virstor/Makefile b/tests/sys/geom/class/virstor/Makefile
new file mode 100644
index 000000000000..67242879e33f
--- /dev/null
+++ b/tests/sys/geom/class/virstor/Makefile
@@ -0,0 +1,9 @@
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T}
+
+ATF_TESTS_SH+= virstor_test
+
+${PACKAGE}FILES+= conf.sh
+
+.include <bsd.test.mk>
diff --git a/tests/sys/geom/class/virstor/conf.sh b/tests/sys/geom/class/virstor/conf.sh
new file mode 100644
index 000000000000..46b0fd1308a3
--- /dev/null
+++ b/tests/sys/geom/class/virstor/conf.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+class="virstor"
+base=$(atf_get ident)
+TEST_VIRSTOR_DEVS_FILE="${TMPDIR}/test_virstor_devs.$(basename $0)"
+
+gvirstor_dev_setup()
+{
+ # Pick a random name and record it for cleanup.
+ local vdevbase="$(mktemp -u virstor.XXXXXX)" || aft_fail "mktemp"
+ echo "$vdevbase" >> "$TEST_VIRSTOR_DEVS_FILE"
+ eval "${1}='${vdevbase}'"
+}
+
+gvirstor_test_cleanup()
+{
+ local vdevbase
+ if [ -f "$TEST_VIRSTOR_DEVS_FILE" ]; then
+ while read vdevbase; do
+ if [ -c "/dev/$class/$vdevbase" ]; then
+ echo "# Destroying test virstor device:" \
+ "$vdevbase"
+ gvirstor destroy "$vdevbase"
+ fi
+ done < "$TEST_VIRSTOR_DEVS_FILE"
+ fi
+ geom_test_cleanup
+}
+
+ATF_TEST=true
+. `dirname $0`/../geom_subr.sh
diff --git a/tests/sys/geom/class/virstor/virstor_test.sh b/tests/sys/geom/class/virstor/virstor_test.sh
new file mode 100644
index 000000000000..4f2047bffe97
--- /dev/null
+++ b/tests/sys/geom/class/virstor/virstor_test.sh
@@ -0,0 +1,73 @@
+#
+# Copyright (c) 2024 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+
+. $(atf_get_srcdir)/conf.sh
+
+atf_test_case basic cleanup
+basic_head()
+{
+ atf_set "descr" "geom virstor basic functional test"
+ atf_set "require.user" "root"
+}
+basic_body()
+{
+ geom_atf_test_setup
+ # Choose a virstor device name
+ gvirstor_dev_setup name
+
+ # Create an md backing device and initialize it with junk
+ psecsize=512
+ attach_md md -t swap -S $psecsize -s 5M || atf_fail "attach_md"
+ jot -b uninitialized 0 | dd status=none of=/dev/$md 2> /dev/null
+
+ # Create a virstor device
+ vsizemb=64
+ vsize=$((vsizemb * 1024 * 1024))
+ atf_check -o ignore -e ignore \
+ gvirstor label -v -s ${vsizemb}M -m 512 $name /dev/$md
+ devwait
+ vdev="/dev/$class/$name"
+
+ ssize=$(diskinfo $vdev | awk '{print $2}')
+ atf_check_equal $psecsize $ssize
+
+ size=$(diskinfo $vdev | awk '{print $3}')
+ atf_check_equal $vsize $size
+
+ # Write the first and last sectors of the virtual address space
+ hasha=$(jot -b a 0 | head -c $ssize | sha1)
+ hashz=$(jot -b z 0 | head -c $ssize | sha1)
+ zsector=$((vsize / ssize - 1))
+ jot -b a 0 | dd status=none of=$vdev bs=$ssize count=1 conv=notrunc
+ jot -b z 0 | dd status=none of=$vdev bs=$ssize count=1 conv=notrunc \
+ seek=$zsector
+
+ # Read back and compare
+ hashx=$(dd status=none if=$vdev bs=$ssize count=1 | sha1)
+ atf_check_equal $hasha $hashx
+ hashx=$(dd status=none if=$vdev bs=$ssize count=1 skip=$zsector | sha1)
+ atf_check_equal $hashz $hashx
+
+ # Destroy, then retaste and reload
+ atf_check -o ignore gvirstor destroy $name
+ true > /dev/$md
+ devwait
+
+ # Read back and compare
+ hashx=$(dd status=none if=$vdev bs=$ssize count=1 | sha1)
+ atf_check_equal $hasha $hashx
+ hashx=$(dd status=none if=$vdev bs=$ssize count=1 skip=$zsector | sha1)
+ atf_check_equal $hashz $hashx
+}
+basic_cleanup()
+{
+ gvirstor_test_cleanup
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case basic
+}