svn commit: r296791 - stable/9/tools/regression/geom_eli

Garrett Cooper ngie at FreeBSD.org
Sun Mar 13 02:05:20 UTC 2016


Author: ngie
Date: Sun Mar 13 02:05:16 2016
New Revision: 296791
URL: https://svnweb.freebsd.org/changeset/base/296791

Log:
  MFstable/10 r296782:
  
  MFC r293436:
  
  - Add a conf.sh file for executing common functions with geli
  -- Use linear probing to find the first unique md(4) device, unlike the other
     code which uses attach_md, as geli(8) allocates the md(4) devices itself
  - Don't hardcode /tmp for temporary files, which violates the kyua sandbox

Added:
  stable/9/tools/regression/geom_eli/conf.sh
     - copied unchanged from r296782, stable/10/tools/regression/geom_eli/conf.sh
Modified:
  stable/9/tools/regression/geom_eli/attach-d.t
  stable/9/tools/regression/geom_eli/configure-b-B.t
  stable/9/tools/regression/geom_eli/delkey.t
  stable/9/tools/regression/geom_eli/detach-l.t
  stable/9/tools/regression/geom_eli/init-B.t
  stable/9/tools/regression/geom_eli/init-J.t
  stable/9/tools/regression/geom_eli/init-a.t
  stable/9/tools/regression/geom_eli/init-i-P.t
  stable/9/tools/regression/geom_eli/init.t
  stable/9/tools/regression/geom_eli/integrity-copy.t
  stable/9/tools/regression/geom_eli/integrity-data.t
  stable/9/tools/regression/geom_eli/integrity-hmac.t
  stable/9/tools/regression/geom_eli/kill.t
  stable/9/tools/regression/geom_eli/nokey.t
  stable/9/tools/regression/geom_eli/onetime-a.t
  stable/9/tools/regression/geom_eli/onetime-d.t
  stable/9/tools/regression/geom_eli/onetime.t
  stable/9/tools/regression/geom_eli/readonly.t
  stable/9/tools/regression/geom_eli/resize.t
  stable/9/tools/regression/geom_eli/setkey.t
Directory Properties:
  stable/9/   (props changed)
  stable/9/tools/   (props changed)
  stable/9/tools/regression/   (props changed)

Modified: stable/9/tools/regression/geom_eli/attach-d.t
==============================================================================
--- stable/9/tools/regression/geom_eli/attach-d.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/attach-d.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,10 +1,11 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
+keyfile=`mktemp $base.XXXXXX` || exit 1
 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
 
 echo "1..3"
@@ -34,5 +35,4 @@ else
 	echo "not ok 3"
 fi
 
-mdconfig -d -u $no
 rm -f $keyfile

Copied: stable/9/tools/regression/geom_eli/conf.sh (from r296782, stable/10/tools/regression/geom_eli/conf.sh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/tools/regression/geom_eli/conf.sh	Sun Mar 13 02:05:16 2016	(r296791, copy of r296782, stable/10/tools/regression/geom_eli/conf.sh)
@@ -0,0 +1,21 @@
+#!/bin/sh
+# $FreeBSD$
+
+class="eli"
+base=`basename $0`
+
+# We need to use linear probing in order to detect the first available md(4)
+# device instead of using mdconfig -a -t, because geli(8) attachs md(4) devices
+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

Modified: stable/9/tools/regression/geom_eli/configure-b-B.t
==============================================================================
--- stable/9/tools/regression/geom_eli/configure-b-B.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/configure-b-B.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -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

Modified: stable/9/tools/regression/geom_eli/delkey.t
==============================================================================
--- stable/9/tools/regression/geom_eli/delkey.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/delkey.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,13 +1,14 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-keyfile1=`mktemp /tmp/$base.XXXXXX` || exit 1
-keyfile2=`mktemp /tmp/$base.XXXXXX` || exit 1
-keyfile3=`mktemp /tmp/$base.XXXXXX` || exit 1
-keyfile4=`mktemp /tmp/$base.XXXXXX` || exit 1
+keyfile1=`mktemp $base.XXXXXX` || exit 1
+keyfile2=`mktemp $base.XXXXXX` || exit 1
+keyfile3=`mktemp $base.XXXXXX` || exit 1
+keyfile4=`mktemp $base.XXXXXX` || exit 1
 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
 
 echo "1..14"
@@ -136,5 +137,4 @@ else
 	echo "not ok 14"
 fi
 
-mdconfig -d -u $no
 rm -f $keyfile1 $keyfile2 $keyfile3 $keyfile4

Modified: stable/9/tools/regression/geom_eli/detach-l.t
==============================================================================
--- stable/9/tools/regression/geom_eli/detach-l.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/detach-l.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,10 +1,11 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
+keyfile=`mktemp $base.XXXXXX` || exit 1
 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
 
 echo "1..4"
@@ -40,5 +41,4 @@ else
 	echo "not ok 4"
 fi
 
-mdconfig -d -u $no
 rm -f $keyfile

Modified: stable/9/tools/regression/geom_eli/init-B.t
==============================================================================
--- stable/9/tools/regression/geom_eli/init-B.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/init-B.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,11 +1,12 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
-backupfile=`mktemp /tmp/$base.XXXXXX` || exit 1
+keyfile=`mktemp $base.XXXXXX` || exit 1
+backupfile=`mktemp $base.XXXXXX` || exit 1
 
 echo "1..13"
 
@@ -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

Modified: stable/9/tools/regression/geom_eli/init-J.t
==============================================================================
--- stable/9/tools/regression/geom_eli/init-J.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/init-J.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,13 +1,14 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-keyfile0=`mktemp /tmp/$base.XXXXXX` || exit 1
-keyfile1=`mktemp /tmp/$base.XXXXXX` || exit 1
-passfile0=`mktemp /tmp/$base.XXXXXX` || exit 1
-passfile1=`mktemp /tmp/$base.XXXXXX` || exit 1
+keyfile0=`mktemp $base.XXXXXX` || exit 1
+keyfile1=`mktemp $base.XXXXXX` || exit 1
+passfile0=`mktemp $base.XXXXXX` || exit 1
+passfile1=`mktemp $base.XXXXXX` || exit 1
 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
 
 echo "1..150"
@@ -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}

Modified: stable/9/tools/regression/geom_eli/init-a.t
==============================================================================
--- stable/9/tools/regression/geom_eli/init-a.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/init-a.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,10 +1,11 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
+keyfile=`mktemp $base.XXXXXX` || exit 1
 
 echo "1..1380"
 
@@ -26,7 +27,7 @@ for cipher in aes:0 aes:128 aes:256 \
 	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
-			rnd=`mktemp /tmp/$base.XXXXXX` || exit 1
+			rnd=`mktemp $base.XXXXXX` || exit 1
 			mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1
 
 			dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1

Modified: stable/9/tools/regression/geom_eli/init-i-P.t
==============================================================================
--- stable/9/tools/regression/geom_eli/init-i-P.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/init-i-P.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,10 +1,11 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
+keyfile=`mktemp $base.XXXXXX` || exit 1
 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
 
 echo "1..1"
@@ -18,5 +19,4 @@ else
 	echo "not ok 1"
 fi
 
-mdconfig -d -u $no
 rm -f $keyfile

Modified: stable/9/tools/regression/geom_eli/init.t
==============================================================================
--- stable/9/tools/regression/geom_eli/init.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/init.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,10 +1,11 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
+keyfile=`mktemp $base.XXXXXX` || exit 1
 
 echo "1..460"
 
@@ -25,7 +26,7 @@ for cipher in aes:0 aes:128 aes:256 \
 	ealgo=${cipher%%:*}
 	keylen=${cipher##*:}
 	for secsize in 512 1024 2048 4096 8192; do
-		rnd=`mktemp /tmp/$base.XXXXXX` || exit 1
+		rnd=`mktemp $base.XXXXXX` || exit 1
 		mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1
 
 		dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1

Modified: stable/9/tools/regression/geom_eli/integrity-copy.t
==============================================================================
--- stable/9/tools/regression/geom_eli/integrity-copy.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/integrity-copy.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,11 +1,12 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
-sector=`mktemp /tmp/$base.XXXXXX` || exit 1
+keyfile=`mktemp $base.XXXXXX` || exit 1
+sector=`mktemp $base.XXXXXX` || exit 1
 
 echo "1..5520"
 

Modified: stable/9/tools/regression/geom_eli/integrity-data.t
==============================================================================
--- stable/9/tools/regression/geom_eli/integrity-data.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/integrity-data.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,11 +1,12 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
-sector=`mktemp /tmp/$base.XXXXXX` || exit 1
+keyfile=`mktemp $base.XXXXXX` || exit 1
+sector=`mktemp $base.XXXXXX` || exit 1
 
 echo "1..2760"
 

Modified: stable/9/tools/regression/geom_eli/integrity-hmac.t
==============================================================================
--- stable/9/tools/regression/geom_eli/integrity-hmac.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/integrity-hmac.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,11 +1,12 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
-sector=`mktemp /tmp/$base.XXXXXX` || exit 1
+keyfile=`mktemp $base.XXXXXX` || exit 1
+sector=`mktemp $base.XXXXXX` || exit 1
 
 echo "1..2760"
 

Modified: stable/9/tools/regression/geom_eli/kill.t
==============================================================================
--- stable/9/tools/regression/geom_eli/kill.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/kill.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,11 +1,12 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-keyfile1=`mktemp /tmp/$base.XXXXXX` || exit 1
-keyfile2=`mktemp /tmp/$base.XXXXXX` || exit 1
+keyfile1=`mktemp $base.XXXXXX` || exit 1
+keyfile2=`mktemp $base.XXXXXX` || exit 1
 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
 
 echo "1..9"
@@ -93,5 +94,4 @@ else
 	echo "not ok 9"
 fi
 
-mdconfig -d -u $no
 rm -f $keyfile1 $keyfile2

Modified: stable/9/tools/regression/geom_eli/nokey.t
==============================================================================
--- stable/9/tools/regression/geom_eli/nokey.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/nokey.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,10 +1,11 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
+keyfile=`mktemp $base.XXXXXX` || exit 1
 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
 
 echo "1..8"
@@ -61,5 +62,4 @@ else
 	echo "not ok 8"
 fi
 
-mdconfig -d -u $no
 rm -f $keyfile

Modified: stable/9/tools/regression/geom_eli/onetime-a.t
==============================================================================
--- stable/9/tools/regression/geom_eli/onetime-a.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/onetime-a.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,8 +1,9 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
 
 echo "1..1380"
@@ -25,7 +26,7 @@ for cipher in aes:0 aes:128 aes:256 \
 	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
-			rnd=`mktemp /tmp/$base.XXXXXX` || exit 1
+			rnd=`mktemp $base.XXXXXX` || exit 1
 			mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1
 
 			geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null

Modified: stable/9/tools/regression/geom_eli/onetime-d.t
==============================================================================
--- stable/9/tools/regression/geom_eli/onetime-d.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/onetime-d.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -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
 

Modified: stable/9/tools/regression/geom_eli/onetime.t
==============================================================================
--- stable/9/tools/regression/geom_eli/onetime.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/onetime.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,8 +1,9 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
 
 echo "1..460"
@@ -24,7 +25,7 @@ for cipher in aes:0 aes:128 aes:256 \
 	ealgo=${cipher%%:*}
 	keylen=${cipher##*:}
 	for secsize in 512 1024 2048 4096 8192; do
-		rnd=`mktemp /tmp/$base.XXXXXX` || exit 1
+		rnd=`mktemp $base.XXXXXX` || exit 1
 		mdconfig -a -t malloc -s `expr $secsize \* $sectors`b -u $no || exit 1
 
 		geli onetime -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null

Modified: stable/9/tools/regression/geom_eli/readonly.t
==============================================================================
--- stable/9/tools/regression/geom_eli/readonly.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/readonly.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,10 +1,11 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
+keyfile=`mktemp $base.XXXXXX` || exit 1
 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
 
 echo "1..11"

Modified: stable/9/tools/regression/geom_eli/resize.t
==============================================================================
--- stable/9/tools/regression/geom_eli/resize.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/resize.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -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))
@@ -144,6 +143,5 @@ echo ok $i - "Attached ${md}p1.eli"
 i=$((i + 1))
 
 geli detach ${md}p1.eli
-mdconfig -du$unit
 
 rm tmp.*

Modified: stable/9/tools/regression/geom_eli/setkey.t
==============================================================================
--- stable/9/tools/regression/geom_eli/setkey.t	Sun Mar 13 01:49:36 2016	(r296790)
+++ stable/9/tools/regression/geom_eli/setkey.t	Sun Mar 13 02:05:16 2016	(r296791)
@@ -1,15 +1,16 @@
 #!/bin/sh
 # $FreeBSD$
 
+. $(dirname $0)/conf.sh
+
 base=`basename $0`
-no=45
 sectors=100
-rnd=`mktemp /tmp/$base.XXXXXX` || exit 1
-keyfile1=`mktemp /tmp/$base.XXXXXX` || exit 1
-keyfile2=`mktemp /tmp/$base.XXXXXX` || exit 1
-keyfile3=`mktemp /tmp/$base.XXXXXX` || exit 1
-keyfile4=`mktemp /tmp/$base.XXXXXX` || exit 1
-keyfile5=`mktemp /tmp/$base.XXXXXX` || exit 1
+rnd=`mktemp $base.XXXXXX` || exit 1
+keyfile1=`mktemp $base.XXXXXX` || exit 1
+keyfile2=`mktemp $base.XXXXXX` || exit 1
+keyfile3=`mktemp $base.XXXXXX` || exit 1
+keyfile4=`mktemp $base.XXXXXX` || exit 1
+keyfile5=`mktemp $base.XXXXXX` || exit 1
 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
 
 echo "1..16"
@@ -152,5 +153,4 @@ else
 	echo "not ok 16"
 fi
 
-mdconfig -d -u $no
 rm -f $keyfile1 $keyfile2 $keyfile3 $keyfile4 $keyfile5


More information about the svn-src-stable-9 mailing list