1# $FreeBSD$ 2 3atf_test_case detach_l cleanup 4detach_l_head() 5{ 6 atf_set "descr" "geli detach -l will cause a provider to detach on last close" 7 atf_set "require.user" "root" 8} 9detach_l_body() 10{ 11 . $(atf_get_srcdir)/conf.sh 12 13 sectors=100 14 md=$(attach_md -t malloc -s `expr $sectors + 1`) 15 16 atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none 17 18 atf_check geli init -B none -P -K keyfile ${md} 19 atf_check geli attach -p -k keyfile ${md} 20 21 # Be sure it doesn't detach before 'detach -l'. 22 atf_check dd if=/dev/${md}.eli of=/dev/null status=none 23 sleep 1 24 if [ ! -c /dev/${md}.eli ]; then 25 atf_fail "provider detached on last close without detach -l" 26 fi 27 atf_check geli detach -l ${md} 28 if [ ! -c /dev/${md}.eli ]; then 29 atf_fail "Provider detached before last close" 30 fi 31 atf_check dd if=/dev/${md}.eli of=/dev/null status=none 32 sleep 1 33 if [ -c /dev/${md}.eli ]; then 34 atf_fail "Provider did not detach on last close" 35 fi 36} 37detach_l_cleanup() 38{ 39 . $(atf_get_srcdir)/conf.sh 40 geli_test_cleanup 41} 42 43atf_init_test_cases() 44{ 45 atf_add_test_case detach_l 46} 47