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