diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-01-18 15:21:52 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-01-18 15:21:52 -0800 |
commit | a14d24ce9c880bf0b6e46d8fbb7b1e4dbb9a308e (patch) | |
tree | b594cced802b445b9176c249b0a1873b08919812 /tests/runner.py | |
parent | e36ed341d217b86cdee5c483ce65e9a1208e794c (diff) | |
parent | 233113e07d42ed104eca9fc134e1e9894bc78305 (diff) |
Merge branch 'master' into libcxx
Diffstat (limited to 'tests/runner.py')
-rw-r--r-- | tests/runner.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index 20a3ea29..30f5f62c 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -4001,6 +4001,39 @@ def process(filename): } ''' self.do_run(src, 'value:10') + + def test_mmap(self): + src = ''' + #include <stdio.h> + #include <sys/mman.h> + #include <assert.h> + + int main(int argc, char *argv[]) { + const int NUM_BYTES = 8 * 1024 * 1024; + const int NUM_INTS = NUM_BYTES / sizeof(int); + + int* map = (int*)mmap(0, NUM_BYTES, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANON, -1, 0); + assert(map != MAP_FAILED); + + int i; + + for (i = 0; i < NUM_INTS; i++) { + map[i] = i; + } + + for (i = 0; i < NUM_INTS; i++) { + assert(map[i] == i); + } + + assert(munmap(map, NUM_BYTES) == 0); + + printf("hello,world"); + return 0; + } + ''' + self.do_run(src, 'hello,world') + self.do_run(src, 'hello,world', force_c=True) def test_cubescript(self): if self.emcc_args is not None and '-O2' in self.emcc_args: |