summaryrefslogtreecommitdiffstats
path: root/tests/filesys/extended/dir-rm-cwd.ck
diff options
context:
space:
mode:
Diffstat (limited to 'tests/filesys/extended/dir-rm-cwd.ck')
-rw-r--r--tests/filesys/extended/dir-rm-cwd.ck51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/filesys/extended/dir-rm-cwd.ck b/tests/filesys/extended/dir-rm-cwd.ck
new file mode 100644
index 0000000..6fa4739
--- /dev/null
+++ b/tests/filesys/extended/dir-rm-cwd.ck
@@ -0,0 +1,51 @@
1# -*- perl -*-
2use strict;
3use warnings;
4use tests::tests;
5my ($cwd_removable) = check_expected (IGNORE_EXIT_CODES => 1,
6 {NO => <<'EOF', YES => <<'EOF'});
7(dir-rm-cwd) begin
8(dir-rm-cwd) open "/"
9(dir-rm-cwd) mkdir "a"
10(dir-rm-cwd) open "/a"
11(dir-rm-cwd) verify "/a" is empty
12(dir-rm-cwd) "/" and "/a" must have different inumbers
13(dir-rm-cwd) chdir "a"
14(dir-rm-cwd) try to remove "/a"
15(dir-rm-cwd) remove failed
16(dir-rm-cwd) try to remove "../a" (must fail)
17(dir-rm-cwd) try to remove ".././a" (must fail)
18(dir-rm-cwd) try to remove "/./a" (must fail)
19(dir-rm-cwd) open "/a"
20(dir-rm-cwd) open "."
21(dir-rm-cwd) "/a" and "." must have same inumber
22(dir-rm-cwd) "/" and "/a" must have different inumbers
23(dir-rm-cwd) chdir "/a"
24(dir-rm-cwd) open "."
25(dir-rm-cwd) "." must have same inumber as before
26(dir-rm-cwd) chdir "/"
27(dir-rm-cwd) try to remove "a" (must fail: still open)
28(dir-rm-cwd) verify "/a" is empty
29(dir-rm-cwd) end
30EOF
31(dir-rm-cwd) begin
32(dir-rm-cwd) open "/"
33(dir-rm-cwd) mkdir "a"
34(dir-rm-cwd) open "/a"
35(dir-rm-cwd) verify "/a" is empty
36(dir-rm-cwd) "/" and "/a" must have different inumbers
37(dir-rm-cwd) chdir "a"
38(dir-rm-cwd) try to remove "/a"
39(dir-rm-cwd) remove successful
40(dir-rm-cwd) open "/a" (must fail)
41(dir-rm-cwd) open "." (must fail)
42(dir-rm-cwd) open ".." (must fail)
43(dir-rm-cwd) create "x" (must fail)
44(dir-rm-cwd) verify "/a" is empty
45(dir-rm-cwd) end
46EOF
47open (CAN_RMDIR_CWD, ">tests/filesys/extended/can-rmdir-cwd")
48 or die "tests/filesys/extended/can-rmdir-cwd: create: $!\n";
49print CAN_RMDIR_CWD "$cwd_removable";
50close (CAN_RMDIR_CWD);
51pass;