diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cases/floatreturningfuncptr.ll | 18 | ||||
-rw-r--r-- | tests/emscripten_api_browser_infloop.cpp | 12 | ||||
-rwxr-xr-x | tests/runner.py | 8 |
3 files changed, 26 insertions, 12 deletions
diff --git a/tests/cases/floatreturningfuncptr.ll b/tests/cases/floatreturningfuncptr.ll new file mode 100644 index 00000000..e07e97b3 --- /dev/null +++ b/tests/cases/floatreturningfuncptr.ll @@ -0,0 +1,18 @@ +; ModuleID = 'tests/hello_world.bc' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128" +target triple = "i386-pc-linux-gnu" + +@.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] + +; [#uses=0] +define i32 @main() { +entry: + %retval = alloca i32, align 4 ; [#uses=1 type=i32*] + store i32 0, i32* %retval + %call = call float (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0 type=i32] + %call2 = call float (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), float %call) ; [#uses=0 type=i32] + ret i32 1 +} + +; [#uses=1] +declare float @printf(i8*, ...) diff --git a/tests/emscripten_api_browser_infloop.cpp b/tests/emscripten_api_browser_infloop.cpp index 0fd41922..1e9808da 100644 --- a/tests/emscripten_api_browser_infloop.cpp +++ b/tests/emscripten_api_browser_infloop.cpp @@ -8,17 +8,15 @@ struct Class { int x; Class() : x(0) {} + ~Class() { x = -9999; } void print() { - char buf[18]; - memset(buf, 0, 18); // clear stack. if we did not simulate infinite loop, this clears x and is a bug! - x += buf[7]; - printf("waka %d\n", x++); - if (x == 7) { + if (x == 7 || x < 0) { int result = x; REPORT_RESULT(); + emscripten_cancel_main_loop(); } } @@ -28,7 +26,9 @@ struct Class { void start() { instance = this; - emscripten_set_main_loop(Class::callback, 3, 1); // important if we simulate an infinite loop here or not + // important if we simulate an infinite loop here or not. With an infinite loop, the + // destructor should *NOT* have been called + emscripten_set_main_loop(Class::callback, 3, 1); } }; diff --git a/tests/runner.py b/tests/runner.py index 168567d2..f0b5445c 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -2716,7 +2716,6 @@ Exiting setjmp function, level: 0, prev_jmp: -1 if Settings.ASM_JS: return self.skip('uses report_stack without exporting') Settings.INLINING_LIMIT = 50 - Settings.CATCH_EXIT_CODE = 1 src = r''' #include <stdio.h> @@ -2757,7 +2756,7 @@ Exiting setjmp function, level: 0, prev_jmp: -1 ''') self.emcc_args += ['--pre-js', 'pre.js'] - self.do_run(src, '''reported\npostRun\nok.\nExit Status: 1\n''') + self.do_run(src, '''reported\nExit Status: 1\npostRun\nok.\n''') def test_class(self): src = ''' @@ -8673,8 +8672,6 @@ def process(filename): Settings.CORRECT_SIGNS = 0 def test_exit_status(self): - Settings.CATCH_EXIT_CODE = 1 - src = r''' #include <stdio.h> #include <stdlib.h> @@ -8869,7 +8866,6 @@ class %s(T): Settings.INCLUDE_FULL_LIBRARY = 0 Settings.BUILD_AS_SHARED_LIB = 0 Settings.RUNTIME_LINKED_LIBS = [] - Settings.CATCH_EXIT_CODE = 0 Settings.EMULATE_UNALIGNED_ACCESSES = int(Settings.USE_TYPED_ARRAYS == 2 and Building.LLVM_OPTS == 2) Settings.DOUBLE_MODE = 1 if Settings.USE_TYPED_ARRAYS and Building.LLVM_OPTS == 0 else 0 Settings.PRECISE_I64_MATH = 0 @@ -10079,7 +10075,7 @@ f.close() (1, 0, 3, 2), (1, 1, 3, 4) ]: print asm, linkable, chunks, js_chunks - output, err = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_libcxx.cpp'), '-O1', '-s', 'LINKABLE=%d' % linkable, '-s', 'ASM_JS=%d' % asm, '-s', 'UNRESOLVED_AS_DEAD=1'], stdout=PIPE, stderr=PIPE).communicate() + output, err = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_libcxx.cpp'), '-O1', '-s', 'LINKABLE=%d' % linkable, '-s', 'ASM_JS=%d' % asm, '-s', 'UNRESOLVED_AS_DEAD=1'] + (['-O2'] if asm else []), stdout=PIPE, stderr=PIPE).communicate() ok = False for c in range(chunks, chunks+2): ok = ok or ('phase 2 working on %d chunks' % c in err) |