diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cases/extendedprecision.ll | 2 | ||||
-rw-r--r-- | tests/openjpeg/codec/convert.h | 4 | ||||
-rwxr-xr-x | tests/runner.py | 71 |
3 files changed, 67 insertions, 10 deletions
diff --git a/tests/cases/extendedprecision.ll b/tests/cases/extendedprecision.ll index 2ab74d58..6f1b2626 100644 --- a/tests/cases/extendedprecision.ll +++ b/tests/cases/extendedprecision.ll @@ -5,7 +5,7 @@ target triple = "i386-pc-linux-gnu" @.str = private constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1] ; [#uses=2] -define void @"\01_Z5hellov"() { +define void @"\01_Z5hellov"(x86_fp80 %waka) { entry: %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] br label %return diff --git a/tests/openjpeg/codec/convert.h b/tests/openjpeg/codec/convert.h index 1dc58d72..73ad6fb7 100644 --- a/tests/openjpeg/codec/convert.h +++ b/tests/openjpeg/codec/convert.h @@ -57,7 +57,7 @@ int imagetobmp(opj_image_t *image, const char *outfile); /* TIFF conversion*/ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters); -int imagetotif(opj_image_t *image, const char *outfile); +static int imagetotif(opj_image_t *image, const char *outfile) { return 0; } // XXX EMSCRIPTEN /** Load a single image component encoded in PGX file format @param filename Name of the PGX file to load @@ -75,7 +75,7 @@ int imagetoraw(opj_image_t * image, const char *outfile); opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw_cparameters_t *raw_cp); /* PNG conversion*/ -extern int imagetopng(opj_image_t *image, const char *write_idf); +static int imagetopng(opj_image_t *image, const char *write_idf) { return 0; } // XXX EMSCRIPTEN extern opj_image_t* pngtoimage(const char *filename, opj_cparameters_t *parameters); #endif /* __J2K_CONVERT_H */ diff --git a/tests/runner.py b/tests/runner.py index 106389a9..a33bf133 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -276,6 +276,11 @@ process(sys.argv[1]) os.chdir(cwd) out = open(stdout, 'r').read() err = open(stderr, 'r').read() + if engine == SPIDERMONKEY_ENGINE and Settings.ASM_JS: + if 'Successfully compiled asm.js code' in err and 'asm.js link error' not in err: + print >> sys.stderr, "[was asm.js'ified]" + else: + print >> sys.stderr, "[did NOT asm.js'ify]" if output_nicerizer: ret = output_nicerizer(out, err) else: @@ -1161,6 +1166,8 @@ m_divisor is 1091269979 def test_llvm_intrinsics(self): if self.emcc_args == None: return self.skip('needs ta2') + Settings.PRECISE_I64_MATH = 2 # for bswap64 + src = r''' #include <stdio.h> #include <sys/types.h> @@ -1188,6 +1195,10 @@ m_divisor is 1091269979 printf("%d\n", llvm_expect_i32(x % 27, 3)); + int64_t a = 1; + a = __builtin_bswap64(a); + printf("%lld\n", a); + return 0; } ''' @@ -1197,6 +1208,7 @@ c8,ef c5,de,15,8a 23,21 13 +72057594037927936 ''') def test_bswap64(self): @@ -2277,6 +2289,7 @@ Exception execution path of first function! 1 ''') def test_exceptions(self): + if Settings.ASM_JS: return self.skip('no exceptions support in asm') if Settings.QUANTUM_SIZE == 1: return self.skip("we don't support libcxx in q1") Settings.EXCEPTION_DEBUG = 1 @@ -2316,8 +2329,8 @@ Exception execution path of first function! 1 self.do_run(src, '*throw...caught!infunc...done!*') Settings.DISABLE_EXCEPTION_CATCHING = 1 - self.do_run(src, 'Compiled code throwing an exception') - + self.do_run(src, 'Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0') + src = ''' #include <iostream> @@ -2367,7 +2380,41 @@ Exception execution path of first function! 1 Settings.DISABLE_EXCEPTION_CATCHING = 0 self.do_run(src, 'Throw...Construct...Catched...Destruct...Throw...Construct...Copy...Catched...Destruct...Destruct...') + def test_white_list_exception(self): + if Settings.ASM_JS: return self.skip('no exceptions support in asm') + Settings.DISABLE_EXCEPTION_CATCHING = 2 + Settings.EXCEPTION_CATCHING_WHITELIST = ["__Z12somefunctionv"] + + src = ''' + #include <stdio.h> + + void thrower() { + printf("infunc..."); + throw(99); + printf("FAIL"); + } + + void somefunction() { + try { + thrower(); + } catch(...) { + printf("done!*\\n"); + } + } + + int main() { + somefunction(); + return 0; + } + ''' + self.do_run(src, 'infunc...done!*') + + Settings.DISABLE_EXCEPTION_CATCHING = 0 + Settings.EXCEPTION_CATCHING_WHITELIST = [] + + def test_uncaught_exception(self): + if Settings.ASM_JS: return self.skip('no exceptions support in asm') if self.emcc_args is None: return self.skip('no libcxx inclusion without emcc') if '-O2' in self.emcc_args: self.emcc_args += ['--closure', '1'] # Use closure here for some additional coverage @@ -2409,6 +2456,7 @@ Exception execution path of first function! 1 self.do_run(src, 'success') def test_typed_exceptions(self): + if Settings.ASM_JS: return self.skip('no exceptions support in asm') Settings.DISABLE_EXCEPTION_CATCHING = 0 Settings.SAFE_HEAP = 0 # Throwing null will cause an ignorable null pointer access. src = open(path_from_root('tests', 'exceptions', 'typed.cpp'), 'r').read() @@ -2416,6 +2464,7 @@ Exception execution path of first function! 1 self.do_run(src, expected) def test_multiexception(self): + if Settings.ASM_JS: return self.skip('no exceptions support in asm') Settings.DISABLE_EXCEPTION_CATCHING = 0 src = r''' #include <stdio.h> @@ -3195,6 +3244,7 @@ def process(filename): self.do_run(src, 'hello world!\n*100*\n*fivesix*\nmann\n', post_build=check) def test_inlinejs(self): + if Settings.ASM_JS: return self.skip('asm does not support random code, TODO: something that works in asm') src = r''' #include <stdio.h> @@ -3348,6 +3398,8 @@ def process(filename): self.do_run(src, '*96,97,98,-14,-14,101*') def test_bigswitch(self): + if Settings.RELOOP: return self.skip('TODO: switch in relooper, issue #781') + src = open(path_from_root('tests', 'bigswitch.cpp')).read() self.do_run(src, '''34962: GL_ARRAY_BUFFER (0x8892) 26214: what? @@ -3782,6 +3834,7 @@ The current type of b is: 9 self.do_run(src, '*0\n') def test_intentional_fault(self): + if Settings.ASM_JS: return self.skip('no throw support in asm') # Some programs intentionally segfault themselves, we should compile that into a throw src = r''' int main () { @@ -4721,7 +4774,7 @@ at function.:blag ''' self.do_run(src, re.sub('(^|\n)\s+', '\\1', expected)) - def test_snprintf0(self): + def test_printf_cases(self): src = r''' #include <stdio.h> int main() { @@ -4729,10 +4782,13 @@ at function.:blag char buf[size]; snprintf(buf, size, "%s %d %.2f\n", "me and myself", 25, 1.345); printf("%d : %s\n", size, buf); + char *buff = NULL; + asprintf(&buff, "%d waka %d\n", 21, 95); + puts(buff); return 0; } ''' - self.do_run(src, '22 : me and myself 25 1.34\n') + self.do_run(src, '22 : me and myself 25 1.34\n21 waka 95\n') def test_atoX(self): if self.emcc_args is None: return self.skip('requires ta2') @@ -5513,7 +5569,7 @@ def process(filename): int main() { char *c = "μ†ℱ ╋ℯ╳╋"; printf("%d %d %d %d %s\n", c[0]&0xff, c[1]&0xff, c[2]&0xff, c[3]&0xff, c); - emscripten_run_script("cheez = Module._malloc(100);" + emscripten_run_script("cheez = _malloc(100);" "Module.writeStringToMemory(\"μ†ℱ ╋ℯ╳╋\", cheez);" "Module.print([Pointer_stringify(cheez), Module.getValue(cheez, 'i8')&0xff, Module.getValue(cheez+1, 'i8')&0xff, Module.getValue(cheez+2, 'i8')&0xff, Module.getValue(cheez+3, 'i8')&0xff, ]);"); } @@ -10552,7 +10608,8 @@ elif 'benchmark' in str(sys.argv): try_delete(final_filename) output = Popen([PYTHON, EMCC, filename, #'-O3', - '-O2', '-s', 'INLINING_LIMIT=0', '-s', 'DOUBLE_MODE=0', '-s', 'PRECISE_I64_MATH=0',# '-s', 'ASM_JS=1', + '-O2', '-s', 'INLINING_LIMIT=0', '-s', 'DOUBLE_MODE=0', '-s', 'PRECISE_I64_MATH=0', + #'-s', 'ASM_JS=1', '-s', 'USE_MATH_IMUL=1', '-s', 'TOTAL_MEMORY=128*1024*1024', '-s', 'FAST_MEMORY=10*1024*1024', '-o', final_filename] + emcc_args, stdout=PIPE, stderr=self.stderr_redirect).communicate() assert os.path.exists(final_filename), 'Failed to compile file: ' + output[0] @@ -10562,7 +10619,7 @@ elif 'benchmark' in str(sys.argv): times = [] for i in range(TEST_REPS): start = time.time() - js_output = self.run_generated_code(JS_ENGINE, final_filename, args, check_timeout=False) + js_output = run_js(final_filename, engine=JS_ENGINE, args=args, stderr=PIPE, full_output=True) if i == 0 and 'Successfully compiled asm.js code' in js_output: print "[%s was asm.js'ified]" % name curr = time.time()-start |