init_B_test.sh revision 182452
1182452Spjd#!/bin/sh 2182452Spjd# $FreeBSD: head/tools/regression/geom_eli/init-B.t 182452 2008-08-29 18:10:18Z pjd $ 3182452Spjd 4182452Spjdbase=`basename $0` 5182452Spjdno=45 6182452Spjdsectors=100 7182452Spjdkeyfile=`mktemp /tmp/$base.XXXXXX` || exit 1 8182452Spjdbackupfile=`mktemp /tmp/$base.XXXXXX` || exit 1 9182452Spjd 10182452Spjdecho "1..13" 11182452Spjd 12182452Spjddd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 13182452Spjd 14182452Spjdmdconfig -a -t malloc -s $sectors -u $no || exit 1 15182452Spjd 16182452Spjd# -B none 17182452Spjdrm -f /var/backups/md${no}.eli 18182452Spjdgeli init -B none -P -K $keyfile md${no} 2>/dev/null 19182452Spjdif [ ! -f /var/backups/md${no}.eli ]; then 20182452Spjd echo "ok 1 - -B none" 21182452Spjdelse 22182452Spjd echo "not ok 1 - -B none" 23182452Spjdfi 24182452Spjd 25182452Spjd# no -B 26182452Spjdrm -f /var/backups/md${no}.eli 27182452Spjdgeli init -P -K $keyfile md${no} >/dev/null 2>&1 28182452Spjdif [ -f /var/backups/md${no}.eli ]; then 29182452Spjd echo "ok 2 - no -B" 30182452Spjdelse 31182452Spjd echo "not ok 2 - no -B" 32182452Spjdfi 33182452Spjdgeli clear md${no} 34182452Spjdgeli attach -p -k $keyfile md${no} 2>/dev/null 35182452Spjdif [ $? -ne 0 ]; then 36182452Spjd echo "ok 3 - no -B" 37182452Spjdelse 38182452Spjd echo "not ok 3 - no -B" 39182452Spjdfi 40182452Spjdif [ ! -c /dev/md${no}.eli ]; then 41182452Spjd echo "ok 4 - no -B" 42182452Spjdelse 43182452Spjd echo "not ok 4 - no -B" 44182452Spjdfi 45182452Spjdgeli restore /var/backups/md${no}.eli md${no} 46182452Spjdif [ $? -eq 0 ]; then 47182452Spjd echo "ok 5 - no -B" 48182452Spjdelse 49182452Spjd echo "not ok 5 - no -B" 50182452Spjdfi 51182452Spjdgeli attach -p -k $keyfile md${no} 2>/dev/null 52182452Spjdif [ $? -eq 0 ]; then 53182452Spjd echo "ok 6 - no -B" 54182452Spjdelse 55182452Spjd echo "not ok 6 - no -B" 56182452Spjdfi 57182452Spjdif [ -c /dev/md${no}.eli ]; then 58182452Spjd echo "ok 7 - no -B" 59182452Spjdelse 60182452Spjd echo "not ok 7 - no -B" 61182452Spjdfi 62182452Spjdgeli detach md${no} 63182452Spjdrm -f /var/backups/md${no}.eli 64182452Spjd 65182452Spjd# -B file 66182452Spjdrm -f $backupfile 67182452Spjdgeli init -B $backupfile -P -K $keyfile md${no} >/dev/null 2>&1 68182452Spjdif [ -f $backupfile ]; then 69182452Spjd echo "ok 8 - -B file" 70182452Spjdelse 71182452Spjd echo "not ok 8 - -B file" 72182452Spjdfi 73182452Spjdgeli clear md${no} 74182452Spjdgeli attach -p -k $keyfile md${no} 2>/dev/null 75182452Spjdif [ $? -ne 0 ]; then 76182452Spjd echo "ok 9 - -B file" 77182452Spjdelse 78182452Spjd echo "not ok 9 - -B file" 79182452Spjdfi 80182452Spjdif [ ! -c /dev/md${no}.eli ]; then 81182452Spjd echo "ok 10 - -B file" 82182452Spjdelse 83182452Spjd echo "not ok 10 - -B file" 84182452Spjdfi 85182452Spjdgeli restore $backupfile md${no} 86182452Spjdif [ $? -eq 0 ]; then 87182452Spjd echo "ok 11 - -B file" 88182452Spjdelse 89182452Spjd echo "not ok 11 - -B file" 90182452Spjdfi 91182452Spjdgeli attach -p -k $keyfile md${no} 2>/dev/null 92182452Spjdif [ $? -eq 0 ]; then 93182452Spjd echo "ok 12 - -B file" 94182452Spjdelse 95182452Spjd echo "not ok 12 - -B file" 96182452Spjdfi 97182452Spjdif [ -c /dev/md${no}.eli ]; then 98182452Spjd echo "ok 13 - -B file" 99182452Spjdelse 100182452Spjd echo "not ok 13 - -B file" 101182452Spjdfi 102182452Spjdgeli detach md${no} 103182452Spjdrm -f $backupfile 104182452Spjd 105182452Spjdmdconfig -d -u $no 106182452Spjdrm -f $keyfile 107