Honor stdin and expected exit metadata in cross-runtime case execution
Current master follow-up (2026-11-12)
This update records the remaining behavior on the audited master. The historical report and earlier delivered work are retained below; current code paths are Rust rather than the retired Python helpers.
Problem
The shared Rust runner parses metadata but classifies explicit expected-exit/stdin cases as compile-only for the wasm target. Compilation success is then reported as pass without evaluating the runtime contract.
Reproduction and evidence
Audited canonical master 69a67c6e0fb700f37ee6114f5a66d37ee13771a5 (0.0.1-alpha-dev). Matching checkout-built compiler/std were used for compiler probes on Linux amd64 with Rust 1.89.0 and LLVM 21.1.8. Artifact inspection, mocked/projection checks and foreign-target object emission are identified below and are not native execution on those operating systems.
// wave-test: expected-exit=7
fun main()->i32{return 0;}
target/debug/wave-tools test --wavec target/debug/wavec --target-id wasm-unknown --source repro.wave --report-json report.json
Executed result: exit 0/pass, report phase artifact and only build commands; no run command. The program would return 0 while metadata expects 7. A stdin=hello fixture with an empty main follows the same compile-only path. This report does not claim these programs were executed by the runner.
Scope
Honor existing explicit runtime contracts on supported executors. If a target cannot implement a contract, record an explicit unsupported/skip reason rather than runtime success.
Starting points: tools/src/runner.rs:520, tools/src/runner.rs:1237.
Completion criteria
- [ ] Expected nonzero exit matches pass and mismatches fail after actual execution.
- [ ] Supported stdin reaches the program with the documented bytes.
- [ ] Reports distinguish compilation, unsupported execution and real run evidence for QEMU/Wasm/native.
Related: #697. Related broad trackers or completed implementations are context, not claims that their entire scope is unfinished.
Original report (historical)
Problem
tools/run_runtime_cases.py never loads wave-test metadata: every command expects exit 0 and receives no declared stdin. Native tests already use tools/test_contracts.py. Existing shared/test22.wave and shared/test64.wave declare stdin, so the same fixture has different inputs under QEMU/WASM.
Reproduction
Audited on canonical master b384e64c21257a87a1afcd8b43ba28b8c03dcfe4 (2026-09-30). The local checkout used for reproductions has the identical tracked tree. Linux amd64, Python 3.14.7.
Executed a Python boundary test with a temporary selected source:
// wave-test: stdin=3, expected-exit=7
fun main() -> i32 { return 7; }
Call run_runtime_cases.execute with a temporary ROOT, a mocked enabled wasm target and a run_process stub returning subprocess.CompletedProcess(args, 7, '', ''); record its keyword arguments. Actual: suite exit 1, report actual_exit: 7, expected_exit: 0, and no input argument. This isolates runner behavior; it does not claim native QEMU/WASM execution.
For end-to-end validation, run a self-contained return-7 fixture through a supported QEMU target with --sources and verify it passes. Test stdin forwarding with an appropriate supported target/provider, independent of missing WASM host imports.
Scope
Apply supported existing metadata consistently to selected executable cases, keeping build exit status separate from program exit status. Reject unsupported execution modes explicitly instead of silently discarding metadata. This is separate from #459 eligibility/classification and #712 native artifact validation; do not add host shims or filename-based exclusions. Difficulty: medium.
Completion criteria
- [ ] Expected nonzero program exits pass when matched; mismatches fail with actual/expected values.
- [ ] Declared stdin reaches the program phase with the same convention as native execution; compilation remains independently checked.
- [ ] Both QEMU and WASM command plans have focused tests, including malformed/unsupported metadata and timeouts.