init_B_test.sh revision 293436
1#!/bin/sh 2# $FreeBSD: head/tools/regression/geom_eli/init-B.t 293436 2016-01-08 19:38:59Z ngie $ 3 4. $(dirname $0)/conf.sh 5 6base=`basename $0` 7sectors=100 8keyfile=`mktemp $base.XXXXXX` || exit 1 9backupfile=`mktemp $base.XXXXXX` || exit 1 10 11echo "1..13" 12 13dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 14 15mdconfig -a -t malloc -s $sectors -u $no || exit 1 16 17# -B none 18rm -f /var/backups/md${no}.eli 19geli init -B none -P -K $keyfile md${no} 2>/dev/null 20if [ ! -f /var/backups/md${no}.eli ]; then 21 echo "ok 1 - -B none" 22else 23 echo "not ok 1 - -B none" 24fi 25 26# no -B 27rm -f /var/backups/md${no}.eli 28geli init -P -K $keyfile md${no} >/dev/null 2>&1 29if [ -f /var/backups/md${no}.eli ]; then 30 echo "ok 2 - no -B" 31else 32 echo "not ok 2 - no -B" 33fi 34geli clear md${no} 35geli attach -p -k $keyfile md${no} 2>/dev/null 36if [ $? -ne 0 ]; then 37 echo "ok 3 - no -B" 38else 39 echo "not ok 3 - no -B" 40fi 41if [ ! -c /dev/md${no}.eli ]; then 42 echo "ok 4 - no -B" 43else 44 echo "not ok 4 - no -B" 45fi 46geli restore /var/backups/md${no}.eli md${no} 47if [ $? -eq 0 ]; then 48 echo "ok 5 - no -B" 49else 50 echo "not ok 5 - no -B" 51fi 52geli attach -p -k $keyfile md${no} 2>/dev/null 53if [ $? -eq 0 ]; then 54 echo "ok 6 - no -B" 55else 56 echo "not ok 6 - no -B" 57fi 58if [ -c /dev/md${no}.eli ]; then 59 echo "ok 7 - no -B" 60else 61 echo "not ok 7 - no -B" 62fi 63geli detach md${no} 64rm -f /var/backups/md${no}.eli 65 66# -B file 67rm -f $backupfile 68geli init -B $backupfile -P -K $keyfile md${no} >/dev/null 2>&1 69if [ -f $backupfile ]; then 70 echo "ok 8 - -B file" 71else 72 echo "not ok 8 - -B file" 73fi 74geli clear md${no} 75geli attach -p -k $keyfile md${no} 2>/dev/null 76if [ $? -ne 0 ]; then 77 echo "ok 9 - -B file" 78else 79 echo "not ok 9 - -B file" 80fi 81if [ ! -c /dev/md${no}.eli ]; then 82 echo "ok 10 - -B file" 83else 84 echo "not ok 10 - -B file" 85fi 86geli restore $backupfile md${no} 87if [ $? -eq 0 ]; then 88 echo "ok 11 - -B file" 89else 90 echo "not ok 11 - -B file" 91fi 92geli attach -p -k $keyfile md${no} 2>/dev/null 93if [ $? -eq 0 ]; then 94 echo "ok 12 - -B file" 95else 96 echo "not ok 12 - -B file" 97fi 98if [ -c /dev/md${no}.eli ]; then 99 echo "ok 13 - -B file" 100else 101 echo "not ok 13 - -B file" 102fi 103 104rm -f $backupfile $keyfile 105