xref: /netbsd-src/tests/sbin/newfs/t_enable_quotas.sh (revision 4fac6e71e424a0c5eb745dfe7d685e1a1c4f1fb6)
1*4fac6e71Sjruoho# $NetBSD: t_enable_quotas.sh,v 1.3 2012/03/18 09:31:50 jruoho Exp $
2063f96f3Sbouyer#
3063f96f3Sbouyer#  Copyright (c) 2011 Manuel Bouyer
4063f96f3Sbouyer#  All rights reserved.
5063f96f3Sbouyer#
6063f96f3Sbouyer#  Redistribution and use in source and binary forms, with or without
7063f96f3Sbouyer#  modification, are permitted provided that the following conditions
8063f96f3Sbouyer#  are met:
9063f96f3Sbouyer#  1. Redistributions of source code must retain the above copyright
10063f96f3Sbouyer#     notice, this list of conditions and the following disclaimer.
11063f96f3Sbouyer#  2. Redistributions in binary form must reproduce the above copyright
12063f96f3Sbouyer#     notice, this list of conditions and the following disclaimer in the
13063f96f3Sbouyer#     documentation and/or other materials provided with the distribution.
14063f96f3Sbouyer#
15063f96f3Sbouyer#  THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16063f96f3Sbouyer#  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17063f96f3Sbouyer#  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18063f96f3Sbouyer#  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19063f96f3Sbouyer#  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20063f96f3Sbouyer#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21063f96f3Sbouyer#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22063f96f3Sbouyer#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23063f96f3Sbouyer#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24063f96f3Sbouyer#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25063f96f3Sbouyer#  POSSIBILITY OF SUCH DAMAGE.
26063f96f3Sbouyer#
27063f96f3Sbouyer
28063f96f3Sbouyerfor e in le be; do
29063f96f3Sbouyer  for v in 1 2; do
30063f96f3Sbouyer    for q in "user" "group"; do
31063f96f3Sbouyer      test_case enabled_${e}_${v}_${q} quota_enabled_single \
32063f96f3Sbouyer	 "creation of" ${e} ${v} ${q}
33063f96f3Sbouyer    done
34063f96f3Sbouyer    test_case enabled_${e}_${v}_"both" quota_enabled_both \
35063f96f3Sbouyer	 "creation of" ${e} ${v} "both"
36063f96f3Sbouyer  done
37063f96f3Sbouyerdone
38063f96f3Sbouyer
39063f96f3Sbouyerquota_enabled_single()
40063f96f3Sbouyer{
41063f96f3Sbouyer	create_with_quotas $*
42063f96f3Sbouyer
43063f96f3Sbouyer# check that the quota inode creation didn't corrupt the filesystem
44063f96f3Sbouyer	atf_check -s exit:0 -o "match:already clean" -o "match:2 files" \
45063f96f3Sbouyer		-o "match:Phase 6 - Check Quotas" \
46063f96f3Sbouyer		fsck_ffs -nf -F ${IMG}
47063f96f3Sbouyer}
48063f96f3Sbouyer
49063f96f3Sbouyerquota_enabled_both()
50063f96f3Sbouyer{
51063f96f3Sbouyer	create_with_quotas $*
52063f96f3Sbouyer
53063f96f3Sbouyer# check that the quota inode creation didn't corrupt the filesystem
54063f96f3Sbouyer	atf_check -s exit:0 -o "match:already clean" -o "match:3 files" \
55063f96f3Sbouyer		-o "match:Phase 6 - Check Quotas" \
56063f96f3Sbouyer		fsck_ffs -nf -F ${IMG}
57063f96f3Sbouyer}
58