tools/gen-cpydiff.py: Fail CPython diff generation if output matches.
Previously this information was recorded in a "status" field of the result, but nothing ever parsed this result which led to non-differences not being removed. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
committed by
Damien George
parent
e9a80fc9a0
commit
74a5bf94c1
@@ -69,7 +69,6 @@ Output = namedtuple(
|
||||
"code",
|
||||
"output_cpy",
|
||||
"output_upy",
|
||||
"status",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -98,7 +97,7 @@ def readfiles():
|
||||
if not re.match(r"\s*# fmt: (on|off)\s*", x)
|
||||
)
|
||||
|
||||
output = Output(test, class_, desc, cause, workaround, code, "", "", "")
|
||||
output = Output(test, class_, desc, cause, workaround, code, "", "")
|
||||
files.append(output)
|
||||
except IndexError:
|
||||
print("Incorrect format in file " + test_fullpath)
|
||||
@@ -108,6 +107,7 @@ def readfiles():
|
||||
|
||||
def run_tests(tests):
|
||||
"""executes all tests"""
|
||||
same_results = False
|
||||
results = []
|
||||
for test in tests:
|
||||
test_fullpath = os.path.join(TESTPATH, test.name)
|
||||
@@ -133,11 +133,9 @@ def run_tests(tests):
|
||||
output_upy = [com.decode("utf8") for com in process.communicate(input_py)]
|
||||
|
||||
if output_cpy[0] == output_upy[0] and output_cpy[1] == output_upy[1]:
|
||||
status = "Supported"
|
||||
print("Supported operation!\nFile: " + test_fullpath)
|
||||
print("Error: Test has same output in CPython vs MicroPython: " + test_fullpath)
|
||||
same_results = True
|
||||
else:
|
||||
status = "Unsupported"
|
||||
|
||||
output = Output(
|
||||
test.name,
|
||||
test.class_,
|
||||
@@ -147,10 +145,15 @@ def run_tests(tests):
|
||||
test.code,
|
||||
output_cpy,
|
||||
output_upy,
|
||||
status,
|
||||
)
|
||||
results.append(output)
|
||||
|
||||
if same_results:
|
||||
raise SystemExit(
|
||||
"Failing due to non-differences in results. If MicroPython behaviour has changed "
|
||||
"to match CPython, please remove the file(s) mentioned above."
|
||||
)
|
||||
|
||||
results.sort(key=lambda x: x.class_)
|
||||
return results
|
||||
|
||||
|
||||
Reference in New Issue
Block a user