ww: package-level -c -o names the single package's test artifact

The last Open-driver-work bullet. `-c -o <name>` replaces the fixed
<package>.test stem for exactly one package; the coordinator rejects a
multi-package fan-out ("cannot use -o with multiple packages", Go's
`go test -o` rule) and -o without -c is rejected at the driver
("needs -c for a package target" — a plain run executes from the temp
root, so a caller-owned name has nothing to name). Both driver stages
byte-identical wording; -S keeps its single-file-only reject.

package_test gains the contract row (naming, fixed-stem absence,
artifact runs, both rejects, both drivers); the tree-mode -o row's
pinned wording follows the contract.
This commit is contained in:
2026-08-08 17:30:36 +09:00
parent cf90c50c38
commit 192ddd4c66
5 changed files with 150 additions and 22 deletions

View File

@@ -2684,8 +2684,14 @@ fn dotest(selfdir: *u8, argv: **u8, argc: i32, start: i32) i32 = {
&& target[tlen - 1u64] == '.';
};
if (istree) {
if (outstem != nil) {
cerr("ww test: -c/-S/-o need a single test file\n");
if (emitasm != 0) {
cerr("ww test: -S needs a single test file\n");
return 2;
};
// -c -o forwards: the coordinator names the single
// package's artifact and rejects a multi-package fan-out.
if (outstem != nil && compileonly == 0) {
cerr("ww test: -o needs -c for a package target\n");
return 2;
};
if (workdir != nil) {
@@ -2728,8 +2734,12 @@ fn dotest(selfdir: *u8, argv: **u8, argc: i32, start: i32) i32 = {
emitasm, outstem, workdir, patarg);
};
if (outstem != nil) {
cerr("ww test: -c/-S/-o need a single test file\n");
if (emitasm != 0) {
cerr("ww test: -S needs a single test file\n");
return 2;
};
if (outstem != nil && compileonly == 0) {
cerr("ww test: -o needs -c for a package target\n");
return 2;
};
if (workdir != nil) {