diff options
author | ngie <ngie@FreeBSD.org> | 2015-11-25 03:53:14 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-11-25 03:53:14 +0000 |
commit | 2a21ca898bc762a485efb3b613009eb2a5f158f8 (patch) | |
tree | adbd5e2e0cc6a7ef6476db696b5290b67a0b79b4 | |
parent | c11080c84d6759760b0035a4ddcd1d144346b6ad (diff) | |
download | FreeBSD-src-2a21ca898bc762a485efb3b613009eb2a5f158f8.zip FreeBSD-src-2a21ca898bc762a485efb3b613009eb2a5f158f8.tar.gz |
conf.sh:
- Implement gnop_test_cleanup
- Use a random name for the shsec
1_test.sh/2_test.sh:
- Attach md devices with attach_md
- Remove unnecessary mdconfig -d -u and gstripe destroy calls at the end
of the scripts
-rwxr-xr-x | sbin/geom/class/tests/nop/1_test.sh | 11 | ||||
-rwxr-xr-x | sbin/geom/class/tests/nop/2_test.sh | 15 | ||||
-rwxr-xr-x | sbin/geom/class/tests/nop/conf.sh | 7 |
3 files changed, 16 insertions, 17 deletions
diff --git a/sbin/geom/class/tests/nop/1_test.sh b/sbin/geom/class/tests/nop/1_test.sh index f08f71d..4d6b65d 100755 --- a/sbin/geom/class/tests/nop/1_test.sh +++ b/sbin/geom/class/tests/nop/1_test.sh @@ -5,21 +5,16 @@ echo "1..1" -us=45 +us=$(attach_md -t malloc -s 1M) || exit 1 -mdconfig -a -t malloc -s 1M -u $us || exit 1 - -gnop create /dev/md${us} || exit 1 +gnop create /dev/${us} || exit 1 # Size of created device should be 1MB. -size=`diskinfo /dev/md${us}.nop | awk '{print $3}'` +size=`diskinfo /dev/${us}.nop | awk '{print $3}'` if [ $size -eq 1048576 ]; then echo "ok 1" else echo "not ok 1" fi - -gnop destroy md${us}.nop -mdconfig -d -u $us diff --git a/sbin/geom/class/tests/nop/2_test.sh b/sbin/geom/class/tests/nop/2_test.sh index e0ddb17..7422345 100755 --- a/sbin/geom/class/tests/nop/2_test.sh +++ b/sbin/geom/class/tests/nop/2_test.sh @@ -3,20 +3,19 @@ . `dirname $0`/conf.sh -us=45 -src=`mktemp /tmp/$base.XXXXXX` || exit 1 -dst=`mktemp /tmp/$base.XXXXXX` || exit 1 +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 -mdconfig -a -t malloc -s 1M -u $us || exit 1 +us=$(attach_md -t malloc -s 1M) || exit 1 -gnop create /dev/md${us} || exit 1 +gnop create /dev/${us} || exit 1 -dd if=${src} of=/dev/md${us}.nop bs=1m count=1 >/dev/null 2>&1 -dd if=/dev/md${us}.nop of=${dst} bs=1m count=1 >/dev/null 2>&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" @@ -24,6 +23,4 @@ else echo "ok 1" fi -gnop destroy md${us}.nop -mdconfig -d -u $us rm -f ${src} ${dst} diff --git a/sbin/geom/class/tests/nop/conf.sh b/sbin/geom/class/tests/nop/conf.sh index 0dc9797..e38e10c 100755 --- a/sbin/geom/class/tests/nop/conf.sh +++ b/sbin/geom/class/tests/nop/conf.sh @@ -4,4 +4,11 @@ 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 |