Pass read/write CRx registers to userspace
[freebsd-src/fkvm-freebsd.git] / tools / regression / geom_eli / nokey.t
blob19ef6804385292d29d451f1ec048b1ac3d56d3a8
1 #!/bin/sh
2 # $FreeBSD$
4 base=`basename $0`
5 no=45
6 sectors=100
7 keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
8 mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
10 echo "1..8"
12 geli init -B none -P md${no} 2>/dev/null
13 if [ $? -ne 0 ]; then
14 echo "ok 1"
15 else
16 echo "not ok 1"
19 dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1
21 geli init -B none -P -K ${keyfile} md${no} 2>/dev/null
22 if [ $? -eq 0 ]; then
23 echo "ok 2"
24 else
25 echo "not ok 2"
27 geli attach -p md${no} 2>/dev/null
28 if [ $? -ne 0 ]; then
29 echo "ok 3"
30 else
31 echo "not ok 3"
33 geli attach -p -k ${keyfile} md${no} 2>/dev/null
34 if [ $? -eq 0 ]; then
35 echo "ok 4"
36 else
37 echo "not ok 4"
39 geli setkey -n 0 -P md${no} 2>/dev/null
40 if [ $? -ne 0 ]; then
41 echo "ok 5"
42 else
43 echo "not ok 5"
45 geli detach md${no} 2>/dev/null
46 if [ $? -eq 0 ]; then
47 echo "ok 6"
48 else
49 echo "not ok 6"
51 geli setkey -n 0 -p -P -K ${keyfile} md${no} 2>/dev/null
52 if [ $? -ne 0 ]; then
53 echo "ok 7"
54 else
55 echo "not ok 7"
57 geli setkey -n 0 -p -k ${keyfile} -P md${no} 2>/dev/null
58 if [ $? -ne 0 ]; then
59 echo "ok 8"
60 else
61 echo "not ok 8"
64 mdconfig -d -u $no
65 rm -f $keyfile