Module Name:    src
Committed By:   bouyer
Date:           Wed Feb  2 21:01:09 UTC 2011

Modified Files:
        src/tests/fs/ffs [bouyer-quota2]: t_quotalimit.sh

Log Message:
Check that a new id properly get limits from the defaults.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/tests/fs/ffs/t_quotalimit.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/fs/ffs/t_quotalimit.sh
diff -u src/tests/fs/ffs/t_quotalimit.sh:1.1.2.1 src/tests/fs/ffs/t_quotalimit.sh:1.1.2.2
--- src/tests/fs/ffs/t_quotalimit.sh:1.1.2.1	Wed Feb  2 19:17:08 2011
+++ src/tests/fs/ffs/t_quotalimit.sh	Wed Feb  2 21:01:08 2011
@@ -1,4 +1,4 @@
-# $NetBSD: t_quotalimit.sh,v 1.1.2.1 2011/02/02 19:17:08 bouyer Exp $ 
+# $NetBSD: t_quotalimit.sh,v 1.1.2.2 2011/02/02 21:01:08 bouyer Exp $ 
 #
 #  Copyright (c) 2011 Manuel Bouyer
 #  All rights reserved.
@@ -36,6 +36,10 @@
 	 "hit hard limit ino quota with ${q} enabled" ${e} ${v} ${q}
       test_case_root sinolimit_${e}_${v}_${q} limit_softiquota \
 	 "hit soft limit ino quota with ${q} enabled after grace time" ${e} ${v} ${q}
+      test_case_root herit_defq_${e}_${v}_${q} inherit_defaultquota \
+	 "new id herit from default for ${q} quota" ${e} ${v} ${q}
+      test_case_root herit_idefq_${e}_${v}_${q} inherit_defaultiquota \
+	 "new id herit from default for ${q} ino quota" ${e} ${v} ${q}
     done
   done
 done
@@ -227,3 +231,107 @@
 	done
 	rump_shutdown
 }
+
+inherit_defaultquota()
+{
+	create_with_quotas_server $*
+	local q=$3
+	local expect
+	local id=1
+
+	case ${q} in
+	user)
+		expect=u
+		fail=g
+		;;
+	group)
+		expect=g
+		fail=u
+		;;
+	both)
+		expect="u g"
+		fail=""
+		;;
+	*)
+		atf_fail "wrong quota type"
+		;;
+	esac
+
+	for q in ${expect} ; do
+		atf_check -s exit:0 \
+		   $(atf_get_srcdir)/rump_edquota -$q -s2k/4 -h3k/6 \
+		   -t 2h/2h -d
+	done
+	for q in ${expect} ; do
+		atf_check -s exit:0 \
+		    -o match:'Disk quotas for .*id 1\): none' \
+		    $(atf_get_srcdir)/rump_quota -$q -v ${id}
+	done
+	atf_check -s exit:0 rump.halt
+
+	#now start the server which does the limits tests
+	atf_check -s exit:0 -o ignore \
+-e match:'test 0: write up to hard limit returned 69: Disc quota exceeded' \
+	    $(atf_get_srcdir)/h_quota2_tests -b 0 ${IMG} ${RUMP_SERVER}
+	for q in ${expect} ; do
+		atf_check -s exit:0 \
+		    -o match:'/mnt   2560 B\*  2048 B   3072 B     2:0      2       4       6         ' \
+		    $(atf_get_srcdir)/rump_quota -$q -h ${id}
+		atf_check -s exit:0 \
+		    -o match:'daemon    \+-        2        2        3    2:0         2       4       6' \
+		    $(atf_get_srcdir)/rump_repquota -$q /mnt
+	done
+	rump_shutdown
+}
+
+inherit_defaultiquota()
+{
+	create_with_quotas_server $*
+	local q=$3
+	local expect
+	local id=1
+
+	case ${q} in
+	user)
+		expect=u
+		fail=g
+		;;
+	group)
+		expect=g
+		fail=u
+		;;
+	both)
+		expect="u g"
+		fail=""
+		;;
+	*)
+		atf_fail "wrong quota type"
+		;;
+	esac
+
+	for q in ${expect} ; do
+		atf_check -s exit:0 \
+		   $(atf_get_srcdir)/rump_edquota -$q -s2m/4 -h3m/6 \
+		   -t 2h/2h -d
+	done
+	for q in ${expect} ; do
+		atf_check -s exit:0 \
+		    -o match:'Disk quotas for .*id 1\): none' \
+		    $(atf_get_srcdir)/rump_quota -$q -v ${id}
+	done
+	atf_check -s exit:0 rump.halt
+
+	#now start the server which does the limits tests
+	atf_check -s exit:0 -o ignore \
+-e match:'test 2: create file up to hard limit returned 69: Disc quota exceeded' \
+	    $(atf_get_srcdir)/h_quota2_tests -b 2 ${IMG} ${RUMP_SERVER}
+	for q in ${expect} ; do
+		atf_check -s exit:0 \
+		    -o match:'/mnt   2560 B   2048 K   3072 K              5 \*     4       6      2:0' \
+		    $(atf_get_srcdir)/rump_quota -$q -h ${id}
+		atf_check -s exit:0 \
+		    -o match:'daemon    -\+        2     2048     3072                5       4       6    2:0' \
+		    $(atf_get_srcdir)/rump_repquota -$q /mnt
+	done
+	rump_shutdown
+}

Reply via email to