attach_d_test.sh revision 293436
1148459Spjd#!/bin/sh 2148459Spjd# $FreeBSD: head/tools/regression/geom_eli/attach-d.t 293436 2016-01-08 19:38:59Z ngie $ 3148459Spjd 4293436Sngie. $(dirname $0)/conf.sh 5293436Sngie 6148459Spjdbase=`basename $0` 7148459Spjdsectors=100 8293436Sngiekeyfile=`mktemp $base.XXXXXX` || exit 1 9148459Spjdmdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1 10148459Spjd 11148459Spjdecho "1..3" 12148459Spjd 13148459Spjddd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 14148459Spjd 15182452Spjdgeli init -B none -P -K $keyfile md${no} 16148459Spjdgeli attach -d -p -k $keyfile md${no} 17148459Spjdif [ -c /dev/md${no}.eli ]; then 18148459Spjd echo "ok 1" 19148459Spjdelse 20148459Spjd echo "not ok 1" 21148459Spjdfi 22148459Spjd# Be sure it doesn't detach on read. 23148459Spjddd if=/dev/md${no}.eli of=/dev/null 2>/dev/null 24148459Spjdsleep 1 25148459Spjdif [ -c /dev/md${no}.eli ]; then 26148459Spjd echo "ok 2" 27148459Spjdelse 28148459Spjd echo "not ok 2" 29148459Spjdfi 30148459Spjdtrue > /dev/md${no}.eli 31148459Spjdsleep 1 32148459Spjdif [ ! -c /dev/md${no}.eli ]; then 33148459Spjd echo "ok 3" 34148459Spjdelse 35148459Spjd echo "not ok 3" 36148459Spjdfi 37148459Spjd 38148459Spjdrm -f $keyfile 39