diff options
author | max99x <max99x@gmail.com> | 2011-07-07 10:38:35 +0300 |
---|---|---|
committer | max99x <max99x@gmail.com> | 2011-07-07 12:24:09 +0300 |
commit | 7dcdb044d329babc697363eb1652d8e65f17c699 (patch) | |
tree | b523f3eedaea0e89bce0f03bc0b0b1d8cee07c18 /tests | |
parent | d94b2423aef4593ce2b07725e992b7eb25d5f34c (diff) |
Rewrite of emscripten.py:
* Uses option arguments instead of positional ones.
* Allows linking to dlmalloc.
* Accepts both .bc and .ll files and takes care of annotations.
* Allows running the LLVM optimization pass automatically.
* Updated test runner to use the new emscripten.py interface.
Refactoring:
* Moved settings.py to root folder. It no longer applies just to tests.
* Updated references to settings.py.
* Added an __init__.py to tools, so we don't have to hack around imports.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/runner.py | 7 | ||||
-rw-r--r-- | tests/settings.py | 31 |
2 files changed, 4 insertions, 34 deletions
diff --git a/tests/runner.py b/tests/runner.py index beef1823..c1ce67ff 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -5,7 +5,7 @@ See settings.py file for options¶ms. Edit as needed. ''' from subprocess import Popen, PIPE, STDOUT -import os, unittest, tempfile, shutil, time, inspect, sys, math, glob, tempfile, re +import os, unittest, tempfile, shutil, time, inspect, sys, math, glob, tempfile, re, json # Setup @@ -19,7 +19,7 @@ exec(open(path_from_root('tools', 'shared.py'), 'r').read()) try: assert COMPILER_OPTS != None except: - raise Exception('Cannot find "COMPILER_OPTS" definition. Is ~/.emscripten set up properly? You may need to copy the template at ~/tests/settings.py into it.') + raise Exception('Cannot find "COMPILER_OPTS" definition. Is ~/.emscripten set up properly? You may need to copy the template from settings.py into it.') # Paths @@ -246,7 +246,8 @@ class RunnerCore(unittest.TestCase): exported_settings[setting] = value except: pass - compiler_output = timeout_run(Popen([EMSCRIPTEN, filename + '.o.ll', str(exported_settings).replace("'", '"'), filename + '.o.js'], stdout=PIPE, stderr=STDOUT), TIMEOUT, 'Compiling') + settings = ['%s=%s' % (k, json.dumps(v)) for k, v in exported_settings.items()] + compiler_output = timeout_run(Popen([EMSCRIPTEN, filename + '.o.ll', '-o', filename + '.o.js', '-s'] + settings, stdout=PIPE, stderr=STDOUT), TIMEOUT, 'Compiling') # Detect compilation crashes and errors if compiler_output is not None and 'Traceback' in compiler_output and 'in test_' in compiler_output: print compiler_output; assert 0 diff --git a/tests/settings.py b/tests/settings.py deleted file mode 100644 index e91d07d2..00000000 --- a/tests/settings.py +++ /dev/null @@ -1,31 +0,0 @@ -# This file will be copied to ~/.emscripten if that file doesn't exist. -# IMPORTANT: Edit it with the right paths! - -EMSCRIPTEN_ROOT=os.path.expanduser("~/Dev/emscripten") # TODO: Use this - -TEMP_DIR='/dev/shm' - -LLVM_ROOT=os.path.expanduser('~/Dev/llvm-2.9/cbuild/bin') - -LLVM_GCC=os.path.expanduser('~/Dev/llvm-gcc-2.9/cbuild/install/bin/llvm-g++') - -COMPILER_OPTS = ['-m32'] # Need to build as 32bit arch, for now - - # various errors on 64bit compilation - # WARNING: '-g' here will generate llvm bitcode that lli will crash on! - -SPIDERMONKEY_ENGINE = [os.path.expanduser('~/Dev/tracemonkey/js/src/js'), '-m', '-j', '-p'] -V8_ENGINE = [os.path.expanduser('~/Dev/v8/d8')] - -# XXX Warning: Compiling the 'cubescript' test in SpiderMonkey can lead to an extreme amount of memory being -# used, see Mozilla bug 593659. Possibly also some other tests as well. -#COMPILER_ENGINE=SPIDERMONKEY_ENGINE -COMPILER_ENGINE=V8_ENGINE - -JS_ENGINE=V8_ENGINE - -TIMEOUT = None - -# Tools - -CLOSURE_COMPILER = os.path.expanduser('~/Dev/closure-compiler/compiler.jar') - |