aboutsummaryrefslogtreecommitdiffstats
path: root/travis
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2018-12-15 12:00:16 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2018-12-15 12:00:16 +0300
commit763cad619dc21fd55df93d0294d4cd46b50e437e (patch)
treed1df9486ccf6f3f34c76853feecb957823f80888 /travis
parentb7f24e7715d8fdca52fda7fb9df1b70d8d4bbc6b (diff)
downloadnasm-763cad619dc21fd55df93d0294d4cd46b50e437e.tar.gz
nasm-763cad619dc21fd55df93d0294d4cd46b50e437e.tar.xz
nasm-763cad619dc21fd55df93d0294d4cd46b50e437e.zip
test: nasm-t -- Move data reading out of cmp_std
Since the only purpose of cmp_std is to compare outputs. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'travis')
-rwxr-xr-xtravis/nasm-t.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/travis/nasm-t.py b/travis/nasm-t.py
index 7c37bde8..aed1bfb0 100755
--- a/travis/nasm-t.py
+++ b/travis/nasm-t.py
@@ -210,20 +210,17 @@ def show_std(stdname, data):
print("\t%s" % i)
print("\t---")
-def cmp_std(test, data_name, data, match):
- match_data = read_stdfile(match)
- if match_data == None:
- return test_fail(test, "Can't read " + match)
- if data != match_data:
- print("\t--- %s" % (data_name))
- for i in data.split("\n"):
+def cmp_std(from_name, from_data, match_name, match_data):
+ if from_data != match_data:
+ print("\t--- %s" % (from_name))
+ for i in from_data.split("\n"):
print("\t%s" % i)
- print("\t--- %s" % (match))
+ print("\t--- %s" % (match_name))
for i in match_data.split("\n"):
print("\t%s" % i)
- diff = difflib.unified_diff(data.split("\n"), match_data.split("\n"),
- fromfile = data_name, tofile = match)
+ diff = difflib.unified_diff(from_data.split("\n"), match_data.split("\n"),
+ fromfile = from_name, tofile = match_name)
for i in diff:
print("\t%s" % i.strip("\n"))
print("\t---")
@@ -337,14 +334,20 @@ def test_run(desc):
elif 'stdout' in t:
print("\tComparing stdout")
match = desc['_base-dir'] + os.sep + t['stdout']
- if cmp_std(desc['_test-name'], 'stdout', stdout, match) == False:
+ match_data = read_stdfile(match)
+ if match_data == None:
+ return test_fail(test, "Can't read " + match)
+ if cmp_std('stdout', stdout, match, match_data) == False:
return test_fail(desc['_test-name'], "Stdout mismatch")
else:
stdout = ""
elif 'stderr' in t:
print("\tComparing stderr")
match = desc['_base-dir'] + os.sep + t['stderr']
- if cmp_std(desc['_test-name'], 'stderr', stderr, match) == False:
+ match_data = read_stdfile(match)
+ if match_data == None:
+ return test_fail(test, "Can't read " + match)
+ if cmp_std('stderr', stderr, match, match_data) == False:
return test_fail(desc['_test-name'], "Stderr mismatch")
else:
stderr = ""