1 # $NetBSD: t_setquota.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 set_
${e}_${v}_${q} set_quota \
32 "set quota with ${q} enabled" -b ${e} ${v} ${q}
33 test_case_root set_new_${e}_${v}_${q} set_quota_new \
34 "set quota
for new id with
${q} enabled" -b ${e} ${v} ${q}
35 test_case_root set_default_
${e}_${v}_${q} set_quota_default \
36 "set default quota with ${q} enabled" -b ${e} ${v} ${q}
38 test_case_root set_${e}_${v}_"both
" set_quota \
39 "set quota with both enabled
" -b ${e} ${v} "both
"
40 test_case_root set_new_${e}_${v}_"both
" set_quota_new \
41 "set quota
for new id with both enabled
" -b ${e} ${v} "both
"
42 test_case_root set_new_${e}_${v}_"both_log
" set_quota_new \
43 "set quota
for new id with both enabled
, WAPBL
" -bl ${e} ${v} "both
"
44 test_case_root set_default_${e}_${v}_"both
" set_quota_default \
45 "set default quota with both enabled
" -b ${e} ${v} "both
"
70 atf_fail "wrong quota
type"
74 #check that we can set the expected quota
75 for q in ${expect} ; do
78 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt edquota -$q -s10k/20 -h40M/50k \
81 -o "match
:/mnt
0 10 40960 2weeks
1 20 51200 3days
" \
82 -o "match
:Disk quotas
for .
*: $
" \
83 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -${q} -v
85 -o "match
:-- 0 10 40960 1 20 51200" \
86 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt repquota -${q} /mnt
89 #check that we do not get positive reply for non-expected quota
93 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt edquota -$q -s10k/20 -h40M/50k ${id}
94 atf_check -s exit:0 -o "not-match
:/mnt
" \
95 -o "not-match
:Disk quotas
for .
*: $
" \
96 -o "match
:Disk quotas
for .
*: none$
" \
97 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -${q} -v
99 -o "not-match
:-- 0 - -" \
100 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt repquota -${q} /mnt
126 atf_fail "wrong quota
type"
130 #check that we can set the expected quota
131 for q in ${expect} ; do
133 atf_check -s exit:0 \
134 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt edquota -$q -s10k/20 -h40M/50k \
136 atf_check -s exit:0 \
137 -o "match
:/mnt
0 10 40960 2years
0 20 51200 9months
" \
138 -o "match
:Disk quotas
for .
*: $
" \
139 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -${q} -v ${id}
142 #check that we do not get positive reply for non-expected quota
143 for q in ${fail} ; do
145 atf_check -s exit:0 \
146 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt edquota -$q -s10k/20 -h40M/50k ${id}
147 atf_check -s exit:0 -o "not-match
:/mnt
" \
148 -o "not-match
:Disk quotas
for .
*: $
" \
149 -o "match
:Disk quotas
for .
*: none$
" \
150 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -${q} -v ${id}
176 atf_fail "wrong quota
type"
180 #check that we can set the expected quota
181 for q in ${expect} ; do
183 atf_check -s exit:0 \
184 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt edquota -$q -s10k/20 -h40M/50k \
186 atf_check -s exit:0 \
187 -o "match
:/mnt
0 10 40960 2:2 0 20 51200 59" \
188 -o "match
:Default
(user|group
) disk quotas
: $
" \
189 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -${q} -v ${id}
192 #check that we do not get positive reply for non-expected quota
193 for q in ${fail} ; do
195 atf_check -s exit:0 \
196 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt edquota -$q -s10k/20 -h40M/50k ${id}
197 atf_check -s exit:0 -o "not-match
:/mnt
" \
198 -o "not-match
:Default
(user|group
) disk quotas
: $
" \
199 -o "match
:Default
(user|group
) disk quotas
: none$
" \
200 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -${q} -v ${id}