1# $NetBSD: ffs_common.sh,v 1.5 2020/08/20 07:23:20 gson Exp $ 2 3create_ffs() 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_ffs_server() 19{ 20 local sarg=$1; shift 21 create_ffs $* 22 atf_check -o ignore -e ignore $(atf_get_srcdir)/h_ffs_server \ 23 ${sarg} ${IMG} ${RUMP_SERVER} 24} 25 26# from tests/ipf/h_common.sh via tests/sbin/resize_ffs 27test_case() 28{ 29 local name="${1}"; shift 30 local check_function="${1}"; shift 31 local descr="${1}"; shift 32 33 atf_test_case "${name}" 34 35 eval "${name}_head() { \ 36 atf_set "descr" "${descr}" 37 atf_set "timeout" "120" 38 }" 39 eval "${name}_body() { \ 40 RUMP_SOCKETS_LIST=\${RUMP_SOCKET}; \ 41 export RUMP_SERVER=unix://\${RUMP_SOCKET}; \ 42 ${check_function} " "${@}" "; \ 43 }" 44 tests="${tests} ${name}" 45} 46 47test_case_root() 48{ 49 local name="${1}"; shift 50 local check_function="${1}"; shift 51 local descr="${1}"; shift 52 53 atf_test_case "${name}" 54 55 eval "${name}_head() { \ 56 atf_set "descr" "${descr}" 57 atf_set "require.user" "root" 58 atf_set "timeout" "360" 59 }" 60 eval "${name}_body() { \ 61 RUMP_SOCKETS_LIST=\${RUMP_SOCKET}; \ 62 export RUMP_SERVER=unix://\${RUMP_SOCKET}; \ 63 ${check_function} " "${@}" "; \ 64 }" 65 tests="${tests} ${name}" 66} 67 68atf_init_test_cases() 69{ 70 IMG=fsimage 71 DIR=target 72 RUMP_SOCKET=test; 73 for i in ${tests}; do 74 atf_add_test_case $i 75 done 76} 77