Make tests public. Rewrite most tests. Add tests.
[pintos-anon] / src / tests / vm / mmap-unmap.c
1 #include <syscall.h>
2 #include "tests/vm/sample.inc"
3 #include "tests/lib.h"
4 #include "tests/main.h"
5
6 #define ACTUAL ((void *) 0x10000000)
7
8 void
9 test_main (void)
10 {
11   int handle;
12   mapid_t map;
13
14   CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
15   CHECK ((map = mmap (handle, ACTUAL)) != MAP_FAILED, "mmap \"sample.txt\"");
16
17   munmap (map);
18
19   fail ("unmapped memory is readable (%d)", *(int *) ACTUAL);
20 }