aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-05-15 19:07:12 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-05-15 19:07:12 -0700
commit1be1268669d2a253312dd7b9f2da564e4dfc8e24 (patch)
treec4f2512ed5e4b13614f4988a4078f04d3e1e56be
parent798e635cf912d778f08f8107d6d59fcd11b20082 (diff)
remove compiler argument to emscripten.py - use ~/.emscripten instead
-rwxr-xr-xemscripten.py23
-rw-r--r--tests/runner.py2
2 files changed, 10 insertions, 15 deletions
diff --git a/emscripten.py b/emscripten.py
index 5bd245eb..ec2c1662 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -2,8 +2,6 @@
import os, sys, subprocess
-COMPILER_ENGINE = None
-
abspath = os.path.abspath(os.path.dirname(__file__))
def path_from_root(*pathelems):
return os.path.join(os.path.sep, *(abspath.split(os.sep) + list(pathelems)))
@@ -26,23 +24,20 @@ def emscripten(filename, settings, outfile):
if __name__ == '__main__':
if sys.argv.__len__() not in range(2,6):
print '''
-Emscripten usage: emscripten.py INFILE [PATH-TO-JS-ENGINE] [SETTINGS] [OUTPUT_FILE]
+Emscripten usage: emscripten.py INFILE [SETTINGS] [OUTPUT_FILE]
INFILE must be in human-readable LLVM disassembly form (i.e., as text,
not binary).
- PATH-TO-JS-ENGINE should be a path to the JavaScript engine used to
- run the compiler (which is in JavaScript itself). You can later use
- the same engine to run the code, or another one, that is a separate
- issue. If you do not provide this parameter, you should define
- COMPILER_ENGINE = ... in a file at ~/.emscripten.
- SETTINGS is an optional set of compiler settings, overriding the defaults.
+ SETTINGS is an optional set of compiler settings, overriding the defaults,
+ in JSON format. See src/settings.js.
OUTPUT_FILE is the file to create with the output. If not given, we write
- to stdout
+ to stdout.
+
+ You should have an ~/.emscripten file set up, see tests/settings.py, which
+ in particular includes COMPILER_ENGINE.
'''
else:
- if len(sys.argv) >= 3:
- COMPILER_ENGINE = [sys.argv[2]]
- settings = sys.argv[3] if len(sys.argv) >= 4 else "{}"
- outfile = open(sys.argv[4], 'w') if len(sys.argv) >= 5 else None
+ settings = sys.argv[2] if len(sys.argv) >= 3 else "{}"
+ outfile = open(sys.argv[3], 'w') if len(sys.argv) >= 4 else None
emscripten(sys.argv[1], settings, outfile)
diff --git a/tests/runner.py b/tests/runner.py
index 7bb5f5ab..eeb09978 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -231,7 +231,7 @@ class RunnerCore(unittest.TestCase):
for setting in ['QUANTUM_SIZE', 'RELOOP', 'OPTIMIZE', 'ASSERTIONS', 'USE_TYPED_ARRAYS', 'SAFE_HEAP', 'CHECK_OVERFLOWS', 'CORRECT_OVERFLOWS', 'CORRECT_SIGNS', 'CHECK_SIGNS', 'CORRECT_OVERFLOWS_LINES', 'CORRECT_SIGNS_LINES', 'CORRECT_ROUNDINGS', 'CORRECT_ROUNDINGS_LINES', 'INVOKE_RUN', 'SAFE_HEAP_LINES', 'INIT_STACK']:
value = eval(setting)
exported_settings[setting] = value
- compiler_output = timeout_run(Popen([EMSCRIPTEN, filename + '.o.ll', COMPILER_ENGINE[0], str(exported_settings).replace("'", '"'), filename + '.o.js'], stdout=PIPE, stderr=STDOUT), TIMEOUT, 'Compiling')
+ compiler_output = timeout_run(Popen([EMSCRIPTEN, filename + '.o.ll', str(exported_settings).replace("'", '"'), filename + '.o.js'], 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