Make the default simulator qemu for project 2...4,
[pintos-anon] / src / tests / filesys / extended / dir-rm-cwd-cd.c
1 /* Tries to remove the current directory.
2    This is allowed to succeed or fail.
3    If it succeeds, then it must not be possible to chdir back to
4    the current directory by name (because it's been deleted).
5    If it fails, then it must be possible to chdir back to the
6    current directory by name (because it still exists). */
7
8 #include <syscall.h>
9 #include "tests/lib.h"
10 #include "tests/main.h"
11
12 void
13 test_main (void) 
14 {
15   CHECK (mkdir ("a"), "mkdir \"a\"");
16   CHECK (chdir ("a"), "chdir \"a\"");
17   msg ("remove \"/a\" (must not crash)");
18   if (remove ("/a"))
19     CHECK (!chdir ("/a"),
20            "chdir \"/a\" (remove succeeded so this must return false)");
21   else
22     CHECK (chdir ("/a"), "chdir \"/a\" (remove failed so this must succeed)");
23 }