@@ -105,7 +105,7 @@ def run_wasm_opt_tests():
105105 actual = ''
106106 for module , asserts in split_wast (t ):
107107 assert len (asserts ) == 0
108- with open ('split.wast' , 'w' ) as o :
108+ with open ('split.wast' , "wb" if binary else 'w' ) as o :
109109 o .write (module )
110110 cmd = WASM_OPT + opts + ['split.wast' , '--print' ]
111111 curr = run_command (cmd )
@@ -139,12 +139,12 @@ def check():
139139 wasm = os .path .basename (t ).replace ('.wast' , '' )
140140 cmd = WASM_OPT + [os .path .join (options .binaryen_test , 'print' , t ), '--print' ]
141141 print ' ' , ' ' .join (cmd )
142- actual , err = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE ).communicate ()
142+ actual , err = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , universal_newlines = True ).communicate ()
143143 expected_file = os .path .join (options .binaryen_test , 'print' , wasm + '.txt' )
144144 fail_if_not_identical_to_file (actual , expected_file )
145145 cmd = WASM_OPT + [os .path .join (options .binaryen_test , 'print' , t ), '--print-minified' ]
146146 print ' ' , ' ' .join (cmd )
147- actual , err = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE ).communicate ()
147+ actual , err = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , universal_newlines = True ).communicate ()
148148 fail_if_not_identical (actual .strip (), open (os .path .join (options .binaryen_test , 'print' , wasm + '.minified.txt' )).read ().strip ())
149149
150150 print '\n [ checking wasm-opt testcases... ]\n '
0 commit comments