Pass read/write CRx registers to userspace
[freebsd-src/fkvm-freebsd.git] / tools / regression / geom_eli / detach-l.t
blobdfa3269a6db96ea60ca5fb507d1758215b67de6c
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..4"
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 -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 before 'detach -l'.
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 geli detach -l md${no}
30 if [ -c /dev/md${no}.eli ]; then
31 echo "ok 3"
32 else
33 echo "not ok 3"
35 dd if=/dev/md${no}.eli of=/dev/null 2>/dev/null
36 sleep 1
37 if [ ! -c /dev/md${no}.eli ]; then
38 echo "ok 4"
39 else
40 echo "not ok 4"
43 mdconfig -d -u $no
44 rm -f $keyfile