Make tests public. Rewrite most tests. Add tests.
[pintos-anon] / src / tests / vm / mmap-zero.c
1 #include <syscall.h>
2 #include "tests/lib.h"
3 #include "tests/main.h"
4
5 void
6 test_main (void) 
7 {
8   char *data = (char *) 0x7f000000;
9   int handle;
10
11   CHECK (create ("empty", 0), "create empty file \"empty\"");
12   CHECK ((handle = open ("empty")) > 1, "open \"empty\"");
13
14   /* Calling mmap() might succeed or fail.  We don't care. */
15   msg ("mmap \"empty\"");
16   mmap (handle, data);
17
18   /* Regardless of whether the call worked, *data should cause
19      the process to be terminated. */
20   fail ("unmapped memory is readable (%d)", *data);
21 }
22