run_wml_tests: Output symbolic forms of unit test results in addition to the numeric return code

This commit is contained in:
Celtic Minstrel 2021-02-28 01:17:44 -05:00 committed by Celtic Minstrel
parent 7b7b904c99
commit 5337973cd5

View File

@ -22,6 +22,9 @@ class UnitTestResult(enum.Enum):
FAIL_BY_DEFEAT = 7 FAIL_BY_DEFEAT = 7
PASS_BY_VICTORY = 8 PASS_BY_VICTORY = 8
def __str__(self):
return str(self.value) + ' ' + self.name
class TestCase: class TestCase:
"""Represents a single line of the wml_test_schedule.""" """Represents a single line of the wml_test_schedule."""
def __init__(self, status, name): def __init__(self, status, name):
@ -166,11 +169,12 @@ class WesnothRunner:
gdb_args.extend(args) gdb_args.extend(args)
subprocess.run(gdb_args, timeout=240) subprocess.run(gdb_args, timeout=240)
raise UnexpectedTestStatusException() raise UnexpectedTestStatusException()
if res.returncode != expected_result.value: returned_result = UnitTestResult(res.returncode)
if returned_result != expected_result:
with open(get_output_filename(args), "r") as output: with open(get_output_filename(args), "r") as output:
for line in output.readlines(): for line in output.readlines():
print(line) print(line)
print("Failure, Wesnoth returned", res.returncode, "but we expected", expected_result.value) print("Failure, Wesnoth returned", returned_result, "but we expected", expected_result)
raise UnexpectedTestStatusException() raise UnexpectedTestStatusException()
def test_batcher(test_list): def test_batcher(test_list):