Index: head/tests/sys/geom/class/eli/conf.sh =================================================================== --- head/tests/sys/geom/class/eli/conf.sh (revision 341666) +++ head/tests/sys/geom/class/eli/conf.sh (revision 341667) @@ -1,103 +1,102 @@ #!/bin/sh # $FreeBSD$ class="eli" base=$(atf_get ident) MAX_SECSIZE=8192 -TEST_MDS_FILE=md.devs attach_md() { local test_md test_md=$(mdconfig -a "$@") || atf_fail "failed to allocate md(4)" echo $test_md >> $TEST_MDS_FILE || exit echo $test_md } # Execute `func` for each combination of cipher, sectorsize, and hmac algo # `func` usage should be: # func for_each_geli_config() { func=$1 backing_filename=$2 # Double the sector size to allow for the HMACs' storage space. osecsize=$(( $MAX_SECSIZE * 2 )) # geli needs 512B for the label. bytes=`expr $osecsize \* $sectors + 512`b if [ -n "$backing_filename" ]; then # Use a file-backed md(4) device, so we can deliberatly corrupt # it without detaching the geli device first. truncate -s $bytes backing_file md=$(attach_md -t vnode -f backing_file) else md=$(attach_md -t malloc -s $bytes) fi for cipher in aes-xts:128 aes-xts:256 \ aes-cbc:128 aes-cbc:192 aes-cbc:256 \ 3des-cbc:192 \ blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \ blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \ blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ blowfish-cbc:416 blowfish-cbc:448 \ camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do ealgo=${cipher%%:*} keylen=${cipher##*:} for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 \ hmac/sha384 hmac/sha512; do for secsize in 512 1024 2048 4096 $MAX_SECSIZE; do ${func} $cipher $aalgo $secsize geli detach ${md} 2>/dev/null done done done } # Execute `func` for each combination of cipher, and sectorsize, with no hmac # `func` usage should be: # func for_each_geli_config_nointegrity() { func=$1 # geli needs 512B for the label. bytes=`expr $MAX_SECSIZE \* $sectors + 512`b md=$(attach_md -t malloc -s $bytes) for cipher in aes-xts:128 aes-xts:256 \ aes-cbc:128 aes-cbc:192 aes-cbc:256 \ 3des-cbc:192 \ blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \ blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \ blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ blowfish-cbc:416 blowfish-cbc:448 \ camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do ealgo=${cipher%%:*} keylen=${cipher##*:} for secsize in 512 1024 2048 4096 $MAX_SECSIZE; do ${func} $cipher $secsize geli detach ${md} 2>/dev/null done done } geli_test_cleanup() { if [ -f "$TEST_MDS_FILE" ]; then while read md; do [ -c /dev/${md}.eli ] && \ geli detach $md.eli 2>/dev/null mdconfig -d -u $md 2>/dev/null done < $TEST_MDS_FILE fi true } geli_test_setup() { geom_atf_test_setup } ATF_TEST=true . `dirname $0`/../geom_subr.sh Index: head/tests/sys/geom/class/geom_subr.sh =================================================================== --- head/tests/sys/geom/class/geom_subr.sh (revision 341666) +++ head/tests/sys/geom/class/geom_subr.sh (revision 341667) @@ -1,97 +1,81 @@ #!/bin/sh # $FreeBSD$ -# NOTE: existence is sanity-checked in `geom_verify_temp_mds_file_existence(..)` -TEST_MDS_FILE="$(mktemp test_mds.${0##*/}.XXXXXXXX)" +TEST_MDS_FILE="${TMPDIR}/test_mds.$(basename $0)" devwait() { while :; do if [ -c /dev/${class}/${name} ]; then return fi sleep 0.2 done } attach_md() { local test_md test_md=$(mdconfig -a "$@") || exit echo $test_md >> $TEST_MDS_FILE || exit echo $test_md } detach_md() { local test_md unit test_md=$1 unit=${test_md#md} mdconfig -d -u $unit || exit sed -i '' "/^${test_md}$/d" $TEST_MDS_FILE || exit } geom_test_cleanup() { local test_md if [ -f "$TEST_MDS_FILE" ]; then while read test_md; do # The "#" tells the TAP parser this is a comment echo "# Removing test memory disk: $test_md" mdconfig -d -u $test_md done < $TEST_MDS_FILE rm -f "$TEST_MDS_FILE" fi } -geom_verify_temp_mds_file_existence() -{ - if [ ! -f $TEST_MDS_FILE ]; then - echo "test md(4) devices file creation unsuccessful" - return 1 - fi -} - geom_load_class_if_needed() { local class=$1 # If the geom class isn't already loaded, try loading it. if ! kldstat -q -m g_${class}; then if ! geom ${class} load; then echo "could not load module for geom class=${class}" return 1 fi fi return 0 } geom_atf_test_setup() { - if ! error_message=$(geom_verify_temp_mds_file_existence); then - atf_skip "$error_message" - fi if ! error_message=$(geom_load_class_if_needed $class); then atf_skip "$error_message" fi } geom_tap_test_setup() { - if ! error_message=$(geom_verify_temp_mds_file_existence); then - echo "1..0 # SKIP $error_message" - exit 1 - fi if ! error_message=$(geom_load_class_if_needed $class); then echo "1..0 # SKIP $error_message" exit 0 fi } : ${ATF_TEST=false} if ! $ATF_TEST; then geom_tap_test_setup fi