1155185Spjd#!/bin/sh 2155185Spjd# $FreeBSD: releng/11.0/tests/sys/geom/class/eli/nokey_test.sh 293821 2016-01-13 09:14:27Z ngie $ 3155185Spjd 4293436Sngie. $(dirname $0)/conf.sh 5293436Sngie 6155185Spjdbase=`basename $0` 7155185Spjdsectors=100 8293436Sngiekeyfile=`mktemp $base.XXXXXX` || exit 1 9155185Spjdmdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1 10155185Spjd 11155185Spjdecho "1..8" 12155185Spjd 13182452Spjdgeli init -B none -P md${no} 2>/dev/null 14155185Spjdif [ $? -ne 0 ]; then 15155185Spjd echo "ok 1" 16155185Spjdelse 17155185Spjd echo "not ok 1" 18155185Spjdfi 19155185Spjd 20155185Spjddd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 21155185Spjd 22182452Spjdgeli init -B none -P -K ${keyfile} md${no} 2>/dev/null 23155185Spjdif [ $? -eq 0 ]; then 24155185Spjd echo "ok 2" 25155185Spjdelse 26155185Spjd echo "not ok 2" 27155185Spjdfi 28155185Spjdgeli attach -p md${no} 2>/dev/null 29155185Spjdif [ $? -ne 0 ]; then 30155185Spjd echo "ok 3" 31155185Spjdelse 32155185Spjd echo "not ok 3" 33155185Spjdfi 34155185Spjdgeli attach -p -k ${keyfile} md${no} 2>/dev/null 35155185Spjdif [ $? -eq 0 ]; then 36155185Spjd echo "ok 4" 37155185Spjdelse 38155185Spjd echo "not ok 4" 39155185Spjdfi 40155185Spjdgeli setkey -n 0 -P md${no} 2>/dev/null 41155185Spjdif [ $? -ne 0 ]; then 42155185Spjd echo "ok 5" 43155185Spjdelse 44155185Spjd echo "not ok 5" 45155185Spjdfi 46155185Spjdgeli detach md${no} 2>/dev/null 47155185Spjdif [ $? -eq 0 ]; then 48155185Spjd echo "ok 6" 49155185Spjdelse 50155185Spjd echo "not ok 6" 51155185Spjdfi 52155185Spjdgeli setkey -n 0 -p -P -K ${keyfile} md${no} 2>/dev/null 53155185Spjdif [ $? -ne 0 ]; then 54155185Spjd echo "ok 7" 55155185Spjdelse 56155185Spjd echo "not ok 7" 57155185Spjdfi 58155185Spjdgeli setkey -n 0 -p -k ${keyfile} -P md${no} 2>/dev/null 59155185Spjdif [ $? -ne 0 ]; then 60155185Spjd echo "ok 8" 61155185Spjdelse 62155185Spjd echo "not ok 8" 63155185Spjdfi 64155185Spjd 65155185Spjdrm -f $keyfile 66