summaryrefslogtreecommitdiffstats
path: root/tests/vm/child-mm-wrt.c
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2012-03-27 11:51:08 +0200
committermanuel <manuel@mausz.at>2012-03-27 11:51:08 +0200
commit4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b (patch)
tree868c52e06f207b5ec8a3cc141f4b8b2bdfcc165c /tests/vm/child-mm-wrt.c
parenteae0bd57f0a26314a94785061888d193d186944a (diff)
downloadprogos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.tar.gz
progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.tar.bz2
progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.zip
reorganize file structure to match the upstream requirements
Diffstat (limited to 'tests/vm/child-mm-wrt.c')
-rw-r--r--tests/vm/child-mm-wrt.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/vm/child-mm-wrt.c b/tests/vm/child-mm-wrt.c
new file mode 100644
index 0000000..8419788
--- /dev/null
+++ b/tests/vm/child-mm-wrt.c
@@ -0,0 +1,24 @@
1/* Child process of mmap-exit.
2 Mmaps a file and writes to it via the mmap'ing, then exits
3 without calling munmap. The data in the mapped region must be
4 written out at program termination. */
5
6#include <string.h>
7#include <syscall.h>
8#include "tests/vm/sample.inc"
9#include "tests/lib.h"
10#include "tests/main.h"
11
12#define ACTUAL ((void *) 0x10000000)
13
14void
15test_main (void)
16{
17 int handle;
18
19 CHECK (create ("sample.txt", sizeof sample), "create \"sample.txt\"");
20 CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
21 CHECK (mmap (handle, ACTUAL) != MAP_FAILED, "mmap \"sample.txt\"");
22 memcpy (ACTUAL, sample, sizeof sample);
23}
24