Skip to content

Commit 83f6145

Browse files
authored
Add --out-dir to allow setting the test output dir. (#2389)
This allows fuzzing in parallel invocations.
1 parent 1abfe59 commit 83f6145

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
fail_if_not_identical, fail_if_not_contained, has_vanilla_emcc,
3030
has_vanilla_llvm, minify_check, options, tests, requested, warnings,
3131
has_shell_timeout, fail_if_not_identical_to_file, with_pass_debug,
32-
validate_binary, test_out
32+
validate_binary
3333
)
3434

3535
# For shared.num_failures. Cannot import directly because modifications made in
@@ -84,7 +84,7 @@ def run_wasm_opt_tests():
8484
for extra_args in [[], ['--no-validation']]:
8585
wast = os.path.join(options.binaryen_test, 'hello_world.wast')
8686
delete_from_orbit('a.wast')
87-
out = os.path.join(test_out, 'a.wast')
87+
out = 'a.wast'
8888
cmd = WASM_OPT + [wast, '-o', out, '-S'] + extra_args
8989
run_command(cmd)
9090
fail_if_not_identical_to_file(open(out).read(), wast)

scripts/test/shared.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ def parse_args(args):
5757
'--binaryen-root', dest='binaryen_root', default='',
5858
help=('Specifies a path to the root of the Binaryen repository tree.'
5959
' Default: the directory where this file check.py resides.'))
60+
parser.add_argument(
61+
'--out-dir', dest='out_dir', default='',
62+
help=('Specifies a path to the output directory for temp files, which '
63+
'is also where the test runner changes directory into.',
64+
' Default:. out/test under the binaryen root.'))
6065
parser.add_argument(
6166
'--valgrind', dest='valgrind', default='',
6267
help=('Specifies a path to Valgrind tool, which will be used to validate'
@@ -124,10 +129,12 @@ def warn(text):
124129

125130
options.binaryen_test = os.path.join(options.binaryen_root, 'test')
126131

127-
test_out = os.path.join(options.binaryen_root, 'out', 'test')
128-
if not os.path.exists(test_out):
129-
os.makedirs(test_out)
130-
os.chdir(test_out)
132+
if not options.out_dir:
133+
options.out_dir = os.path.join(options.binaryen_root, 'out', 'test')
134+
135+
if not os.path.exists(options.out_dir):
136+
os.makedirs(options.out_dir)
137+
os.chdir(options.out_dir)
131138

132139

133140
# Finds the given executable 'program' in PATH.

0 commit comments

Comments
 (0)