Separate persistence tests from the extended filesys tests.
[pintos-anon] / src / tests / filesys / extended / dir-rm-cwd.ck
1 # -*- perl -*-
2 use strict;
3 use warnings;
4 use tests::tests;
5 my ($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
30 EOF
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
46 EOF
47 open (CAN_RMDIR_CWD, ">tests/filesys/extended/can-rmdir-cwd")
48   or die "tests/filesys/extended/can-rmdir-cwd: create: $!\n";
49 print CAN_RMDIR_CWD "$cwd_removable";
50 close (CAN_RMDIR_CWD);
51 pass;