diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-07-01 11:31:15 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-07-03 15:31:04 -0700 |
commit | 461478fbb7199a6a557b754271a9d7e69172765f (patch) | |
tree | 8d41a98331b06579190c1cbf5cf7fa5c175f9888 /tests/runner.py | |
parent | 5b27fcf2088abd85fbca78f9067806227772dbba (diff) |
testing for using libc in a side module, and forcing inclusion of libc making it work
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-x | tests/runner.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/runner.py b/tests/runner.py index 0db58f4e..b0d86c6a 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -10731,13 +10731,37 @@ f.close() ''', r''' #include "header.h" char *side(const char *data) { - return (char*)data; char *ret = (char*)malloc(strlen(data)+1); strcpy(ret, data); return ret; } ''', ['hello through side\n']) + # libc usage in one modules. must force libc inclusion in the main module if that isn't the one using mallinfo() + try: + os.environ['EMCC_FORCE_STDLIBS'] = 'libc' + test('malloc-1', r''' + #include <string.h> + int side(); + ''', r''' + #include <stdio.h> + #include "header.h" + int main() { + printf("|%d|\n", side()); + return 0; + } + ''', r''' + #include <stdlib.h> + #include <malloc.h> + #include "header.h" + int side() { + struct mallinfo m = mallinfo(); + return m.arena > 1; + } + ''', ['|1|\n']) + finally: + del os.environ['EMCC_FORCE_STDLIBS'] + return # TODO # iostream usage in one and std::string in both |