3 #include "tests/vm/sample.inc"
5 #include "tests/main.h"
10 char *actual = (char *) 0x10000000;
16 CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
17 CHECK ((map = mmap (handle, actual)) != MAP_FAILED, "mmap \"sample.txt\"");
19 /* Close file and delete it. */
21 CHECK (remove ("sample.txt"), "remove \"sample.txt\"");
22 CHECK (open ("sample.txt") == -1, "try to open \"sample.txt\"");
24 /* Create a new file in hopes of overwriting data from the old
25 one, in case the file system has incorrectly freed the
27 CHECK (create ("another", 4096 * 10), "create \"another\"");
29 /* Check that mapped data is correct. */
30 if (memcmp (actual, sample, strlen (sample)))
31 fail ("read of mmap'd file reported bad data");
33 /* Verify that data is followed by zeros. */
34 for (i = strlen (sample); i < 4096; i++)
36 fail ("byte %zu of mmap'd region has value %02hhx (should be 0)",