test/package: wire the runtime fixture set into package_test

test/package/runtime/ was a manual README-driven corpus with no
target. Its unique surface — the driver's single-file ww test leg,
the unmet-expected-abort outcome, and the published -c binary's own
CLI (repeated globs, -list, -timeout-ms, direct-binary timeout and
descendant handling) — is now asserted by three new @test fns in
package_test.ww; the README drops its manual-run instructions.
This commit is contained in:
2026-08-08 00:39:53 +09:00
parent 0b23f9fb31
commit 90af21e132
2 changed files with 180 additions and 42 deletions

View File

@@ -1,45 +1,23 @@
# Native package-runtime fixtures
# Package-runtime fixtures
These fixtures exercise the compiled package test binary, rather than a
subprocess-per-assertion harness. Build the bootstrap tools once with `make all`,
then run the focused cases from the repository root:
Single-file `@test` sources driven by `test/package/package_test.ww`
(the `make test-package` binary): `singlefile_runtime_outcomes`,
`published_binary_cli`, and `direct_binary_timeout_and_descendants`.
They exercise the driver's single-file `ww test` leg and the published
`-c` binary's own command surface (repeated globs, `-list`,
`-timeout-ms`); the directory-package legs of the same outcome classes
are owned by `test/package/cases/*`.
```sh
out/bin/ww test test/package/runtime/success_test.ww
out/bin/ww test -c -o /tmp/ww-runtime-test test/package/runtime/success_test.ww
/tmp/ww-runtime-test 'alpha*' 'delta*'
/tmp/ww-runtime-test -list
/tmp/ww-runtime-test -list 'gamma*'
/tmp/ww-runtime-test -timeout-ms=50 'alpha*'
out/bin/ww test test/package/runtime/fail_test.ww
out/bin/ww test test/package/runtime/multiple_fail_test.ww
out/bin/ww test test/package/runtime/expected_abort_return_test.ww
out/bin/ww test test/package/runtime/premature_exit_test.ww
out/bin/ww test test/package/runtime/signal_test.ww
out/bin/ww test -c -o /tmp/ww-runtime-timeout test/package/runtime/timeout_test.ww
/tmp/ww-runtime-timeout -timeout-ms=50
out/bin/ww test -c -o /tmp/ww-runtime-descendant test/package/runtime/lingering_descendant_test.ww
/tmp/ww-runtime-descendant -timeout-ms=250
out/bin/ww test -c -o /tmp/ww-runtime-escaped test/package/runtime/escaped_descendant_test.ww
/tmp/ww-runtime-escaped -timeout-ms=250
```
Fixture notes:
The success fixture reports two ordinary passes, one expected-abort pass, and
one skip with its reason. The preserved test binary accepts repeated glob
arguments directly. List mode prints selected names without starting tests.
Each test has a 30-second default timeout; `-timeout-ms=N` selects a positive
per-test timeout up to one hour for a direct test-binary invocation.
The current runtime recognizes `expectabort(); os.exit(nonzero)` as an expected
abort because WW's abort primitive itself terminates with a normal exit status;
the ABI cannot distinguish those two paths without a future abort hook.
The assertion, multiple-failure, unmet-expected-abort, premature-exit, and
signal fixtures fail respectively with a normal exit, two failures whose
process status is still clamped to 1, an expected abort that never happens, an
incomplete completion record, and signal 15; none may be mistaken for a pass.
The timeout fixture fails deterministically as `FAIL(timeout)`. The lingering
descendant fixture passes without waiting on the inherited control-pipe writer:
the descendant blocks SIGTERM, so the runner exercises its grace period and
SIGKILL escalation before draining the record.
The escaped-descendant fixture moves its inherited writer into another process
group for one second. The framed nonblocking protocol returns immediately after
the test leader and owned group complete; it never waits for pipe EOF.
- The runtime recognizes `expectabort(); os.exit(nonzero)` as an
expected abort because WW's abort primitive itself terminates with a
normal exit status; the ABI cannot distinguish those two paths
without a future abort hook.
- The lingering-descendant fixture blocks SIGTERM in its descendant, so
the runner exercises its grace period and SIGKILL escalation before
draining the record.
- The escaped-descendant fixture moves its inherited pipe writer into
another process group for one second; the framed nonblocking protocol
must return after the test leader and owned group complete, never
waiting for pipe EOF.