aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-02-24 14:33:34 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-02-24 14:33:34 -0800
commita75d43ec8dfc66a461dbe736692e70352d7dc556 (patch)
tree78004f2935a323dc46bb2db83d72c4458e63ed7f /tests
parentd47a30c26ab0f76c74cb53d9eb54cb049ea05d21 (diff)
parentcd3e0b2ceef728c27745d1e7f5d6b95671bcaf04 (diff)
Merge branch 'fastcomp-by-default' into incoming
Diffstat (limited to 'tests')
-rw-r--r--tests/core/test_inlinejs3.in1
-rw-r--r--tests/core/test_inlinejs3.out1
-rwxr-xr-xtests/runner.py18
-rw-r--r--tests/test_benchmark.py1
-rw-r--r--tests/test_browser.py377
-rw-r--r--tests/test_core.py148
-rw-r--r--tests/test_other.py677
-rw-r--r--tests/test_sanity.py134
8 files changed, 644 insertions, 713 deletions
diff --git a/tests/core/test_inlinejs3.in b/tests/core/test_inlinejs3.in
index 9ddd5907..12e31007 100644
--- a/tests/core/test_inlinejs3.in
+++ b/tests/core/test_inlinejs3.in
@@ -7,6 +7,7 @@ int main(int argc, char **argv) {
for (int i = 0; i < 3; i++) {
EM_ASM(Module.print('hello dere3'); Module.print('hello dere' + 4););
}
+ EM_ASM_({ Module.print('hello input ' + $0) }, 123);
int sum = 0;
for (int i = 0; i < argc * 3; i++) {
sum += EM_ASM_INT({
diff --git a/tests/core/test_inlinejs3.out b/tests/core/test_inlinejs3.out
index c293e80b..1f64a89a 100644
--- a/tests/core/test_inlinejs3.out
+++ b/tests/core/test_inlinejs3.out
@@ -6,6 +6,7 @@ hello dere3
hello dere4
hello dere3
hello dere4
+hello input 123
i: 0,0.00
i: 1,0.08
i: 2,0.17
diff --git a/tests/runner.py b/tests/runner.py
index 501299c7..32575a1a 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -27,6 +27,19 @@ sys.path += [path_from_root(''), path_from_root('third_party/websockify')]
import tools.shared
from tools.shared import *
+# Utils
+
+def nonfastcomp(test):
+ try:
+ old_fastcomp = os.environ.get('EMCC_FAST_COMPILER')
+ os.environ['EMCC_FAST_COMPILER'] = '0'
+ test()
+ finally:
+ if old_fastcomp is None:
+ del os.environ['EMCC_FAST_COMPILER']
+ else:
+ os.environ['EMCC_FAST_COMPILER'] = old_fastcomp
+
# Sanity check for config
try:
@@ -36,10 +49,7 @@ except:
# Core test runner class, shared between normal tests and benchmarks
checked_sanity = False
-if os.environ.get('EMCC_FAST_COMPILER') == '1':
- test_modes = ['default', 'asm1', 'asm2', 'asm3', 'asm2f', 'asm2g']
-else:
- test_modes = ['default', 'o1', 'o2', 'asm1', 'asm2', 'asm3', 'asm2f', 'asm2g', 'asm2x86', 's_0_0', 's_0_1']
+test_modes = ['default', 'asm1', 'asm2', 'asm3', 'asm2f', 'asm2g', 'slow2', 'slow2asm', 's_0_0', 's_0_1']
test_index = 0
class RunnerCore(unittest.TestCase):
diff --git a/tests/test_benchmark.py b/tests/test_benchmark.py
index 023ac1e2..2bc34c60 100644
--- a/tests/test_benchmark.py
+++ b/tests/test_benchmark.py
@@ -134,7 +134,6 @@ try:
#JSBenchmarker('sm-f32-3.2', SPIDERMONKEY_ENGINE, ['-s', 'PRECISE_F32=2'], env={ 'LLVM': LLVM_3_2 }),
#JSBenchmarker('sm-f32-3.3', SPIDERMONKEY_ENGINE, ['-s', 'PRECISE_F32=2'], env={ 'LLVM': LLVM_3_3 }),
#JSBenchmarker('sm-f32-3.4', SPIDERMONKEY_ENGINE, ['-s', 'PRECISE_F32=2'], env={ 'LLVM': LLVM_3_4 }),
- #JSBenchmarker('sm-fc', SPIDERMONKEY_ENGINE, env={ 'EMCC_FAST_COMPILER': '1' }),
#JSBenchmarker('sm-noasm', SPIDERMONKEY_ENGINE + ['--no-asmjs']),
#JSBenchmarker('sm-noasm-f32', SPIDERMONKEY_ENGINE + ['--no-asmjs'], ['-s', 'PRECISE_F32=2']),
#JSBenchmarker('v8', V8_ENGINE)
diff --git a/tests/test_browser.py b/tests/test_browser.py
index c1d1caab..f2e17ea0 100644
--- a/tests/test_browser.py
+++ b/tests/test_browser.py
@@ -1,5 +1,5 @@
import BaseHTTPServer, multiprocessing, os, shutil, subprocess, unittest, zlib, webbrowser, time, shlex
-from runner import BrowserCore, path_from_root
+from runner import BrowserCore, path_from_root, nonfastcomp
from tools.shared import *
# User can specify an environment variable EMSCRIPTEN_BROWSER to force the browser test suite to
@@ -120,8 +120,6 @@ If manually bisecting:
'''
def test_emscripten_log(self):
- if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('fastcomp uses asm, where call stacks are sometimes less clear')
-
src = os.path.join(self.get_dir(), 'src.cpp')
open(src, 'w').write(self.with_report_result(open(path_from_root('tests', 'emscripten_log', 'emscripten_log.cpp')).read()))
@@ -143,191 +141,193 @@ If manually bisecting:
os.chdir(cwd)
def test_split(self):
- if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('no --split in fastcomp, deprecated')
+ def nfc():
+ # test HTML generation.
+ self.reftest(path_from_root('tests', 'htmltest.png'))
+ output = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_sdl.cpp'), '-o', 'something.js', '--split', '100', '--pre-js', 'reftest.js']).communicate()
+ assert os.path.exists(os.path.join(self.get_dir(), 'something.js')), 'must be main js file'
+ assert os.path.exists(os.path.join(self.get_dir(), 'something_functions.js')), 'must be functions js file'
+ assert os.path.exists(os.path.join(self.get_dir(), 'something.include.html')), 'must be js include file'
- # test HTML generation.
- self.reftest(path_from_root('tests', 'htmltest.png'))
- output = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_sdl.cpp'), '-o', 'something.js', '--split', '100', '--pre-js', 'reftest.js']).communicate()
- assert os.path.exists(os.path.join(self.get_dir(), 'something.js')), 'must be main js file'
- assert os.path.exists(os.path.join(self.get_dir(), 'something_functions.js')), 'must be functions js file'
- assert os.path.exists(os.path.join(self.get_dir(), 'something.include.html')), 'must be js include file'
-
- open(os.path.join(self.get_dir(), 'something.html'), 'w').write('''
-
- <!doctype html>
- <html lang="en-us">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Emscripten-Generated Code</title>
- <style>
- .emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
- canvas.emscripten { border: 1px solid black; }
- textarea.emscripten { font-family: monospace; width: 80%; }
- div.emscripten { text-align: center; }
- </style>
- </head>
- <body>
- <hr/>
- <div class="emscripten" id="status">Downloading...</div>
- <div class="emscripten">
- <progress value="0" max="100" id="progress" hidden=1></progress>
- </div>
- <canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
- <hr/>
- <div class="emscripten"><input type="button" value="fullscreen" onclick="Module.requestFullScreen()"></div>
- <hr/>
- <textarea class="emscripten" id="output" rows="8"></textarea>
- <hr>
- <script type='text/javascript'>
- // connect to canvas
- var Module = {
- preRun: [],
- postRun: [],
- print: (function() {
- var element = document.getElementById('output');
- element.value = ''; // clear browser cache
- return function(text) {
- // These replacements are necessary if you render to raw HTML
- //text = text.replace(/&/g, "&amp;");
- //text = text.replace(/</g, "&lt;");
- //text = text.replace(/>/g, "&gt;");
- //text = text.replace('\\n', '<br>', 'g');
- element.value += text + "\\n";
- element.scrollTop = element.scrollHeight; // focus on bottom
- };
- })(),
- printErr: function(text) {
- if (0) { // XXX disabled for safety typeof dump == 'function') {
- dump(text + '\\n'); // fast, straight to the real console
- } else {
- console.log(text);
- }
- },
- canvas: document.getElementById('canvas'),
- setStatus: function(text) {
- if (Module.setStatus.interval) clearInterval(Module.setStatus.interval);
- var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
- var statusElement = document.getElementById('status');
- var progressElement = document.getElementById('progress');
- if (m) {
- text = m[1];
- progressElement.value = parseInt(m[2])*100;
- progressElement.max = parseInt(m[4])*100;
- progressElement.hidden = false;
- } else {
- progressElement.value = null;
- progressElement.max = null;
- progressElement.hidden = true;
+ open(os.path.join(self.get_dir(), 'something.html'), 'w').write('''
+
+ <!doctype html>
+ <html lang="en-us">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>Emscripten-Generated Code</title>
+ <style>
+ .emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
+ canvas.emscripten { border: 1px solid black; }
+ textarea.emscripten { font-family: monospace; width: 80%; }
+ div.emscripten { text-align: center; }
+ </style>
+ </head>
+ <body>
+ <hr/>
+ <div class="emscripten" id="status">Downloading...</div>
+ <div class="emscripten">
+ <progress value="0" max="100" id="progress" hidden=1></progress>
+ </div>
+ <canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
+ <hr/>
+ <div class="emscripten"><input type="button" value="fullscreen" onclick="Module.requestFullScreen()"></div>
+ <hr/>
+ <textarea class="emscripten" id="output" rows="8"></textarea>
+ <hr>
+ <script type='text/javascript'>
+ // connect to canvas
+ var Module = {
+ preRun: [],
+ postRun: [],
+ print: (function() {
+ var element = document.getElementById('output');
+ element.value = ''; // clear browser cache
+ return function(text) {
+ // These replacements are necessary if you render to raw HTML
+ //text = text.replace(/&/g, "&amp;");
+ //text = text.replace(/</g, "&lt;");
+ //text = text.replace(/>/g, "&gt;");
+ //text = text.replace('\\n', '<br>', 'g');
+ element.value += text + "\\n";
+ element.scrollTop = element.scrollHeight; // focus on bottom
+ };
+ })(),
+ printErr: function(text) {
+ if (0) { // XXX disabled for safety typeof dump == 'function') {
+ dump(text + '\\n'); // fast, straight to the real console
+ } else {
+ console.log(text);
+ }
+ },
+ canvas: document.getElementById('canvas'),
+ setStatus: function(text) {
+ if (Module.setStatus.interval) clearInterval(Module.setStatus.interval);
+ var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
+ var statusElement = document.getElementById('status');
+ var progressElement = document.getElementById('progress');
+ if (m) {
+ text = m[1];
+ progressElement.value = parseInt(m[2])*100;
+ progressElement.max = parseInt(m[4])*100;
+ progressElement.hidden = false;
+ } else {
+ progressElement.value = null;
+ progressElement.max = null;
+ progressElement.hidden = true;
+ }
+ statusElement.innerHTML = text;
+ },
+ totalDependencies: 0,
+ monitorRunDependencies: function(left) {
+ this.totalDependencies = Math.max(this.totalDependencies, left);
+ Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
}
- statusElement.innerHTML = text;
- },
- totalDependencies: 0,
- monitorRunDependencies: function(left) {
- this.totalDependencies = Math.max(this.totalDependencies, left);
- Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
- }
- };
- Module.setStatus('Downloading...');
- </script>''' + open(os.path.join(self.get_dir(), 'something.include.html')).read() + '''
- </body>
- </html>
- ''')
+ };
+ Module.setStatus('Downloading...');
+ </script>''' + open(os.path.join(self.get_dir(), 'something.include.html')).read() + '''
+ </body>
+ </html>
+ ''')
- self.run_browser('something.html', 'You should see "hello, world!" and a colored cube.', '/report_result?0')
+ self.run_browser('something.html', 'You should see "hello, world!" and a colored cube.', '/report_result?0')
+
+ nonfastcomp(nfc)
def test_split_in_source_filenames(self):
- if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('no --split in fastcomp, deprecated')
-
- self.reftest(path_from_root('tests', 'htmltest.png'))
- output = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_sdl.cpp'), '-o', 'something.js', '-g', '--split', '100', '--pre-js', 'reftest.js']).communicate()
- assert os.path.exists(os.path.join(self.get_dir(), 'something.js')), 'must be main js file'
- assert os.path.exists(os.path.join(self.get_dir(), 'something', 'hello_world_sdl.cpp.js')), 'must be functions js file'
- assert os.path.exists(os.path.join(self.get_dir(), 'something.include.html')), 'must be js include file'
-
- open(os.path.join(self.get_dir(), 'something.html'), 'w').write('''
-
- <!doctype html>
- <html lang="en-us">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Emscripten-Generated Code</title>
- <style>
- .emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
- canvas.emscripten { border: 1px solid black; }
- textarea.emscripten { font-family: monospace; width: 80%; }
- div.emscripten { text-align: center; }
- </style>
- </head>
- <body>
- <hr/>
- <div class="emscripten" id="status">Downloading...</div>
- <div class="emscripten">
- <progress value="0" max="100" id="progress" hidden=1></progress>
- </div>
- <canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
- <hr/>
- <div class="emscripten"><input type="button" value="fullscreen" onclick="Module.requestFullScreen()"></div>
- <hr/>
- <textarea class="emscripten" id="output" rows="8"></textarea>
- <hr>
- <script type='text/javascript'>
- // connect to canvas
- var Module = {
- preRun: [],
- postRun: [],
- print: (function() {
- var element = document.getElementById('output');
- element.value = ''; // clear browser cache
- return function(text) {
- // These replacements are necessary if you render to raw HTML
- //text = text.replace(/&/g, "&amp;");
- //text = text.replace(/</g, "&lt;");
- //text = text.replace(/>/g, "&gt;");
- //text = text.replace('\\n', '<br>', 'g');
- element.value += text + "\\n";
- element.scrollTop = element.scrollHeight; // focus on bottom
- };
- })(),
- printErr: function(text) {
- if (0) { // XXX disabled for safety typeof dump == 'function') {
- dump(text + '\\n'); // fast, straight to the real console
- } else {
- console.log(text);
- }
- },
- canvas: document.getElementById('canvas'),
- setStatus: function(text) {
- if (Module.setStatus.interval) clearInterval(Module.setStatus.interval);
- var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
- var statusElement = document.getElementById('status');
- var progressElement = document.getElementById('progress');
- if (m) {
- text = m[1];
- progressElement.value = parseInt(m[2])*100;
- progressElement.max = parseInt(m[4])*100;
- progressElement.hidden = false;
- } else {
- progressElement.value = null;
- progressElement.max = null;
- progressElement.hidden = true;
+ def nfc():
+ self.reftest(path_from_root('tests', 'htmltest.png'))
+ output = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_sdl.cpp'), '-o', 'something.js', '-g', '--split', '100', '--pre-js', 'reftest.js']).communicate()
+ assert os.path.exists(os.path.join(self.get_dir(), 'something.js')), 'must be main js file'
+ assert os.path.exists(os.path.join(self.get_dir(), 'something', 'hello_world_sdl.cpp.js')), 'must be functions js file'
+ assert os.path.exists(os.path.join(self.get_dir(), 'something.include.html')), 'must be js include file'
+
+ open(os.path.join(self.get_dir(), 'something.html'), 'w').write('''
+
+ <!doctype html>
+ <html lang="en-us">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>Emscripten-Generated Code</title>
+ <style>
+ .emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
+ canvas.emscripten { border: 1px solid black; }
+ textarea.emscripten { font-family: monospace; width: 80%; }
+ div.emscripten { text-align: center; }
+ </style>
+ </head>
+ <body>
+ <hr/>
+ <div class="emscripten" id="status">Downloading...</div>
+ <div class="emscripten">
+ <progress value="0" max="100" id="progress" hidden=1></progress>
+ </div>
+ <canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
+ <hr/>
+ <div class="emscripten"><input type="button" value="fullscreen" onclick="Module.requestFullScreen()"></div>
+ <hr/>
+ <textarea class="emscripten" id="output" rows="8"></textarea>
+ <hr>
+ <script type='text/javascript'>
+ // connect to canvas
+ var Module = {
+ preRun: [],
+ postRun: [],
+ print: (function() {
+ var element = document.getElementById('output');
+ element.value = ''; // clear browser cache
+ return function(text) {
+ // These replacements are necessary if you render to raw HTML
+ //text = text.replace(/&/g, "&amp;");
+ //text = text.replace(/</g, "&lt;");
+ //text = text.replace(/>/g, "&gt;");
+ //text = text.replace('\\n', '<br>', 'g');
+ element.value += text + "\\n";
+ element.scrollTop = element.scrollHeight; // focus on bottom
+ };
+ })(),
+ printErr: function(text) {
+ if (0) { // XXX disabled for safety typeof dump == 'function') {
+ dump(text + '\\n'); // fast, straight to the real console
+ } else {
+ console.log(text);
+ }
+ },
+ canvas: document.getElementById('canvas'),
+ setStatus: function(text) {
+ if (Module.setStatus.interval) clearInterval(Module.setStatus.interval);
+ var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
+ var statusElement = document.getElementById('status');
+ var progressElement = document.getElementById('progress');
+ if (m) {
+ text = m[1];
+ progressElement.value = parseInt(m[2])*100;
+ progressElement.max = parseInt(m[4])*100;
+ progressElement.hidden = false;
+ } else {
+ progressElement.value = null;
+ progressElement.max = null;
+ progressElement.hidden = true;
+ }
+ statusElement.innerHTML = text;
+ },
+ totalDependencies: 0,
+ monitorRunDependencies: function(left) {
+ this.totalDependencies = Math.max(this.totalDependencies, left);
+ Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
}
- statusElement.innerHTML = text;
- },
- totalDependencies: 0,
- monitorRunDependencies: function(left) {
- this.totalDependencies = Math.max(this.totalDependencies, left);
- Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
- }
- };
- Module.setStatus('Downloading...');
- </script>''' + open(os.path.join(self.get_dir(), 'something.include.html')).read() + '''
- </body>
- </html>
- ''')
+ };
+ Module.setStatus('Downloading...');
+ </script>''' + open(os.path.join(self.get_dir(), 'something.include.html')).read() + '''
+ </body>
+ </html>
+ ''')
- self.run_browser('something.html', 'You should see "hello, world!" and a colored cube.', '/report_result?0')
+ self.run_browser('something.html', 'You should see "hello, world!" and a colored cube.', '/report_result?0')
+
+ nonfastcomp(nfc)
def test_compression(self):
open(os.path.join(self.get_dir(), 'main.cpp'), 'w').write(self.with_report_result(r'''
@@ -1495,11 +1495,6 @@ keydown(100);keyup(100); // trigger the end
def test_sdl_resize(self):
self.btest('sdl_resize.c', '1')
- def test_gc(self):
- if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('flaky in fastcomp and also non-fastcomp -O1, timing issues')
-
- self.btest('browser_gc.cpp', '1')
-
def test_glshaderinfo(self):
self.btest('glshaderinfo.cpp', '1')
@@ -1706,7 +1701,7 @@ void *getBindBuffer() {
self.btest('s3tc_crunch.c', reference='s3tc_crunch.png', reference_slack=11, args=['--pre-js', 'asset_a.js', '--pre-js', 'asset_b.js', '-s', 'LEGACY_GL_EMULATION=1'])
def test_aniso(self):
- if SPIDERMONKEY_ENGINE in JS_ENGINES and os.environ.get('EMCC_FAST_COMPILER') != '1':
+ if SPIDERMONKEY_ENGINE in JS_ENGINES:
# asm.js-ification check
Popen([PYTHON, EMCC, path_from_root('tests', 'aniso.c'), '-O2', '-g2', '-s', 'LEGACY_GL_EMULATION=1']).communicate()
Settings.ASM_JS = 1
@@ -1766,10 +1761,10 @@ void *getBindBuffer() {
self.btest('http.cpp', expected='0', args=['-I' + path_from_root('tests')])
def test_module(self):
- if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
-
- Popen([PYTHON, EMCC, path_from_root('tests', 'browser_module.cpp'), '-o', 'module.js', '-O2', '-s', 'SIDE_MODULE=1', '-s', 'DLOPEN_SUPPORT=1', '-s', 'EXPORTED_FUNCTIONS=["_one", "_two"]']).communicate()
- self.btest('browser_main.cpp', args=['-O2', '-s', 'MAIN_MODULE=1', '-s', 'DLOPEN_SUPPORT=1'], expected='8')
+ def nfc():
+ Popen([PYTHON, EMCC, path_from_root('tests', 'browser_module.cpp'), '-o', 'module.js', '-O2', '-s', 'SIDE_MODULE=1', '-s', 'DLOPEN_SUPPORT=1', '-s', 'EXPORTED_FUNCTIONS=["_one", "_two"]']).communicate()
+ self.btest('browser_main.cpp', args=['-O2', '-s', 'MAIN_MODULE=1', '-s', 'DLOPEN_SUPPORT=1'], expected='8')
+ nonfastcomp(nfc)
def test_mmap_file(self):
open(self.in_dir('data.dat'), 'w').write('data from the file ' + ('.' * 9000))
diff --git a/tests/test_core.py b/tests/test_core.py
index c4bfcfa3..19bb9ca1 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -512,33 +512,45 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
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)
-
- # A good test of i64 math
- if Settings.USE_TYPED_ARRAYS != 2: return self.skip('requires ta2 C-style memory aliasing')
- self.do_run('', 'Usage: hashstring <seed>',
- libraries=self.get_library('cube2hash', ['cube2hash.bc'], configure=None),
- includes=[path_from_root('tests', 'cube2hash')])
-
- for text, output in [('fleefl', '892BDB6FD3F62E863D63DA55851700FDE3ACF30204798CE9'),
- ('fleefl2', 'AA2CC5F96FC9D540CA24FDAF1F71E2942753DB83E8A81B61'),
- ('64bitisslow', '64D8470573635EC354FEE7B7F87C566FCAF1EFB491041670')]:
- self.do_run('', 'hash value: ' + output, [text], no_build=True)
- finally:
- os.environ['EMSCRIPT_MAX_CHUNK_SIZE'] = old_chunk_size
-
- assert 'asm1' in test_modes
- if self.run_name == 'asm1' and not os.environ.get('EMCC_FAST_COMPILER'):
- assert Settings.RELOOP
- generated = open('src.cpp.o.js').read()
- main = generated[generated.find('function _main'):]
- main = main[:main.find('\n}')]
- num_vars = 0
- for v in re.findall('var [^;]+;', main):
- num_vars += v.count(',') + 1
- assert num_vars == 10, 'no variable elimination should have been run, but seeing %d' % num_vars
+ # extra testing for various codegen modes
+ for x86 in [0, 1] if self.run_name == 'asm2' else [0]:
+ print 'x86', x86
+ try:
+ old_x86 = os.environ.get('EMCC_LLVM_TARGET') or ''
+ if x86:
+ os.environ['EMCC_LLVM_TARGET'] = "i386-pc-linux-gnu"
+ try:
+ old_fastcomp = os.environ.get('EMCC_FAST_COMPILER') or ''
+ if x86:
+ os.environ['EMCC_FAST_COMPILER'] = "0"
+ 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)
+
+ # A good test of i64 math
+ if Settings.USE_TYPED_ARRAYS != 2: return self.skip('requires ta2 C-style memory aliasing')
+ self.do_run('', 'Usage: hashstring <seed>',
+ libraries=self.get_library('cube2hash', ['cube2hash.bc'], configure=None, cache_name_extra=str(x86)),
+ includes=[path_from_root('tests', 'cube2hash')])
+
+ for text, output in [('fleefl', '892BDB6FD3F62E863D63DA55851700FDE3ACF30204798CE9'),
+ ('fleefl2', 'AA2CC5F96FC9D540CA24FDAF1F71E2942753DB83E8A81B61'),
+ ('64bitisslow', '64D8470573635EC354FEE7B7F87C566FCAF1EFB491041670')]:
+ self.do_run('', 'hash value: ' + output, [text], no_build=True)
+ finally:
+ os.environ['EMSCRIPT_MAX_CHUNK_SIZE'] = old_chunk_size
+ finally:
+ if x86:
+ if old_fastcomp:
+ os.environ['EMCC_FAST_COMPILER'] = old_fastcomp
+ else:
+ del os.environ['EMCC_FAST_COMPILER']
+ finally:
+ if x86:
+ if old_x86:
+ os.environ['EMCC_LLVM_TARGET'] = old_x86
+ else:
+ del os.environ['EMCC_LLVM_TARGET']
def test_unaligned(self):
if Settings.QUANTUM_SIZE == 1: return self.skip('No meaning to unaligned addresses in q1')
@@ -951,7 +963,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
for named in (0, 1):
print named
- if os.environ.get('EMCC_FAST_COMPILER') == '1' and named: continue # no named globals in fastcomp
+ if os.environ.get('EMCC_FAST_COMPILER') != '0' and named: continue # no named globals in fastcomp
Settings.NAMED_GLOBALS = named
self.do_run_from_file(src, output, ['wowie', 'too', '74'])
@@ -1138,7 +1150,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
self.do_run_from_file(src, output)
def test_longjmp_repeat(self):
- if os.environ.get('EMCC_FAST_COMPILER') != '1': Settings.MAX_SETJMPS = 1 # todo: do this more strict thing in fastcomp too
+ if os.environ.get('EMCC_FAST_COMPILER') == '0': Settings.MAX_SETJMPS = 1 # todo: do this more strict thing in fastcomp too
test_path = path_from_root('tests', 'core', 'test_longjmp_repeat')
src, output = (test_path + s for s in ('.in', '.out'))
self.do_run_from_file(src, output)
@@ -1162,7 +1174,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
self.do_run_from_file(src, output)
def test_setjmp_many(self):
- if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp: make MAX_SETJMPS take effect')
+ if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('todo in fastcomp: make MAX_SETJMPS take effect')
src = r'''
#include <stdio.h>
@@ -1930,7 +1942,7 @@ def process(filename):
def test_inlinejs(self):
if not self.is_le32(): return self.skip('le32 needed for inline js')
- if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('fastcomp only supports EM_ASM')
+ if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('fastcomp only supports EM_ASM')
test_path = path_from_root('tests', 'core', 'test_inlinejs')
src, output = (test_path + s for s in ('.in', '.out'))
@@ -1943,7 +1955,7 @@ def process(filename):
def test_inlinejs2(self):
if not self.is_le32(): return self.skip('le32 needed for inline js')
- if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('fastcomp only supports EM_ASM')
+ if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('fastcomp only supports EM_ASM')
test_path = path_from_root('tests', 'core', 'test_inlinejs2')
src, output = (test_path + s for s in ('.in', '.out'))
@@ -2749,7 +2761,7 @@ The current type of b is: 9
self.do_run(main, 'supp: 54,2\nmain: 56\nsupp see: 543\nmain see: 76\nok.')
def can_dlfcn(self):
- if os.environ.get('EMCC_FAST_COMPILER') == '1':
+ if os.environ.get('EMCC_FAST_COMPILER') != '0':
self.skip('todo in fastcomp')
return False
@@ -3171,7 +3183,7 @@ def process(filename):
def test_dlfcn_self(self):
if Settings.USE_TYPED_ARRAYS == 1: return self.skip('Does not work with USE_TYPED_ARRAYS=1')
- if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+ if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('todo in fastcomp')
Settings.DLOPEN_SUPPORT = 1
def post(filename):
@@ -4673,25 +4685,6 @@ return malloc(size);
main = main[:main.find('\n}')]
assert main.count('\n') <= 7, ('must not emit too many postSets: %d' % main.count('\n')) + ' : ' + main
- if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('fastcomp always aliases pointers')
-
- assert 'asm2g' in test_modes
- if self.run_name == 'asm2g':
- results = {}
- original = open('src.cpp.o.js').read()
- results[Settings.ALIASING_FUNCTION_POINTERS] = len(original)
- Settings.ALIASING_FUNCTION_POINTERS = 1 - Settings.ALIASING_FUNCTION_POINTERS
- self.do_run(path_from_root('tests', 'cubescript'), '*\nTemp is 33\n9\n5\nhello, everyone\n*', main_file='command.cpp')
- final = open('src.cpp.o.js').read()
- results[Settings.ALIASING_FUNCTION_POINTERS] = len(final)
- open('original.js', 'w').write(original)
- print results
- assert results[1] < 0.99*results[0]
- assert ' & 3]()' in original, 'small function table exists'
- assert ' & 3]()' not in final, 'small function table does not exist'
- assert ' & 255]()' not in original, 'big function table does not exist'
- assert ' & 255]()' in final, 'big function table exists'
-
def test_simd(self):
if Settings.USE_TYPED_ARRAYS != 2: return self.skip('needs ta2')
if Settings.ASM_JS: Settings.ASM_JS = 2 # does not validate
@@ -4721,7 +4714,7 @@ return malloc(size);
self.do_run_from_file(src, output)
def test_gcc_unmangler(self):
- if os.environ.get('EMCC_FAST_COMPILER') != '1': Settings.NAMED_GLOBALS = 1 # test coverage for this; fastcomp never names globals
+ if os.environ.get('EMCC_FAST_COMPILER') == '0': Settings.NAMED_GLOBALS = 1 # test coverage for this; fastcomp never names globals
Building.COMPILER_TEST_OPTS += ['-I' + path_from_root('third_party'), '-Wno-warn-absolute-paths']
@@ -4892,7 +4885,7 @@ def process(filename):
test()
assert 'asm2g' in test_modes
- if self.run_name == 'asm2g' and not use_cmake and os.environ.get('EMCC_FAST_COMPILER') != '1':
+ if self.run_name == 'asm2g' and not use_cmake and os.environ.get('EMCC_FAST_COMPILER') == '0':
# Test forced alignment
print >> sys.stderr, 'testing FORCE_ALIGNED_MEMORY'
old = open('src.cpp.o.js').read()
@@ -5125,7 +5118,7 @@ def process(filename):
for name in glob.glob(path_from_root('tests', 'cases', '*.ll')):
shortname = name.replace('.ll', '')
if '' not in shortname: continue
- if os.environ.get('EMCC_FAST_COMPILER') == '1' and os.path.basename(shortname) in [
+ if os.environ.get('EMCC_FAST_COMPILER') != '0' and os.path.basename(shortname) in [
'structparam', 'extendedprecision', 'issue_39', 'emptystruct', 'phinonexist', 'quotedlabel', 'oob_ta2', 'phientryimplicit', 'phiself', 'invokebitcast', 'funcptr', # invalid ir
'structphiparam', 'callwithstructural_ta2', 'callwithstructural64_ta2', 'structinparam', # pnacl limitations in ExpandStructRegs
'2xi40', # pnacl limitations in ExpandGetElementPtr
@@ -5141,7 +5134,7 @@ def process(filename):
if '_le32' in shortname and not self.is_le32():
print self.skip('case "%s" not relevant for non-le32 target' % shortname)
continue
- if '_fastcomp' in shortname and not os.environ.get('EMCC_FAST_COMPILER') == '1':
+ if '_fastcomp' in shortname and not os.environ.get('EMCC_FAST_COMPILER') != '0':
print self.skip('case "%s" not relevant for non-fastcomp' % shortname)
continue
self.emcc_args = emcc_args
@@ -5180,7 +5173,7 @@ def process(filename):
for name in glob.glob(path_from_root('tests', 'fuzz', '*.c')) + glob.glob(path_from_root('tests', 'fuzz', '*.cpp')):
#if os.path.basename(name) != '4.c': continue
if 'newfail' in name: continue
- if os.path.basename(name) == '18.cpp' and not os.environ.get('EMCC_FAST_COMPILER') == '1': continue # works only in fastcomp
+ if os.path.basename(name) == '18.cpp' and not os.environ.get('EMCC_FAST_COMPILER') != '0': continue # works only in fastcomp
print name
self.do_run(open(path_from_root('tests', 'fuzz', name)).read(),
@@ -5420,7 +5413,7 @@ def process(filename):
def test_asm_pgo(self):
if not Settings.ASM_JS: return self.skip('this is a test for PGO for asm (NB: not *in* asm)')
- if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+ if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('todo in fastcomp')
src = open(path_from_root('tests', 'hello_libcxx.cpp')).read()
output = 'hello, world!'
@@ -5540,7 +5533,7 @@ def process(filename):
def test_embind(self):
if self.emcc_args is None: return self.skip('requires emcc')
- if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+ if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('todo in fastcomp')
Building.COMPILER_TEST_OPTS += ['--bind']
src = r'''
@@ -5563,7 +5556,7 @@ def process(filename):
def test_embind_2(self):
if self.emcc_args is None: return self.skip('requires emcc')
- if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')
+ if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('todo in fastcomp')
Building.COMPILER_TEST_OPTS += ['--bind', '--post-js', 'post.js']
open('post.js', 'w').write('''
Module.print('lerp ' + Module.lerp(1, 2, 0.66) + '.');
@@ -5637,8 +5630,6 @@ def process(filename):
# Way 2: use CppHeaderParser
- Settings.RUNTIME_TYPE_INFO = 1
-
header = '''
#include <stdio.h>
@@ -5879,6 +5870,8 @@ def process(filename):
self.do_run(src, '|hello|43|world|41|', post_build=post)
def test_typeinfo(self):
+ if os.environ.get('EMCC_FAST_COMPILER') != '0': return self.skip('fastcomp does not support RUNTIME_TYPE_INFO')