@@ -187,8 +187,8 @@ def run_test262(engine, arch, extra_arg):
187
187
args = ['python3' , join ('tools' , 'packaging' , 'test262.py' ),
188
188
'--command' , engine ,
189
189
'--summary' ]
190
- if len (extra_arg ):
191
- args .extend (extra_arg .split (" " ))
190
+ if len (extra_arg [ "test262_extra_arg" ] ):
191
+ args .extend (extra_arg [ "test262_extra_arg" ] .split (" " ))
192
192
stdout = run (args ,
193
193
cwd = TEST262_DIR ,
194
194
env = {'TZ' : 'US/Pacific' },
@@ -209,8 +209,8 @@ def run_test262_strict(engine, arch, extra_arg):
209
209
'--command' , engine ,
210
210
'--full-summary' ,
211
211
'--strict_only' ],
212
- if len (extra_arg ):
213
- args .extend (extra_arg .split (" " ))
212
+ if len (extra_arg [ "test262_extra_arg" ] ):
213
+ args .extend (extra_arg [ "test262_extra_arg" ] .split (" " ))
214
214
run (args ,
215
215
cwd = TEST262_DIR ,
216
216
env = {'TZ' : 'US/Pacific' },
@@ -239,8 +239,8 @@ def run_test262_nonstrict(engine, arch, extra_arg):
239
239
'--command' , engine ,
240
240
'--full-summary' ,
241
241
'--non_strict_only' ],
242
- if len (extra_arg ):
243
- args .extend (extra_arg .split (" " ))
242
+ if len (extra_arg [ "test262_extra_arg" ] ):
243
+ args .extend (extra_arg [ "test262_extra_arg" ] .split (" " ))
244
244
run (args ,
245
245
cwd = TEST262_DIR ,
246
246
env = {'TZ' : 'US/Pacific' },
@@ -258,10 +258,12 @@ def run_test262_nonstrict(engine, arch, extra_arg):
258
258
259
259
print ('test262-nonstrict: All tests passed' )
260
260
261
- def compile_test_data_runner ():
261
+ def compile_test_data_runner (extra_arg ):
262
+ if extra_arg ["skip_build_test_data_runner" ]:
263
+ return
262
264
run (['g++' , "./tools/test/test-data-runner/test-data-runner.cpp" , "-o" , "./tools/test/test-data-runner/test-data-runner" , "-g3" , "-std=c++11" , "-lpthread" ],
263
- cwd = PROJECT_SOURCE_DIR ,
264
- stdout = PIPE )
265
+ cwd = PROJECT_SOURCE_DIR ,
266
+ stdout = PIPE )
265
267
266
268
@runner ('test262-dump' , default = False )
267
269
def run_test262_dump (engine , arch , extra_arg ):
@@ -271,8 +273,8 @@ def run_test262_dump(engine, arch, extra_arg):
271
273
args = ['python3' , join ('tools' , 'packaging' , 'test262.py' ),
272
274
'--command' , engine ,
273
275
'--summary' ]
274
- if len (extra_arg ):
275
- args .extend (extra_arg .split (" " ))
276
+ if len (extra_arg [ "test262_extra_arg" ] ):
277
+ args .extend (extra_arg [ "test262_extra_arg" ] .split (" " ))
276
278
stdout = run (args ,
277
279
cwd = TEST262_DIR ,
278
280
env = {'TZ' : 'US/Pacific' , 'ESCARGOT_DUMP262DATA' : '1' },
@@ -285,9 +287,9 @@ def run_test262_dump(engine, arch, extra_arg):
285
287
286
288
@runner ('test262-dump-run' , default = False )
287
289
def run_test262_dump_run (engine , arch , extra_arg ):
288
- compile_test_data_runner ()
290
+ compile_test_data_runner (extra_arg )
289
291
290
- stdout = run ([PROJECT_SOURCE_DIR + '/tools/test/test-data-runner/test-data-runner' , "--shell" , engine ,
292
+ stdout = run ([extra_arg [ "test_data_runner_path" ] , "--shell" , engine ,
291
293
"--test" , "test262" , "--test-data" , join (PROJECT_SOURCE_DIR , 'test' , 'test262' , 'test262_data' )],
292
294
cwd = join (PROJECT_SOURCE_DIR , 'test' , 'test262' ),
293
295
stdout = PIPE )
@@ -358,10 +360,10 @@ def run_spidermonkey_dump(engine, arch, extra_arg):
358
360
359
361
@runner ('spidermonkey-dump-run' , default = False )
360
362
def run_spidermonkey_dump_run (engine , arch , extra_arg ):
361
- compile_test_data_runner ()
363
+ compile_test_data_runner (extra_arg )
362
364
363
365
SPIDERMONKEY_OVERRIDE_DIR = join (PROJECT_SOURCE_DIR , 'tools' , 'test' , 'spidermonkey' )
364
- stdout = run (['./tools/test/test-data-runner/test-data-runner' , '--test-data' , join (SPIDERMONKEY_OVERRIDE_DIR , '%s.data.txt' % arch ),
366
+ stdout = run ([extra_arg [ "test_data_runner_path" ] , '--test-data' , join (SPIDERMONKEY_OVERRIDE_DIR , '%s.data.txt' % arch ),
365
367
"--shell" , engine , "--env" , "LOCALE=en_US" ],
366
368
cwd = PROJECT_SOURCE_DIR ,
367
369
stdout = PIPE )
@@ -407,9 +409,9 @@ def run_jsc_stress_dump_run(engine, arch, extra_arg):
407
409
JSC_DIR = join ('test' , 'vendortest' , 'driver' )
408
410
data_path = join (JSC_DIR , 'jsc.stress.%s.data.txt' % arch )
409
411
410
- compile_test_data_runner ()
412
+ compile_test_data_runner (extra_arg )
411
413
412
- stdout = run ([PROJECT_SOURCE_DIR + '/tools/test/test-data-runner/test-data-runner' , "--shell" , engine ,
414
+ stdout = run ([extra_arg [ "test_data_runner_path" ] , "--shell" , engine ,
413
415
"--test-data" , data_path , "--env" , "GC_FREE_SPACE_DIVISOR=1" ],
414
416
cwd = PROJECT_SOURCE_DIR ,
415
417
stdout = PIPE )
@@ -578,10 +580,10 @@ def run_chakracore_dump(engine, arch, extra_arg):
578
580
579
581
@runner ('chakracore-dump-run' , default = False )
580
582
def run_chakracore_dump_run (engine , arch , extra_arg ):
581
- compile_test_data_runner ()
583
+ compile_test_data_runner (extra_arg )
582
584
583
585
CHAKRACORE_OVERRIDE_DIR = join (PROJECT_SOURCE_DIR , 'tools' , 'test' , 'chakracore' )
584
- stdout = run ([PROJECT_SOURCE_DIR + '/tools/test/test-data-runner/test-data-runner' , "--shell" , engine ,
586
+ stdout = run ([extra_arg [ "test_data_runner_path" ] , "--shell" , engine ,
585
587
"--test-data" , join (CHAKRACORE_OVERRIDE_DIR , 'chakracore.%s.data.txt' % arch ),
586
588
"--env" , "GC_FREE_SPACE_DIVISOR=1 TZ=US/Pacific" ,
587
589
"--treat-global-tostring-as-object" ],
@@ -644,7 +646,7 @@ def run_v8(engine, arch, extra_arg):
644
646
645
647
@runner ('v8-dump' , default = False )
646
648
def run_v8_dump (engine , arch , extra_arg ):
647
- stdout = run_v8 (engine , arch )
649
+ stdout = run_v8 (engine , arch , extra_arg )
648
650
stdout = stdout .decode ("utf-8" ).split ("\n " )
649
651
650
652
TOOL_V8_DIR = join (PROJECT_SOURCE_DIR , 'tools' , 'test' , 'v8' )
@@ -674,10 +676,10 @@ def run_v8_dump(engine, arch, extra_arg):
674
676
675
677
@runner ('v8-dump-run' , default = False )
676
678
def run_v8_dump_run (engine , arch , extra_arg ):
677
- compile_test_data_runner ()
679
+ compile_test_data_runner (extra_arg )
678
680
679
681
TOOL_V8_DIR = join (PROJECT_SOURCE_DIR , 'tools' , 'test' , 'v8' )
680
- stdout = run ([PROJECT_SOURCE_DIR + '/tools/test/test-data-runner/test-data-runner' , "--shell" , engine ,
682
+ stdout = run ([extra_arg [ "test_data_runner_path" ] , "--shell" , engine ,
681
683
"--test-data" , join (TOOL_V8_DIR , '%s.data.txt' % arch ), "--env" , "GC_FREE_SPACE_DIVISOR=1" ],
682
684
cwd = join (PROJECT_SOURCE_DIR ),
683
685
stdout = PIPE )
@@ -786,9 +788,9 @@ def run_escargot_test_dump(engine, arch, extra_arg):
786
788
787
789
@runner ('escargot-test-dump-run' , default = False )
788
790
def run_escargot_test_dump_run (engine , arch , extra_arg ):
789
- compile_test_data_runner ()
791
+ compile_test_data_runner (extra_arg )
790
792
791
- stdout = run ([PROJECT_SOURCE_DIR + '/tools/test/test-data-runner/test-data-runner' , "--shell" , engine ,
793
+ stdout = run ([extra_arg [ "test_data_runner_path" ] , "--shell" , engine ,
792
794
"--test-data" , join (PROJECT_SOURCE_DIR , 'test' , 'vendortest' , 'Escargot' , 'data.txt' )],
793
795
cwd = join (PROJECT_SOURCE_DIR ),
794
796
stdout = PIPE )
@@ -948,22 +950,26 @@ def run_web_tooling_benchmark(engine, arch, extra_arg):
948
950
def run_dump_all (engine , arch , extra_arg ):
949
951
for test in RUNNERS :
950
952
if test .endswith ("-dump" ):
951
- RUNNERS [test ](engine , arch )
953
+ RUNNERS [test ](engine , arch , extra_arg )
952
954
953
955
@runner ('dump-run-all' , default = False )
954
956
def run_dump_run_all (engine , arch , extra_arg ):
955
957
for test in RUNNERS :
956
958
if test .endswith ("-dump-run" ):
957
- RUNNERS [test ](engine , arch )
959
+ RUNNERS [test ](engine , arch , extra_arg )
958
960
959
961
def main ():
960
962
parser = ArgumentParser (description = 'Escargot Test Suite Runner' )
961
963
parser .add_argument ('--engine' , metavar = 'PATH' , default = DEFAULT_ESCARGOT ,
962
964
help = 'path to the engine to be tested (default: %(default)s)' )
963
965
parser .add_argument ('--arch' , metavar = 'NAME' , choices = ['x86' , 'x86_64' ], default = 'x86_64' ,
964
966
help = 'architecture the engine was built for (%(choices)s; default: %(default)s)' )
965
- parser .add_argument ('--extra-arg' , default = '' ,
966
- help = 'extra argument variable to drivers' )
967
+ parser .add_argument ('--test262-extra-arg' , default = '' ,
968
+ help = 'extra argument variable to test262' )
969
+ parser .add_argument ('--test-data-runner-path' , metavar = 'PATH' , default = (PROJECT_SOURCE_DIR + '/tools/test/test-data-runner/test-data-runner' ),
970
+ help = 'test-data-runner executable path' )
971
+ parser .add_argument ('--skip-build-test-data-runner' , default = False , action = "store_true" ,
972
+ help = 'Skip build test-data-runner executable' )
967
973
parser .add_argument ('suite' , metavar = 'SUITE' , nargs = '*' , default = sorted (DEFAULT_RUNNERS ),
968
974
help = 'test suite to run (%s; default: %s)' % (', ' .join (sorted (RUNNERS .keys ())), ' ' .join (sorted (DEFAULT_RUNNERS ))))
969
975
args = parser .parse_args ()
@@ -973,11 +979,15 @@ def main():
973
979
parser .error ('invalid test suite: %s' % suite )
974
980
975
981
success , fail = [], []
976
-
982
+ extra_arg = {
983
+ 'test262_extra_arg' : args .test262_extra_arg ,
984
+ 'skip_build_test_data_runner' : args .skip_build_test_data_runner ,
985
+ 'test_data_runner_path' : args .test_data_runner_path
986
+ }
977
987
for suite in args .suite :
978
988
print (COLOR_PURPLE + 'running test suite: ' + suite + COLOR_RESET )
979
989
try :
980
- RUNNERS [suite ](args .engine , args .arch , args . extra_arg )
990
+ RUNNERS [suite ](args .engine , args .arch , extra_arg )
981
991
success += [suite ]
982
992
except Exception as e :
983
993
print ('\n ' .join (COLOR_YELLOW + line + COLOR_RESET for line in traceback .format_exc ().splitlines ()))
0 commit comments