mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 09:20:28 +03:00
Meta: Generate failing tests for unsupported assertions in wasm tests
Let's not ignore a test just because our test generator doesn't understand it, assume the worst and generate a failing test case instead.
This commit is contained in:
parent
fe026fef47
commit
7fb458b7c9
Notes:
sideshowbarker
2024-07-18 17:01:27 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/7fb458b7c98 Pull-request: https://github.com/SerenityOS/serenity/pull/7670
@ -98,7 +98,19 @@ def generate(ast):
|
||||
"result": parse_typed_value(entry[2]) if len(entry) == 3 else None
|
||||
})
|
||||
else:
|
||||
print("Ignoring unknown assertion argument", entry[1][0], file=stderr)
|
||||
if not len(tests):
|
||||
tests.append({
|
||||
"module": "",
|
||||
"tests": []
|
||||
})
|
||||
tests[-1]["tests"].append({
|
||||
"kind": "testgen_fail",
|
||||
"function": {
|
||||
"name": "<unknown>",
|
||||
"args": []
|
||||
},
|
||||
"reason": f"Unknown assertion {entry[0][0][len('assert_'):]}"
|
||||
})
|
||||
elif len(entry) >= 2 and entry[0][0] == 'invoke':
|
||||
# toplevel invoke :shrug:
|
||||
tests[-1]["tests"].append({
|
||||
@ -110,7 +122,19 @@ def generate(ast):
|
||||
"result": parse_typed_value(entry[2]) if len(entry) == 3 else None
|
||||
})
|
||||
else:
|
||||
print("Ignoring unknown entry", entry, file=stderr)
|
||||
if not len(tests):
|
||||
tests.append({
|
||||
"module": "",
|
||||
"tests": []
|
||||
})
|
||||
tests[-1]["tests"].append({
|
||||
"kind": "testgen_fail",
|
||||
"function": {
|
||||
"name": "<unknown>",
|
||||
"args": []
|
||||
},
|
||||
"reason": f"Unknown command {entry[0][0]}"
|
||||
})
|
||||
return tests
|
||||
|
||||
|
||||
@ -178,6 +202,9 @@ def genresult(ident, entry):
|
||||
if entry['kind'] == 'ignore':
|
||||
return f'module.invoke({ident}, {", ".join(genarg(x) for x in entry["function"]["args"])});\n '
|
||||
|
||||
if entry['kind'] == 'testgen_fail':
|
||||
return f'throw Exception("Test Generator Failure: " + {json.dumps(entry["reason"])});\n '
|
||||
|
||||
return f'throw Exception("(Test Generator) Unknown test kind {entry["kind"]}");\n '
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user