test: align package fixtures with Go semantics

This commit is contained in:
2026-08-13 23:43:07 +09:00
parent 9a2812347c
commit 028da6323e
6 changed files with 61 additions and 52 deletions

View File

@@ -1,18 +1,18 @@
package driver_test;
// `ww` driver CLI observers. Ports of the retired native carriers
// test/wcc/949_driver_flagargs.c and 949_missingpkg.c; every
// assertion preserved.
// test/wcc/949_driver_flagargs.c and 949_missingpkg.c; the retired
// second-positional single-file-only assertion now belongs to package-root
// selection, while the remaining driver assertions stay here.
//
// flagargs (#15 B2) — `ww -V` exits 0 with stdout exactly
// "ww <WW_VERSION>\n" and empty stderr; 15 flag-misuse rows each exit
// "ww <WW_VERSION>\n" and empty stderr; 14 flag-misuse rows each exit
// 2 with the row's stderr fragment; and on every row plus -V the
// wwstage twin `ww_ww` matches the cstage `ww` byte-exactly on exit
// code, stdout and stderr (rule 10 on the driver surface). The
// version oracle is parsed from cmd/wcc/ww.h at run time, preserving
// the carrier's exact-output ownership without a C toolchain
// dependency. Rows run from a fresh scratch cwd: the `test . zzz` row
// takes `.` positionally, so the cwd must never be the repo tree.
// dependency.
//
// missingpkg (#16 ENFORCE-driver) — `ww build` over a source whose
// only import cannot be located exits nonzero with "cannot find
@@ -168,13 +168,13 @@ fn runrootargv(dir: str, root: str, name: str, drv: str,
@test fn flagargs() void = {
let a1: []str = ["build", "build", "build", "build", "build",
"run", "run", "run", "test", "test", "test", "test", "test",
"test", "test"];
"test"];
let a2: []str = ["-o", "-I", "-L", "-l", "-zz",
"-o", "-l", "-zz", "-l", "-zz", "-I", "-o", "-o",
"-run", "."];
"-run"];
let a3: []str = ["", "", "", "", "",
"", "", "", "", "", "", "", "x",
"", "zzz"];
""];
let subs: []str = [
"ww build: -o needs an argument",
"ww build: -I needs an argument",
@@ -189,8 +189,7 @@ fn runrootargv(dir: str, root: str, name: str, drv: str,
"ww test: -I needs an argument",
"ww test: -o needs an argument",
"ww test: -o needs -c for a package target",
"ww test: -run needs an argument",
"ww test: pattern needs a single test file"];
"ww test: -run needs an argument"];
let i: i32 = 0;
for (i < subs.len) {
let td: str = testenv.fresh();
@@ -231,8 +230,8 @@ fn runrootargv(dir: str, root: str, name: str, drv: str,
// -o needs a writable stem: the output-derived .sepwork follows -o,
// so /dev/null would yield an uncreatable /dev/null.sepwork and
// mask the missing-package fatal.
let av: []str = [testenv.driver("ww"), "build", src, "-o",
strings.concat(td, "/miss.out")];
let av: []str = [testenv.driver("ww"), "build", "-o",
strings.concat(td, "/miss.out"), src];
testenv.runcommand(td, td, "miss", av, tmo(), &co);
assert(co.termination == exec.termination.EXIT);
if (co.code == 0) {

View File

@@ -152,8 +152,8 @@ main(void)
char cmd[1024];
snprintf(cmd, sizeof cmd,
"%s/ww build -o %s %s -L %s -l c",
bin, outbin, src, libdir);
"%s/ww build -o %s -L %s -l c %s",
bin, outbin, libdir, src);
if (runwait(cmd) != 0) {
fprintf(stderr, "dyn row %d: build failed\n", i);
rowfail = 1;

View File

@@ -72,8 +72,8 @@ build_run(const char *driver, const char *src, const char *libdir,
{
char cmd[1024];
snprintf(outbin, obsz, "%s/main", tmpdir);
snprintf(cmd, sizeof cmd, "cd %s && %s build -o %s %s -L %s -l c "
"2>/dev/null", tmpdir, driver, outbin, src, libdir);
snprintf(cmd, sizeof cmd, "cd %s && %s build -o %s -L %s -l c %s "
"2>/dev/null", tmpdir, driver, outbin, libdir, src);
if (runwait(cmd) != 0) return -1;
return runwait(outbin);
}

View File

@@ -114,8 +114,8 @@ main(void)
}
snprintf(cmd, sizeof cmd,
"%s/ww build -o %s %s -L %s -l c >/dev/null 2>&1",
bin, stem, src, libdir);
"%s/ww build -o %s -L %s -l c %s >/dev/null 2>&1",
bin, stem, libdir, src);
if (runwait(cmd) != 0) {
fprintf(stderr, "w6l_ww-dyn FAIL: cannot build generated command\n");
rc = 1;