ffs_common.sh revision 1.1
11.1Sbouyer# $NetBSD: ffs_common.sh,v 1.1 2012/01/18 20:51:23 bouyer Exp $ 21.1Sbouyer 31.1Sbouyercreate_ffs() 41.1Sbouyer{ 51.1Sbouyer local endian=$1; shift 61.1Sbouyer local vers=$1; shift 71.1Sbouyer local type=$1; shift 81.1Sbouyer local op; 91.1Sbouyer if [ ${type} = "both" ]; then 101.1Sbouyer op="-q user -q group" 111.1Sbouyer else 121.1Sbouyer op="-q ${type}" 131.1Sbouyer fi 141.1Sbouyer atf_check -o ignore -e ignore newfs ${op} \ 151.1Sbouyer -B ${endian} -O ${vers} -s 4000 -F ${IMG} 161.1Sbouyer} 171.1Sbouyer 181.1Sbouyercreate_ffs_server() 191.1Sbouyer{ 201.1Sbouyer local sarg=$1; shift 211.1Sbouyer create_ffs $* 221.1Sbouyer atf_check -o ignore -e ignore $(atf_get_srcdir)/h_ffs_server \ 231.1Sbouyer ${sarg} ${IMG} ${RUMP_SERVER} 241.1Sbouyer} 251.1Sbouyer 261.1Sbouyerrump_shutdown() 271.1Sbouyer{ 281.1Sbouyer for s in ${RUMP_SOCKETS_LIST}; do 291.1Sbouyer atf_check -s exit:0 env RUMP_SERVER=unix://${s} rump.halt; 301.1Sbouyer done 311.1Sbouyer# check that the quota inode creation didn't corrupt the filesystem 321.1Sbouyer atf_check -s exit:0 -o "match:already clean" \ 331.1Sbouyer -o "match:Phase 6 - Check Quotas" \ 341.1Sbouyer fsck_ffs -nf -F ${IMG} 351.1Sbouyer} 361.1Sbouyer 371.1Sbouyer# from tests/ipf/h_common.sh via tests/sbin/resize_ffs 381.1Sbouyertest_case() 391.1Sbouyer{ 401.1Sbouyer local name="${1}"; shift 411.1Sbouyer local check_function="${1}"; shift 421.1Sbouyer local descr="${1}"; shift 431.1Sbouyer 441.1Sbouyer atf_test_case "${name}" cleanup 451.1Sbouyer 461.1Sbouyer eval "${name}_head() { \ 471.1Sbouyer atf_set "descr" "${descr}" 481.1Sbouyer atf_set "timeout" "60" 491.1Sbouyer }" 501.1Sbouyer eval "${name}_body() { \ 511.1Sbouyer RUMP_SOCKETS_LIST=\${RUMP_SOCKET}; \ 521.1Sbouyer export RUMP_SERVER=unix://\${RUMP_SOCKET}; \ 531.1Sbouyer ${check_function} " "${@}" "; \ 541.1Sbouyer }" 551.1Sbouyer eval "${name}_cleanup() { \ 561.1Sbouyer for s in \${RUMP_SOCKETS_LIST}; do \ 571.1Sbouyer export RUMP_SERVER=unix://\${s}; \ 581.1Sbouyer atf_check -s exit:1 -o ignore -e ignore rump.halt; \ 591.1Sbouyer done; \ 601.1Sbouyer }" 611.1Sbouyer tests="${tests} ${name}" 621.1Sbouyer} 631.1Sbouyer 641.1Sbouyertest_case_root() 651.1Sbouyer{ 661.1Sbouyer local name="${1}"; shift 671.1Sbouyer local check_function="${1}"; shift 681.1Sbouyer local descr="${1}"; shift 691.1Sbouyer 701.1Sbouyer atf_test_case "${name}" cleanup 711.1Sbouyer 721.1Sbouyer eval "${name}_head() { \ 731.1Sbouyer atf_set "descr" "${descr}" 741.1Sbouyer atf_set "require.user" "root" 751.1Sbouyer atf_set "timeout" "60" 761.1Sbouyer }" 771.1Sbouyer eval "${name}_body() { \ 781.1Sbouyer RUMP_SOCKETS_LIST=\${RUMP_SOCKET}; \ 791.1Sbouyer export RUMP_SERVER=unix://\${RUMP_SOCKET}; \ 801.1Sbouyer ${check_function} " "${@}" "; \ 811.1Sbouyer }" 821.1Sbouyer eval "${name}_cleanup() { \ 831.1Sbouyer for s in \${RUMP_SOCKETS_LIST}; do \ 841.1Sbouyer export RUMP_SERVER=unix://\${s}; \ 851.1Sbouyer atf_check -s exit:1 -o ignore -e ignore rump.halt; \ 861.1Sbouyer done; \ 871.1Sbouyer }" 881.1Sbouyer tests="${tests} ${name}" 891.1Sbouyer} 901.1Sbouyer 911.1Sbouyeratf_init_test_cases() 921.1Sbouyer{ 931.1Sbouyer IMG=fsimage 941.1Sbouyer DIR=target 951.1Sbouyer RUMP_SOCKET=test; 961.1Sbouyer for i in ${tests}; do 971.1Sbouyer atf_add_test_case $i 981.1Sbouyer done 991.1Sbouyer} 100