31 lines
1.4 KiB
Python
31 lines
1.4 KiB
Python
import os
|
|
|
|
|
|
def register(registry):
|
|
# W4/W5 kill pages are only meaningful with the wasm backend enabled. Native
|
|
# requests may terminate the worker by design, so keep them out of the normal
|
|
# native suite unless the W5 harness opts in explicitly.
|
|
if os.environ.get("UCE_INCLUDE_WASM_KILL") != "1":
|
|
return
|
|
|
|
pages = [
|
|
# oob is __builtin_trap() → wasm `unreachable`, a signal-delivering trap.
|
|
# It crashed the worker until signals_based_traps(false) (see make_engine
|
|
# in src/wasm/worker.cpp); keeping it in the gate guards that fix.
|
|
("wasm kill trap", "/tests/wasm-kill/oob.uce", "unreachable"),
|
|
("wasm kill loop", "/tests/wasm-kill/loop.uce", "interrupt"),
|
|
("wasm kill recurse", "/tests/wasm-kill/recurse.uce", "wasm_kill_recurse"),
|
|
]
|
|
for name, path, marker in pages:
|
|
def make_case(page_path=path, expected_marker=marker):
|
|
def run(context):
|
|
response = context.expect_status(page_path, 500)
|
|
context.expect_body_contains(response, "wasm runtime error during request")
|
|
context.expect_body_contains(response, expected_marker)
|
|
# The worker should remain healthy after the trap.
|
|
health = context.expect_status("/demo/hello.uce", 200)
|
|
context.expect_body_contains(health, "hello world")
|
|
return "clean wasm trap page and post-trap health check for %s" % page_path
|
|
return run
|
|
registry.case(name, make_case(), tags=["http", "uce", "wasm", "kill", "internal"])
|