mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-07-24 10:25:42 -04:00
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>
This commit is contained in:
parent
b7f24e7715
commit
763cad619d
@ -210,20 +210,17 @@ def show_std(stdname, data):
|
|||||||
print("\t%s" % i)
|
print("\t%s" % i)
|
||||||
print("\t---")
|
print("\t---")
|
||||||
|
|
||||||
def cmp_std(test, data_name, data, match):
|
def cmp_std(from_name, from_data, match_name, match_data):
|
||||||
match_data = read_stdfile(match)
|
if from_data != match_data:
|
||||||
if match_data == None:
|
print("\t--- %s" % (from_name))
|
||||||
return test_fail(test, "Can't read " + match)
|
for i in from_data.split("\n"):
|
||||||
if data != match_data:
|
|
||||||
print("\t--- %s" % (data_name))
|
|
||||||
for i in data.split("\n"):
|
|
||||||
print("\t%s" % i)
|
print("\t%s" % i)
|
||||||
print("\t--- %s" % (match))
|
print("\t--- %s" % (match_name))
|
||||||
for i in match_data.split("\n"):
|
for i in match_data.split("\n"):
|
||||||
print("\t%s" % i)
|
print("\t%s" % i)
|
||||||
|
|
||||||
diff = difflib.unified_diff(data.split("\n"), match_data.split("\n"),
|
diff = difflib.unified_diff(from_data.split("\n"), match_data.split("\n"),
|
||||||
fromfile = data_name, tofile = match)
|
fromfile = from_name, tofile = match_name)
|
||||||
for i in diff:
|
for i in diff:
|
||||||
print("\t%s" % i.strip("\n"))
|
print("\t%s" % i.strip("\n"))
|
||||||
print("\t---")
|
print("\t---")
|
||||||
@ -337,14 +334,20 @@ def test_run(desc):
|
|||||||
elif 'stdout' in t:
|
elif 'stdout' in t:
|
||||||
print("\tComparing stdout")
|
print("\tComparing stdout")
|
||||||
match = desc['_base-dir'] + os.sep + t['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")
|
return test_fail(desc['_test-name'], "Stdout mismatch")
|
||||||
else:
|
else:
|
||||||
stdout = ""
|
stdout = ""
|
||||||
elif 'stderr' in t:
|
elif 'stderr' in t:
|
||||||
print("\tComparing stderr")
|
print("\tComparing stderr")
|
||||||
match = desc['_base-dir'] + os.sep + t['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")
|
return test_fail(desc['_test-name'], "Stderr mismatch")
|
||||||
else:
|
else:
|
||||||
stderr = ""
|
stderr = ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user