CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sat Mar 5 18:54:48 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: t_getquota.sh Log Message: Also check that repquota doesn't report any overquota user To generate a diff of this commit: cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/tests/fs/ffs/t_getquota.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_getquota.sh diff -u src/tests/fs/ffs/t_getquota.sh:1.1.2.8 src/tests/fs/ffs/t_getquota.sh:1.1.2.9 --- src/tests/fs/ffs/t_getquota.sh:1.1.2.8 Fri Feb 11 16:54:03 2011 +++ src/tests/fs/ffs/t_getquota.sh Sat Mar 5 18:54:47 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_getquota.sh,v 1.1.2.8 2011/02/11 16:54:03 bouyer Exp $ +# $NetBSD: t_getquota.sh,v 1.1.2.9 2011/03/05 18:54:47 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -69,6 +69,7 @@ $(atf_get_srcdir)/rump_quota -${q} -v atf_check -s exit:0 \ -o "match:--0--1 - -" \ +-o "not-match:\+\+" \ $(atf_get_srcdir)/rump_repquota -${q} /mnt done
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sun Feb 13 20:58:28 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: h_quota2_tests.c t_miscquota.sh Log Message: Add a test checking that an unlinked file cleaned by the log replay keeps quotas up to date. To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/tests/fs/ffs/h_quota2_tests.c cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/tests/fs/ffs/t_miscquota.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/h_quota2_tests.c diff -u src/tests/fs/ffs/h_quota2_tests.c:1.1.2.4 src/tests/fs/ffs/h_quota2_tests.c:1.1.2.5 --- src/tests/fs/ffs/h_quota2_tests.c:1.1.2.4 Sat Feb 12 21:49:08 2011 +++ src/tests/fs/ffs/h_quota2_tests.c Sun Feb 13 20:58:28 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: h_quota2_tests.c,v 1.1.2.4 2011/02/12 21:49:08 bouyer Exp $ */ +/* $NetBSD: h_quota2_tests.c,v 1.1.2.5 2011/02/13 20:58:28 bouyer Exp $ */ /* * rump server for advanced quota tests @@ -35,6 +35,7 @@ int fd; int error; rump_sys_chown(".", TEST_NONROOT_ID, TEST_NONROOT_ID); + rump_sys_chmod(".", 0777); if (rump_sys_setegid(TEST_NONROOT_ID) != 0) { error = errno; perror("rump_sys_setegid"); @@ -67,6 +68,7 @@ int fd; int error; rump_sys_chown(".", TEST_NONROOT_ID, TEST_NONROOT_ID); + rump_sys_chmod(".", 0777); if (rump_sys_setegid(TEST_NONROOT_ID) != 0) { error = errno; perror("rump_sys_setegid"); @@ -115,6 +117,7 @@ int error; int i; rump_sys_chown(".", TEST_NONROOT_ID, TEST_NONROOT_ID); + rump_sys_chmod(".", 0777); if (rump_sys_setegid(TEST_NONROOT_ID) != 0) { error = errno; perror("rump_sys_setegid"); @@ -151,6 +154,7 @@ int error; int i; rump_sys_chown(".", TEST_NONROOT_ID, TEST_NONROOT_ID); + rump_sys_chmod(".", 0777); if (rump_sys_setegid(TEST_NONROOT_ID) != 0) { error = errno; perror("rump_sys_setegid"); @@ -204,6 +208,8 @@ * take an internal snapshot of the filesystem, and create a new * file with some data */ + rump_sys_chown(".", 0, 0); + rump_sys_chmod(".", 0777); for (i =0; testopts && i < strlen(testopts); i++) { switch(testopts[i]) { @@ -233,8 +239,10 @@ fss.fss_csize = 0; if (rump_sys_ioctl(fssfd, FSSIOCSET, &fss) == -1) err(1, "create snapshot"); - if (unl) - rump_sys_unlink(FSTEST_MNTNAME "/le_snap"); + if (unl) { + if (rump_sys_unlink(FSTEST_MNTNAME "/le_snap") == -1) + err(1, "unlink snapshot"); + } /* now create some extra files */ @@ -253,6 +261,63 @@ return 0; } +static int +quota_test5(const char *testopts) +{ + static char buf[512]; + int fd; + int remount = 0; + int unlnk = 0; + int log = 0; + unsigned int i; + + for (i =0; testopts && i < strlen(testopts); i++) { + switch(testopts[i]) { + case 'L': + log++; + break; + case 'R': + remount++; + break; + case 'U': + unlnk++; + break; + default: + errx(1, "test4: unknown option %c", testopts[i]); + } + } + if (remount) { + struct ufs_args uargs; + uargs.fspec = __UNCONST("/diskdev"); + /* remount the fs read/write */ + if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, + MNT_UPDATE | (log ? MNT_LOG : 0), + &uargs, sizeof(uargs)) == -1) + err(1, "mount ffs rw %s", FSTEST_MNTNAME); + } + + if (unlnk) { + /* + * open and unlink a file + */ + + fd = rump_sys_open("unlinked_file", + O_EXCL| O_CREAT | O_RDWR, 0644); + if (fd < 0) + err(1, "create %s", "unlinked_file"); + sprintf(buf, "test unlinked_file"); + rump_sys_write(fd, buf, strlen(buf)); + if (rump_sys_unlink("unlinked_file") == -1) + err(1, "unlink unlinked_file"); + if (rump_sys_fsync(fd) == -1) + err(1, "fsync unlinked_file"); + rump_sys_reboot(RUMP_RB_NOSYNC, NULL); + errx(1, "reboot failed"); + return 1; + } + return 0; +} + struct quota_test { int (*func)(const char *); const char *desc; @@ -264,6 +329,7 @@ { quota_test2, "create file up to hard limit"}, { quota_test3, "create file beyond the soft limit after grace time"}, { quota_test4, "take a snapshot and add some data"}, + { quota_test5, "open and unlink a file"}, }; static void @@ -307,16 +373,19 @@ const char *filename; const char *serverurl; const char *topts = NULL; - int log = 0; + int mntopts = 0; int ch; - while ((ch = getopt(argc, argv, "blo:")) != -1) { + while ((ch = getopt(argc, argv, "blo:r")) != -1) { switch(ch) { case 'b': background = 1; break; case 'l': - log = 1; + mntopts |= MNT_LOG; + break; + case 'r': + mntopts |= MNT_RDONLY; break; case 'o': topts = optarg; @@ -356,14 +425,12 @@ err(1, "mount point create"); rump_pub_etfs_register("/diskdev", filename, RUMP_ETFS_BLK); uargs.fspec = __UNCONST("/diskdev"); - if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, (log) ? MNT_LOG : 0, + if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, mntopts, &uargs, sizeof(uargs)) == -1) die("mount ffs", errno); if (rump_sys_chdir(FSTEST_
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sat Feb 12 21:49:08 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: h_quota2_tests.c t_miscquota.sh Log Message: Add some quota+snapshot tests. To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/tests/fs/ffs/h_quota2_tests.c cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/tests/fs/ffs/t_miscquota.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/h_quota2_tests.c diff -u src/tests/fs/ffs/h_quota2_tests.c:1.1.2.3 src/tests/fs/ffs/h_quota2_tests.c:1.1.2.4 --- src/tests/fs/ffs/h_quota2_tests.c:1.1.2.3 Mon Feb 7 16:22:50 2011 +++ src/tests/fs/ffs/h_quota2_tests.c Sat Feb 12 21:49:08 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: h_quota2_tests.c,v 1.1.2.3 2011/02/07 16:22:50 bouyer Exp $ */ +/* $NetBSD: h_quota2_tests.c,v 1.1.2.4 2011/02/12 21:49:08 bouyer Exp $ */ /* * rump server for advanced quota tests @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -28,7 +29,7 @@ #define TEST_NONROOT_ID 1 static int -quota_test0(void) +quota_test0(const char *testopts) { static char buf[512]; int fd; @@ -60,7 +61,7 @@ } static int -quota_test1(void) +quota_test1(const char *testopts) { static char buf[512]; int fd; @@ -107,7 +108,7 @@ } static int -quota_test2(void) +quota_test2(const char *testopts) { static char buf[512]; int fd; @@ -143,7 +144,7 @@ } static int -quota_test3(void) +quota_test3(const char *testopts) { static char buf[512]; int fd; @@ -189,8 +190,71 @@ return error; } +static int +quota_test4(const char *testopts) +{ + static char buf[512]; + int fd, fssfd; + struct fss_set fss; + unsigned int i; + int unl=0; + int unconf=0; + + /* + * take an internal snapshot of the filesystem, and create a new + * file with some data + */ + + for (i =0; testopts && i < strlen(testopts); i++) { + switch(testopts[i]) { + case 'L': + unl++; + break; + case 'C': + unconf++; + break; + default: + errx(1, "test4: unknown option %c", testopts[i]); + } + } + + /* first create the snapshot */ + + fd = rump_sys_open(FSTEST_MNTNAME "/le_snap", O_CREAT | O_RDWR, 0777); + if (fd == -1) + err(1, "create " FSTEST_MNTNAME "/le_snap"); + rump_sys_close(fd); + fssfd = rump_sys_open("/dev/rfss0", O_RDWR); + if (fssfd == -1) + err(1, "cannot open fss"); + memset(&fss, 0, sizeof(fss)); + fss.fss_mount = __UNCONST("/mnt"); + fss.fss_bstore = __UNCONST(FSTEST_MNTNAME "/le_snap"); + fss.fss_csize = 0; + if (rump_sys_ioctl(fssfd, FSSIOCSET, &fss) == -1) + err(1, "create snapshot"); + if (unl) + rump_sys_unlink(FSTEST_MNTNAME "/le_snap"); + + /* now create some extra files */ + + for (i = 0; i < 4; i++) { + sprintf(buf, "file%d", i); + fd = rump_sys_open(buf, O_EXCL| O_CREAT | O_RDWR, 0644); + if (fd < 0) + err(1, "create %s", buf); + sprintf(buf, "test file no %d", i); + rump_sys_write(fd, buf, strlen(buf)); + rump_sys_close(fd); + } + if (unconf) + if (rump_sys_ioctl(fssfd, FSSIOCCLR, NULL) == -1) + err(1, "unconfigure snapshot"); + return 0; +} + struct quota_test { - int (*func)(void); + int (*func)(const char *); const char *desc; }; @@ -199,13 +263,19 @@ { quota_test1, "write beyond the soft limit after grace time"}, { quota_test2, "create file up to hard limit"}, { quota_test3, "create file beyond the soft limit after grace time"}, + { quota_test4, "take a snapshot and add some data"}, }; static void usage(void) { + unsigned int test; fprintf(stderr, "usage: %s [-b] [-l] test# diskimage bindurl\n", getprogname()); + fprintf(stderr, "available tests:\n"); + for (test = 0; test < sizeof(quota_tests) / sizeof(quota_tests[0]); + test++) + fprintf(stderr, "\t%d: %s\n", test, quota_tests[test].desc); exit(1); } @@ -236,10 +306,11 @@ struct ufs_args uargs; const char *filename; const char *serverurl; + const char *topts = NULL; int log = 0; int ch; - while ((ch = getopt(argc, argv, "bl")) != -1) { + while ((ch = getopt(argc, argv, "blo:")) != -1) { switch(ch) { case 'b': background = 1; @@ -247,6 +318,9 @@ case 'l': log = 1; break; + case 'o': + topts = optarg; + break; default: usage(); } @@ -265,8 +339,7 @@ usage(); } if (test > sizeof(quota_tests) / sizeof(quota_tests[0])) { - fprintf(stderr, "test number %lu too big\n", test); - exit(1); + usage(); } if (background) { @@ -291,7 +364,7 @@ err(1, "cd %s", FSTEST_MNTNAME); rump_sys_chown(".", 0, 0); rump_sys_chmod(".", 0777); - error = quota_tests[test].func(); + error = quota_tests[test].func(topts); if (error) { fprintf(stderr, " test %lu: %s returned %d: %s\n", test, quota_tests[test].desc, error, strerror(error)); Index: src/tests/fs/ffs/t_miscquota.sh diff -u src/tests/fs/ffs/t_miscquota.sh:1.1.2.2 src/tests/fs/ffs/t_miscquota.sh:1.1.2.3 --- src/tests/fs/ffs/t_miscquota.sh:1
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Fri Feb 11 17:28:30 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: t_miscquota.sh Log Message: This test requires root To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/tests/fs/ffs/t_miscquota.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_miscquota.sh diff -u src/tests/fs/ffs/t_miscquota.sh:1.1.2.1 src/tests/fs/ffs/t_miscquota.sh:1.1.2.2 --- src/tests/fs/ffs/t_miscquota.sh:1.1.2.1 Fri Feb 11 16:54:03 2011 +++ src/tests/fs/ffs/t_miscquota.sh Fri Feb 11 17:28:29 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_miscquota.sh,v 1.1.2.1 2011/02/11 16:54:03 bouyer Exp $ +# $NetBSD: t_miscquota.sh,v 1.1.2.2 2011/02/11 17:28:29 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -25,7 +25,7 @@ # POSSIBILITY OF SUCH DAMAGE. # -test_case walk_list_user quota_walk_list \ +test_case_root walk_list_user quota_walk_list \ "walk user quota list over several disk blocks" -b le 1 user quota_walk_list()
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Fri Feb 11 16:54:03 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: Makefile t_getquota.sh Added Files: src/tests/fs/ffs [bouyer-quota2]: t_miscquota.sh Log Message: Add a test which cause the kernel to walk a quota list where all entries are not in the header disk block, and at last 2 of them are in the same non-header disk block. To generate a diff of this commit: cvs rdiff -u -r1.14.2.6 -r1.14.2.7 src/tests/fs/ffs/Makefile cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/tests/fs/ffs/t_getquota.sh cvs rdiff -u -r0 -r1.1.2.1 src/tests/fs/ffs/t_miscquota.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/Makefile diff -u src/tests/fs/ffs/Makefile:1.14.2.6 src/tests/fs/ffs/Makefile:1.14.2.7 --- src/tests/fs/ffs/Makefile:1.14.2.6 Wed Feb 9 20:53:10 2011 +++ src/tests/fs/ffs/Makefile Fri Feb 11 16:54:03 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14.2.6 2011/02/09 20:53:10 bouyer Exp $ +# $NetBSD: Makefile,v 1.14.2.7 2011/02/11 16:54:03 bouyer Exp $ # .include @@ -17,7 +17,7 @@ MAN.h_quota2_tests= # empty BINDIR.h_quota2_tests= ${TESTSDIR} -.for name in t_getquota t_setquota t_quotalimit t_clearquota +.for name in t_getquota t_setquota t_quotalimit t_clearquota t_miscquota TESTS_SH+= ${name} TESTS_SH_SRC_${name}= quotas_common.sh ${name}.sh .endfor Index: src/tests/fs/ffs/t_getquota.sh diff -u src/tests/fs/ffs/t_getquota.sh:1.1.2.7 src/tests/fs/ffs/t_getquota.sh:1.1.2.8 --- src/tests/fs/ffs/t_getquota.sh:1.1.2.7 Mon Feb 7 16:22:50 2011 +++ src/tests/fs/ffs/t_getquota.sh Fri Feb 11 16:54:03 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_getquota.sh,v 1.1.2.7 2011/02/07 16:22:50 bouyer Exp $ +# $NetBSD: t_getquota.sh,v 1.1.2.8 2011/02/11 16:54:03 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -84,3 +84,28 @@ done rump_shutdown } + +quota_walk_list() +{ + create_with_quotas_server $* + local q=$4 + local expect + + case ${q} in + user) + expect=u + fail=g + ;; + group) + expect=g + fail=u + ;; + both) + expect="u g" + fail="" + ;; + *) + atf_fail "wrong quota type" + ;; + esac +} Added files: Index: src/tests/fs/ffs/t_miscquota.sh diff -u /dev/null src/tests/fs/ffs/t_miscquota.sh:1.1.2.1 --- /dev/null Fri Feb 11 16:54:03 2011 +++ src/tests/fs/ffs/t_miscquota.sh Fri Feb 11 16:54:03 2011 @@ -0,0 +1,63 @@ +# $NetBSD: t_miscquota.sh,v 1.1.2.1 2011/02/11 16:54:03 bouyer Exp $ +# +# Copyright (c) 2011 Manuel Bouyer +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +test_case walk_list_user quota_walk_list \ +"walk user quota list over several disk blocks" -b le 1 user + +quota_walk_list() +{ + create_with_quotas_server $* + local q=$4 + local expect + + case ${q} in + user) + expect=u + fail=g + ;; + group) + expect=g + fail=u + ;; + *) + atf_fail "wrong quota type" + ;; + esac + + # create 100 users, all in the same hash list + local i=1; + while [ $i -lt 101 ]; do + atf_check -s exit:0 \ + $(atf_get_srcdir)/rump_edquota -${expect} \ + -s10k/20 -h40M/50k -t 2W/3D $((i * 4096)) + i=$((i + 1)) + done + # do a repquota + atf_check -s exit:0 -o 'match:0x64000' \ + $(atf_get_srcdir)/rump_repquota -x -${expect} /mnt + rump_shutdown +}
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Mon Feb 7 20:31:46 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: Makefile Added Files: src/tests/fs/ffs [bouyer-quota2]: t_clearquota.sh Log Message: Test clearing of quota entries To generate a diff of this commit: cvs rdiff -u -r1.14.2.4 -r1.14.2.5 src/tests/fs/ffs/Makefile cvs rdiff -u -r0 -r1.1.2.1 src/tests/fs/ffs/t_clearquota.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/Makefile diff -u src/tests/fs/ffs/Makefile:1.14.2.4 src/tests/fs/ffs/Makefile:1.14.2.5 --- src/tests/fs/ffs/Makefile:1.14.2.4 Wed Feb 2 19:17:08 2011 +++ src/tests/fs/ffs/Makefile Mon Feb 7 20:31:46 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14.2.4 2011/02/02 19:17:08 bouyer Exp $ +# $NetBSD: Makefile,v 1.14.2.5 2011/02/07 20:31:46 bouyer Exp $ # .include @@ -17,7 +17,7 @@ MAN.h_quota2_tests= # empty BINDIR.h_quota2_tests= ${TESTSDIR} -.for name in t_getquota t_setquota t_quotalimit +.for name in t_getquota t_setquota t_quotalimit t_clearquota TESTS_SH+= ${name} TESTS_SH_SRC_${name}= quotas_common.sh ${name}.sh .endfor Added files: Index: src/tests/fs/ffs/t_clearquota.sh diff -u /dev/null src/tests/fs/ffs/t_clearquota.sh:1.1.2.1 --- /dev/null Mon Feb 7 20:31:47 2011 +++ src/tests/fs/ffs/t_clearquota.sh Mon Feb 7 20:31:46 2011 @@ -0,0 +1,91 @@ +# $NetBSD: t_clearquota.sh,v 1.1.2.1 2011/02/07 20:31:46 bouyer Exp $ +# +# Copyright (c) 2011 Manuel Bouyer +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +for e in le be; do + for v in 1 2; do +for q in "user" "group"; do + test_case_root clear_${e}_${v}_${q} clear_quota \ + "clear quota with ${q} enabled" -b ${e} ${v} ${q} +done +test_case_root clear_${e}_${v}_"both" clear_quota \ + "clear quota with both enabled" -b ${e} ${v} "both" +test_case_root clear_${e}_${v}_"both_log" clear_quota \ + "clear quota for new id with both enabled, WAPBL" -bl ${e} ${v} "both" + done +done + +clear_quota() +{ + create_with_quotas_server $* + local q=$4 + local expect + local fail + 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 + +#set and check the expected quota + for q in ${expect} ; do + atf_check -s exit:0 \ + $(atf_get_srcdir)/rump_edquota -$q -s10k/20 -h40M/50k \ + -t 2W/3D ${id} + atf_check -s exit:0 \ +-o "match:/mnt0 1040960 2weeks 0 20 51200 3days" \ +-o "match:Disk quotas for .*: $" \ + $(atf_get_srcdir)/rump_quota -${q} -v ${id} + done +#now clear the quotas + for q in ${expect} ; do + atf_check -s exit:0 \ + $(atf_get_srcdir)/rump_edquota -$q -c ${id} + done; + +#check that we do not get positive reply for any quota type + for q in u g ; do + atf_check -s exit:0 -o "not-match:/mnt" \ + -o "not-match:Disk quotas for .*: $" \ + -o "match:Disk quotas for .*: none$" \ + $(atf_get_srcdir)/rump_quota -${q} -v ${id} + done + rump_shutdown +}
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Mon Feb 7 16:22:50 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: h_quota2_server.c h_quota2_tests.c quotas_common.sh t_getquota.sh t_quotalimit.sh t_setquota.sh Log Message: Add an option to mount the filesystem -o log to rump quota servers. Add some quota tests on a WAPBL-enabled filesystem. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/tests/fs/ffs/h_quota2_server.c \ src/tests/fs/ffs/h_quota2_tests.c cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/tests/fs/ffs/quotas_common.sh cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/tests/fs/ffs/t_getquota.sh \ src/tests/fs/ffs/t_setquota.sh cvs rdiff -u -r1.1.2.3 -r1.1.2.4 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/h_quota2_server.c diff -u src/tests/fs/ffs/h_quota2_server.c:1.1.2.2 src/tests/fs/ffs/h_quota2_server.c:1.1.2.3 --- src/tests/fs/ffs/h_quota2_server.c:1.1.2.2 Sun Jan 30 13:15:14 2011 +++ src/tests/fs/ffs/h_quota2_server.c Mon Feb 7 16:22:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: h_quota2_server.c,v 1.1.2.2 2011/01/30 13:15:14 bouyer Exp $ */ +/* $NetBSD: h_quota2_server.c,v 1.1.2.3 2011/02/07 16:22:50 bouyer Exp $ */ /* * rump server for advanced quota tests @@ -26,7 +26,8 @@ static void usage(void) { - fprintf(stderr, "usage: %s [-b] diskimage bindurl\n", getprogname()); + fprintf(stderr, "usage: %s [-b] [-l] diskimage bindurl\n", + getprogname()); exit(1); } @@ -58,11 +59,14 @@ int log = 0; int ch; - while ((ch = getopt(argc, argv, "b")) != -1) { + while ((ch = getopt(argc, argv, "bl")) != -1) { switch(ch) { case 'b': background = 1; break; + case 'l': + log = 1; + break; default: usage(); } Index: src/tests/fs/ffs/h_quota2_tests.c diff -u src/tests/fs/ffs/h_quota2_tests.c:1.1.2.2 src/tests/fs/ffs/h_quota2_tests.c:1.1.2.3 --- src/tests/fs/ffs/h_quota2_tests.c:1.1.2.2 Thu Feb 3 17:36:31 2011 +++ src/tests/fs/ffs/h_quota2_tests.c Mon Feb 7 16:22:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: h_quota2_tests.c,v 1.1.2.2 2011/02/03 17:36:31 bouyer Exp $ */ +/* $NetBSD: h_quota2_tests.c,v 1.1.2.3 2011/02/07 16:22:50 bouyer Exp $ */ /* * rump server for advanced quota tests @@ -204,7 +204,7 @@ static void usage(void) { - fprintf(stderr, "usage: %s [-b] test# diskimage bindurl\n", + fprintf(stderr, "usage: %s [-b] [-l] test# diskimage bindurl\n", getprogname()); exit(1); } @@ -239,11 +239,14 @@ int log = 0; int ch; - while ((ch = getopt(argc, argv, "b")) != -1) { + while ((ch = getopt(argc, argv, "bl")) != -1) { switch(ch) { case 'b': background = 1; break; + case 'l': + log = 1; + break; default: usage(); } Index: src/tests/fs/ffs/quotas_common.sh diff -u src/tests/fs/ffs/quotas_common.sh:1.1.2.5 src/tests/fs/ffs/quotas_common.sh:1.1.2.6 --- src/tests/fs/ffs/quotas_common.sh:1.1.2.5 Wed Feb 2 19:17:08 2011 +++ src/tests/fs/ffs/quotas_common.sh Mon Feb 7 16:22:50 2011 @@ -1,4 +1,4 @@ -# $NetBSD: quotas_common.sh,v 1.1.2.5 2011/02/02 19:17:08 bouyer Exp $ +# $NetBSD: quotas_common.sh,v 1.1.2.6 2011/02/07 16:22:50 bouyer Exp $ create_with_quotas() { @@ -17,9 +17,10 @@ create_with_quotas_server() { + local sarg=$1; shift create_with_quotas $* - atf_check -o ignore -e ignore $(atf_get_srcdir)/h_quota2_server -b \ - ${IMG} ${RUMP_SERVER} + atf_check -o ignore -e ignore $(atf_get_srcdir)/h_quota2_server \ + ${sarg} ${IMG} ${RUMP_SERVER} } rump_shutdown() Index: src/tests/fs/ffs/t_getquota.sh diff -u src/tests/fs/ffs/t_getquota.sh:1.1.2.6 src/tests/fs/ffs/t_getquota.sh:1.1.2.7 --- src/tests/fs/ffs/t_getquota.sh:1.1.2.6 Wed Feb 2 19:17:08 2011 +++ src/tests/fs/ffs/t_getquota.sh Mon Feb 7 16:22:50 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_getquota.sh,v 1.1.2.6 2011/02/02 19:17:08 bouyer Exp $ +# $NetBSD: t_getquota.sh,v 1.1.2.7 2011/02/07 16:22:50 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -29,17 +29,17 @@ for v in 1 2; do for q in "user" "group"; do test_case get_${e}_${v}_${q} get_quota \ - "get quota with ${q} enabled" ${e} ${v} ${q} + "get quota with ${q} enabled" -b ${e} ${v} ${q} done test_case get_${e}_${v}_"both" get_quota \ - "get quota with both enabled" ${e} ${v} "both" + "get quota with both enabled" -b ${e} ${v} "both" done done get_quota() { create_with_quotas_server $* - local q=$3 + local q=$4 local expect local fail Index: src/tests/fs/ffs/t_setquota.sh diff -u src/tests/fs/ffs/t_setquota.sh:1.1.2.6 src/tests/fs/ffs/t_setquota.sh:1.1.2.7 --- src/tests/fs/ffs/t_setquota.sh:1.1.2.6 Wed Feb 2 19:17:08 2011 +++ src/tests/fs/ffs/t_setquota.sh Mon Feb 7 16:22:50 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_setquota.sh,v 1.1.2.6 2011/02/02 19:17:08 bouyer Exp $ +# $NetBSD: t_setquota.sh,v 1.1.2.7 2011/02/07 16:22:50 bouye
CVS commit: [bouyer-quota2] src/tests/fs/ffs
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\+-2232: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 30725 4 62:0' \ + $(atf_get_srcdir)/rump_repquota -$q /mnt + done + rump_shutdown +}
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Wed Feb 2 19:17:09 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: Makefile quotas_common.sh t_getquota.sh t_setquota.sh src/tests/fs/ffs/clients [bouyer-quota2]: Makefile Added Files: src/tests/fs/ffs [bouyer-quota2]: h_quota2_tests.c t_quotalimit.sh Log Message: Check that the kernel enforces the quota limits and grace times. To generate a diff of this commit: cvs rdiff -u -r1.14.2.3 -r1.14.2.4 src/tests/fs/ffs/Makefile cvs rdiff -u -r0 -r1.1.2.1 src/tests/fs/ffs/h_quota2_tests.c \ src/tests/fs/ffs/t_quotalimit.sh cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/tests/fs/ffs/quotas_common.sh cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/tests/fs/ffs/t_getquota.sh \ src/tests/fs/ffs/t_setquota.sh cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/tests/fs/ffs/clients/Makefile 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/Makefile diff -u src/tests/fs/ffs/Makefile:1.14.2.3 src/tests/fs/ffs/Makefile:1.14.2.4 --- src/tests/fs/ffs/Makefile:1.14.2.3 Sun Jan 30 12:37:34 2011 +++ src/tests/fs/ffs/Makefile Wed Feb 2 19:17:08 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14.2.3 2011/01/30 12:37:34 bouyer Exp $ +# $NetBSD: Makefile,v 1.14.2.4 2011/02/02 19:17:08 bouyer Exp $ # .include @@ -8,12 +8,16 @@ TESTSDIR= ${TESTSBASE}/fs/ffs WARNS= 4 -PROGS= h_quota2_server +PROGS= h_quota2_server h_quota2_tests SRCS.h_quota2_server= h_quota2_server.c MAN.h_quota2_server= # empty BINDIR.h_quota2_server= ${TESTSDIR} -.for name in t_getquota t_setquota +SRCS.h_quota2_tests= h_quota2_tests.c +MAN.h_quota2_tests= # empty +BINDIR.h_quota2_tests= ${TESTSDIR} + +.for name in t_getquota t_setquota t_quotalimit TESTS_SH+= ${name} TESTS_SH_SRC_${name}= quotas_common.sh ${name}.sh .endfor Index: src/tests/fs/ffs/quotas_common.sh diff -u src/tests/fs/ffs/quotas_common.sh:1.1.2.4 src/tests/fs/ffs/quotas_common.sh:1.1.2.5 --- src/tests/fs/ffs/quotas_common.sh:1.1.2.4 Mon Jan 31 22:04:26 2011 +++ src/tests/fs/ffs/quotas_common.sh Wed Feb 2 19:17:08 2011 @@ -1,4 +1,4 @@ -# $NetBSD: quotas_common.sh,v 1.1.2.4 2011/01/31 22:04:26 bouyer Exp $ +# $NetBSD: quotas_common.sh,v 1.1.2.5 2011/02/02 19:17:08 bouyer Exp $ create_with_quotas() { @@ -13,6 +13,11 @@ fi atf_check -o ignore -e ignore newfs ${op} \ -B ${endian} -O ${vers} -s 4000 -F ${IMG} +} + +create_with_quotas_server() +{ + create_with_quotas $* atf_check -o ignore -e ignore $(atf_get_srcdir)/h_quota2_server -b \ ${IMG} ${RUMP_SERVER} } Index: src/tests/fs/ffs/t_getquota.sh diff -u src/tests/fs/ffs/t_getquota.sh:1.1.2.5 src/tests/fs/ffs/t_getquota.sh:1.1.2.6 --- src/tests/fs/ffs/t_getquota.sh:1.1.2.5 Mon Jan 31 22:04:26 2011 +++ src/tests/fs/ffs/t_getquota.sh Wed Feb 2 19:17:08 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_getquota.sh,v 1.1.2.5 2011/01/31 22:04:26 bouyer Exp $ +# $NetBSD: t_getquota.sh,v 1.1.2.6 2011/02/02 19:17:08 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -38,7 +38,7 @@ get_quota() { - create_with_quotas $* + create_with_quotas_server $* local q=$3 local expect local fail Index: src/tests/fs/ffs/t_setquota.sh diff -u src/tests/fs/ffs/t_setquota.sh:1.1.2.5 src/tests/fs/ffs/t_setquota.sh:1.1.2.6 --- src/tests/fs/ffs/t_setquota.sh:1.1.2.5 Mon Jan 31 22:04:26 2011 +++ src/tests/fs/ffs/t_setquota.sh Wed Feb 2 19:17:08 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_setquota.sh,v 1.1.2.5 2011/01/31 22:04:26 bouyer Exp $ +# $NetBSD: t_setquota.sh,v 1.1.2.6 2011/02/02 19:17:08 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -46,7 +46,7 @@ set_quota() { - create_with_quotas $* + create_with_quotas_server $* local q=$3 local expect local fail @@ -102,7 +102,7 @@ set_quota_new() { - create_with_quotas $* + create_with_quotas_server $* local q=$3 local expect local fail @@ -152,7 +152,7 @@ set_quota_default() { - create_with_quotas $* + create_with_quotas_server $* local q=$3 local expect local fail Index: src/tests/fs/ffs/clients/Makefile diff -u src/tests/fs/ffs/clients/Makefile:1.1.2.3 src/tests/fs/ffs/clients/Makefile:1.1.2.4 --- src/tests/fs/ffs/clients/Makefile:1.1.2.3 Sun Jan 30 00:27:56 2011 +++ src/tests/fs/ffs/clients/Makefile Wed Feb 2 19:17:09 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1.2.3 2011/01/30 00:27:56 bouyer Exp $ +# $NetBSD: Makefile,v 1.1.2.4 2011/02/02 19:17:09 bouyer Exp $ # .include @@ -6,7 +6,7 @@ TESTSDIR= ${TESTSBASE}/fs/ffs WARNS= 4 -PROGS= rump_quota rump_repquota rump_edquota +PROGS= rump_quota rump_repquota rump_edquota rump_quotactl .PATH: ${NETBSDSRCDIR}/usr.bin/quota SRCS.rump_quota= quota.c printquota.c getvfsquota.c quota_rumpops.c @@ -24,10 +24,15 @@ SRCS.rump_edquota+= edquota.c CPPFLAGS.edquota.c+= -I${NETBSDSRCDIR}/sys -I${NETBSDSRCDIR}/usr.bin/quota +.PATH: ${NETBSDSRCDIR}/usr.sbin/q
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Mon Jan 31 22:04:26 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: quotas_common.sh t_getquota.sh t_setquota.sh Log Message: Extract code to shut down the rump server and check the filesystem image to a function. To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/tests/fs/ffs/quotas_common.sh cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/tests/fs/ffs/t_getquota.sh \ src/tests/fs/ffs/t_setquota.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/quotas_common.sh diff -u src/tests/fs/ffs/quotas_common.sh:1.1.2.3 src/tests/fs/ffs/quotas_common.sh:1.1.2.4 --- src/tests/fs/ffs/quotas_common.sh:1.1.2.3 Sun Jan 30 13:23:26 2011 +++ src/tests/fs/ffs/quotas_common.sh Mon Jan 31 22:04:26 2011 @@ -1,4 +1,4 @@ -# $NetBSD: quotas_common.sh,v 1.1.2.3 2011/01/30 13:23:26 bouyer Exp $ +# $NetBSD: quotas_common.sh,v 1.1.2.4 2011/01/31 22:04:26 bouyer Exp $ create_with_quotas() { @@ -17,6 +17,15 @@ ${IMG} ${RUMP_SERVER} } +rump_shutdown() +{ + atf_check -s exit:0 rump.halt +# check that the quota inode creation didn't corrupt the filesystem + atf_check -s exit:0 -o "match:already clean" \ + -o "match:Phase 6 - Check Quotas" \ + fsck_ffs -nf -F ${IMG} +} + # from tests/ipf/h_common.sh via tests/sbin/resize_ffs test_case() { Index: src/tests/fs/ffs/t_getquota.sh diff -u src/tests/fs/ffs/t_getquota.sh:1.1.2.4 src/tests/fs/ffs/t_getquota.sh:1.1.2.5 --- src/tests/fs/ffs/t_getquota.sh:1.1.2.4 Sun Jan 30 19:49:48 2011 +++ src/tests/fs/ffs/t_getquota.sh Mon Jan 31 22:04:26 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_getquota.sh,v 1.1.2.4 2011/01/30 19:49:48 bouyer Exp $ +# $NetBSD: t_getquota.sh,v 1.1.2.5 2011/01/31 22:04:26 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -82,9 +82,5 @@ -o "not-match:--0--1 - -" \ $(atf_get_srcdir)/rump_repquota -${q} /mnt done - atf_check -s exit:0 rump.halt -# check that the quota inode creation didn't corrupt the filesystem - atf_check -s exit:0 -o "match:already clean" \ - -o "match:Phase 6 - Check Quotas" \ - fsck_ffs -nf -F ${IMG} + rump_shutdown } Index: src/tests/fs/ffs/t_setquota.sh diff -u src/tests/fs/ffs/t_setquota.sh:1.1.2.4 src/tests/fs/ffs/t_setquota.sh:1.1.2.5 --- src/tests/fs/ffs/t_setquota.sh:1.1.2.4 Sun Jan 30 23:04:52 2011 +++ src/tests/fs/ffs/t_setquota.sh Mon Jan 31 22:04:26 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_setquota.sh,v 1.1.2.4 2011/01/30 23:04:52 bouyer Exp $ +# $NetBSD: t_setquota.sh,v 1.1.2.5 2011/01/31 22:04:26 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -97,11 +97,7 @@ -o "not-match:--0--" \ $(atf_get_srcdir)/rump_repquota -${q} /mnt done - atf_check -s exit:0 rump.halt -# check that the quota inode creation didn't corrupt the filesystem - atf_check -s exit:0 -o "match:already clean" \ - -o "match:Phase 6 - Check Quotas" \ - fsck_ffs -nf -F ${IMG} + rump_shutdown } set_quota_new() @@ -151,11 +147,7 @@ -o "match:Disk quotas for .*: none$" \ $(atf_get_srcdir)/rump_quota -${q} -v ${id} done - atf_check -s exit:0 rump.halt -# check that the quota inode creation didn't corrupt the filesystem - atf_check -s exit:0 -o "match:already clean" \ - -o "match:Phase 6 - Check Quotas" \ - fsck_ffs -nf -F ${IMG} + rump_shutdown } set_quota_default() @@ -205,9 +197,5 @@ -o "match:Default (user|group) disk quotas: none$" \ $(atf_get_srcdir)/rump_quota -${q} -v ${id} done - atf_check -s exit:0 rump.halt -# check that the quota inode creation didn't corrupt the filesystem - atf_check -s exit:0 -o "match:already clean" \ - -o "match:Phase 6 - Check Quotas" \ - fsck_ffs -nf -F ${IMG} + rump_shutdown }
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sun Jan 30 23:04:52 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: t_setquota.sh Log Message: Also set and check the grace time in edquota tests. To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/tests/fs/ffs/t_setquota.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_setquota.sh diff -u src/tests/fs/ffs/t_setquota.sh:1.1.2.3 src/tests/fs/ffs/t_setquota.sh:1.1.2.4 --- src/tests/fs/ffs/t_setquota.sh:1.1.2.3 Sun Jan 30 19:49:48 2011 +++ src/tests/fs/ffs/t_setquota.sh Sun Jan 30 23:04:52 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_setquota.sh,v 1.1.2.3 2011/01/30 19:49:48 bouyer Exp $ +# $NetBSD: t_setquota.sh,v 1.1.2.4 2011/01/30 23:04:52 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -73,9 +73,10 @@ for q in ${expect} ; do local id=$(id -${q}) atf_check -s exit:0 \ - $(atf_get_srcdir)/rump_edquota -$q -s10k/20 -h40M/50k ${id} + $(atf_get_srcdir)/rump_edquota -$q -s10k/20 -h40M/50k \ + -t 2W/3D ${id} atf_check -s exit:0 \ --o "match:/mnt0 1040960 7days 1 20 51200 7days" \ +-o "match:/mnt0 1040960 2weeks 1 20 51200 3days" \ -o "match:Disk quotas for .*: $" \ $(atf_get_srcdir)/rump_quota -${q} -v atf_check -s exit:0 \ @@ -132,9 +133,10 @@ for q in ${expect} ; do local id=1 atf_check -s exit:0 \ - $(atf_get_srcdir)/rump_edquota -$q -s10k/20 -h40M/50k ${id} + $(atf_get_srcdir)/rump_edquota -$q -s10k/20 -h40M/50k \ + -t 120W/255D ${id} atf_check -s exit:0 \ --o "match:/mnt0 1040960 7days 0 20 51200 7days" \ +-o "match:/mnt0 1040960 2years 0 20 51200 9months" \ -o "match:Disk quotas for .*: $" \ $(atf_get_srcdir)/rump_quota -${q} -v ${id} done @@ -185,9 +187,10 @@ for q in ${expect} ; do local id="-d" atf_check -s exit:0 \ - $(atf_get_srcdir)/rump_edquota -$q -s10k/20 -h40M/50k ${id} + $(atf_get_srcdir)/rump_edquota -$q -s10k/20 -h40M/50k \ + -t 2H2M/3540 ${id} atf_check -s exit:0 \ --o "match:/mnt0 1040960 7days 0 20 51200 7days" \ +-o "match:/mnt0 1040960 2:2 0 20 51200 59" \ -o "match:Default (user|group) disk quotas: $" \ $(atf_get_srcdir)/rump_quota -${q} -v ${id} done
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sun Jan 30 19:49:48 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: t_getquota.sh t_setquota.sh Log Message: Remove rump.halt race workaround now that it's fixed in rump Ajust for new quota tools output To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/tests/fs/ffs/t_getquota.sh cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/tests/fs/ffs/t_setquota.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_getquota.sh diff -u src/tests/fs/ffs/t_getquota.sh:1.1.2.3 src/tests/fs/ffs/t_getquota.sh:1.1.2.4 --- src/tests/fs/ffs/t_getquota.sh:1.1.2.3 Sun Jan 30 13:23:26 2011 +++ src/tests/fs/ffs/t_getquota.sh Sun Jan 30 19:49:48 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_getquota.sh,v 1.1.2.3 2011/01/30 13:23:26 bouyer Exp $ +# $NetBSD: t_getquota.sh,v 1.1.2.4 2011/01/30 19:49:48 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -64,7 +64,7 @@ #check that we can get the expected quota for q in ${expect} ; do atf_check -s exit:0 \ --o "match:/mnt0-- 1 - -" \ +-o "match:/mnt0-- 7days 1 - - 7days" \ -o "match:Disk quotas for .*: $" \ $(atf_get_srcdir)/rump_quota -${q} -v atf_check -s exit:0 \ @@ -83,9 +83,6 @@ $(atf_get_srcdir)/rump_repquota -${q} /mnt done atf_check -s exit:0 rump.halt -#wait for rump server to be gone - while [ -e ${RUMP_SOCKET} ] ; do done - sleep 1 # check that the quota inode creation didn't corrupt the filesystem atf_check -s exit:0 -o "match:already clean" \ -o "match:Phase 6 - Check Quotas" \ Index: src/tests/fs/ffs/t_setquota.sh diff -u src/tests/fs/ffs/t_setquota.sh:1.1.2.2 src/tests/fs/ffs/t_setquota.sh:1.1.2.3 --- src/tests/fs/ffs/t_setquota.sh:1.1.2.2 Sun Jan 30 13:23:26 2011 +++ src/tests/fs/ffs/t_setquota.sh Sun Jan 30 19:49:48 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_setquota.sh,v 1.1.2.2 2011/01/30 13:23:26 bouyer Exp $ +# $NetBSD: t_setquota.sh,v 1.1.2.3 2011/01/30 19:49:48 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -75,7 +75,7 @@ atf_check -s exit:0 \ $(atf_get_srcdir)/rump_edquota -$q -s10k/20 -h40M/50k ${id} atf_check -s exit:0 \ --o "match:/mnt0 1040960 1 20 51200" \ +-o "match:/mnt0 1040960 7days 1 20 51200 7days" \ -o "match:Disk quotas for .*: $" \ $(atf_get_srcdir)/rump_quota -${q} -v atf_check -s exit:0 \ @@ -93,13 +93,10 @@ -o "match:Disk quotas for .*: none$" \ $(atf_get_srcdir)/rump_quota -${q} -v atf_check -s exit:0 \ --o "not-match:--0--1 - -" \ +-o "not-match:--0--" \ $(atf_get_srcdir)/rump_repquota -${q} /mnt done atf_check -s exit:0 rump.halt -#wait for rump server to be gone - while [ -e ${RUMP_SOCKET} ] ; do done - sleep 1 # check that the quota inode creation didn't corrupt the filesystem atf_check -s exit:0 -o "match:already clean" \ -o "match:Phase 6 - Check Quotas" \ @@ -137,7 +134,7 @@ atf_check -s exit:0 \ $(atf_get_srcdir)/rump_edquota -$q -s10k/20 -h40M/50k ${id} atf_check -s exit:0 \ --o "match:/mnt0 1040960 0 20 51200" \ +-o "match:/mnt0 1040960 7days 0 20 51200 7days" \ -o "match:Disk quotas for .*: $" \ $(atf_get_srcdir)/rump_quota -${q} -v ${id} done @@ -153,9 +150,6 @@ $(atf_get_srcdir)/rump_quota -${q} -v ${id} done atf_check -s exit:0 rump.halt -#wait for rump server to be gone - while [ -e ${RUMP_SOCKET} ] ; do done - sleep 1 # check that the quota inode creation didn't corrupt the filesystem atf_check -s exit:0 -o "match:already clean" \ -o "match:Phase 6 - Check Quotas" \ @@ -193,7 +187,7 @@ atf_check -s exit:0 \ $(atf_get_srcdir)/rump_edquota -$q -s10k/20 -h40M/50k ${id} atf_check -s exit:0 \ --o "match:/mnt0 1040960 0 20 51200" \ +-o "match:/mnt0 1040960 7days 0 20 51200 7days" \ -o "match:Default (user|group) disk quotas: $" \ $(atf_get_srcdir)/rump_quota -${q} -v ${id} done @@ -209,9 +203,6 @@ $(atf_get_srcdir)/rump_quota -${q} -v ${id} done atf_check -s exit:0 rump.halt -#wait for rump server to be gone - while [ -e ${RUMP_SOCKET} ] ; do done - sleep 1 # check that the quota inode creation didn't corrupt the filesystem atf_check -s exit:0 -o "match:already clean" \ -o "match:Phase 6 - Check Quotas" \
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sun Jan 30 14:28:34 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: t_quota2_1.c Log Message: Use 8 for gid offset instead of 6, just in case ... To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/tests/fs/ffs/t_quota2_1.c 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_quota2_1.c diff -u src/tests/fs/ffs/t_quota2_1.c:1.1.2.1 src/tests/fs/ffs/t_quota2_1.c:1.1.2.2 --- src/tests/fs/ffs/t_quota2_1.c:1.1.2.1 Thu Jan 20 14:25:04 2011 +++ src/tests/fs/ffs/t_quota2_1.c Sun Jan 30 14:28:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: t_quota2_1.c,v 1.1.2.1 2011/01/20 14:25:04 bouyer Exp $ */ +/* $NetBSD: t_quota2_1.c,v 1.1.2.2 2011/01/30 14:28:33 bouyer Exp $ */ /* * Basic tests for quota2 @@ -47,12 +47,13 @@ atf_tc_expect_pass(); FSTEST_ENTER(); + RL(rump_sys_chown(".", 0, 0)); for (i = 0 ; i < n; i++) { sprintf(buf, "file%d", i); RL(fd = rump_sys_open(buf, O_CREAT | O_RDWR, 0755)); sprintf(buf, "test file no %d", i); RL(rump_sys_write(fd, buf, strlen(buf))); - RL(rump_sys_fchown(fd, i, i+6)); + RL(rump_sys_fchown(fd, i, i+8)); rump_sys_close(fd); } FSTEST_EXIT();
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sun Jan 30 13:23:27 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: quotas_common.sh t_getquota.sh t_setquota.sh Log Message: Ask the rump server to background itself, to avoid a race at startup where a rump command could be run before the server is available. Add a sleep after shutdown to workaround a race where the fsck would run before the server is fully showdown (testing for the existence of the socket seems to not be enough). To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/tests/fs/ffs/quotas_common.sh \ src/tests/fs/ffs/t_getquota.sh cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/tests/fs/ffs/t_setquota.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/quotas_common.sh diff -u src/tests/fs/ffs/quotas_common.sh:1.1.2.2 src/tests/fs/ffs/quotas_common.sh:1.1.2.3 --- src/tests/fs/ffs/quotas_common.sh:1.1.2.2 Sun Jan 30 12:37:34 2011 +++ src/tests/fs/ffs/quotas_common.sh Sun Jan 30 13:23:26 2011 @@ -1,4 +1,4 @@ -# $NetBSD: quotas_common.sh,v 1.1.2.2 2011/01/30 12:37:34 bouyer Exp $ +# $NetBSD: quotas_common.sh,v 1.1.2.3 2011/01/30 13:23:26 bouyer Exp $ create_with_quotas() { @@ -13,9 +13,8 @@ fi atf_check -o ignore -e ignore newfs ${op} \ -B ${endian} -O ${vers} -s 4000 -F ${IMG} - #atf_check -o ignore -e ignore $(atf_get_srcdir)/h_quota2_server \ - # ${IMG} ${RUMP_SERVER} - $(atf_get_srcdir)/h_quota2_server ${IMG} ${RUMP_SERVER} & + atf_check -o ignore -e ignore $(atf_get_srcdir)/h_quota2_server -b \ + ${IMG} ${RUMP_SERVER} } # from tests/ipf/h_common.sh via tests/sbin/resize_ffs @@ -66,7 +65,8 @@ { IMG=fsimage DIR=target - RUMP_SERVER=unix:///tmp/test + RUMP_SOCKET=test + RUMP_SERVER=unix://${RUMP_SOCKET} export RUMP_SERVER for i in ${tests}; do atf_add_test_case $i Index: src/tests/fs/ffs/t_getquota.sh diff -u src/tests/fs/ffs/t_getquota.sh:1.1.2.2 src/tests/fs/ffs/t_getquota.sh:1.1.2.3 --- src/tests/fs/ffs/t_getquota.sh:1.1.2.2 Sun Jan 30 11:33:33 2011 +++ src/tests/fs/ffs/t_getquota.sh Sun Jan 30 13:23:26 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_getquota.sh,v 1.1.2.2 2011/01/30 11:33:33 bouyer Exp $ +# $NetBSD: t_getquota.sh,v 1.1.2.3 2011/01/30 13:23:26 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -83,7 +83,9 @@ $(atf_get_srcdir)/rump_repquota -${q} /mnt done atf_check -s exit:0 rump.halt - wait $! +#wait for rump server to be gone + while [ -e ${RUMP_SOCKET} ] ; do done + sleep 1 # check that the quota inode creation didn't corrupt the filesystem atf_check -s exit:0 -o "match:already clean" \ -o "match:Phase 6 - Check Quotas" \ Index: src/tests/fs/ffs/t_setquota.sh diff -u src/tests/fs/ffs/t_setquota.sh:1.1.2.1 src/tests/fs/ffs/t_setquota.sh:1.1.2.2 --- src/tests/fs/ffs/t_setquota.sh:1.1.2.1 Sun Jan 30 12:37:34 2011 +++ src/tests/fs/ffs/t_setquota.sh Sun Jan 30 13:23:26 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_setquota.sh,v 1.1.2.1 2011/01/30 12:37:34 bouyer Exp $ +# $NetBSD: t_setquota.sh,v 1.1.2.2 2011/01/30 13:23:26 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -97,7 +97,9 @@ $(atf_get_srcdir)/rump_repquota -${q} /mnt done atf_check -s exit:0 rump.halt - wait $! +#wait for rump server to be gone + while [ -e ${RUMP_SOCKET} ] ; do done + sleep 1 # check that the quota inode creation didn't corrupt the filesystem atf_check -s exit:0 -o "match:already clean" \ -o "match:Phase 6 - Check Quotas" \ @@ -151,7 +153,9 @@ $(atf_get_srcdir)/rump_quota -${q} -v ${id} done atf_check -s exit:0 rump.halt - wait $! +#wait for rump server to be gone + while [ -e ${RUMP_SOCKET} ] ; do done + sleep 1 # check that the quota inode creation didn't corrupt the filesystem atf_check -s exit:0 -o "match:already clean" \ -o "match:Phase 6 - Check Quotas" \ @@ -205,7 +209,9 @@ $(atf_get_srcdir)/rump_quota -${q} -v ${id} done atf_check -s exit:0 rump.halt - wait $! +#wait for rump server to be gone + while [ -e ${RUMP_SOCKET} ] ; do done + sleep 1 # check that the quota inode creation didn't corrupt the filesystem atf_check -s exit:0 -o "match:already clean" \ -o "match:Phase 6 - Check Quotas" \
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sun Jan 30 13:15:14 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: h_quota2_server.c Log Message: Add a command-line flag to toggle foreground/background To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/tests/fs/ffs/h_quota2_server.c 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/h_quota2_server.c diff -u src/tests/fs/ffs/h_quota2_server.c:1.1.2.1 src/tests/fs/ffs/h_quota2_server.c:1.1.2.2 --- src/tests/fs/ffs/h_quota2_server.c:1.1.2.1 Thu Jan 20 14:25:04 2011 +++ src/tests/fs/ffs/h_quota2_server.c Sun Jan 30 13:15:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: h_quota2_server.c,v 1.1.2.1 2011/01/20 14:25:04 bouyer Exp $ */ +/* $NetBSD: h_quota2_server.c,v 1.1.2.2 2011/01/30 13:15:14 bouyer Exp $ */ /* * rump server for advanced quota tests @@ -12,6 +12,7 @@ #include #include +#include #include @@ -20,10 +21,12 @@ #include "../../h_macros.h" +int background = 0; + static void usage(void) { - fprintf(stderr, "usage: %s diskimage bindurl\n", getprogname()); + fprintf(stderr, "usage: %s [-b] diskimage bindurl\n", getprogname()); exit(1); } @@ -32,7 +35,8 @@ { warnx("%s: %s", reason, strerror(error)); - //rump_daemonize_done(error); + if (background) + rump_daemonize_done(error); exit(1); } @@ -45,25 +49,38 @@ } int -main(int argc, const char *argv[]) +main(int argc, char **argv) { int error; struct ufs_args uargs; const char *filename; const char *serverurl; int log = 0; + int ch; + + while ((ch = getopt(argc, argv, "b")) != -1) { + switch(ch) { + case 'b': + background = 1; + break; + default: + usage(); + } + } + argc -= optind; + argv += optind; - if (argc != 3) + if (argc != 2) usage(); - filename = argv[1]; - serverurl = argv[2]; + filename = argv[0]; + serverurl = argv[1]; -#if 0 - error = rump_daemonize_begin(); - if (error) - errx(1, "rump daemonize: %s", strerror(error)); -#endif + if (background) { + error = rump_daemonize_begin(); + if (error) + errx(1, "rump daemonize: %s", strerror(error)); + } error = rump_init(); if (error) @@ -80,7 +97,8 @@ error = rump_init_server(serverurl); if (error) die("rump server init failed", error); - //rump_daemonize_done(RUMP_DAEMONIZE_SUCCESS); + if (background) + rump_daemonize_done(RUMP_DAEMONIZE_SUCCESS); sem_init(&sigsem, 0, 0); signal(SIGTERM, sigreboot);
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sun Jan 30 12:37:34 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: Makefile quotas_common.sh Added Files: src/tests/fs/ffs [bouyer-quota2]: t_setquota.sh Log Message: Add tests cases for quotactl("set") To generate a diff of this commit: cvs rdiff -u -r1.14.2.2 -r1.14.2.3 src/tests/fs/ffs/Makefile cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/tests/fs/ffs/quotas_common.sh cvs rdiff -u -r0 -r1.1.2.1 src/tests/fs/ffs/t_setquota.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/Makefile diff -u src/tests/fs/ffs/Makefile:1.14.2.2 src/tests/fs/ffs/Makefile:1.14.2.3 --- src/tests/fs/ffs/Makefile:1.14.2.2 Fri Jan 28 18:38:07 2011 +++ src/tests/fs/ffs/Makefile Sun Jan 30 12:37:34 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14.2.2 2011/01/28 18:38:07 bouyer Exp $ +# $NetBSD: Makefile,v 1.14.2.3 2011/01/30 12:37:34 bouyer Exp $ # .include @@ -13,7 +13,7 @@ MAN.h_quota2_server= # empty BINDIR.h_quota2_server= ${TESTSDIR} -.for name in t_getquota +.for name in t_getquota t_setquota TESTS_SH+= ${name} TESTS_SH_SRC_${name}= quotas_common.sh ${name}.sh .endfor Index: src/tests/fs/ffs/quotas_common.sh diff -u src/tests/fs/ffs/quotas_common.sh:1.1.2.1 src/tests/fs/ffs/quotas_common.sh:1.1.2.2 --- src/tests/fs/ffs/quotas_common.sh:1.1.2.1 Fri Jan 28 18:38:07 2011 +++ src/tests/fs/ffs/quotas_common.sh Sun Jan 30 12:37:34 2011 @@ -1,4 +1,4 @@ -# $NetBSD: quotas_common.sh,v 1.1.2.1 2011/01/28 18:38:07 bouyer Exp $ +# $NetBSD: quotas_common.sh,v 1.1.2.2 2011/01/30 12:37:34 bouyer Exp $ create_with_quotas() { @@ -29,6 +29,29 @@ eval "${name}_head() { \ atf_set "descr" "${descr}" + atf_set "timeout" "60" + }" + eval "${name}_body() { \ + ${check_function} " "${@}" "; \ + }" + eval "${name}_cleanup() { \ + atf_check -s exit:1 -o ignore -e ignore rump.halt; \ + }" + tests="${tests} ${name}" +} + +test_case_root() +{ + local name="${1}"; shift + local check_function="${1}"; shift + local descr="${1}"; shift + + atf_test_case "${name}" cleanup + + eval "${name}_head() { \ + atf_set "descr" "${descr}" + atf_set "require.user" "root" + atf_set "timeout" "60" }" eval "${name}_body() { \ ${check_function} " "${@}" "; \ Added files: Index: src/tests/fs/ffs/t_setquota.sh diff -u /dev/null src/tests/fs/ffs/t_setquota.sh:1.1.2.1 --- /dev/null Sun Jan 30 12:37:34 2011 +++ src/tests/fs/ffs/t_setquota.sh Sun Jan 30 12:37:34 2011 @@ -0,0 +1,213 @@ +# $NetBSD: t_setquota.sh,v 1.1.2.1 2011/01/30 12:37:34 bouyer Exp $ +# +# Copyright (c) 2011 Manuel Bouyer +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +for e in le be; do + for v in 1 2; do +for q in "user" "group"; do + test_case_root set_${e}_${v}_${q} set_quota \ + "set quota with ${q} enabled" ${e} ${v} ${q} + test_case_root set_new_${e}_${v}_${q} set_quota_new \ + "set quota for new id with ${q} enabled" ${e} ${v} ${q} + test_case_root set_default_${e}_${v}_${q} set_quota_default \ + "set default quota with ${q} enabled" ${e} ${v} ${q} +done +test_case_root set_${e}_${v}_"both" set_quota \ + "set quota with both enabled" ${e} ${v} "both" +test_case_root set_new_${e}_${v}_"both" set_quota_new \ + "set quota for new id with both enabled" ${e} ${v} "both" +test_case_root set_default_${e}_${v}_"both" set_quota_default \ + "set default quota with both enabled" ${e} ${v} "both" + done +done + +set_quota() +{ + create_with_quotas $* + local q=$3 + local expect + local fail + + case ${q} in + user) + expect=u + fail=g + ;; + group) + expe
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sun Jan 30 11:33:33 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: t_getquota.sh Log Message: Remove unused function To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/tests/fs/ffs/t_getquota.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_getquota.sh diff -u src/tests/fs/ffs/t_getquota.sh:1.1.2.1 src/tests/fs/ffs/t_getquota.sh:1.1.2.2 --- src/tests/fs/ffs/t_getquota.sh:1.1.2.1 Fri Jan 28 18:38:07 2011 +++ src/tests/fs/ffs/t_getquota.sh Sun Jan 30 11:33:33 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_getquota.sh,v 1.1.2.1 2011/01/28 18:38:07 bouyer Exp $ +# $NetBSD: t_getquota.sh,v 1.1.2.2 2011/01/30 11:33:33 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -89,13 +89,3 @@ -o "match:Phase 6 - Check Quotas" \ fsck_ffs -nf -F ${IMG} } - -quota_enabled_both() -{ - create_with_quotas $* - -# check that the quota inode creation didn't corrupt the filesystem - atf_check -s exit:0 -o "match:already clean" -o "match:3 files" \ - -o "match:Phase 6 - Check Quotas" \ - fsck_ffs -nf -F ${IMG} -}
CVS commit: [bouyer-quota2] src/tests/fs/ffs/clients
Module Name:src Committed By: bouyer Date: Sun Jan 30 00:27:56 UTC 2011 Modified Files: src/tests/fs/ffs/clients [bouyer-quota2]: Makefile Log Message: Add a edquota rump client To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/tests/fs/ffs/clients/Makefile 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/clients/Makefile diff -u src/tests/fs/ffs/clients/Makefile:1.1.2.2 src/tests/fs/ffs/clients/Makefile:1.1.2.3 --- src/tests/fs/ffs/clients/Makefile:1.1.2.2 Fri Jan 28 22:15:36 2011 +++ src/tests/fs/ffs/clients/Makefile Sun Jan 30 00:27:56 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1.2.2 2011/01/28 22:15:36 bouyer Exp $ +# $NetBSD: Makefile,v 1.1.2.3 2011/01/30 00:27:56 bouyer Exp $ # .include @@ -6,11 +6,12 @@ TESTSDIR= ${TESTSBASE}/fs/ffs WARNS= 4 -PROGS= rump_quota rump_repquota +PROGS= rump_quota rump_repquota rump_edquota .PATH: ${NETBSDSRCDIR}/usr.bin/quota SRCS.rump_quota= quota.c printquota.c getvfsquota.c quota_rumpops.c SRCS.rump_repquota= printquota.c quota_rumpops.c +SRCS.rump_edquota= printquota.c getvfsquota.c quota_rumpops.c CPPFLAGS.quota.c+= -I${NETBSDSRCDIR}/usr.bin/quota CPPFLAGS.printquota.c+= -I${NETBSDSRCDIR}/usr.bin/quota CPPFLAGS.getvfsquota.c+=-I${NETBSDSRCDIR}/usr.bin/quota -I${NETBSDSRCDIR}/sys @@ -19,10 +20,16 @@ SRCS.rump_repquota+= repquota.c CPPFLAGS.repquota.c+= -I${NETBSDSRCDIR}/sys -I${NETBSDSRCDIR}/usr.bin/quota +.PATH: ${NETBSDSRCDIR}/usr.sbin/edquota +SRCS.rump_edquota+= edquota.c +CPPFLAGS.edquota.c+= -I${NETBSDSRCDIR}/sys -I${NETBSDSRCDIR}/usr.bin/quota + .PATH: ${NETBSDSRCDIR}/sys/ufs/ufs SRCS.rump_quota+= quota2_prop.c SRCS.rump_repquota+= quota2_prop.c quota1_subr.c -CPPFLAGS.quota2_prop.c+=-I${NETBSDSRCDIR}/sys -I${NETBSDSRCDIR}/usr.bin/quota +SRCS.rump_edquota+= quota2_prop.c quota1_subr.c +CPPFLAGS.quota2_prop.c+=-I${NETBSDSRCDIR}/sys +CPPFLAGS.quota1_subr.c+=-I${NETBSDSRCDIR}/sys DPADD.rump_quota= ${LIBRPCSVC} ${LIBPROP} ${LIBRUMPCLIENT} LDADD.rump_quota= -lrpcsvc -lprop -lrumpclient @@ -34,4 +41,9 @@ MAN.rump_repquota= # empty BINDIR.rump_repquota= ${TESTSDIR} +DPADD.rump_edquota= ${LIBRPCSVC} ${LIBPROP} ${LIBRUMPCLIENT} +LDADD.rump_edquota= -lrpcsvc -lprop -lrumpclient +MAN.rump_edquota= # empty +BINDIR.rump_edquota= ${TESTSDIR} + .include
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Fri Jan 28 18:38:08 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: Makefile Added Files: src/tests/fs/ffs [bouyer-quota2]: quotas_common.sh t_getquota.sh src/tests/fs/ffs/clients [bouyer-quota2]: Makefile quota_rumpops.c Log Message: Add rump versions of quota utilities, to be used by tests. Add a test which figures if we can retrieve quota values from the kernel. To generate a diff of this commit: cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/tests/fs/ffs/Makefile cvs rdiff -u -r0 -r1.1.2.1 src/tests/fs/ffs/quotas_common.sh \ src/tests/fs/ffs/t_getquota.sh cvs rdiff -u -r0 -r1.1.2.1 src/tests/fs/ffs/clients/Makefile \ src/tests/fs/ffs/clients/quota_rumpops.c 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/Makefile diff -u src/tests/fs/ffs/Makefile:1.14.2.1 src/tests/fs/ffs/Makefile:1.14.2.2 --- src/tests/fs/ffs/Makefile:1.14.2.1 Thu Jan 20 14:25:04 2011 +++ src/tests/fs/ffs/Makefile Fri Jan 28 18:38:07 2011 @@ -1,16 +1,23 @@ -# $NetBSD: Makefile,v 1.14.2.1 2011/01/20 14:25:04 bouyer Exp $ +# $NetBSD: Makefile,v 1.14.2.2 2011/01/28 18:38:07 bouyer Exp $ # .include +SUBDIR= clients + TESTSDIR= ${TESTSBASE}/fs/ffs WARNS= 4 -PROGS= h_quota2_server +PROGS= h_quota2_server SRCS.h_quota2_server= h_quota2_server.c MAN.h_quota2_server= # empty BINDIR.h_quota2_server= ${TESTSDIR} +.for name in t_getquota +TESTS_SH+= ${name} +TESTS_SH_SRC_${name}= quotas_common.sh ${name}.sh +.endfor + TESTS_C+= t_fifos TESTS_C+= t_snapshot TESTS_C+= t_snapshot_log Added files: Index: src/tests/fs/ffs/quotas_common.sh diff -u /dev/null src/tests/fs/ffs/quotas_common.sh:1.1.2.1 --- /dev/null Fri Jan 28 18:38:08 2011 +++ src/tests/fs/ffs/quotas_common.sh Fri Jan 28 18:38:07 2011 @@ -0,0 +1,51 @@ +# $NetBSD: quotas_common.sh,v 1.1.2.1 2011/01/28 18:38:07 bouyer Exp $ + +create_with_quotas() +{ + local endian=$1; shift + local vers=$1; shift + local type=$1; shift + local op; + if [ ${type} = "both" ]; then + op="-q user -q group" + else + op="-q ${type}" + fi + atf_check -o ignore -e ignore newfs ${op} \ + -B ${endian} -O ${vers} -s 4000 -F ${IMG} + #atf_check -o ignore -e ignore $(atf_get_srcdir)/h_quota2_server \ + # ${IMG} ${RUMP_SERVER} + $(atf_get_srcdir)/h_quota2_server ${IMG} ${RUMP_SERVER} & +} + +# from tests/ipf/h_common.sh via tests/sbin/resize_ffs +test_case() +{ + local name="${1}"; shift + local check_function="${1}"; shift + local descr="${1}"; shift + + atf_test_case "${name}" cleanup + + eval "${name}_head() { \ + atf_set "descr" "${descr}" + }" + eval "${name}_body() { \ + ${check_function} " "${@}" "; \ + }" + eval "${name}_cleanup() { \ + atf_check -s exit:1 -o ignore -e ignore rump.halt; \ + }" + tests="${tests} ${name}" +} + +atf_init_test_cases() +{ + IMG=fsimage + DIR=target + RUMP_SERVER=unix:///tmp/test + export RUMP_SERVER + for i in ${tests}; do + atf_add_test_case $i + done +} Index: src/tests/fs/ffs/t_getquota.sh diff -u /dev/null src/tests/fs/ffs/t_getquota.sh:1.1.2.1 --- /dev/null Fri Jan 28 18:38:08 2011 +++ src/tests/fs/ffs/t_getquota.sh Fri Jan 28 18:38:07 2011 @@ -0,0 +1,101 @@ +# $NetBSD: t_getquota.sh,v 1.1.2.1 2011/01/28 18:38:07 bouyer Exp $ +# +# Copyright (c) 2011 Manuel Bouyer +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +for e in le be; do + for v in 1 2; do +for q in "user" "group"; do + test_case get_${e}_${v}_${q} get_quota \ + "get quota with ${q} enabled" ${e} ${v} ${q} +done +test_case get_${e}_${v}_"both" get_quota \ + "get quota with bo