diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 17:07:03 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:36:01 +0200 |
commit | 002a677488c3c7f4f57b37803dab25ca05974dfc (patch) | |
tree | 0c7516a14630583ca2bb56b39756407c19ac9a63 | |
parent | 77bc19e22629ca314c5b5c85f2c45c7ee5e2e8e4 (diff) |
Use do_run_from_file() for test_dlmalloc_partial_2
-rw-r--r-- | tests/core/test_dlmalloc_partial_2.in | 14 | ||||
-rw-r--r-- | tests/core/test_dlmalloc_partial_2.out | 2 | ||||
-rw-r--r-- | tests/test_core.py | 21 |
3 files changed, 21 insertions, 16 deletions
diff --git a/tests/core/test_dlmalloc_partial_2.in b/tests/core/test_dlmalloc_partial_2.in new file mode 100644 index 00000000..f68e9cdf --- /dev/null +++ b/tests/core/test_dlmalloc_partial_2.in @@ -0,0 +1,14 @@ + + #include <stdio.h> + #include <stdlib.h> + void *malloc(size_t size) + { + return (void*)123; + } + int main() { + void *x = malloc(10); + printf("got %p\n", x); + free(x); + printf("freed the faker\n"); + return 1; + } diff --git a/tests/core/test_dlmalloc_partial_2.out b/tests/core/test_dlmalloc_partial_2.out new file mode 100644 index 00000000..5512c7a8 --- /dev/null +++ b/tests/core/test_dlmalloc_partial_2.out @@ -0,0 +1,2 @@ +got 0x7b +freed
\ No newline at end of file diff --git a/tests/test_core.py b/tests/test_core.py index c0612760..97636b51 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -4439,22 +4439,11 @@ return malloc(size); def test_dlmalloc_partial_2(self): if self.emcc_args is None or 'SAFE_HEAP' in str(self.emcc_args) or 'CHECK_HEAP_ALIGN' in str(self.emcc_args): return self.skip('only emcc will link in dlmalloc, and we do unsafe stuff') # present part of the symbols of dlmalloc, not all. malloc is harder to link than new which is weak. - src = r''' - #include <stdio.h> - #include <stdlib.h> - void *malloc(size_t size) - { - return (void*)123; - } - int main() { - void *x = malloc(10); - printf("got %p\n", x); - free(x); - printf("freed the faker\n"); - return 1; - } -''' - self.do_run(src, 'got 0x7b\nfreed') + + test_path = path_from_root('tests', 'core', 'test_dlmalloc_partial_2') + src, output = (test_path + s for s in ('.in', '.out')) + + self.do_run_from_file(src, output) def test_libcxx(self): if self.emcc_args is None: return self.skip('requires emcc') |