Author: asomers Date: Fri Dec 29 16:13:06 2017 New Revision: 327347 URL: https://svnweb.freebsd.org/changeset/base/327347
Log: geli: factor out some common code in the geli tests No functional change. MFC after: 2 weeks Sponsored by: Spectra Logic Corp Modified: head/tests/sys/geom/class/eli/conf.sh head/tests/sys/geom/class/eli/init_a_test.sh head/tests/sys/geom/class/eli/init_test.sh head/tests/sys/geom/class/eli/integrity_copy_test.sh head/tests/sys/geom/class/eli/integrity_data_test.sh head/tests/sys/geom/class/eli/integrity_hmac_test.sh head/tests/sys/geom/class/eli/onetime_a_test.sh head/tests/sys/geom/class/eli/onetime_test.sh Modified: head/tests/sys/geom/class/eli/conf.sh ============================================================================== --- head/tests/sys/geom/class/eli/conf.sh Fri Dec 29 16:06:10 2017 (r327346) +++ head/tests/sys/geom/class/eli/conf.sh Fri Dec 29 16:13:06 2017 (r327347) @@ -23,7 +23,11 @@ for_each_geli_config() { for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 \ hmac/sha384 hmac/sha512; do for secsize in 512 1024 2048 4096 8192; do + bytes=`expr $secsize \* $sectors + 512`b + md=$(attach_md -t malloc -s $bytes) ${func} $cipher $aalgo $secsize + geli detach ${md} 2>/dev/null + mdconfig -d -u ${md} 2>/dev/null done done done @@ -46,7 +50,11 @@ for_each_geli_config_nointegrity() { ealgo=${cipher%%:*} keylen=${cipher##*:} for secsize in 512 1024 2048 4096 8192; do + bytes=`expr $secsize \* $sectors + 512`b + md=$(attach_md -t malloc -s $bytes) ${func} $cipher $aalgo $secsize + geli detach ${md} 2>/dev/null + mdconfig -d -u ${md} 2>/dev/null done done } Modified: head/tests/sys/geom/class/eli/init_a_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/init_a_test.sh Fri Dec 29 16:06:10 2017 (r327346) +++ head/tests/sys/geom/class/eli/init_a_test.sh Fri Dec 29 16:13:06 2017 (r327347) @@ -15,7 +15,6 @@ do_test() { ealgo=${cipher%%:*} keylen=${cipher##*:} - md=$(attach_md -t malloc -s `expr $secsize \* $sectors + 512`b) geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize ${md} 2>/dev/null geli attach -p -k $keyfile ${md} @@ -32,9 +31,6 @@ do_test() { echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" fi i=$((i+1)) - - geli detach ${md} - mdconfig -d -u ${md} } echo "1..600" Modified: head/tests/sys/geom/class/eli/init_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/init_test.sh Fri Dec 29 16:06:10 2017 (r327346) +++ head/tests/sys/geom/class/eli/init_test.sh Fri Dec 29 16:13:06 2017 (r327347) @@ -16,8 +16,6 @@ do_test() { ealgo=${cipher%%:*} keylen=${cipher##*:} - md=$(attach_md -t malloc -s `expr $secsize \* $sectors + 512`b) - geli init -B none -e $ealgo -l $keylen -P -K $keyfile -s $secsize ${md} 2>/dev/null geli attach -p -k $keyfile ${md} @@ -42,9 +40,6 @@ do_test() { echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" fi i=$((i+1)) - - geli detach ${md} - mdconfig -d -u ${md} } i=1 Modified: head/tests/sys/geom/class/eli/integrity_copy_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/integrity_copy_test.sh Fri Dec 29 16:06:10 2017 (r327346) +++ head/tests/sys/geom/class/eli/integrity_copy_test.sh Fri Dec 29 16:13:06 2017 (r327347) @@ -4,6 +4,7 @@ . $(dirname $0)/conf.sh base=`basename $0` +sectors=2 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 @@ -16,7 +17,6 @@ do_test() { ealgo=${cipher%%:*} keylen=${cipher##*:} - md=$(attach_md -t malloc -s `expr $secsize \* 2 + 512`b) geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize ${md} 2>/dev/null geli attach -p -k $keyfile ${md} @@ -65,18 +65,13 @@ do_test() { # This should be detected as corruption. dd if=/dev/${md} of=${sector} bs=${usecsize} count=1 >/dev/null 2>&1 dd if=${sector} of=/dev/${md} bs=${usecsize} count=1 seek=1 >/dev/null 2>&1 - geli attach -p -k $keyfile ${md} - - dd if=/dev/${md}.eli of=/dev/null bs=${secsize} count=2 >/dev/null 2>&1 + geli attach -p -k $keyfile ${md} 2>/dev/null if [ $? -ne 0 ]; then echo "ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" else echo "not ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" fi i=$((i+1)) - - geli detach ${md} - mdconfig -d -u ${md} } Modified: head/tests/sys/geom/class/eli/integrity_data_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/integrity_data_test.sh Fri Dec 29 16:06:10 2017 (r327346) +++ head/tests/sys/geom/class/eli/integrity_data_test.sh Fri Dec 29 16:13:06 2017 (r327347) @@ -4,6 +4,7 @@ . $(dirname $0)/conf.sh base=`basename $0` +sectors=2 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 @@ -16,7 +17,6 @@ do_test() { ealgo=${cipher%%:*} keylen=${cipher##*:} - md=$(attach_md -t malloc -s `expr $secsize \* 2 + 512`b) geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize ${md} 2>/dev/null # Corrupt 8 bytes of data. @@ -32,9 +32,6 @@ do_test() { echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" fi i=$((i+1)) - - geli detach ${md} - mdconfig -d -u ${md} } i=1 Modified: head/tests/sys/geom/class/eli/integrity_hmac_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/integrity_hmac_test.sh Fri Dec 29 16:06:10 2017 (r327346) +++ head/tests/sys/geom/class/eli/integrity_hmac_test.sh Fri Dec 29 16:13:06 2017 (r327347) @@ -4,6 +4,7 @@ . $(dirname $0)/conf.sh base=`basename $0` +sectors=2 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 @@ -16,7 +17,6 @@ do_test() { ealgo=${cipher%%:*} keylen=${cipher##*:} - md=$(attach_md -t malloc -s `expr $secsize \* 2 + 512`b) geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize ${md} 2>/dev/null # Corrupt 8 bytes of HMAC. @@ -32,9 +32,6 @@ do_test() { echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" fi i=$((i+1)) - - geli detach ${md} - mdconfig -d -u ${md} } Modified: head/tests/sys/geom/class/eli/onetime_a_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/onetime_a_test.sh Fri Dec 29 16:06:10 2017 (r327346) +++ head/tests/sys/geom/class/eli/onetime_a_test.sh Fri Dec 29 16:13:06 2017 (r327347) @@ -16,7 +16,6 @@ do_test() { ealgo=${cipher%%:*} keylen=${cipher##*:} - md=$(attach_md -t malloc -s `expr $secsize \* $sectors + 512`b) geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize ${md} 2>/dev/null secs=`diskinfo /dev/${md}.eli | awk '{print $4}'` @@ -32,9 +31,6 @@ do_test() { echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" fi i=$((i+1)) - - geli detach ${md} - mdconfig -d -u ${md} } i=1 Modified: head/tests/sys/geom/class/eli/onetime_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/onetime_test.sh Fri Dec 29 16:06:10 2017 (r327346) +++ head/tests/sys/geom/class/eli/onetime_test.sh Fri Dec 29 16:13:06 2017 (r327347) @@ -15,7 +15,6 @@ do_test() { keylen=${cipher##*:} rnd=`mktemp $base.XXXXXX` || exit 1 - md=$(attach_md -t malloc -s `expr $secsize \* $sectors`b) geli onetime -e $ealgo -l $keylen -s $secsize ${md} 2>/dev/null @@ -41,9 +40,7 @@ do_test() { fi i=$((i+1)) - geli detach ${md} rm -f $rnd - mdconfig -d -u ${md} } i=1 _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"