Pass read/write CRx registers to userspace
[freebsd-src/fkvm-freebsd.git] / tools / regression / geom_eli / attach-d.t
blob4c4789e0f5fc7fd28bb5089fbb5b125f028c4ea1
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..3"
12 dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1
14 geli init -B none -P -K $keyfile md${no}
15 geli attach -d -p -k $keyfile md${no}
16 if [ -c /dev/md${no}.eli ]; then
17 echo "ok 1"
18 else
19 echo "not ok 1"
21 # Be sure it doesn't detach on read.
22 dd if=/dev/md${no}.eli of=/dev/null 2>/dev/null
23 sleep 1
24 if [ -c /dev/md${no}.eli ]; then
25 echo "ok 2"
26 else
27 echo "not ok 2"
29 true > /dev/md${no}.eli
30 sleep 1
31 if [ ! -c /dev/md${no}.eli ]; then
32 echo "ok 3"
33 else
34 echo "not ok 3"
37 mdconfig -d -u $no
38 rm -f $keyfile