Make tests public. Rewrite most tests. Add tests.
[pintos-anon] / src / tests / vm / mmap-overlap.c
1 #include <syscall.h>
2 #include "tests/vm/sample.inc"
3 #include "tests/lib.h"
4 #include "tests/main.h"
5
6 void
7 test_main (void)
8 {
9   char *start = (char *) 0x10000000;
10   int fd[2];
11
12   CHECK ((fd[0] = open ("zeros")) > 1, "open \"zeros\" once");
13   CHECK (mmap (fd[0], start) != MAP_FAILED, "mmap \"zeros\"");
14   CHECK ((fd[1] = open ("zeros")) > 1 && fd[0] != fd[1],
15          "open \"zeros\" again");
16   CHECK (mmap (fd[1], start + 4096) == MAP_FAILED,
17          "try to mmap \"zeros\" again");
18 }