quotas_common.sh revision 1.2
1# $NetBSD: quotas_common.sh,v 1.2 2011/03/06 17:08:40 bouyer Exp $ 2 3create_with_quotas() 4{ 5 local endian=$1; shift 6 local vers=$1; shift 7 local type=$1; shift 8 local op; 9 if [ ${type} = "both" ]; then 10 op="-q user -q group" 11 else 12 op="-q ${type}" 13 fi 14 atf_check -o ignore -e ignore newfs ${op} \ 15 -B ${endian} -O ${vers} -s 4000 -F ${IMG} 16} 17 18create_with_quotas_server() 19{ 20 local sarg=$1; shift 21 create_with_quotas $* 22 atf_check -o ignore -e ignore $(atf_get_srcdir)/h_quota2_server \ 23 ${sarg} ${IMG} ${RUMP_SERVER} 24} 25 26rump_shutdown() 27{ 28 atf_check -s exit:0 rump.halt 29# check that the quota inode creation didn't corrupt the filesystem 30 atf_check -s exit:0 -o "match:already clean" \ 31 -o "match:Phase 6 - Check Quotas" \ 32 fsck_ffs -nf -F ${IMG} 33} 34 35# from tests/ipf/h_common.sh via tests/sbin/resize_ffs 36test_case() 37{ 38 local name="${1}"; shift 39 local check_function="${1}"; shift 40 local descr="${1}"; shift 41 42 atf_test_case "${name}" cleanup 43 44 eval "${name}_head() { \ 45 atf_set "descr" "${descr}" 46 atf_set "timeout" "60" 47 }" 48 eval "${name}_body() { \ 49 ${check_function} " "${@}" "; \ 50 }" 51 eval "${name}_cleanup() { \ 52 atf_check -s exit:1 -o ignore -e ignore rump.halt; \ 53 }" 54 tests="${tests} ${name}" 55} 56 57test_case_root() 58{ 59 local name="${1}"; shift 60 local check_function="${1}"; shift 61 local descr="${1}"; shift 62 63 atf_test_case "${name}" cleanup 64 65 eval "${name}_head() { \ 66 atf_set "descr" "${descr}" 67 atf_set "require.user" "root" 68 atf_set "timeout" "60" 69 }" 70 eval "${name}_body() { \ 71 ${check_function} " "${@}" "; \ 72 }" 73 eval "${name}_cleanup() { \ 74 atf_check -s exit:1 -o ignore -e ignore rump.halt; \ 75 }" 76 tests="${tests} ${name}" 77} 78 79atf_init_test_cases() 80{ 81 IMG=fsimage 82 DIR=target 83 RUMP_SOCKET=test 84 RUMP_SERVER=unix://${RUMP_SOCKET} 85 export RUMP_SERVER 86 for i in ${tests}; do 87 atf_add_test_case $i 88 done 89} 90