From a24724bbe785f73975c2b502e21abd3db3a19dbf Mon Sep 17 00:00:00 2001 From: Volodymyr Shymanskyy Date: Sat, 7 Dec 2019 01:43:02 +0200 Subject: [PATCH] Cleanup --- test/run-spec-test.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/test/run-spec-test.py b/test/run-spec-test.py index 1777478..ea19871 100755 --- a/test/run-spec-test.py +++ b/test/run-spec-test.py @@ -314,14 +314,16 @@ def runInvoke(test): stats.total_run += 1 + output = "" actual = None actual_val = None + force_fail = False try: output = wasm3.invoke(test.cmd).strip() except Exception as e: - output = "" actual = f"<{e}>" + force_fail = True # Parse the actual output if not actual: @@ -339,14 +341,18 @@ def runInvoke(test): actual = "error " + result[-1] if not actual: actual = "" + force_fail = True if actual == "error no operation ()": actual = "" stats.missing += 1 + force_fail = True elif actual == "": stats.crashed += 1 + force_fail = True elif actual == "": stats.timeout += 1 + force_fail = True # Prepare the expected result expect = None @@ -393,12 +399,7 @@ def runInvoke(test): print(output) log.write(f"{test.source}\t|\t{test.wasm} {test.action.field}({', '.join(displayArgs)})\t=>\t\t") - if actual == expect or (expect == "" and actual != ""): - stats.success += 1 - log.write(f"OK: {actual}\n") - if args.line: - showTestResult() - else: + if actual != expect or force_fail: stats.failed += 1 log.write(f"FAIL: {actual}, should be: {expect}\n") if args.silent: return @@ -406,6 +407,11 @@ def runInvoke(test): showTestResult() #sys.exit(1) + else: + stats.success += 1 + log.write(f"OK: {actual}\n") + if args.line: + showTestResult() if not os.path.isdir(coreDir): if not os.path.isdir(specDir): @@ -419,9 +425,10 @@ if args.file: jsonFiles = args.file elif args.all: jsonFiles = glob.glob(os.path.join(coreDir, "*.json")) + jsonFiles = list(map(lambda x: os.path.relpath(x, curDir), jsonFiles)) jsonFiles.sort() else: - jsonFiles = list(map(lambda x : f"./core/{x}.json", [ + jsonFiles = list(map(lambda x: f"core/{x}.json", [ "get_local", "set_local", "tee_local", "globals",