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