summaryrefslogtreecommitdiff
path: root/test/run-tests.py
diff options
context:
space:
mode:
authorBen Smith <binji@chromium.org>2016-08-30 16:42:42 -0700
committerBen Smith <binji@chromium.org>2016-09-01 11:58:17 -0700
commita0a53eace2efd3e07cb584cd6f360058bb4dce17 (patch)
tree75b9068c8376641a7f996bfa8654eea53259af36 /test/run-tests.py
parente771a3b9d3ac4ea19ff3be45983276b844213d4e (diff)
downloadwabt-a0a53eace2efd3e07cb584cd6f360058bb4dce17.tar.gz
wabt-a0a53eace2efd3e07cb584cd6f360058bb4dce17.tar.bz2
wabt-a0a53eace2efd3e07cb584cd6f360058bb4dce17.zip
python3 support
Diffstat (limited to 'test/run-tests.py')
-rwxr-xr-xtest/run-tests.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/test/run-tests.py b/test/run-tests.py
index 47e4c8fa..216ff8f9 100755
--- a/test/run-tests.py
+++ b/test/run-tests.py
@@ -15,12 +15,17 @@
# limitations under the License.
#
+from __future__ import print_function
import argparse
import difflib
import fnmatch
import multiprocessing
import os
-import Queue
+try:
+ import Queue
+except ImportError:
+ # Python3?
+ import queue as Queue
import re
import shlex
import shutil
@@ -260,7 +265,7 @@ class TestInfo(object):
if not value in TOOLS:
raise Error('Unknown tool: %s' % value)
self.tool = value
- for tool_key, tool_value in TOOLS[value].iteritems():
+ for tool_key, tool_value in TOOLS[value].items():
self.ParseDirective(tool_key, tool_value)
else:
raise Error('Unknown directive: %s' % key)
@@ -367,8 +372,8 @@ class TestInfo(object):
with open(self.input_filename, 'rb') as input_filename:
file_.write(input_filename.read())
else:
- file_.write('\n' * self.header.count('\n'))
- file_.write(self.input_)
+ file_.write(('\n' * self.header.count('\n')).encode('ascii'))
+ file_.write(self.input_.encode('ascii'))
file_.flush()
file_.close()
@@ -689,10 +694,10 @@ def main(args):
if options.list:
for test_name in test_names:
- print test_name
+ print(test_name)
return 0
if not test_names:
- print 'no tests match that filter'
+ print('no tests match that filter')
return 1
if options.exe_dir:
@@ -746,7 +751,7 @@ def main(args):
else:
RunSingleProcess(infos_to_run, status, options, variables)
except:
- print '\nInterrupted testing\n'
+ print('\nInterrupted testing\n')
finally:
if out_dir_is_temp:
shutil.rmtree(out_dir)