summaryrefslogtreecommitdiffstats
path: root/tests/sys/geom/class/nop
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sys/geom/class/nop')
-rw-r--r--tests/sys/geom/class/nop/1_test.sh20
-rw-r--r--tests/sys/geom/class/nop/2_test.sh26
-rw-r--r--tests/sys/geom/class/nop/Makefile16
-rw-r--r--tests/sys/geom/class/nop/conf.sh14
4 files changed, 76 insertions, 0 deletions
diff --git a/tests/sys/geom/class/nop/1_test.sh b/tests/sys/geom/class/nop/1_test.sh
new file mode 100644
index 0000000..4d6b65d
--- /dev/null
+++ b/tests/sys/geom/class/nop/1_test.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+# $FreeBSD$
+
+. `dirname $0`/conf.sh
+
+echo "1..1"
+
+us=$(attach_md -t malloc -s 1M) || exit 1
+
+gnop create /dev/${us} || exit 1
+
+# Size of created device should be 1MB.
+
+size=`diskinfo /dev/${us}.nop | awk '{print $3}'`
+
+if [ $size -eq 1048576 ]; then
+ echo "ok 1"
+else
+ echo "not ok 1"
+fi
diff --git a/tests/sys/geom/class/nop/2_test.sh b/tests/sys/geom/class/nop/2_test.sh
new file mode 100644
index 0000000..7422345
--- /dev/null
+++ b/tests/sys/geom/class/nop/2_test.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+# $FreeBSD$
+
+. `dirname $0`/conf.sh
+
+src=`mktemp $base.XXXXXX` || exit 1
+dst=`mktemp $base.XXXXXX` || exit 1
+
+echo "1..1"
+
+dd if=/dev/random of=${src} bs=1m count=1 >/dev/null 2>&1
+
+us=$(attach_md -t malloc -s 1M) || exit 1
+
+gnop create /dev/${us} || exit 1
+
+dd if=${src} of=/dev/${us}.nop bs=1m count=1 >/dev/null 2>&1
+dd if=/dev/${us}.nop of=${dst} bs=1m count=1 >/dev/null 2>&1
+
+if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
+ echo "not ok 1"
+else
+ echo "ok 1"
+fi
+
+rm -f ${src} ${dst}
diff --git a/tests/sys/geom/class/nop/Makefile b/tests/sys/geom/class/nop/Makefile
new file mode 100644
index 0000000..5659b5d
--- /dev/null
+++ b/tests/sys/geom/class/nop/Makefile
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T}
+
+TAP_TESTS_SH+= 1_test
+TAP_TESTS_SH+= 2_test
+
+FILES+= conf.sh
+FILESNAME_conf.sh= conf.sh
+FILESDIR= ${TESTSDIR}
+
+.for t in ${TAP_TESTS_SH}
+TEST_METADATA.$t+= required_user="root"
+.endfor
+
+.include <bsd.test.mk>
diff --git a/tests/sys/geom/class/nop/conf.sh b/tests/sys/geom/class/nop/conf.sh
new file mode 100644
index 0000000..e38e10c
--- /dev/null
+++ b/tests/sys/geom/class/nop/conf.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+# $FreeBSD$
+
+class="nop"
+base=`basename $0`
+
+gnop_test_cleanup()
+{
+ [ -c /dev/${us}.nop ] && gnop destroy ${us}.nop
+ geom_test_cleanup
+}
+trap gnop_test_cleanup ABRT EXIT INT TERM
+
+. `dirname $0`/../geom_subr.sh
OpenPOWER on IntegriCloud