summaryrefslogtreecommitdiffstats
path: root/src/tests/filesys/extended/dir-rm-parent.c
blob: eb43f5b6cf6070b9767bafa315165ffc3afa8786 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* Tries to remove a parent of the current directory.  This must
   fail, because that directory is non-empty. */

#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"

void
test_main (void) 
{
  CHECK (mkdir ("a"), "mkdir \"a\"");
  CHECK (chdir ("a"), "chdir \"a\"");
  CHECK (mkdir ("b"), "mkdir \"b\"");
  CHECK (chdir ("b"), "chdir \"b\"");
  CHECK (!remove ("/a"), "remove \"/a\" (must fail)");
}