diff options
Diffstat (limited to 'tests/test_core.py')
-rw-r--r-- | tests/test_core.py | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/tests/test_core.py b/tests/test_core.py index 01154605..242494b6 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -4486,46 +4486,11 @@ return malloc(size); Settings.TOTAL_MEMORY = 128*1024*1024 - src = ''' - #include <stdio.h> - #include <sys/mman.h> - #include <assert.h> - - int main(int argc, char *argv[]) { - for (int i = 0; i < 10; i++) { - int* map = (int*)mmap(0, 5000, PROT_READ | PROT_WRITE, - MAP_SHARED | MAP_ANON, -1, 0); - /* TODO: Should we align to 4k? - assert(((int)map) % 4096 == 0); // aligned - */ - assert(munmap(map, 5000) == 0); - } - - 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); + test_path = path_from_root('tests', 'core', 'test_mmap') + src, output = (test_path + s for s in ('.in', '.out')) - printf("hello,world"); - return 0; - } - ''' - self.do_run(src, 'hello,world') - self.do_run(src, 'hello,world', force_c=True) + self.do_run_from_file(src, output) + self.do_run_from_file(src, output, force_c=True) def test_mmap_file(self): if self.emcc_args is None: return self.skip('requires emcc') |