6#include "tests/vm/sample.inc"
13 char *actual = (
char *) 0x10000000;
19 CHECK ((handle =
open (
"sample.txt")) > 1,
"open \"sample.txt\"");
24 CHECK (
remove (
"sample.txt"),
"remove \"sample.txt\"");
25 CHECK (
open (
"sample.txt") == -1,
"try to open \"sample.txt\"");
30 CHECK (
create (
"another", 4096 * 10),
"create \"another\"");
34 fail (
"read of mmap'd file reported bad data");
37 for (i =
strlen (sample); i < 4096; i++)
39 fail (
"byte %zu of mmap'd region has value %02hhx (should be 0)",
mapid_t mmap(int fd, void *addr)
Project 3 and optionally project 4.
bool create(const char *file, unsigned initial_size)
int open(const char *file)
bool remove(const char *file)
void munmap(mapid_t mapid)
int mapid_t
Map region identifier.
void fail(const char *format,...)
#define CHECK(SUCCESS,...)
Takes an expression to test for SUCCESS and a message, which may include printf-style arguments.
void test_main(void)
Deletes and closes file that is mapped into memory and verifies that it can still be read through the...
int memcmp(const void *a_, const void *b_, size_t size)
Find the first differing byte in the two blocks of SIZE bytes at A and B.
size_t strlen(const char *string)
Returns the length of STRING.