@@ -108,7 +108,7 @@ def run_wasm_opt_tests():
108108 if 'BINARYEN_PASS_DEBUG' in os .environ :
109109 del os .environ ['BINARYEN_PASS_DEBUG' ]
110110
111- fail_if_not_identical (actual , open (os .path .join ('test' , 'passes' , passname + ('.bin' if binary else '' ) + '.txt' ), 'rb' ).read ())
111+ fail_if_not_identical (actual , open (os .path .join (options . binaryen_test , 'passes' , passname + ('.bin' if binary else '' ) + '.txt' ), 'rb' ).read ())
112112
113113 if 'emit-js-wrapper' in t :
114114 with open ('a.js' ) as actual :
@@ -175,10 +175,11 @@ def run_wasm_dis_tests():
175175def run_wasm_merge_tests ():
176176 print '\n [ checking wasm-merge... ]\n '
177177
178- for t in os .listdir (os .path .join ('test' , 'merge' )):
178+ test_dir = os .path .join (options .binaryen_test , 'merge' )
179+ for t in os .listdir (test_dir ):
179180 if t .endswith (('.wast' , '.wasm' )):
180181 print '..' , t
181- t = os .path .join ('test' , 'merge' , t )
182+ t = os .path .join (test_dir , t )
182183 u = t + '.toMerge'
183184 for finalize in [0 , 1 ]:
184185 for opt in [0 , 1 ]:
@@ -198,21 +199,23 @@ def run_wasm_merge_tests():
198199def run_crash_tests ():
199200 print "\n [ checking we don't crash on tricky inputs... ]\n "
200201
201- for t in os .listdir (os .path .join ('test' , 'crash' )):
202+ test_dir = os .path .join (options .binaryen_test , 'crash' )
203+ for t in os .listdir (test_dir ):
202204 if t .endswith (('.wast' , '.wasm' )):
203205 print '..' , t
204- t = os .path .join ('test' , 'crash' , t )
206+ t = os .path .join (test_dir , t )
205207 cmd = WASM_OPT + [t ]
206208 # expect a parse error to be reported
207209 run_command (cmd , expected_err = 'parse exception:' , err_contains = True , expected_status = 1 )
208210
209211def run_ctor_eval_tests ():
210212 print '\n [ checking wasm-ctor-eval... ]\n '
211213
212- for t in os .listdir (os .path .join ('test' , 'ctor-eval' )):
214+ test_dir = os .path .join (options .binaryen_test , 'ctor-eval' )
215+ for t in os .listdir (test_dir ):
213216 if t .endswith (('.wast' , '.wasm' )):
214217 print '..' , t
215- t = os .path .join ('test' , 'ctor-eval' , t )
218+ t = os .path .join (test_dir , t )
216219 ctors = open (t + '.ctors' ).read ().strip ()
217220 cmd = WASM_CTOR_EVAL + [t , '-o' , 'a.wast' , '-S' , '--ctors' , ctors ]
218221 stdout = run_command (cmd )
@@ -224,10 +227,11 @@ def run_ctor_eval_tests():
224227def run_wasm_metadce_tests ():
225228 print '\n [ checking wasm-metadce ]\n '
226229
227- for t in os .listdir (os .path .join ('test' , 'metadce' )):
230+ test_dir = os .path .join (options .binaryen_test , 'metadce' )
231+ for t in os .listdir (test_dir ):
228232 if t .endswith (('.wast' , '.wasm' )):
229233 print '..' , t
230- t = os .path .join ('test' , 'metadce' , t )
234+ t = os .path .join (test_dir , t )
231235 graph = t + '.graph.txt'
232236 cmd = WASM_METADCE + [t , '--graph-file=' + graph , '-o' , 'a.wast' , '-S' ]
233237 stdout = run_command (cmd )
@@ -241,10 +245,11 @@ def run_wasm_metadce_tests():
241245def run_wasm_reduce_tests ():
242246 print '\n [ checking wasm-reduce ]\n '
243247
244- for t in os .listdir (os .path .join ('test' , 'reduce' )):
248+ test_dir = os .path .join (options .binaryen_test , 'reduce' )
249+ for t in os .listdir (test_dir ):
245250 if t .endswith ('.wast' ):
246251 print '..' , t
247- t = os .path .join ('test' , 'reduce' , t )
252+ t = os .path .join (test_dir , t )
248253 # convert to wasm
249254 run_command (WASM_AS + [t , '-o' , 'a.wasm' ])
250255 print run_command (WASM_REDUCE + ['a.wasm' , '--command=%s b.wasm --fuzz-exec' % WASM_OPT [0 ], '-t' , 'b.wasm' , '-w' , 'c.wasm' ])
0 commit comments