json/compare: change to useful exit codes in test suite

This commit is contained in:
Danny Robson 2018-07-13 16:08:48 +10:00
parent 33dc5c7053
commit 49d39c4ede

View File

@ -8,6 +8,8 @@ tool="@CMAKE_CURRENT_BINARY_DIR@/json-compare"
src="@CMAKE_CURRENT_SOURCE_DIR@/test/json/compare"
suffix=".a.json"
failures = 0
for expected in [ "good", "bad" ]:
for path in glob(f"{src}/{expected}/*{suffix}"):
base = path[:-len(suffix)]
@ -17,5 +19,12 @@ for expected in [ "good", "bad" ]:
success = (expected == "good") == (code == 0)
prefix = "not " if not success else ""
prefix = ""
if not success:
prefix = "not "
failures += 1
print(prefix, "ok - ", expected, basename(base), code)
exit(1 if failures else 0)