aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George2016-03-07 12:01:21 +0000
committerDamien George2016-03-08 10:20:38 +0000
commitf0e2d13fd26eb05fce2600e255bf625c3f474385 (patch)
treec40a4f09f59ca90aa79ae7fe4baeb3295f84de8e
parented593780bf3e6f073b9e9062bc6e7cb1ffb8b56f (diff)
tests/run-tests: Simplify handling of newline in output from tests.
Now, all output has newlines converted to \n, regardless of port or platform.
-rwxr-xr-xtests/run-tests18
1 files changed, 8 insertions, 10 deletions
diff --git a/tests/run-tests b/tests/run-tests
index b5a88408b..eb8f6ddff 100755
--- a/tests/run-tests
+++ b/tests/run-tests
@@ -136,8 +136,6 @@ def run_micropython(pyb, args, test_file):
if i_mupy >= len(lines_mupy):
break
output_mupy = b''.join(lines_mupy)
- if os.name == 'nt':
- output_mupy = output_mupy.replace(b'\n', b'\r\n')
else:
# a standard test
@@ -150,10 +148,13 @@ def run_micropython(pyb, args, test_file):
import pyboard
pyb.enter_raw_repl()
try:
- output_mupy = pyb.execfile(test_file).replace(b'\r\n', b'\n')
+ output_mupy = pyb.execfile(test_file)
except pyboard.PyboardError:
output_mupy = b'CRASH'
+ # canonical form for all ports/platforms is to use \n for end-of-line
+ output_mupy = output_mupy.replace(b'\r\n', b'\n')
+
return output_mupy
def run_tests(pyb, tests, args):
@@ -277,8 +278,6 @@ def run_tests(pyb, tests, args):
# expected output given by a file, so read that in
with open(test_file_expected, 'rb') as f:
output_expected = f.read()
- if os.name == 'nt':
- output_expected = output_expected.replace(b'\n', b'\r\n')
else:
# run CPython to work out expected output
try:
@@ -289,17 +288,16 @@ def run_tests(pyb, tests, args):
except subprocess.CalledProcessError:
output_expected = b'CPYTHON3 CRASH'
+ # canonical form for all host platforms is to use \n for end-of-line
+ output_expected = output_expected.replace(b'\r\n', b'\n')
+
if args.write_exp:
continue
# run Micro Python
output_mupy = run_micropython(pyb, args, test_file)
- if os.name != 'nt':
- # It may be the case that we run Windows build under Linux
- # (using Wine).
- output_mupy = output_mupy.replace(b'\r\n', b'\n')
- if output_mupy == b'SKIP\n' or output_mupy == b'SKIP\r\n':
+ if output_mupy == b'SKIP\n':
print("skip ", test_file)
skipped_tests.append(test_name)
continue