aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-xtests/runner.py33
1 files changed, 31 insertions, 2 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 2515ef33..e631b025 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -3811,6 +3811,8 @@ The current type of b is: 9
''')
def test_structbyval(self):
+ Settings.INLINING_LIMIT = 50
+
# part 1: make sure that normally, passing structs by value works
src = r'''
@@ -5086,7 +5088,7 @@ at function.:blag
'''
self.do_run(src, '22 : me and myself 25 1.34\n21 waka 95\n')
- def test_perror(self):
+ def test_perrar(self):
src = r'''
#include <sys/types.h>
#include <sys/stat.h>
@@ -9749,6 +9751,23 @@ seeked= file.
if optimize_normally: del os.environ['EMCC_OPTIMIZE_NORMALLY']
del os.environ['EMCC_DEBUG']
+ def test_jcache_printf(self):
+ open(self.in_dir('src.cpp'), 'w').write(r'''
+ #include <stdio.h>
+ #include <stdint.h>
+ #include <emscripten.h>
+ int main() {
+ emscripten_jcache_printf("hello world\n");
+ emscripten_jcache_printf("hello %d world\n", 5);
+ emscripten_jcache_printf("hello %.3f world\n", 123.456789123);
+ emscripten_jcache_printf("hello %llx world\n", 0x1234567811223344ULL);
+ return 0;
+ }
+ ''')
+ Popen([PYTHON, EMCC, self.in_dir('src.cpp')]).communicate()
+ output = run_js('a.out.js')
+ self.assertIdentical('hello world\nhello 5 world\nhello 123.457 world\nhello 1234567811223300 world\n', output)
+
def test_conftest_s_flag_passing(self):
open(os.path.join(self.get_dir(), 'conftest.c'), 'w').write(r'''
int main() {
@@ -11924,6 +11943,8 @@ fi
try_delete(CANONICAL_TEMP_DIR)
def test_relooper(self):
+ RELOOPER = Cache.get_path('relooper.js')
+
restore()
for phase in range(2): # 0: we wipe the relooper dir. 1: we have it, so should just update
if phase == 0: Cache.erase()
@@ -11992,9 +12013,17 @@ fi
# finally, build a file close to the previous, to see that some chunks are found in the cache and some not
(['--jcache'], 'hello_libcxx_mod1.cpp', False, True, True, True, True, True, []), # win on pre, mix on funcs, mix on jsfuncs
(['--jcache'], 'hello_libcxx_mod1.cpp', False, True, False, True, False, True, []),
+ (None, None, None, None, None, None, None, None, None), # clear
+ (['--jcache'], 'hello_libcxx_mod2.cpp', True, False, True, False, True, False, []), # load into cache
+ (['--jcache'], 'hello_libcxx_mod2a.cpp', False, True, True, True, True, True, []) # add a printf, do not lose everything
]:
- print >> sys.stderr, args, input_file, expect_pre_save, expect_pre_load, expect_funcs_save, expect_funcs_load, expect_jsfuncs_save, expect_jsfuncs_load, expected
self.clear()
+ if args is None:
+ Cache.erase()
+ continue
+
+ print >> sys.stderr, args, input_file, expect_pre_save, expect_pre_load, expect_funcs_save, expect_funcs_load, expect_jsfuncs_save, expect_jsfuncs_load, expected
+
out, err = Popen([PYTHON, EMCC, '-O2', path_from_root('tests', input_file)] + args, stdout=PIPE, stderr=PIPE).communicate()
errtail = err.split('emcc invocation')[-1]
self.assertContained('hello, world!', run_js('a.out.js'), errtail)