Make tests public. Rewrite most tests. Add tests.
[pintos-anon] / src / tests / vm / mmap-over-data.c
1 #include <stdint.h>
2 #include <round.h>
3 #include <syscall.h>
4 #include "tests/lib.h"
5 #include "tests/main.h"
6
7 static char x;
8
9 void
10 test_main (void) 
11 {
12   uintptr_t x_page = ROUND_DOWN ((uintptr_t) &x, 4096);
13   int handle;
14   
15   CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
16   CHECK (mmap (handle, (void *) x_page) == MAP_FAILED,
17          "try to mmap over data segment");
18 }
19