Move JS_ENGINE_OVERRIDE to shared Building object to avoid sys.modules hack
This commit is contained in:
Родитель
8d3994c9eb
Коммит
85afe6e007
|
@ -38,7 +38,6 @@ except:
|
|||
checked_sanity = False
|
||||
test_modes = ['default', 'o1', 'o2', 'asm1', 'asm2', 'asm2g', 'asm2x86', 's_0_0', 's_0_1']
|
||||
test_index = 0
|
||||
js_engine_override = None
|
||||
|
||||
class RunnerCore(unittest.TestCase):
|
||||
emcc_args = None
|
||||
|
@ -656,11 +655,6 @@ class BrowserCore(RunnerCore):
|
|||
###################################################################################################
|
||||
|
||||
if __name__ == '__main__':
|
||||
# The runner module is imported by the tests, add the current module
|
||||
# instance into the cache so global variables such as js_engine_override
|
||||
# are shared correctly with the test suite modules.
|
||||
sys.modules['runner'] = sys.modules[__name__]
|
||||
|
||||
# Sanity checks
|
||||
total_engines = len(JS_ENGINES)
|
||||
JS_ENGINES = filter(check_engine, JS_ENGINES)
|
||||
|
@ -745,7 +739,7 @@ an individual test with
|
|||
arg = sys.argv[i]
|
||||
if arg.isupper():
|
||||
print 'Interpreting all capital argument "%s" as JS_ENGINE override' % arg
|
||||
js_engine_override = eval(arg)
|
||||
Building.JS_ENGINE_OVERRIDE = eval(arg)
|
||||
sys.argv[i] = None
|
||||
sys.argv = filter(lambda arg: arg is not None, sys.argv)
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class benchmark(RunnerCore):
|
|||
|
||||
# Pick the JS engine to benchmark. If you specify one, it will be picked. For example, python tests/runner.py benchmark SPIDERMONKEY_ENGINE
|
||||
global JS_ENGINE
|
||||
JS_ENGINE = runner.js_engine_override if runner.js_engine_override is not None else JS_ENGINES[0]
|
||||
JS_ENGINE = Building.JS_ENGINE_OVERRIDE if Building.JS_ENGINE_OVERRIDE is not None else JS_ENGINES[0]
|
||||
print 'Benchmarking JS engine: %s' % JS_ENGINE
|
||||
|
||||
def print_stats(self, times, native_times, last=False, reps=TEST_REPS):
|
||||
|
|
|
@ -764,6 +764,7 @@ class Building:
|
|||
COMPILER = CLANG
|
||||
LLVM_OPTS = False
|
||||
COMPILER_TEST_OPTS = [] # For use of the test runner
|
||||
JS_ENGINE_OVERRIDE = None # Used to pass the JS engine override from runner.py -> test_benchmark.py
|
||||
|
||||
@staticmethod
|
||||
def get_building_env(native=False):
|
||||
|
|
Загрузка…
Ссылка в новой задаче