diff options
Diffstat (limited to 'scripts/test')
-rw-r--r-- | scripts/test/shared.py | 2 | ||||
-rw-r--r-- | scripts/test/support.py | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/scripts/test/shared.py b/scripts/test/shared.py index a0bce3dd5..52dd74fd7 100644 --- a/scripts/test/shared.py +++ b/scripts/test/shared.py @@ -312,7 +312,7 @@ def fail_if_not_contained(actual, expected): def fail_if_not_identical_to_file(actual, expected_file): - with open(expected_file, 'rb') as f: + with open(expected_file, 'rb' if expected_file.endswith(".wasm") else 'r') as f: fail_if_not_identical(actual, f.read(), fromfile=expected_file) diff --git a/scripts/test/support.py b/scripts/test/support.py index 23a91df59..f23e1c4de 100644 --- a/scripts/test/support.py +++ b/scripts/test/support.py @@ -87,16 +87,17 @@ def untar(tarfile, outdir): shutil.rmtree(tmpdir) -def split_wast(wast): +def split_wast(wastFile): # .wast files can contain multiple modules, and assertions for each one. # this splits out a wast into [(module, assertions), ..] # we ignore module invalidity tests here. - wast = open(wast).read() + wast = open(wastFile, 'rb').read() # if it's a binary, leave it as is if wast[0] == '\0': return [[wast, '']] + wast = open(wastFile, 'r').read() ret = [] def to_end(j): @@ -152,7 +153,7 @@ def run_command(cmd, expected_status=0, stderr=None, "Can't redirect stderr if using expected_err" stderr = subprocess.PIPE print 'executing: ', ' '.join(cmd) - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=stderr) + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=stderr, universal_newlines=True) out, err = proc.communicate() code = proc.returncode if code != expected_status: |