aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cases/aliasbitcast2_noasm.ll (renamed from tests/cases/aliasbitcast2.ll)0
-rw-r--r--tests/cases/aliasbitcast3_noasm.ll (renamed from tests/cases/aliasbitcast3.ll)0
-rw-r--r--tests/cases/aliasbitcastdollar_noasm.ll (renamed from tests/cases/aliasbitcastdollar.ll)0
-rw-r--r--tests/cases/gepoverflow.txt2
-rw-r--r--tests/cases/longjmp_tiny_noasm.ll (renamed from tests/cases/longjmp_tiny.ll)0
-rw-r--r--tests/cases/longjmp_tiny_noasm.txt (renamed from tests/cases/longjmp_tiny.txt)0
-rw-r--r--tests/cases/selectstruct.ll3
-rw-r--r--tests/cases/structparam.ll36
-rw-r--r--tests/cases/structparam.txt1
-rw-r--r--tests/cases/uadd_overflow.ll25
-rw-r--r--tests/cases/uadd_overflow.txt1
-rw-r--r--tests/cases/uadd_overflow_ta2.ll44
-rw-r--r--tests/cases/uadd_overflow_ta2.txt3
-rwxr-xr-xtests/runner.py98
-rw-r--r--tests/sqlite/sqlite-autooptimize.fails.txt3436
15 files changed, 165 insertions, 3484 deletions
diff --git a/tests/cases/aliasbitcast2.ll b/tests/cases/aliasbitcast2_noasm.ll
index 8537e272..8537e272 100644
--- a/tests/cases/aliasbitcast2.ll
+++ b/tests/cases/aliasbitcast2_noasm.ll
diff --git a/tests/cases/aliasbitcast3.ll b/tests/cases/aliasbitcast3_noasm.ll
index 4ff969e3..4ff969e3 100644
--- a/tests/cases/aliasbitcast3.ll
+++ b/tests/cases/aliasbitcast3_noasm.ll
diff --git a/tests/cases/aliasbitcastdollar.ll b/tests/cases/aliasbitcastdollar_noasm.ll
index 1ecf6047..1ecf6047 100644
--- a/tests/cases/aliasbitcastdollar.ll
+++ b/tests/cases/aliasbitcastdollar_noasm.ll
diff --git a/tests/cases/gepoverflow.txt b/tests/cases/gepoverflow.txt
index e01c78dd..31d67161 100644
--- a/tests/cases/gepoverflow.txt
+++ b/tests/cases/gepoverflow.txt
@@ -1,2 +1,2 @@
-*5246470,5247040*
+*5242366,5242936*
*-514,56*
diff --git a/tests/cases/longjmp_tiny.ll b/tests/cases/longjmp_tiny_noasm.ll
index 0045847c..0045847c 100644
--- a/tests/cases/longjmp_tiny.ll
+++ b/tests/cases/longjmp_tiny_noasm.ll
diff --git a/tests/cases/longjmp_tiny.txt b/tests/cases/longjmp_tiny_noasm.txt
index 8a0aa386..8a0aa386 100644
--- a/tests/cases/longjmp_tiny.txt
+++ b/tests/cases/longjmp_tiny_noasm.txt
diff --git a/tests/cases/selectstruct.ll b/tests/cases/selectstruct.ll
index 90c15ac7..5c9fecf7 100644
--- a/tests/cases/selectstruct.ll
+++ b/tests/cases/selectstruct.ll
@@ -10,7 +10,8 @@ entry:
%retval = alloca i32, align 4 ; [#uses=1 type=i32*]
%. = select i1 %retval, { i32, i32 } { i32 55, i32 99 }, { i32, i32 } { i32 2, i32 6 } ; [#uses=1 type={ i32, i32 }]
store i32 0, i32* %retval
- %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i32 %.) ; [#uses=0 type=i32]
+ %.1 = extractvalue { i32, i32 } %., 0
+ %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i32 %.1) ; [#uses=0 type=i32]
ret i32 1
}
diff --git a/tests/cases/structparam.ll b/tests/cases/structparam.ll
new file mode 100644
index 00000000..c59ad600
--- /dev/null
+++ b/tests/cases/structparam.ll
@@ -0,0 +1,36 @@
+; ModuleID = '/dev/shm/tmp/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, %d %d!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*]
+@_dispatchTable = internal global i64 0
+
+define i32 @doit(i32 %x, { i32, i32 } %y) {
+ %y0 = extractvalue { i32, i32 } %y, 0
+ %y1 = extractvalue { i32, i32 } %y, 1
+ %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i32 %y0, i32 %y1) ; [#uses=0 type=i32] [debug line = 5:13]
+ ret i32 0
+}
+
+define i32 @main() {
+entry:
+ %retval = alloca i32, align 4 ; [#uses=1 type=i32*]
+ %myi64 = alloca i64, align 4
+ %comp = alloca { i32, i32 }, align 4 ; [#uses=1]
+ store i32 0, i32* %retval
+ br label %cond.end
+
+cond.null:
+ br label %cond.end
+
+cond.end: ; preds = %cond.false, %cond.true
+ %cond = phi { i32, i32 } [ { i32 5, i32 6 }, %entry ], [ zeroinitializer, %cond.null ] ; [#uses=1]
+ store { i32, i32 } %cond, { i32, i32 }* %comp
+ %call = call i32 (i32, { i32, i32 })* @doit(i32 1, { i32, i32 } %cond) ;
+ store { i32, i32 } { i32 ptrtoint (i64* @_dispatchTable to i32), i32 0 }, { i32, i32 }* getelementptr inbounds ([1 x i64]* @_dispatchTable, i32 0, i32 0, i32 1), align 4
+ ret i32 0 ; [debug line = 6:13]
+}
+
+; [#uses=1]
+declare i32 @printf(i8*, ...)
+
diff --git a/tests/cases/structparam.txt b/tests/cases/structparam.txt
new file mode 100644
index 00000000..b2a63262
--- /dev/null
+++ b/tests/cases/structparam.txt
@@ -0,0 +1 @@
+hello, 5 6!
diff --git a/tests/cases/uadd_overflow.ll b/tests/cases/uadd_overflow.ll
deleted file mode 100644
index a808b9de..00000000
--- a/tests/cases/uadd_overflow.ll
+++ /dev/null
@@ -1,25 +0,0 @@
-; 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"
-
-@.str2 = private constant [9 x i8] c"*%d,%d*\0A\00", align 1 ; [#uses=1]
-
-; [#uses=0]
-define i32 @main() {
-entry:
- %retval = alloca i32, align 4 ; [#uses=1 type=i32*]
- %mul7 = bitcast i32 -259741926 to i32
- %shl10 = shl i32 4014, 16
- %uadd1 = tail call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %mul7, i32 %shl10)
- %a0 = extractvalue { i32, i1 } %uadd1, 0
- %a1 = extractvalue { i32, i1 } %uadd1, 1
- %a2 = zext i1 %a1 to i32
- call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([9 x i8]* @.str2, i32 0, i32 0), i32 %a0, i32 %a2) ; [#uses=0]
- ret i32 1
-}
-
-; [#uses=1]
-declare i32 @printf(i8*, ...)
-
-declare { i32, i1 } @llvm.uadd.with.overflow.i32(i32, i32) nounwind readnone
-
diff --git a/tests/cases/uadd_overflow.txt b/tests/cases/uadd_overflow.txt
deleted file mode 100644
index dcda9240..00000000
--- a/tests/cases/uadd_overflow.txt
+++ /dev/null
@@ -1 +0,0 @@
-*3319578,1*
diff --git a/tests/cases/uadd_overflow_ta2.ll b/tests/cases/uadd_overflow_ta2.ll
new file mode 100644
index 00000000..81a76bcd
--- /dev/null
+++ b/tests/cases/uadd_overflow_ta2.ll
@@ -0,0 +1,44 @@
+; 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"
+
+@.str2 = private constant [9 x i8] c"*%d,%d*\0A\00", align 1 ; [#uses=1]
+
+; [#uses=0]
+define i32 @main() {
+entry:
+ %retval = alloca i32, align 4 ; [#uses=1 type=i32*]
+ %mul7 = bitcast i32 -259741926 to i32
+ %shl10 = shl i32 4014, 16
+ %uadd1 = tail call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %mul7, i32 %shl10)
+ %a0 = extractvalue { i32, i1 } %uadd1, 0
+ %a1 = extractvalue { i32, i1 } %uadd1, 1
+ %a2 = zext i1 %a1 to i32
+ call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([9 x i8]* @.str2, i32 0, i32 0), i32 %a0, i32 %a2) ; [#uses=0]
+
+ %buadd1prepre = tail call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %mul7, i32 %shl10)
+ %buadd1pre = insertvalue { i32, i1 } %buadd1prepre, i1 0, 1
+ %buadd1 = insertvalue { i32, i1 } %buadd1pre, i32 5177, 0
+ %ba0 = extractvalue { i32, i1 } %buadd1, 0
+ %ba1 = extractvalue { i32, i1 } %buadd1, 1
+ %ba2 = zext i1 %ba1 to i32
+ call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([9 x i8]* @.str2, i32 0, i32 0), i32 %ba0, i32 %ba2) ; [#uses=0]
+
+ %64buadd1pre = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 5000, i64 3000)
+ %64buadd1 = insertvalue { i64, i1 } %64buadd1pre, i64 9875, 0
+ %64buadd2 = insertvalue { i64, i1 } %64buadd1, i1 1, 1
+ %64ba0pre = extractvalue { i64, i1 } %64buadd2, 0
+ %64ba0 = trunc i64 %64ba0pre to i32
+ %64ba1 = extractvalue { i64, i1 } %64buadd2, 1
+ %64ba2 = zext i1 %64ba1 to i32
+ call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([9 x i8]* @.str2, i32 0, i32 0), i32 %64ba0, i32 %64ba2) ; [#uses=0]
+
+ ret i32 1
+}
+
+; [#uses=1]
+declare i32 @printf(i8*, ...)
+
+declare { i32, i1 } @llvm.uadd.with.overflow.i32(i32, i32) nounwind readnone
+declare { i64, i1 } @llvm.uadd.with.overflow.i64(i64, i32) nounwind readnone
+
diff --git a/tests/cases/uadd_overflow_ta2.txt b/tests/cases/uadd_overflow_ta2.txt
new file mode 100644
index 00000000..bcd04599
--- /dev/null
+++ b/tests/cases/uadd_overflow_ta2.txt
@@ -0,0 +1,3 @@
+*3319578,1*
+*5177,0*
+*9875,1*
diff --git a/tests/runner.py b/tests/runner.py
index b1852ff2..6f7fbdca 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -428,7 +428,7 @@ if 'benchmark' not in str(sys.argv) and 'sanity' not in str(sys.argv) and 'brows
if len(sys.argv) == 2 and 'ALL.' in sys.argv[1]:
ignore, test = sys.argv[1].split('.')
print 'Running all test modes on test "%s"' % test
- sys.argv = [sys.argv[0], 'default.'+test, 'o1.'+test, 'o2.'+test, 's_0_0.'+test, 's_0_1.'+test, 's_0_1_q1.'+test, 's_1_0.'+test, 's_1_1.'+test, 's_1_1_q1.'+test]
+ sys.argv = [sys.argv[0], 'default.'+test, 'o1.'+test, 'o2.'+test, 'asm.'+test, 'asm2.'+test, 's_0_0.'+test, 's_0_1.'+test, 's_0_1_q1.'+test, 's_1_0.'+test, 's_1_1.'+test, 's_1_1_q1.'+test]
class T(RunnerCore): # Short name, to make it more fun to use manually on the commandline
## Does a complete test - builds, runs, checks output, etc.
@@ -836,6 +836,7 @@ if 'benchmark' not in str(sys.argv) and 'sanity' not in str(sys.argv) and 'brows
def test_i64_cmp2(self):
if Settings.USE_TYPED_ARRAYS != 2: return self.skip('full i64 stuff only in ta2')
+
src = r'''
#include <inttypes.h>
#include <stdio.h>
@@ -881,6 +882,8 @@ m_divisor is 1091269979
def test_i64_double(self):
if Settings.USE_TYPED_ARRAYS != 2: return self.skip('full i64 stuff only in ta2')
+
+
src = r'''
#include <stdio.h>
@@ -923,6 +926,7 @@ m_divisor is 1091269979
def test_i64_umul(self):
if Settings.USE_TYPED_ARRAYS != 2: return self.skip('full i64 stuff only in ta2')
+
src = r'''
#include <inttypes.h>
#include <stdio.h>
@@ -1272,6 +1276,7 @@ Succeeded!
self.do_run(open(path_from_root('tests', 'cube2md5.cpp')).read(), open(path_from_root('tests', 'cube2md5.ok')).read())
def test_cube2hash(self):
+
try:
old_chunk_size = os.environ.get('EMSCRIPT_MAX_CHUNK_SIZE') or ''
os.environ['EMSCRIPT_MAX_CHUNK_SIZE'] = '1' # test splitting out each function to a chunk in emscripten.py (21 functions here)
@@ -1401,7 +1406,7 @@ Succeeded!
# corrections otherwise
if Settings.USE_TYPED_ARRAYS == 2:
Settings.CORRECT_SIGNS = 0
- Settings.CHECK_SIGNS = 1
+ Settings.CHECK_SIGNS = 1 if not Settings.ASM_JS else 0
else:
Settings.CORRECT_SIGNS = 1
Settings.CHECK_SIGNS = 0
@@ -2077,6 +2082,8 @@ Succeeded!
self.do_run(src, 'Assertion failed: 1 == false')
def test_longjmp(self):
+ if Settings.ASM_JS: return self.skip('asm does not support longjmp')
+
src = r'''
#include <stdio.h>
#include <setjmp.h>
@@ -2112,6 +2119,8 @@ Succeeded!
self.do_run(src, 'second\nmain: 0\n')
def test_longjmp2(self):
+ if Settings.ASM_JS: return self.skip('asm does not support longjmp')
+
src = r'''
#include <setjmp.h>
#include <stdio.h>
@@ -2158,6 +2167,8 @@ Exiting stack_manipulate_func, level: 0
''')
def test_longjmp3(self):
+ if Settings.ASM_JS: return self.skip('asm does not support longjmp')
+
src = r'''
#include <setjmp.h>
#include <stdio.h>
@@ -2210,6 +2221,8 @@ Exiting setjmp function, level: 0
''')
def test_longjmp4(self):
+ if Settings.ASM_JS: return self.skip('asm does not support longjmp')
+
src = r'''
#include <setjmp.h>
#include <stdio.h>
@@ -2570,6 +2583,7 @@ Exiting setjmp function, level: 0, prev_jmp: -1
def test_segfault(self):
if self.emcc_args is None: return self.skip('SAFE_HEAP without ta2 means we check types too, which hide segfaults')
+ if Settings.ASM_JS: return self.skip('asm does not support safe heap')
Settings.SAFE_HEAP = 1
@@ -3114,7 +3128,7 @@ Exiting setjmp function, level: 0, prev_jmp: -1
emscripten_run_script("Module.print('hello world' + '!')");
printf("*%d*\n", emscripten_run_script_int("5*20"));
printf("*%s*\n", emscripten_run_script_string("'five'+'six'"));
- emscripten_run_script("_save_me_aimee()");
+ emscripten_run_script("Module['_save_me_aimee']()");
return 0;
}
'''
@@ -3124,7 +3138,7 @@ def process(filename):
src = open(filename, 'r').read()
# TODO: restore this (see comment in emscripten.h) assert '// hello from the source' in src
'''
-
+ Settings.EXPORTED_FUNCTIONS = ['_main', '_save_me_aimee']
self.do_run(src, 'hello world!\n*100*\n*fivesix*\nmann\n', post_build=check)
def test_inlinejs(self):
@@ -3148,6 +3162,7 @@ def process(filename):
def test_memorygrowth(self):
if Settings.USE_TYPED_ARRAYS == 0: return self.skip('memory growth is only supported with typed arrays')
+ if Settings.ASM_JS: return self.skip('asm does not support memory growth yet')
# With typed arrays in particular, it is dangerous to use more memory than TOTAL_MEMORY,
# since we then need to enlarge the heap(s).
@@ -3338,6 +3353,7 @@ def process(filename):
def test_varargs(self):
if Settings.QUANTUM_SIZE == 1: return self.skip('FIXME: Add support for this')
+ if Settings.ASM_JS: return self.skip('varargs by function pointer not yet supported')
src = '''
#include <stdio.h>
@@ -4010,13 +4026,14 @@ The current type of b is: 9
def test_runtimelink(self):
if Building.LLVM_OPTS: return self.skip('LLVM opts will optimize printf into puts in the parent, and the child will still look for puts')
- if Settings.NAMED_GLOBALS == 0: return self.skip('dlopen cannot work without named globals, TODO')
+ if Settings.ASM_JS: return self.skip('asm does not support runtime linking')
main, supp = self.setup_runtimelink_test()
self.banned_js_engines = [NODE_JS] # node's global scope behaves differently than everything else, needs investigation FIXME
Settings.LINKABLE = 1
Settings.BUILD_AS_SHARED_LIB = 2
+ Settings.NAMED_GLOBALS = 1
self.build(supp, self.get_dir(), self.in_dir('supp.c'))
shutil.move(self.in_dir('supp.c.o.js'), self.in_dir('liblib.so'))
@@ -4026,6 +4043,9 @@ The current type of b is: 9
self.do_run(main, 'supp: 54,2\nmain: 56\nsupp see: 543\nmain see: 76\nok.')
def test_dlfcn_basic(self):
+ if Settings.ASM_JS: return self.skip('TODO: dlopen in asm')
+
+ Settings.NAMED_GLOBALS = 1
Settings.LINKABLE = 1
lib_src = '''
@@ -4077,7 +4097,10 @@ def process(filename):
post_build=add_pre_run_and_checks)
def test_dlfcn_qsort(self):
+ if Settings.ASM_JS: return self.skip('TODO: dlopen in asm')
+
Settings.LINKABLE = 1
+ Settings.NAMED_GLOBALS = 1
if Settings.USE_TYPED_ARRAYS == 2:
Settings.CORRECT_SIGNS = 1 # Needed for unsafe optimizations
@@ -4169,10 +4192,11 @@ def process(filename):
post_build=add_pre_run_and_checks)
def test_dlfcn_data_and_fptr(self):
+ if Settings.ASM_JS: return self.skip('TODO: dlopen in asm')
if Building.LLVM_OPTS: return self.skip('LLVM opts will optimize out parent_func')
- if Settings.NAMED_GLOBALS == 0: return self.skip('dlopen cannot work without named globals, TODO')
Settings.LINKABLE = 1
+ Settings.NAMED_GLOBALS = 1
lib_src = '''
#include <stdio.h>
@@ -4272,10 +4296,12 @@ def process(filename):
post_build=add_pre_run_and_checks)
def test_dlfcn_alias(self):
+ if Settings.ASM_JS: return self.skip('TODO: dlopen in asm')
+
Settings.LINKABLE = 1
+ Settings.NAMED_GLOBALS = 1
if Building.LLVM_OPTS == 2: return self.skip('LLVM LTO will optimize away stuff we expect from the shared library')
- if Settings.NAMED_GLOBALS == 0: return self.skip('dlopen cannot work without named globals, TODO')
lib_src = r'''
#include <stdio.h>
@@ -4327,7 +4353,10 @@ def process(filename):
Settings.INCLUDE_FULL_LIBRARY = 0
def test_dlfcn_varargs(self):
+ if Settings.ASM_JS: return self.skip('TODO: dlopen in asm')
+
Settings.LINKABLE = 1
+ Settings.NAMED_GLOBALS = 1
if Building.LLVM_OPTS == 2: return self.skip('LLVM LTO will optimize things that prevent shared objects from working')
if Settings.QUANTUM_SIZE == 1: return self.skip('FIXME: Add support for this')
@@ -5458,6 +5487,7 @@ def process(filename):
}
'''
for linkable in [0, 1]:
+ print linkable
Settings.LINKABLE = linkable # regression check for issue #273
self.do_run(src, "1 2 3")
@@ -6037,9 +6067,10 @@ int main(int argc, char **argv) {
def test_dlmalloc(self):
if self.emcc_args is None: self.emcc_args = [] # dlmalloc auto-inclusion is only done if we use emcc
+ self.banned_js_engines = [NODE_JS] # slower, and fail on 64-bit
Settings.CORRECT_SIGNS = 2
Settings.CORRECT_SIGNS_LINES = ['src.cpp:' + str(i+4) for i in [4816, 4191, 4246, 4199, 4205, 4235, 4227]]
- Settings.TOTAL_MEMORY = 100*1024*1024 # needed with typed arrays
+ Settings.TOTAL_MEMORY = 128*1024*1024 # needed with typed arrays
src = open(path_from_root('system', 'lib', 'dlmalloc.c'), 'r').read() + '\n\n\n' + open(path_from_root('tests', 'dlmalloc_test.c'), 'r').read()
self.do_run(src, '*1,0*', ['200', '1'])
@@ -6054,7 +6085,7 @@ int main(int argc, char **argv) {
# emcc should build in dlmalloc automatically, and do all the sign correction etc. for it
try_delete(os.path.join(self.get_dir(), 'src.cpp.o.js'))
- output = Popen([PYTHON, EMCC, path_from_root('tests', 'dlmalloc_test.c'), '-s', 'TOTAL_MEMORY=100000000',
+ output = Popen([PYTHON, EMCC, path_from_root('tests', 'dlmalloc_test.c'), '-s', 'TOTAL_MEMORY=' + str(128*1024*1024),
'-o', os.path.join(self.get_dir(), 'src.cpp.o.js')], stdout=PIPE, stderr=self.stderr_redirect).communicate()
self.do_run('x', '*1,0*', ['200', '1'], no_build=True)
@@ -6241,7 +6272,9 @@ void*:16
self.do_run(src, '*10,22*')
def test_mmap(self):
- Settings.TOTAL_MEMORY = 100*1024*1024
+ self.banned_js_engines = [NODE_JS] # slower, and fail on 64-bit
+
+ Settings.TOTAL_MEMORY = 128*1024*1024
src = '''
#include <stdio.h>
@@ -6326,7 +6359,7 @@ void*:16
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 = 0 # test coverage for this
+ Settings.NAMED_GLOBALS = 1 # test coverage for this
Building.COMPILER_TEST_OPTS = ['-I' + path_from_root('third_party')]
@@ -6372,6 +6405,7 @@ void*:16
def test_freetype(self):
if Settings.QUANTUM_SIZE == 1: return self.skip('TODO: Figure out and try to fix')
+ if Settings.ASM_JS: return self.skip('asm does not support longjmp')
if Settings.CORRECT_SIGNS == 0: Settings.CORRECT_SIGNS = 1 # Not sure why, but needed
@@ -6428,16 +6462,13 @@ def process(filename):
if self.emcc_args is None: return self.skip('Very slow without ta2, and we would also need to include dlmalloc manually without emcc')
if Settings.QUANTUM_SIZE == 1: return self.skip('TODO FIXME')
- pgo_data = read_pgo_data(path_from_root('tests', 'sqlite', 'sqlite-autooptimize.fails.txt'))
-
Settings.CORRECT_SIGNS = 1 # XXX: in default, we fail with 2 here, even though the pgo_data should be correct (and works in s_0_0). Investigate this.
- Settings.CORRECT_SIGNS_LINES = pgo_data['signs_lines']
Settings.CORRECT_OVERFLOWS = 0
Settings.CORRECT_ROUNDINGS = 0
if self.emcc_args is None: Settings.SAFE_HEAP = 0 # uses time.h to set random bytes, other stuff
Settings.DISABLE_EXCEPTION_CATCHING = 1
Settings.FAST_MEMORY = 4*1024*1024
- Settings.EXPORTED_FUNCTIONS = ['_main', '_sqlite3_open', '_sqlite3_close', '_sqlite3_exec', '_sqlite3_free', '_callback'];
+ Settings.EXPORTED_FUNCTIONS += ['_sqlite3_open', '_sqlite3_close', '_sqlite3_exec', '_sqlite3_free', '_callback'];
self.do_run(r'''
#define SQLITE_DISABLE_LFS
@@ -6483,6 +6514,7 @@ def process(filename):
def test_poppler(self):
if self.emcc_args is None: return self.skip('very slow, we only do this in emcc runs')
+ if Settings.ASM_JS: return self.skip('asm does not support relying on function pointers being cast to different types')
Settings.CORRECT_OVERFLOWS = 1
Settings.CORRECT_SIGNS = 1
@@ -6653,7 +6685,7 @@ def process(filename):
Settings.CHECK_OVERFLOWS = 0
if self.emcc_args is None: Settings.SAFE_HEAP = 0 # Has bitfields which are false positives. Also the PyFloat_Init tries to detect endianness.
Settings.CORRECT_SIGNS = 1 # Not sure why, but needed
- Settings.EXPORTED_FUNCTIONS = ['_main', '_PyRun_SimpleStringFlags'] # for the demo
+ Settings.EXPORTED_FUNCTIONS += ['_PyRun_SimpleStringFlags'] # for the demo
self.do_ll_run(path_from_root('tests', 'python', 'python.small.bc'),
'hello python world!\n[0, 2, 4, 6]\n5\n22\n5.470000',
@@ -6691,6 +6723,9 @@ def process(filename):
if '_ta2' in shortname and not Settings.USE_TYPED_ARRAYS == 2:
print self.skip('case "%s" only relevant for ta2' % shortname)
continue
+ if '_noasm' in shortname and Settings.ASM_JS:
+ print self.skip('case "%s" not relevant for asm.js' % shortname)
+ continue
print >> sys.stderr, "Testing case '%s'..." % shortname
output_file = path_from_root('tests', 'cases', shortname + '.txt')
if Settings.QUANTUM_SIZE == 1:
@@ -6764,6 +6799,8 @@ def process(filename):
self.do_run(src, '''AD:-1,1''', build_ll_hook=self.do_autodebug)
def test_profiling(self):
+ if Settings.ASM_JS: return self.skip('asm does not support profiling')
+
src = '''
#include <emscripten.h>
#include <unistd.h>
@@ -6868,11 +6905,13 @@ def process(filename):
open(filename, 'w').write(src)
'''
- Settings.EXPORTED_FUNCTIONS = ['_get_int', '_get_float', '_get_string', '_print_int', '_print_float', '_print_string', '_multi', '_pointer', '_malloc']
+ Settings.EXPORTED_FUNCTIONS += ['_get_int', '_get_float', '_get_string', '_print_int', '_print_float', '_print_string', '_multi', '_pointer']
self.do_run(src, '*\nnumber,5\nnumber,3.14\nstring,hello world\n12\nundefined\n14.56\nundefined\ncheez\nundefined\narr-ay\nundefined\nmore\nnumber,10\n650\nnumber,21\n*\natr\n10\nbret\n53\n*\nstack is ok.\n', post_build=post)
def test_scriptaclass(self):
+ if Settings.ASM_JS: return self.skip('asm does not bindings generator yet')
+
header_filename = os.path.join(self.get_dir(), 'header.h')
header = '''
struct ScriptMe {
@@ -7117,6 +7156,8 @@ Child2:9
''', post_build=[post2, post3])
def test_scriptaclass_2(self):
+ if Settings.ASM_JS: return self.skip('asm does not bindings generator yet')
+
header_filename = os.path.join(self.get_dir(), 'header.h')
header = '''
#include <stdio.h>
@@ -7320,6 +7361,8 @@ def process(filename):
assert 'Assertion failed: Load-store consistency assumption failure!' in str(e), str(e)
def test_check_overflow(self):
+ if Settings.ASM_JS: return self.skip('asm always corrects, and cannot check')
+
Settings.CHECK_OVERFLOWS = 1
Settings.CORRECT_OVERFLOWS = 0
@@ -7374,6 +7417,8 @@ def process(filename):
assert 'Assertion failed' in str(e), str(e)
def test_linespecific(self):
+ if Settings.ASM_JS: return self.skip('asm always has corrections on')
+
if '-g' not in Building.COMPILER_TEST_OPTS: Building.COMPILER_TEST_OPTS.append('-g')
if self.emcc_args: self.emcc_args += ['--llvm-opts', '0'] # llvm full opts make the expected failures here not happen
@@ -7531,6 +7576,8 @@ def process(filename):
Settings.CORRECT_SIGNS = 0
def test_pgo(self):
+ if Settings.ASM_JS: return self.skip('asm does not support pgo')
+
if '-g' not in Building.COMPILER_TEST_OPTS: Building.COMPILER_TEST_OPTS.append('-g')
Settings.PGO = Settings.CHECK_OVERFLOWS = Settings.CORRECT_OVERFLOWS = Settings.CHECK_SIGNS = Settings.CORRECT_SIGNS = 1
@@ -7606,6 +7653,7 @@ def process(filename):
def test_gc(self):
if self.emcc_args == None: return self.skip('needs ta2')
+ if Settings.ASM_JS: return self.skip('asm cannot support generic function table')
Settings.GC_SUPPORT = 1
@@ -7788,6 +7836,10 @@ TT = %s
# Make one run with -O2, but without closure (we enable closure in specific tests, otherwise on everything it is too slow)
exec('o2 = make_run("o2", compiler=CLANG, emcc_args=["-O2", "--closure", "0"])')
+ # asm.js
+ exec('asm = make_run("asm", compiler=CLANG, emcc_args=["-O0", "--closure", "0", "-s", "ASM_JS=1"])')
+ exec('asm2 = make_run("asm2", compiler=CLANG, emcc_args=["-O2", "--closure", "0", "-s", "ASM_JS=1"])')
+
# Make custom runs with various options
for compiler, quantum, embetter, typed_arrays, llvm_opts in [
(CLANG, 1, 1, 0, 0),
@@ -8337,6 +8389,8 @@ f.close()
self.assertContained('hello from lib', run_js(os.path.join(self.get_dir(), 'a.out.js')))
def test_runtimelink_multi(self):
+ if Settings.ASM_JS: return self.skip('asm does not support runtime linking yet')
+
if SPIDERMONKEY_ENGINE not in JS_ENGINES: return self.skip('cannot run without spidermonkey due to node limitations')
open('testa.h', 'w').write(r'''
@@ -8825,6 +8879,10 @@ f.close()
['eliminate']),
(path_from_root('tools', 'eliminator', 'safe-eliminator-test.js'), open(path_from_root('tools', 'eliminator', 'safe-eliminator-test-output.js')).read(),
['eliminateMemSafe']),
+ (path_from_root('tools', 'eliminator', 'asm-eliminator-test.js'), open(path_from_root('tools', 'eliminator', 'asm-eliminator-test-output.js')).read(),
+ ['eliminateAsm']),
+ (path_from_root('tools', 'test-js-optimizer-asm-regs.js'), open(path_from_root('tools', 'test-js-optimizer-asm-regs-output.js')).read(),
+ ['registerizeAsm']),
]:
output = Popen([NODE_JS, path_from_root('tools', 'js-optimizer.js'), input] + passes, stdin=PIPE, stdout=PIPE).communicate()[0]
self.assertIdentical(expected, output.replace('\r\n', '\n').replace('\n\n', '\n'))
@@ -10107,10 +10165,10 @@ elif 'browser' in str(sys.argv):
main, supp = self.setup_runtimelink_test()
open(self.in_dir('supp.cpp'), 'w').write(supp)
- Popen([PYTHON, EMCC, self.in_dir('supp.cpp'), '-o', 'supp.js', '-s', 'LINKABLE=1', '-s', 'BUILD_AS_SHARED_LIB=2', '-O2', '--closure', '0']).communicate()
+ Popen([PYTHON, EMCC, self.in_dir('supp.cpp'), '-o', 'supp.js', '-s', 'LINKABLE=1', '-s', 'NAMED_GLOBALS=1', '-s', 'BUILD_AS_SHARED_LIB=2', '-O2', '--closure', '0']).communicate()
shutil.move(self.in_dir('supp.js'), self.in_dir('supp.so'))
- self.btest(main, args=['-s', 'LINKABLE=1', '-s', 'RUNTIME_LINKED_LIBS=["supp.so"]', '-DBROWSER=1', '-O2', '--closure', '0'], expected='76')
+ self.btest(main, args=['-s', 'LINKABLE=1', '-s', 'NAMED_GLOBALS=1', '-s', 'RUNTIME_LINKED_LIBS=["supp.so"]', '-DBROWSER=1', '-O2', '--closure', '0'], expected='76')
def test_pre_run_deps(self):
# Adding a dependency in preRun will delay run
@@ -10376,7 +10434,7 @@ 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', 'TOTAL_MEMORY=100*1024*1024', '-s', 'FAST_MEMORY=10*1024*1024',
+ '-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]
diff --git a/tests/sqlite/sqlite-autooptimize.fails.txt b/tests/sqlite/sqlite-autooptimize.fails.txt
deleted file mode 100644
index a8fb95c9..00000000
--- a/tests/sqlite/sqlite-autooptimize.fails.txt
+++ /dev/null
@@ -1,3436 +0,0 @@
-UnSign|src.c:53573 : 5437030 hits, %0 failures
-UnSign|src.c:48532 : 5148135 hits, %0 failures
-UnSign|src.c:48527 : 5100537 hits, %0 failures
-UnSign|src.c:52005 : 4073874 hits, %0 failures
-UnSign|src.c:53050 : 3934072 hits, %0 failures
-UnSign|src.c:18445 : 3774770 hits, %0 failures
-ReSign|src.c:53625 : 3436900 hits, %0 failures
-ReSign|src.c:53628 : 3425390 hits, %0 failures
-UnSign|src.c:60549 : 3283684 hits, %0 failures
-UnSign|src.c:60553 : 3273669 hits, %0 failures
-UnSign|src.c:48406 : 3040270 hits, %0 failures
-ReSign|src.c:20723 : 2661440 hits, %0 failures
-ReSign|src.c:60568 : 2383652 hits, %0 failures
-ReSign|src.c:57231 : 2322446 hits, %0 failures
-UnSign|src.c:20762 : 2255540 hits, %0 failures
-ReSign|src.c:53571 : 2197772 hits, %0 failures
-ReSign|src.c:60549 : 2182456 hits, %0 failures
-ReSign|src.c:60554 : 2182446 hits, %0 failures
-ReSign|src.c:60562 : 2182446 hits, %0 failures
-UnSign|src.c:60543 : 2096937 hits, %0 failures
-ReSign|src.c:52033 : 2036931 hits, %0 failures
-ReSign|src.c:104878 : 1954211 hits, %0 failures
-ReSign|src.c:20762 : 1904614 hits, %0 failures
-ReSign|src.c:104872 : 1779034 hits, %0 failures
-ReSign|src.c:53101 : 1720386 hits, %0 failures
-UnSign|src.c:48501 : 1716045 hits, %0 failures
-ReSign|src.c:48513 : 1716045 hits, %0 failures
-UnSign|src.c:48545 : 1716045 hits, %0 failures
-UnSign|src.c:53627 : 1712695 hits, %0 failures
-UnSign|src.c:53104 : 1701640 hits, %0 failures
-UnSign|src.c:53106 : 1701640 hits, %0 failures
-ReSign|src.c:48527 : 1700179 hits, %0 failures
-ReSign|src.c:20618 : 1582657 hits, %0 failures
-ReSign|src.c:82816 : 1520000 hits, %0 failures
-ReSign|src.c:57232 : 1374742 hits, %0 failures
-ReSign|src.c:52083 : 1357954 hits, %0 failures
-ReSign|src.c:107278 : 1330720 hits, %0 failures
-ReSign|src.c:18445 : 1271522 hits, %0 failures
-ReSign|src.c:106763 : 1253037 hits, %0 failures
-ReSign|src.c:18496 : 1251458 hits, %0 failures
-ReSign|src.c:53561 : 1239128 hits, %0 failures
-ReSign|src.c:48399 : 1227618 hits, %0 failures
-ReSign|src.c:48394 : 1221863 hits, %0 failures
-UnSign|src.c:57190 : 1161232 hits, %0 failures
-UnSign|src.c:57191 : 1161232 hits, %0 failures
-ReSign|src.c:57198 : 1161232 hits, %0 failures
-ReSign|src.c:57206 : 1161232 hits, %0 failures
-ReSign|src.c:57207 : 1161223 hits, %0 failures
-ReSign|src.c:57210 : 1161223 hits, %0 failures
-ReSign|src.c:57213 : 1161223 hits, %0 failures
-ReSign|src.c:12957 : 1159636 hits, %0 failures
-ReSign|src.c:107458 : 1127259 hits, %0 failures
-ReSign|src.c:60553 : 1091223 hits, %0 failures
-ReSign|src.c:60564 : 1091223 hits, %0 failures
-ReSign|src.c:52086 : 1086554 hits, %0 failures
-ReSign|src.c:18497 : 1071311 hits, %0 failures
-ReSign|src.c:18501 : 1071311 hits, %0 failures
-UnSign|src.c:48434 : 1050126 hits, %0 failures
-ReSign|src.c:63375 : 1035403 hits, %0 failures
-ReSign|src.c:63377 : 1035403 hits, %0 failures
-ReSign|src.c:63416 : 1035403 hits, %0 failures
-UnSign|src.c:63436 : 1035403 hits, %0 failures
-ReSign|src.c:63436 : 1035403 hits, %0 failures
-UnSign|src.c:63477 : 1035403 hits, %1 failures
-UnSign|src.c:65084 : 990123 hits, %0 failures
-ReSign|src.c:18476 : 983487 hits, %0 failures
-UnSign|src.c:104878 : 952092 hits, %0 failures
-ReSign|src.c:18631 : 951200 hits, %0 failures
-ReSign|src.c:65081 : 940100 hits, %0 failures
-UnSign|src.c:107411 : 902598 hits, %0 failures
-UnSign|src.c:48491 : 850065 hits, %0 failures
-UnSign|src.c:58216 : 800956 hits, %0 failures
-UnSign|src.c:104870 : 776776 hits, %0 failures
-ReSign|src.c:106658 : 776773 hits, %0 failures
-ReSign|src.c:107463 : 751466 hits, %0 failures
-ReSign|src.c:18639 : 750974 hits, %0 failures
-ReSign|src.c:57991 : 750898 hits, %0 failures
-ReSign|src.c:57712 : 750896 hits, %0 failures
-UnSign|src.c:57989 : 750895 hits, %1 failures
-ReSign|src.c:57989 : 750895 hits, %0 failures
-ReSign|src.c:21066 : 750278 hits, %0 failures
-ReSign|dlmalloc.c:4240 : 744231 hits, %0 failures
-UnSign|src.c:48449 : 735069 hits, %0 failures
-UnSign|src.c:21501 : 728920 hits, %0 failures
-UnSign|src.c:57991 : 725878 hits, %1 failures
-UnSign|src.c:58639 : 700848 hits, %0 failures
-ReSign|src.c:60543 : 698979 hits, %0 failures
-UnSign|src.c:60545 : 698979 hits, %0 failures
-ReSign|src.c:60545 : 698979 hits, %0 failures
-UnSign|src.c:60548 : 698979 hits, %0 failures
-UnSign|src.c:60577 : 693974 hits, %0 failures
-ReSign|src.c:60577 : 693974 hits, %0 failures
-ReSign|src.c:60317 : 683799 hits, %0 failures
-UnSign|src.c:60317 : 683799 hits, %0 failures
-ReSign|src.c:52006 : 678979 hits, %0 failures
-ReSign|src.c:52067 : 678979 hits, %0 failures
-UnSign|src.c:52032 : 678977 hits, %0 failures
-UnSign|src.c:52033 : 678977 hits, %0 failures
-ReSign|src.c:52078 : 678977 hits, %0 failures
-UnSign|src.c:107277 : 665360 hits, %0 failures
-ReSign|src.c:107277 : 665360 hits, %0 failures
-ReSign|src.c:20722 : 665360 hits, %0 failures
-UnSign|src.c:65082 : 660082 hits, %0 failures
-UnSign|src.c:65087 : 660082 hits, %0 failures
-UnSign|src.c:20140 : 660000 hits, %0 failures
-UnSign|src.c:20141 : 660000 hits, %0 failures
-UnSign|src.c:60170 : 655075 hits, %0 failures
-UnSign|src.c:56685 : 640140 hits, %0 failures
-ReSign|src.c:56685 : 640140 hits, %0 failures
-ReSign|src.c:62565 : 630092 hits, %0 failures
-UnSign|src.c:48394 : 613809 hits, %0 failures
-UnSign|src.c:48398 : 613809 hits, %0 failures
-UnSign|src.c:104882 : 601752 hits, %0 failures
-ReSign|src.c:62574 : 580020 hits, %0 failures
-UnSign|src.c:52949 : 574492 hits, %0 failures
-UnSign|src.c:65110 : 560036 hits, %0 failures
-UnSign|src.c:60174 : 555027 hits, %0 failures
-ReSign|src.c:35705 : 546585 hits, %0 failures
-ReSign|src.c:35973 : 543546 hits, %0 failures
-UnSign|src.c:60126 : 525078 hits, %0 failures
-ReSign|src.c:60129 : 525078 hits, %0 failures
-ReSign|src.c:60132 : 525078 hits, %0 failures
-UnSign|src.c:48438 : 525063 hits, %0 failures
-UnSign|src.c:104877 : 501069 hits, %0 failures