Module Name:    src
Committed By:   pooka
Date:           Tue Mar  1 15:04:48 UTC 2011

Modified Files:
        src/tests/fs/vfs: t_vnops.c

Log Message:
Rmdir the dir you're in and its parent and try to cd ..
Fails on tmpfs (crash), puffs (cd .. succeeds) and rumpfs (cd .. succeeds).

another testcase derived from the bugfinding genious of Taylor R Campbell


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/fs/vfs/t_vnops.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/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.17 src/tests/fs/vfs/t_vnops.c:1.18
--- src/tests/fs/vfs/t_vnops.c:1.17	Tue Mar  1 14:27:32 2011
+++ src/tests/fs/vfs/t_vnops.c	Tue Mar  1 15:04:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.17 2011/03/01 14:27:32 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.18 2011/03/01 15:04:47 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -152,6 +152,34 @@
 }
 
 static void
+dir_rmdirdotdot(const atf_tc_t *tc, const char *mp)
+{
+	char pb[MAXPATHLEN];
+	int xerrno;
+
+	USES_DIRS;
+
+	FSTEST_ENTER();
+	RL(rump_sys_mkdir("test", 0777));
+	RL(rump_sys_chdir("test"));
+
+	RL(rump_sys_mkdir("subtest", 0777));
+	RL(rump_sys_chdir("subtest"));
+
+	md(pb, mp, "test/subtest");
+	RL(rump_sys_rmdir(pb));
+	md(pb, mp, "test");
+	RL(rump_sys_rmdir(pb));
+
+	if (FSTYPE_NFS(tc))
+		xerrno = ESTALE;
+	else
+		xerrno = ENOENT;
+	ATF_REQUIRE_ERRNO(xerrno, rump_sys_chdir("..") == -1);
+	FSTEST_EXIT();
+}
+
+static void
 checkfile(const char *path, struct stat *refp)
 {
 	char buf[MAXPATHLEN];
@@ -749,6 +777,7 @@
 ATF_TC_FSAPPLY(lookup_complex, "lookup of non-dot entries");
 ATF_TC_FSAPPLY(dir_simple, "mkdir/rmdir");
 ATF_TC_FSAPPLY(dir_notempty, "non-empty directories cannot be removed");
+ATF_TC_FSAPPLY(dir_rmdirdotdot, "remove .. and try to cd out");
 ATF_TC_FSAPPLY(rename_dir, "exercise various directory renaming ops");
 ATF_TC_FSAPPLY(rename_dotdot, "rename dir ..");
 ATF_TC_FSAPPLY(rename_reg_nodir, "rename regular files, no subdirectories");
@@ -768,6 +797,7 @@
 	ATF_TP_FSAPPLY(lookup_complex);
 	ATF_TP_FSAPPLY(dir_simple);
 	ATF_TP_FSAPPLY(dir_notempty);
+	ATF_TP_FSAPPLY(dir_rmdirdotdot);
 	ATF_TP_FSAPPLY(rename_dir);
 	ATF_TP_FSAPPLY(rename_dotdot);
 	ATF_TP_FSAPPLY(rename_reg_nodir);

Reply via email to