1 # $NetBSD: t_quotalimit.sh,v 1.4 2012/01/18 20:51:23 bouyer Exp $
3 # Copyright (c) 2011 Manuel Bouyer
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 # POSSIBILITY OF SUCH DAMAGE.
30 for q
in "user" "group"; do
31 test_case_root limit_
${e}_${v}_${q} limit_quota \
32 "hit hard limit quota with ${q} enabled" -b ${e} ${v} ${q}
33 test_case_root limit_${e}_${v}_${q}_log limit_quota \
34 "hit hard limit quota with
${q} enabled, WAPBL" -bl ${e} ${v} ${q}
35 test_case_root slimit_
${e}_${v}_${q} limit_softquota \
36 "hit soft limit quota with ${q} enabled after grace time" \
38 test_case_root inolimit_
${e}_${v}_${q} limit_iquota \
39 "hit hard limit ino quota with ${q} enabled" -b ${e} ${v} ${q}
40 test_case_root inolimit_${e}_${v}_${q}_log limit_iquota \
41 "hit hard limit ino quota with
${q} enabled, WAPBL" -bl ${e} ${v} ${q}
42 test_case_root sinolimit_
${e}_${v}_${q} limit_softiquota \
43 "hit soft limit ino quota with ${q} enabled after grace time" \
45 test_case_root herit_defq_
${e}_${v}_${q} inherit_defaultquota \
46 "new id herit from default for ${q} quota" -b ${e} ${v} ${q}
47 test_case_root herit_defq_${e}_${v}_${q}_log inherit_defaultquota \
48 "new id herit from default
for ${q} quota, WAPBL" -bl ${e} ${v} ${q}
49 test_case_root herit_idefq_
${e}_${v}_${q}_log inherit_defaultiquota \
50 "new id herit from default for ${q} ino quota, WAPBL" -bl ${e} ${v} ${q}
76 atf_fail "wrong quota
type"
80 for q in ${expect} ; do
82 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt edquota -$q -s2k/4 -h3k/6 \
85 atf_check -s exit:0 rump.halt
87 #now start the server which does the limits tests
88 atf_check -s exit:0 -o ignore \
89 -e match:'test 0: write up to hard limit returned 69: Disc quota exceeded' \
90 $(atf_get_srcdir)/h_quota2_tests -b 0 ${IMG} ${RUMP_SERVER}
91 for q in ${expect} ; do
93 -o match:'/mnt 3072 B\* 2048 B 3072 B 2:0 2 4 6 ' \
94 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -$q -h ${id}
96 -o match:'daemon \+- 3 2 3 2:0 2 4 6' \
97 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt repquota -$q /mnt
123 atf_fail "wrong quota
type"
127 for q in ${expect} ; do
128 atf_check -s exit:0 \
129 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt edquota -$q -s2k/4 -h3k/6 \
132 atf_check -s exit:0 rump.halt
134 #now start the server which does the limits tests
135 atf_check -s exit:0 -o ignore \
136 -e match:'test 1: write beyond the soft limit after grace time returned 69: Disc quota exceeded' \
137 $(atf_get_srcdir)/h_quota2_tests -b 1 ${IMG} ${RUMP_SERVER}
138 for q in ${expect} ; do
139 atf_check -s exit:0 \
140 -o match:'/mnt 2560 B\* 2048 B 3072 B none 2 4 6 ' \
141 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -$q -h ${id}
142 atf_check -s exit:0 \
143 -o match:'daemon \+- 2 2 3 none 2 4 6' \
144 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt repquota -$q /mnt
170 atf_fail "wrong quota
type"
174 for q in ${expect} ; do
175 atf_check -s exit:0 \
176 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt edquota -$q -s2m/4 -h3m/6 \
179 atf_check -s exit:0 rump.halt
181 #now start the server which does the limits tests
182 atf_check -s exit:0 -o ignore \
183 -e match:'test 2: create file up to hard limit returned 69: Disc quota exceeded' \
184 $(atf_get_srcdir)/h_quota2_tests -b 2 ${IMG} ${RUMP_SERVER}
185 for q in ${expect} ; do
186 atf_check -s exit:0 \
187 -o match:'/mnt 3072 B 2048 K 3072 K 6 \* 4 6 2:0' \
188 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -$q -h ${id}
189 atf_check -s exit:0 \
190 -o match:'daemon -\+ 3 2048 3072 6 4 6 2:0' \
191 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt repquota -$q /mnt
217 atf_fail "wrong quota
type"
221 for q in ${expect} ; do
222 atf_check -s exit:0 \
223 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt edquota -$q -s2m/4 -h3m/6 \
226 atf_check -s exit:0 rump.halt
228 #now start the server which does the limits tests
229 atf_check -s exit:0 -o ignore \
230 -e match:'test 3: create file beyond the soft limit after grace time returned 69: Disc quota exceeded' \
231 $(atf_get_srcdir)/h_quota2_tests -b 3 ${IMG} ${RUMP_SERVER}
232 for q in ${expect} ; do
233 atf_check -s exit:0 \
234 -o match:'/mnt 2560 B 2048 K 3072 K 5 \* 4 6 none' \
235 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -$q -h ${id}
236 atf_check -s exit:0 \
237 -o match:'daemon -\+ 2 2048 3072 5 4 6 none' \
238 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt repquota -$q /mnt
243 inherit_defaultquota()
264 atf_fail "wrong quota
type"
268 for q in ${expect} ; do
269 atf_check -s exit:0 \
270 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt edquota -$q -s2k/4 -h3k/6 \
273 for q in ${expect} ; do
274 atf_check -s exit:0 \
275 -o match:'Disk quotas for .*id 1\): none' \
276 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -$q -v ${id}
278 atf_check -s exit:0 rump.halt
280 #now start the server which does the limits tests
281 atf_check -s exit:0 -o ignore \
282 -e match:'test 0: write up to hard limit returned 69: Disc quota exceeded' \
283 $(atf_get_srcdir)/h_quota2_tests -b 0 ${IMG} ${RUMP_SERVER}
284 for q in ${expect} ; do
285 atf_check -s exit:0 \
286 -o match:'/mnt 3072 B\* 2048 B 3072 B 2:0 2 4 6 ' \
287 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -$q -h ${id}
288 atf_check -s exit:0 \
289 -o match:'daemon \+- 3 2 3 2:0 2 4 6' \
290 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt repquota -$q /mnt
295 inherit_defaultiquota()
316 atf_fail "wrong quota
type"
320 for q in ${expect} ; do
321 atf_check -s exit:0 \
322 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt edquota -$q -s2m/4 -h3m/6 \
325 for q in ${expect} ; do
326 atf_check -s exit:0 \
327 -o match:'Disk quotas for .*id 1\): none' \
328 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -$q -v ${id}
330 atf_check -s exit:0 rump.halt
332 #now start the server which does the limits tests
333 atf_check -s exit:0 -o ignore \
334 -e match:'test 2: create file up to hard limit returned 69: Disc quota exceeded' \
335 $(atf_get_srcdir)/h_quota2_tests -b 2 ${IMG} ${RUMP_SERVER}
336 for q in ${expect} ; do
337 atf_check -s exit:0 \
338 -o match:'/mnt 3072 B 2048 K 3072 K 6 \* 4 6 2:0' \
339 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -$q -h ${id}
340 atf_check -s exit:0 \
341 -o match:'daemon -\+ 3 2048 3072 6 4 6 2:0' \
342 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt repquota -$q /mnt