Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/fs/vfs Add a test which creates many directory entries.



details:   https://anonhg.NetBSD.org/src/rev/0adef7c1c36f
branches:  trunk
changeset: 812753:0adef7c1c36f
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Jan 01 15:13:57 2016 +0000

description:
Add a test which creates many directory entries.

diffstat:

 tests/fs/vfs/t_vnops.c |  48 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 47 insertions(+), 1 deletions(-)

diffs (76 lines):

diff -r 9ef0e8032db6 -r 0adef7c1c36f tests/fs/vfs/t_vnops.c
--- a/tests/fs/vfs/t_vnops.c    Thu Dec 31 20:35:21 2015 +0000
+++ b/tests/fs/vfs/t_vnops.c    Fri Jan 01 15:13:57 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_vnops.c,v 1.49 2015/04/09 19:47:05 riastradh Exp $   */
+/*     $NetBSD: t_vnops.c,v 1.50 2016/01/01 15:13:57 pooka Exp $       */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -439,6 +439,47 @@
 }
 
 static void
+create_many(const atf_tc_t *tc, const char *mp)
+{
+       char buf[64];
+       int nfiles = 2324; /* #Nancy */
+       int i;
+
+       /* fs doesn't support many files */
+       if (FSTYPE_SYSVBFS(tc))
+               nfiles = 5;
+
+       /* takes forever with many files */
+       if (FSTYPE_MSDOS(tc))
+               nfiles /= 4;
+
+       RL(rump_sys_chdir(mp));
+
+       /* msdosfs doesn't like many entries in the root directory */
+       RL(rump_sys_mkdir("subdir", 0777));
+       RL(rump_sys_chdir("subdir"));
+
+       /* create them */
+#define TESTFN "this_is_the_filename"
+       for (i = 0; i < nfiles; i++) {
+               int fd;
+
+               sprintf(buf, TESTFN "%d\n", i);
+               RL(fd = rump_sys_open(buf, O_RDWR|O_CREAT|O_EXCL, 0666));
+               RL(rump_sys_close(fd));
+       }
+
+       /* wipe them out */
+       for (i = 0; i < nfiles; i++) {
+               sprintf(buf, TESTFN "%d\n", i);
+               RL(rump_sys_unlink(buf));
+       }
+#undef TESTFN
+
+       rump_sys_chdir("/");
+}
+
+static void
 create_nametoolong(const atf_tc_t *tc, const char *mp)
 {
        char *name;
@@ -958,6 +999,10 @@
 ATF_TC_FSAPPLY(read_directory, "read(2) on directories");
 ATF_TC_FSAPPLY(lstat_symlink, "lstat(2) values for symbolic links");
 
+#undef FSTEST_IMGSIZE
+#define FSTEST_IMGSIZE (1024*1024*64)
+ATF_TC_FSAPPLY(create_many, "create many directory entries");
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -969,6 +1014,7 @@
        ATF_TP_FSAPPLY(rename_dir);
        ATF_TP_FSAPPLY(rename_dotdot);
        ATF_TP_FSAPPLY(rename_reg_nodir);
+       ATF_TP_FSAPPLY(create_many);
        ATF_TP_FSAPPLY(create_nametoolong);
        ATF_TP_FSAPPLY(create_exist);
        ATF_TP_FSAPPLY(rename_nametoolong);



Home | Main Index | Thread Index | Old Index