X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ftests%2Ffilesys%2Fextended%2Fdir-rm-cwd.ck;h=8821f0d767c24f43f671220eedf9dea5fc23933c;hb=b51bfd75c7f55f008d67ec13d895694fbfa22430;hp=91e7c0f37074741b6f122f7a7b551aac9f34d0be;hpb=73389b59f54bfed8eb0cb370a5ffec1223686a9e;p=pintos-anon diff --git a/src/tests/filesys/extended/dir-rm-cwd.ck b/src/tests/filesys/extended/dir-rm-cwd.ck index 91e7c0f..8821f0d 100644 --- a/src/tests/filesys/extended/dir-rm-cwd.ck +++ b/src/tests/filesys/extended/dir-rm-cwd.ck @@ -2,11 +2,48 @@ use strict; use warnings; use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); +my ($cwd_removable) = check_expected (IGNORE_EXIT_CODES => 1, + {NO => <<'EOF', YES => <<'EOF'}); (dir-rm-cwd) begin +(dir-rm-cwd) open "/" (dir-rm-cwd) mkdir "a" +(dir-rm-cwd) open "/a" +(dir-rm-cwd) verify "/a" is empty +(dir-rm-cwd) "/" and "/a" must have different inumbers (dir-rm-cwd) chdir "a" -(dir-rm-cwd) remove "/a" (must not crash) -(dir-rm-cwd) create "b" (must not crash) +(dir-rm-cwd) try to remove "/a" +(dir-rm-cwd) remove failed +(dir-rm-cwd) try to remove "../a" (must fail) +(dir-rm-cwd) try to remove ".././a" (must fail) +(dir-rm-cwd) try to remove "/./a" (must fail) +(dir-rm-cwd) open "/a" +(dir-rm-cwd) open "." +(dir-rm-cwd) "/a" and "." must have same inumber +(dir-rm-cwd) "/" and "/a" must have different inumbers +(dir-rm-cwd) chdir "/a" +(dir-rm-cwd) open "." +(dir-rm-cwd) "." must have same inumber as before +(dir-rm-cwd) chdir "/" +(dir-rm-cwd) try to remove "a" (must fail: still open) +(dir-rm-cwd) verify "/a" is empty (dir-rm-cwd) end EOF +(dir-rm-cwd) begin +(dir-rm-cwd) open "/" +(dir-rm-cwd) mkdir "a" +(dir-rm-cwd) open "/a" +(dir-rm-cwd) verify "/a" is empty +(dir-rm-cwd) "/" and "/a" must have different inumbers +(dir-rm-cwd) chdir "a" +(dir-rm-cwd) try to remove "/a" +(dir-rm-cwd) remove successful +(dir-rm-cwd) open "/a" (must fail) +(dir-rm-cwd) open "." (must fail) +(dir-rm-cwd) open ".." (must fail) +(dir-rm-cwd) create "x" (must fail) +(dir-rm-cwd) verify "/a" is empty +(dir-rm-cwd) end +EOF + +check_archive ($cwd_removable eq 'YES' ? {} : {"a" => {}}); +pass;