1 # $NetBSD: t_clearquota.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 clear_
${e}_${v}_${q} clear_quota \
32 "clear quota with ${q} enabled" -b ${e} ${v} ${q}
34 test_case_root clear_${e}_${v}_"both
" clear_quota \
35 "clear quota with both enabled
" -b ${e} ${v} "both
"
36 test_case_root clear_${e}_${v}_"both_log
" clear_quota \
37 "clear quota
for new id with both enabled
, WAPBL
" -bl ${e} ${v} "both
"
63 atf_fail "wrong quota
type"
67 #set and check the expected quota
68 for q in ${expect} ; do
70 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt edquota -$q -s10k/20 -h40M/50k \
73 -o "match
:/mnt
0 10 40960 2weeks
0 20 51200 3days
" \
74 -o "match
:Disk quotas
for .
*: $
" \
75 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -${q} -v ${id}
78 for q in ${expect} ; do
80 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt edquota -$q -c ${id}
83 #check that we do not get positive reply for any quota type
85 atf_check -s exit:0 -o "not-match
:/mnt
" \
86 -o "not-match
:Disk quotas
for .
*: $
" \
87 -o "match
:Disk quotas
for .
*: none$
" \
88 env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -${q} -v ${id}