extensions
Volodymyr Shymanskyy 5 years ago
parent 05d04ff2ac
commit a24724bbe7

@ -314,14 +314,16 @@ def runInvoke(test):
stats.total_run += 1 stats.total_run += 1
output = ""
actual = None actual = None
actual_val = None actual_val = None
force_fail = False
try: try:
output = wasm3.invoke(test.cmd).strip() output = wasm3.invoke(test.cmd).strip()
except Exception as e: except Exception as e:
output = ""
actual = f"<{e}>" actual = f"<{e}>"
force_fail = True
# Parse the actual output # Parse the actual output
if not actual: if not actual:
@ -339,14 +341,18 @@ def runInvoke(test):
actual = "error " + result[-1] actual = "error " + result[-1]
if not actual: if not actual:
actual = "<No Result>" actual = "<No Result>"
force_fail = True
if actual == "error no operation ()": if actual == "error no operation ()":
actual = "<Not Implemented>" actual = "<Not Implemented>"
stats.missing += 1 stats.missing += 1
force_fail = True
elif actual == "<Crashed>": elif actual == "<Crashed>":
stats.crashed += 1 stats.crashed += 1
force_fail = True
elif actual == "<Timeout>": elif actual == "<Timeout>":
stats.timeout += 1 stats.timeout += 1
force_fail = True
# Prepare the expected result # Prepare the expected result
expect = None expect = None
@ -393,12 +399,7 @@ def runInvoke(test):
print(output) print(output)
log.write(f"{test.source}\t|\t{test.wasm} {test.action.field}({', '.join(displayArgs)})\t=>\t\t") log.write(f"{test.source}\t|\t{test.wasm} {test.action.field}({', '.join(displayArgs)})\t=>\t\t")
if actual == expect or (expect == "<Anything>" and actual != "<Crashed>"): if actual != expect or force_fail:
stats.success += 1
log.write(f"OK: {actual}\n")
if args.line:
showTestResult()
else:
stats.failed += 1 stats.failed += 1
log.write(f"FAIL: {actual}, should be: {expect}\n") log.write(f"FAIL: {actual}, should be: {expect}\n")
if args.silent: return if args.silent: return
@ -406,6 +407,11 @@ def runInvoke(test):
showTestResult() showTestResult()
#sys.exit(1) #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(coreDir):
if not os.path.isdir(specDir): if not os.path.isdir(specDir):
@ -419,9 +425,10 @@ if args.file:
jsonFiles = args.file jsonFiles = args.file
elif args.all: elif args.all:
jsonFiles = glob.glob(os.path.join(coreDir, "*.json")) jsonFiles = glob.glob(os.path.join(coreDir, "*.json"))
jsonFiles = list(map(lambda x: os.path.relpath(x, curDir), jsonFiles))
jsonFiles.sort() jsonFiles.sort()
else: 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", "get_local", "set_local", "tee_local",
"globals", "globals",

Loading…
Cancel
Save