From owner-svn-src-all@freebsd.org Sun Jan 7 02:30:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43A55E5DBE8; Sun, 7 Jan 2018 02:30:10 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F0816F053; Sun, 7 Jan 2018 02:30:10 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75EE51B039; Sun, 7 Jan 2018 02:30:09 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w072U9EO089382; Sun, 7 Jan 2018 02:30:09 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w072U9FX089379; Sun, 7 Jan 2018 02:30:09 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201801070230.w072U9FX089379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sun, 7 Jan 2018 02:30:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327666 - head/tests/sys/geom/class/eli X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/geom/class/eli X-SVN-Commit-Revision: 327666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 02:30:10 -0000 Author: asomers Date: Sun Jan 7 02:30:08 2018 New Revision: 327666 URL: https://svnweb.freebsd.org/changeset/base/327666 Log: geli: fix parallel execution of tests The trick is not to destroy an md(4) device during a test. That can create a "double-free" situation, because we also destroy md devices during test cleanup. MFC after: 2 weeks Modified: head/tests/sys/geom/class/eli/conf.sh head/tests/sys/geom/class/eli/init_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 Sun Jan 7 02:19:54 2018 (r327665) +++ head/tests/sys/geom/class/eli/conf.sh Sun Jan 7 02:30:08 2018 (r327666) @@ -4,6 +4,7 @@ class="eli" base=$(atf_get ident) [ -z "$base" ] && base=`basename $0` # for TAP compatibility +MAX_SECSIZE=8192 TEST_MDS_FILE=md.devs attach_md() @@ -21,6 +22,11 @@ attach_md() for_each_geli_config() { func=$1 + # 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 + 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 \ @@ -33,16 +39,9 @@ for_each_geli_config() { 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 8192; do - # Double the requested sector size to allow - # for the HMACs' storage space. - osecsize=$(( $secsize * 2 )) - # geli needs 512B for the label. - bytes=`expr $osecsize \* $sectors + 512`b - md=$(attach_md -t malloc -s $bytes) + for secsize in 512 1024 2048 4096 $MAX_SECSIZE; do ${func} $cipher $aalgo $secsize geli detach ${md} 2>/dev/null - mdconfig -d -u ${md} 2>/dev/null done done done @@ -54,6 +53,9 @@ for_each_geli_config() { 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 \ @@ -64,13 +66,9 @@ for_each_geli_config_nointegrity() { camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do ealgo=${cipher%%:*} keylen=${cipher##*:} - for secsize in 512 1024 2048 4096 8192; do - # geli needs 512B for the label. - bytes=`expr $secsize \* $sectors + 512`b - md=$(attach_md -t malloc -s $bytes) + for secsize in 512 1024 2048 4096 $MAX_SECSIZE; do ${func} $cipher $secsize geli detach ${md} 2>/dev/null - mdconfig -d -u ${md} 2>/dev/null done done } Modified: head/tests/sys/geom/class/eli/init_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/init_test.sh Sun Jan 7 02:19:54 2018 (r327665) +++ head/tests/sys/geom/class/eli/init_test.sh Sun Jan 7 02:30:08 2018 (r327666) @@ -9,19 +9,18 @@ init_test() keylen=${cipher##*:} atf_check -s exit:0 -e ignore \ - geli init -B none -e $ealgo -l $keylen -P -K keyfile -s $secsize ${md} + geli init -B none -e $ealgo -l $keylen -P -K keyfile + -s $secsize ${md} atf_check geli attach -p -k keyfile ${md} - secs=`diskinfo /dev/${md}.eli | awk '{print $4}'` + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} \ + status=none - atf_check dd if=/dev/random of=rnd bs=${secsize} count=${secs} status=none - atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${secs} status=none - - md_rnd=`dd if=rnd bs=${secsize} count=${secs} status=none | md5` + md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? - md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? - md_edev=`dd if=/dev/${md} bs=${secsize} count=${secs} status=none | md5` + md_edev=`dd if=/dev/${md} bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? if [ ${md_rnd} != ${md_ddev} ]; then @@ -45,7 +44,8 @@ init_body() sectors=32 atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none - atf_check dd if=/dev/random of=rnd bs=8192 count=${sectors} status=none + atf_check dd if=/dev/random of=rnd bs=$MAX_SECSIZE count=${sectors} \ + status=none for_each_geli_config_nointegrity init_test } init_cleanup() @@ -235,16 +235,16 @@ init_a_test() ealgo=${cipher%%:*} keylen=${cipher##*:} - atf_check -s exit:0 -e ignore geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile -s $secsize ${md} + atf_check -s exit:0 -e ignore \ + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile \ + -s $secsize ${md} atf_check geli attach -p -k keyfile ${md} - secs=`diskinfo /dev/${md}.eli | awk '{print $4}'` + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} status=none - atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${secs} status=none - - md_rnd=`dd if=rnd bs=${secsize} count=${secs} status=none | md5` + md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? - md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} status=none | md5` + md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? if [ ${md_rnd} != ${md_ddev} ]; then @@ -265,7 +265,8 @@ init_a_body() sectors=100 atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none - atf_check dd if=/dev/random of=rnd bs=8192 count=${sectors} status=none + atf_check dd if=/dev/random of=rnd bs=$MAX_SECSIZE count=${sectors} \ + status=none for_each_geli_config init_a_test true } @@ -348,7 +349,7 @@ init_i_P_body() atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none - atf_check -s exit:1 -e "match:Options -i and -P are mutually exclusive"\ + atf_check -s not-exit:0 -e "match:Options -i and -P are mutually exclusive"\ geli init -B none -i 64 -P -K keyfile $md } init_i_P_cleanup() Modified: head/tests/sys/geom/class/eli/onetime_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/onetime_test.sh Sun Jan 7 02:19:54 2018 (r327665) +++ head/tests/sys/geom/class/eli/onetime_test.sh Sun Jan 7 02:30:08 2018 (r327666) @@ -10,16 +10,14 @@ onetime_test() atf_check -s exit:0 -o ignore -e ignore \ geli onetime -e $ealgo -l $keylen -s $secsize ${md} - secs=`diskinfo /dev/${md}.eli | awk '{print $4}'` + atf_check dd if=/dev/random of=rnd bs=${secsize} count=${sectors} status=none + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} status=none - atf_check dd if=/dev/random of=rnd bs=${secsize} count=${secs} status=none - atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${secs} status=none - - md_rnd=`dd if=rnd bs=${secsize} count=${secs} status=none | md5` + md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? - md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} status=none | md5` + md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? - md_edev=`dd if=/dev/${md} bs=${secsize} count=${secs} status=none | md5` + md_edev=`dd if=/dev/${md} bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? if [ ${md_rnd} != ${md_ddev} ]; then @@ -41,6 +39,7 @@ onetime_body() . $(atf_get_srcdir)/conf.sh sectors=100 + dd if=/dev/random of=rnd bs=${MAX_SECSIZE} count=${sectors} status=none for_each_geli_config_nointegrity onetime_test } onetime_cleanup() @@ -60,13 +59,11 @@ onetime_a_test() atf_check -s exit:0 -o ignore -e ignore \ geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize ${md} - secs=`diskinfo /dev/${md}.eli | awk '{print $4}'` + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} status=none - atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${secs} status=none - - md_rnd=`dd if=rnd bs=${secsize} count=${secs} status=none | md5` + md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? - md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} status=none | md5` + md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? if [ ${md_rnd} != ${md_ddev} ]; then