PKUOS - Pintos
Pintos source browser for PKU Operating System course
dir-rm-parent.c
Go to the documentation of this file.
1/** Tries to remove a parent of the current directory. This must
2 fail, because that directory is non-empty. */
3
4#include <syscall.h>
5#include "tests/lib.h"
6#include "tests/main.h"
7
8void
9test_main (void)
10{
11 CHECK (mkdir ("a"), "mkdir \"a\"");
12 CHECK (chdir ("a"), "chdir \"a\"");
13 CHECK (mkdir ("b"), "mkdir \"b\"");
14 CHECK (chdir ("b"), "chdir \"b\"");
15 CHECK (!remove ("/a"), "remove \"/a\" (must fail)");
16}
void test_main(void)
Tries to remove a parent of the current directory.
Definition: dir-rm-parent.c:9
bool chdir(const char *dir)
Project 4 only.
Definition: syscall.c:157
bool remove(const char *file)
Definition: syscall.c:97
bool mkdir(const char *dir)
Definition: syscall.c:163
#define CHECK(SUCCESS,...)
Takes an expression to test for SUCCESS and a message, which may include printf-style arguments.
Definition: lib.h:29