Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178095356
D45535.1795945807.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D45535.1795945807.diff
View Options
diff --git a/tests/sys/geom/class/Makefile b/tests/sys/geom/class/Makefile
--- a/tests/sys/geom/class/Makefile
+++ b/tests/sys/geom/class/Makefile
@@ -19,6 +19,7 @@
TESTS_SUBDIRS+= stripe
TESTS_SUBDIRS+= union
TESTS_SUBDIRS+= uzip
+TESTS_SUBDIRS+= virstor
${PACKAGE}FILES+= geom_subr.sh
diff --git a/tests/sys/geom/class/virstor/Makefile b/tests/sys/geom/class/virstor/Makefile
new file mode 100644
--- /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
--- /dev/null
+++ b/tests/sys/geom/class/virstor/conf.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+class="virstor"
+base=$(atf_get ident)
+name="$(mktemp -u virstor.XXXXXX)"
+
+gvirstor_test_cleanup()
+{
+ [ -c /dev/$class/$name ] && gvirstor destroy $name
+ 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
--- /dev/null
+++ b/tests/sys/geom/class/virstor/virstor_test.sh
@@ -0,0 +1,71 @@
+#
+# 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
+
+ # Create an md backing device and initialize it with junk
+ psecsize=512
+ attach_md md0 -t malloc -S $psecsize -s 5M || atf_fail "attach_md"
+ jot -b uninitialized 0 | dd status=none of=/dev/$md0
+
+ # 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/$md0
+ devwait
+ vdev="/dev/virstor/$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/$md0
+ [ -c $vdev ] || atf_fail "retaste failed"
+
+ # 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
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 29, 9:50 AM (8 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42087844
Default Alt Text
D45535.1795945807.diff (3 KB)
Attached To
Mode
D45535: virstor: basic functional test
Attached
Detach File
Event Timeline