diff options
author | ngie <ngie@FreeBSD.org> | 2015-11-25 03:46:49 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-11-25 03:46:49 +0000 |
commit | c11080c84d6759760b0035a4ddcd1d144346b6ad (patch) | |
tree | 36c1ce63fe2fb2b24df071cd4e8cdb85912a89af | |
parent | 6bec2d835922511b32421fa8066a23f324c0cc1b (diff) | |
download | FreeBSD-src-c11080c84d6759760b0035a4ddcd1d144346b6ad.zip FreeBSD-src-c11080c84d6759760b0035a4ddcd1d144346b6ad.tar.gz |
Probe for the first available md unit number instead of hardcoding 45
Detach/mdconfig -d -u at the end of the test consistently
22 files changed, 65 insertions, 38 deletions
diff --git a/sbin/geom/class/tests/eli/Makefile b/sbin/geom/class/tests/eli/Makefile index 721774a..1846ed6 100644 --- a/sbin/geom/class/tests/eli/Makefile +++ b/sbin/geom/class/tests/eli/Makefile @@ -29,4 +29,8 @@ TEST_METADATA.integrity_hmac_test+= timeout="600" TEST_METADATA.onetime_a_test+= timeout="600" TEST_METADATA.onetime_test+= timeout="600" +FILES+= conf.sh +FILESNAME_conf.sh= conf.sh +FILESDIR= ${TESTSDIR} + .include <bsd.test.mk> diff --git a/sbin/geom/class/tests/eli/attach_d_test.sh b/sbin/geom/class/tests/eli/attach_d_test.sh index d1a57ce..5d700b3 100755 --- a/sbin/geom/class/tests/eli/attach_d_test.sh +++ b/sbin/geom/class/tests/eli/attach_d_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1 @@ -34,5 +35,4 @@ else echo "not ok 3" fi -mdconfig -d -u $no rm -f $keyfile diff --git a/sbin/geom/class/tests/eli/conf.sh b/sbin/geom/class/tests/eli/conf.sh new file mode 100755 index 0000000..080fa61 --- /dev/null +++ b/sbin/geom/class/tests/eli/conf.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# $FreeBSD$ + +class="eli" +base=`basename $0` + +no=0 +while [ -c /dev/md$no ]; do + : $(( no += 1 )) +done + +geli_test_cleanup() +{ + [ -c /dev/md${no}.eli ] && geli detach md${no}.eli + mdconfig -d -u $no +} +trap geli_test_cleanup ABRT EXIT INT TERM + +. `dirname $0`/../geom_subr.sh diff --git a/sbin/geom/class/tests/eli/configure_b_B_test.sh b/sbin/geom/class/tests/eli/configure_b_B_test.sh index 23aa412..b6cdf4f 100755 --- a/sbin/geom/class/tests/eli/configure_b_B_test.sh +++ b/sbin/geom/class/tests/eli/configure_b_B_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1 @@ -126,5 +127,3 @@ if [ $? -eq 0 ]; then else echo "not ok 17" fi - -mdconfig -d -u $no diff --git a/sbin/geom/class/tests/eli/delkey_test.sh b/sbin/geom/class/tests/eli/delkey_test.sh index ec839e6..67b253e 100755 --- a/sbin/geom/class/tests/eli/delkey_test.sh +++ b/sbin/geom/class/tests/eli/delkey_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 keyfile1=`mktemp $base.XXXXXX` || exit 1 keyfile2=`mktemp $base.XXXXXX` || exit 1 @@ -136,5 +137,4 @@ else echo "not ok 14" fi -mdconfig -d -u $no rm -f $keyfile1 $keyfile2 $keyfile3 $keyfile4 diff --git a/sbin/geom/class/tests/eli/detach_l_test.sh b/sbin/geom/class/tests/eli/detach_l_test.sh index 6645501..605ae94 100755 --- a/sbin/geom/class/tests/eli/detach_l_test.sh +++ b/sbin/geom/class/tests/eli/detach_l_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1 @@ -40,5 +41,4 @@ else echo "not ok 4" fi -mdconfig -d -u $no rm -f $keyfile diff --git a/sbin/geom/class/tests/eli/init_B_test.sh b/sbin/geom/class/tests/eli/init_B_test.sh index 70036af..3ba743c 100755 --- a/sbin/geom/class/tests/eli/init_B_test.sh +++ b/sbin/geom/class/tests/eli/init_B_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 backupfile=`mktemp $base.XXXXXX` || exit 1 @@ -99,8 +100,5 @@ if [ -c /dev/md${no}.eli ]; then else echo "not ok 13 - -B file" fi -geli detach md${no} -rm -f $backupfile -mdconfig -d -u $no -rm -f $keyfile +rm -f $backupfile $keyfile diff --git a/sbin/geom/class/tests/eli/init_J_test.sh b/sbin/geom/class/tests/eli/init_J_test.sh index 3408637..266a3d5 100755 --- a/sbin/geom/class/tests/eli/init_J_test.sh +++ b/sbin/geom/class/tests/eli/init_J_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 keyfile0=`mktemp $base.XXXXXX` || exit 1 keyfile1=`mktemp $base.XXXXXX` || exit 1 @@ -122,5 +123,4 @@ for iter in -1 0 64; do echo "ok ${i}"; i=$((i+1)) done -mdconfig -d -u $no rm -f ${keyfile0} ${keyfile1} ${passfile0} ${passfile1} diff --git a/sbin/geom/class/tests/eli/init_a_test.sh b/sbin/geom/class/tests/eli/init_a_test.sh index e1f1b3f..dbb24fe 100755 --- a/sbin/geom/class/tests/eli/init_a_test.sh +++ b/sbin/geom/class/tests/eli/init_a_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 diff --git a/sbin/geom/class/tests/eli/init_i_P_test.sh b/sbin/geom/class/tests/eli/init_i_P_test.sh index df0d138..1c59a97 100755 --- a/sbin/geom/class/tests/eli/init_i_P_test.sh +++ b/sbin/geom/class/tests/eli/init_i_P_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1 @@ -18,5 +19,4 @@ else echo "not ok 1" fi -mdconfig -d -u $no rm -f $keyfile diff --git a/sbin/geom/class/tests/eli/init_test.sh b/sbin/geom/class/tests/eli/init_test.sh index c5765d0..71dd6e2 100755 --- a/sbin/geom/class/tests/eli/init_test.sh +++ b/sbin/geom/class/tests/eli/init_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 diff --git a/sbin/geom/class/tests/eli/integrity_copy_test.sh b/sbin/geom/class/tests/eli/integrity_copy_test.sh index 742fb21..4c8efd3 100755 --- a/sbin/geom/class/tests/eli/integrity_copy_test.sh +++ b/sbin/geom/class/tests/eli/integrity_copy_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 diff --git a/sbin/geom/class/tests/eli/integrity_data_test.sh b/sbin/geom/class/tests/eli/integrity_data_test.sh index e02950b..7ea7c96b 100755 --- a/sbin/geom/class/tests/eli/integrity_data_test.sh +++ b/sbin/geom/class/tests/eli/integrity_data_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 diff --git a/sbin/geom/class/tests/eli/integrity_hmac_test.sh b/sbin/geom/class/tests/eli/integrity_hmac_test.sh index 3cb4f8a..243eac9 100755 --- a/sbin/geom/class/tests/eli/integrity_hmac_test.sh +++ b/sbin/geom/class/tests/eli/integrity_hmac_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 diff --git a/sbin/geom/class/tests/eli/kill_test.sh b/sbin/geom/class/tests/eli/kill_test.sh index 513e853..ccced9f 100755 --- a/sbin/geom/class/tests/eli/kill_test.sh +++ b/sbin/geom/class/tests/eli/kill_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 keyfile1=`mktemp $base.XXXXXX` || exit 1 keyfile2=`mktemp $base.XXXXXX` || exit 1 @@ -93,5 +94,4 @@ else echo "not ok 9" fi -mdconfig -d -u $no rm -f $keyfile1 $keyfile2 diff --git a/sbin/geom/class/tests/eli/nokey_test.sh b/sbin/geom/class/tests/eli/nokey_test.sh index f29150b..f32e1a4 100755 --- a/sbin/geom/class/tests/eli/nokey_test.sh +++ b/sbin/geom/class/tests/eli/nokey_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1 @@ -61,5 +62,4 @@ else echo "not ok 8" fi -mdconfig -d -u $no rm -f $keyfile diff --git a/sbin/geom/class/tests/eli/onetime_a_test.sh b/sbin/geom/class/tests/eli/onetime_a_test.sh index 0fb3e5e..4e26dfb 100755 --- a/sbin/geom/class/tests/eli/onetime_a_test.sh +++ b/sbin/geom/class/tests/eli/onetime_a_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 echo "1..1380" diff --git a/sbin/geom/class/tests/eli/onetime_d_test.sh b/sbin/geom/class/tests/eli/onetime_d_test.sh index d49cb64..51a6abb 100755 --- a/sbin/geom/class/tests/eli/onetime_d_test.sh +++ b/sbin/geom/class/tests/eli/onetime_d_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 mdconfig -a -t malloc -s $sectors -u $no || exit 1 diff --git a/sbin/geom/class/tests/eli/onetime_test.sh b/sbin/geom/class/tests/eli/onetime_test.sh index 267fc27..17061d0 100755 --- a/sbin/geom/class/tests/eli/onetime_test.sh +++ b/sbin/geom/class/tests/eli/onetime_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 echo "1..460" diff --git a/sbin/geom/class/tests/eli/readonly_test.sh b/sbin/geom/class/tests/eli/readonly_test.sh index 74396b5..721ad62 100755 --- a/sbin/geom/class/tests/eli/readonly_test.sh +++ b/sbin/geom/class/tests/eli/readonly_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1 diff --git a/sbin/geom/class/tests/eli/resize_test.sh b/sbin/geom/class/tests/eli/resize_test.sh index 86ee364..67d6291 100755 --- a/sbin/geom/class/tests/eli/resize_test.sh +++ b/sbin/geom/class/tests/eli/resize_test.sh @@ -1,7 +1,8 @@ -#! /bin/sh -# +#!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + echo 1..27 BLK=512 @@ -22,8 +23,6 @@ setsize() { # Initialise -kldload geom_eli >/dev/null 2>&1 - setsize 10 40 || echo -n "not " echo ok $i - "Sized ${md}a to 10m" i=$((i + 1)) @@ -145,6 +144,5 @@ echo ok $i - "Attached ${md}p1.eli" i=$((i + 1)) geli detach ${md}p1.eli -mdconfig -du$unit rm tmp.* diff --git a/sbin/geom/class/tests/eli/setkey_test.sh b/sbin/geom/class/tests/eli/setkey_test.sh index f2ebe77..458100c 100755 --- a/sbin/geom/class/tests/eli/setkey_test.sh +++ b/sbin/geom/class/tests/eli/setkey_test.sh @@ -1,8 +1,9 @@ #!/bin/sh # $FreeBSD$ +. $(dirname $0)/conf.sh + base=`basename $0` -no=45 sectors=100 rnd=`mktemp $base.XXXXXX` || exit 1 keyfile1=`mktemp $base.XXXXXX` || exit 1 @@ -152,5 +153,4 @@ else echo "not ok 16" fi -mdconfig -d -u $no rm -f $keyfile1 $keyfile2 $keyfile3 $keyfile4 $keyfile5 |