Коммит
997ae35917
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
'''
|
||||
This is a helper tool which is designed to make it possible
|
||||
for other apps to read emscripten's configuration variables
|
||||
in a unified way. Usage:
|
||||
|
||||
em-config VAR_NAME
|
||||
|
||||
This tool prints the value of the variable to stdout if one
|
||||
is found, or exits with 1 if the variable does not exist.
|
||||
'''
|
||||
|
||||
import os, sys, re
|
||||
from tools import shared
|
||||
|
||||
if len(sys.argv) != 2 or \
|
||||
not re.match(r"^[\w\W_][\w\W_\d]*$", sys.argv[1]) or \
|
||||
not (sys.argv[1] in dir(shared)):
|
||||
print 'Usage: em-config VAR_NAME'
|
||||
exit(1)
|
||||
|
||||
print eval('shared.' + sys.argv[1])
|
||||
|
|
@ -6094,6 +6094,23 @@ def process(filename):
|
|||
'''
|
||||
self.do_run(src, 'hello, world!\ncleanup\nExit Status: 118')
|
||||
|
||||
def test_emconfig(self):
|
||||
output = Popen(['python', EMCONFIG, 'LLVM_ROOT'], stdout=PIPE, stderr=PIPE).communicate()[0]
|
||||
assert output == LLVM_ROOT + "\n"
|
||||
invalid = 'Usage: em-config VAR_NAME\n'
|
||||
# Don't accept variables that do not exist
|
||||
output = Popen(['python', EMCONFIG, 'VAR_WHICH_DOES_NOT_EXIST'], stdout=PIPE, stderr=PIPE).communicate()[0]
|
||||
assert output == invalid
|
||||
# Don't accept no arguments
|
||||
output = Popen(['python', EMCONFIG], stdout=PIPE, stderr=PIPE).communicate()[0]
|
||||
assert output == invalid
|
||||
# Don't accept more than one variable
|
||||
output = Popen(['python', EMCONFIG, 'LLVM_ROOT', 'EMCC'], stdout=PIPE, stderr=PIPE).communicate()[0]
|
||||
assert output == invalid
|
||||
# Don't accept arbitrary python code
|
||||
output = Popen(['python', EMCONFIG, 'sys.argv[1]'], stdout=PIPE, stderr=PIPE).communicate()[0]
|
||||
assert output == invalid
|
||||
|
||||
|
||||
# Generate tests for everything
|
||||
def make_run(fullname, name=-1, compiler=-1, llvm_opts=0, embetter=0, quantum_size=0, typed_arrays=0, emcc_args=None):
|
||||
|
|
|
@ -125,6 +125,7 @@ EMAR = path_from_root('emar')
|
|||
EMLD = path_from_root('emld')
|
||||
EMRANLIB = path_from_root('emranlib')
|
||||
EMLIBTOOL = path_from_root('emlibtool')
|
||||
EMCONFIG = path_from_root('em-config')
|
||||
EMMAKEN = path_from_root('tools', 'emmaken.py')
|
||||
AUTODEBUGGER = path_from_root('tools', 'autodebugger.py')
|
||||
BINDINGS_GENERATOR = path_from_root('tools', 'bindings_generator.py')
|
||||
|
|
Загрузка…
Ссылка в новой задаче