diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cases/fp80_ta2.ll | 21 | ||||
-rw-r--r-- | tests/test_core.py | 41 | ||||
-rw-r--r-- | tests/test_other.py | 2 |
3 files changed, 23 insertions, 41 deletions
diff --git a/tests/cases/fp80_ta2.ll b/tests/cases/fp80_ta2.ll deleted file mode 100644 index 7fc0db4a..00000000 --- a/tests/cases/fp80_ta2.ll +++ /dev/null @@ -1,21 +0,0 @@ -; ModuleID = 'src.cpp.o' -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" -target triple = "i386-pc-linux-gnu" - -@.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00" ; [#uses=1] - -; [#uses=0] -define i32 @main() { -entry: - %x = zext i32 0 to x86_fp80 - %1 = bitcast x86_fp80 %x to i80 - %2 = trunc i80 %1 to i32 - %retval = alloca i32, align 4 ; [#uses=1] - store i32 0, i32* %retval - %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] - ret i32 0 -} - -; [#uses=1] -declare i32 @printf(i8*, ...) - diff --git a/tests/test_core.py b/tests/test_core.py index 11ec8fd2..c1bfce6f 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -3841,25 +3841,26 @@ def process(filename): self.do_run(src, '4\n200\ndone\n') def test_inlinejs3(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> - #include <emscripten.h> + src = r''' + #include <stdio.h> + #include <emscripten.h> - int main() { - EM_ASM(Module.print('hello dere1')); - EM_ASM( - Module.print('hello dere2'); - ); + int main() { + EM_ASM(Module.print('hello dere1')); + EM_ASM( + Module.print('hello dere2'); + ); + for (int i = 0; i < 3; i++) { EM_ASM( Module.print('hello dere3'); Module.print('hello dere' + 4); ); - return 0; } - ''' + return 0; + } + ''' - self.do_run(src, 'hello dere1\nhello dere2\nhello dere3\nhello dere4\n') + self.do_run(src, 'hello dere1\nhello dere2\nhello dere3\nhello dere4\nhello dere3\nhello dere4\nhello dere3\nhello dere4\n') def test_memorygrowth(self): if Settings.USE_TYPED_ARRAYS == 0: return self.skip('memory growth is only supported with typed arrays') @@ -7266,6 +7267,7 @@ date: 18.07.2013w; day 18, month 7, year 2013, extra: 201, 3 if self.emcc_args is not None and '-O2' in self.emcc_args: self.emcc_args += ['--closure', '1'] # Use closure here, to test we don't break FS stuff self.emcc_args = filter(lambda x: x != '-g', self.emcc_args) # ensure we test --closure 1 --memory-init-file 1 (-g would disable closure) + self.emcc_args += ["-s", "CHECK_HEAP_ALIGN=0"] # disable heap align check here, it mixes poorly with closure Settings.CORRECT_SIGNS = 1 # Just so our output is what we expect. Can flip them both. post = ''' @@ -7749,7 +7751,6 @@ def process(filename): self.do_run(src, 'success', force_c=True, js_engines=[NODE_JS]) def test_unistd_access(self): - if Settings.ASM_JS: Settings.ASM_JS = 2 # skip validation, asm does not support random code if not self.is_le32(): return self.skip('le32 needed for inline js') for fs in ['MEMFS', 'NODEFS']: src = open(path_from_root('tests', 'unistd', 'access.c'), 'r').read() @@ -7758,7 +7759,6 @@ def process(filename): self.do_run(src, expected, js_engines=[NODE_JS]) def test_unistd_curdir(self): - if Settings.ASM_JS: Settings.ASM_JS = 2 # skip validation, asm does not support random code if not self.is_le32(): return self.skip('le32 needed for inline js') src = open(path_from_root('tests', 'unistd', 'curdir.c'), 'r').read() expected = open(path_from_root('tests', 'unistd', 'curdir.out'), 'r').read() @@ -7789,7 +7789,6 @@ def process(filename): self.do_run(src, expected) def test_unistd_truncate(self): - if Settings.ASM_JS: Settings.ASM_JS = 2 # skip validation, asm does not support random code if not self.is_le32(): return self.skip('le32 needed for inline js') for fs in ['MEMFS', 'NODEFS']: src = open(path_from_root('tests', 'unistd', 'truncate.c'), 'r').read() @@ -7825,7 +7824,6 @@ def process(filename): self.do_run(src, 'success', force_c=True, js_engines=[NODE_JS]) def test_unistd_links(self): - if Settings.ASM_JS: Settings.ASM_JS = 2 # skip validation, asm does not support random code if not self.is_le32(): return self.skip('le32 needed for inline js') for fs in ['MEMFS', 'NODEFS']: src = open(path_from_root('tests', 'unistd', 'links.c'), 'r').read() @@ -7839,7 +7837,6 @@ def process(filename): self.do_run(src, expected) def test_unistd_io(self): - if Settings.ASM_JS: Settings.ASM_JS = 2 # skip validation, asm does not support random code if not self.is_le32(): return self.skip('le32 needed for inline js') if self.run_name == 'o2': return self.skip('non-asm optimized builds can fail with inline js') if self.emcc_args is None: return self.skip('requires emcc') @@ -8609,6 +8606,12 @@ void*:16 assert ' & 255]()' not in original, 'big function table does not exist' assert ' & 255]()' in final, 'big function table exists' + assert 'asm1' in test_modes + if self.run_name == 'asm1': + assert not Settings.RELOOP + Settings.RELOOP = 1 # check for mixing of relooping with asm1 + self.do_run(path_from_root('tests', 'cubescript'), '*\nTemp is 33\n9\n5\nhello, everyone\n*', main_file='command.cpp') + def test_gcc_unmangler(self): Settings.NAMED_GLOBALS = 1 # test coverage for this @@ -10517,9 +10520,9 @@ o1 = make_run("o1", compiler=CLANG, emcc_args=["-O1", "-s", "ASM_JS=0", "-s", "S o2 = make_run("o2", compiler=CLANG, emcc_args=["-O2", "-s", "ASM_JS=0", "-s", "JS_CHUNK_SIZE=1024"]) # asm.js -asm1 = make_run("asm1", compiler=CLANG, emcc_args=["-O1", "-s", "CHECK_HEAP_ALIGN=1"]) +asm1 = make_run("asm1", compiler=CLANG, emcc_args=["-O1"]) asm2 = make_run("asm2", compiler=CLANG, emcc_args=["-O2"]) -asm2g = make_run("asm2g", compiler=CLANG, emcc_args=["-O2", "-g", "-s", "ASSERTIONS=1", "--memory-init-file", "1"]) +asm2g = make_run("asm2g", compiler=CLANG, emcc_args=["-O2", "-g", "-s", "ASSERTIONS=1", "--memory-init-file", "1", "-s", "CHECK_HEAP_ALIGN=1"]) asm2x86 = make_run("asm2x86", compiler=CLANG, emcc_args=["-O2", "-g", "-s", "CHECK_HEAP_ALIGN=1"], env={"EMCC_LLVM_TARGET": "i386-pc-linux-gnu"}) # Make custom runs with various options diff --git a/tests/test_other.py b/tests/test_other.py index 69823d8e..afad1927 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -175,7 +175,7 @@ Options that are modified or new in %s include: if opt_level >= 2 and '-g' in params: assert re.search('HEAP8\[\$?\w+ ?\+ ?\(+\$?\w+ ?', generated) or re.search('HEAP8\[HEAP32\[', generated), 'eliminator should create compound expressions, and fewer one-time vars' # also in -O1, but easier to test in -O2 assert ('_puts(' in generated) == (opt_level >= 1), 'with opt >= 1, llvm opts are run and they should optimize printf to puts' - if opt_level == 0 or '-g' in params: assert 'function _main() {' in generated, 'Should be unminified, including whitespace' + if opt_level == 0 or '-g' in params: assert 'function _main() {' in generated or 'function _main(){' in generated, 'Should be unminified' elif opt_level >= 2: assert ('function _main(){' in generated or '"use asm";var a=' in generated), 'Should be whitespace-minified' # emcc -s RELOOP=1 src.cpp ==> should pass -s to emscripten.py. --typed-arrays is a convenient alias for -s USE_TYPED_ARRAYS |