attach_d_test.sh revision 148459
1148459Spjd#!/bin/sh 2148459Spjd# $FreeBSD: head/tools/regression/geom_eli/attach-d.t 148459 2005-07-27 22:27:30Z pjd $ 3148459Spjd 4148459Spjdbase=`basename $0` 5148459Spjdno=45 6148459Spjdsectors=100 7148459Spjdkeyfile=`mktemp /tmp/$base.XXXXXX` || exit 1 8148459Spjdmdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1 9148459Spjd 10148459Spjdecho "1..3" 11148459Spjd 12148459Spjddd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 13148459Spjd 14148459Spjdgeli init -P -K $keyfile md${no} 15148459Spjdgeli attach -d -p -k $keyfile md${no} 16148459Spjdif [ -c /dev/md${no}.eli ]; then 17148459Spjd echo "ok 1" 18148459Spjdelse 19148459Spjd echo "not ok 1" 20148459Spjdfi 21148459Spjd# Be sure it doesn't detach on read. 22148459Spjddd if=/dev/md${no}.eli of=/dev/null 2>/dev/null 23148459Spjdsleep 1 24148459Spjdif [ -c /dev/md${no}.eli ]; then 25148459Spjd echo "ok 2" 26148459Spjdelse 27148459Spjd echo "not ok 2" 28148459Spjdfi 29148459Spjdtrue > /dev/md${no}.eli 30148459Spjdsleep 1 31148459Spjdif [ ! -c /dev/md${no}.eli ]; then 32148459Spjd echo "ok 3" 33148459Spjdelse 34148459Spjd echo "not ok 3" 35148459Spjdfi 36148459Spjd 37148459Spjdmdconfig -d -u $no 38148459Spjdrm -f $keyfile 39