test/wcc: carrier ownership repair and driver-contract adaptation
Every surviving carrier now owns its artifacts: checked mkdir/mkdtemp/ fopen acquisition, one all-exit cleanup funnel per carrier, ENOENT- tolerant checked unlinks, exact-path deletion (rm -rf only for an owned pid-keyed dir or a .sepwork beneath one), and cleanup failure fails a passing carrier without overwriting its diagnostic. In the same pass the carriers adapt to the driver contract this branch lands: --sep and WW_PKGCACHE are gone, -S and the /tmp/ww_run_<pid> scratch contract are asserted, and rows whose runtime or reject coverage moved to test/wcc/data fixtures or test/lang @test owners are trimmed to the byte/artifact/diagnostic observations only they can make. Repair and adaptation ride together because most files interleave both in the same hunks; splitting would manufacture intermediate carrier states that never existed and cannot run against either driver.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 989_wwispread_sep — #95 .wwi producer must preserve the `...` union-spread
|
||||
* marker when serializing a tagged-union type under `ww build --sep`.
|
||||
* marker when serializing a tagged-union type under `ww build`.
|
||||
*
|
||||
* A spread variant `(...inner | str)` carries Node.op == TK_ELLIPSIS on the
|
||||
* variant node (parse.c:315-324). The N_TTAGGED serializer loop must re-emit
|
||||
@@ -14,7 +14,7 @@
|
||||
*
|
||||
* TABLE-DRIVEN over two spread shapes (2-arm `inner` and 3-arm `three`). For
|
||||
* each shape and each driver stage (cs `ww`, ww `ww_ww`) the test:
|
||||
* (a) builds the consumer via `ww build --sep` and runs it — clean compile
|
||||
* (a) builds the consumer via `ww build` and runs it — clean compile
|
||||
* + exit 0 proves the imported alias's arms flattened into the spread
|
||||
* type (the consumer assigns BARE members the spread must expose);
|
||||
* (b) greps the produced <pkg>.wwi and asserts the spread marker survived;
|
||||
@@ -24,12 +24,12 @@
|
||||
* build fails with `init i32 not assignable to declared outer` AND the marker
|
||||
* grep finds nothing (verified by hand at fix time).
|
||||
*
|
||||
* Light wwstage-driver test (CLAUDE.md rule 14): every build's intermediates
|
||||
* are `-o`-redirected to a private /tmp dir, so it is phase-1 parallel-safe.
|
||||
* Every build's intermediates are `-o`-redirected to a private /tmp directory.
|
||||
* Models 989_declns_sep conventions; 989 prefix per the sep-gate precedent.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -124,23 +124,21 @@ main(void)
|
||||
const char *bin = absbin();
|
||||
if (!bin) { fprintf(stderr, "wwispread FAIL: getcwd\n"); return 1; }
|
||||
|
||||
char td[64], cmd[4096];
|
||||
snprintf(td, sizeof td, "/tmp/wwwwispread_%d", getpid());
|
||||
snprintf(cmd, sizeof cmd, "rm -rf %s", td);
|
||||
runwait(cmd);
|
||||
mkdir(td, 0755);
|
||||
char td[] = "/tmp/wwwwispread_XXXXXX";
|
||||
char cmd[4096];
|
||||
if (mkdtemp(td) == NULL) return 1;
|
||||
|
||||
int fail = 0;
|
||||
int fail = 0, cleanup_fail = 0;
|
||||
for (size_t s = 0; s < sizeof shapes / sizeof shapes[0]; s++) {
|
||||
char wwi[2][256];
|
||||
char wwi[2][256] = {{0}};
|
||||
for (size_t d = 0; d < sizeof drivers / sizeof drivers[0]; d++) {
|
||||
char prog[160];
|
||||
snprintf(prog, sizeof prog, "%s/%s.%s", td, shapes[s].name,
|
||||
drivers[d].tag);
|
||||
snprintf(cmd, sizeof cmd, "%s/%s build --sep -o %s %s 2>/dev/null",
|
||||
snprintf(cmd, sizeof cmd, "%s/%s build -o %s %s 2>/dev/null",
|
||||
bin, drivers[d].drv, prog, shapes[s].main);
|
||||
if (runwait(cmd) != 0) {
|
||||
fprintf(stderr, "wwispread FAIL: %s build --sep %s "
|
||||
fprintf(stderr, "wwispread FAIL: %s build %s "
|
||||
"(spread member not assignable → marker dropped?)\n",
|
||||
drivers[d].drv, shapes[s].name);
|
||||
fail++;
|
||||
@@ -169,8 +167,23 @@ main(void)
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(cmd, sizeof cmd, "rm -rf %s", td);
|
||||
runwait(cmd);
|
||||
for (size_t s = 0; s < sizeof shapes / sizeof shapes[0]; s++) {
|
||||
for (size_t d = 0; d < sizeof drivers / sizeof drivers[0]; d++) {
|
||||
char path[1200];
|
||||
snprintf(path, sizeof path, "%s/%s.%s.sepwork", td,
|
||||
shapes[s].name, drivers[d].tag);
|
||||
snprintf(cmd, sizeof cmd, "rm -rf -- '%s'", path);
|
||||
if (runwait(cmd) != 0) cleanup_fail = 1;
|
||||
snprintf(path, sizeof path, "%s/%s.%s", td,
|
||||
shapes[s].name, drivers[d].tag);
|
||||
if (unlink(path) != 0 && errno != ENOENT) cleanup_fail = 1;
|
||||
}
|
||||
}
|
||||
if (rmdir(td) != 0) cleanup_fail = 1;
|
||||
if (cleanup_fail) {
|
||||
fprintf(stderr, "wwispread FAIL: cleanup incomplete under %s\n", td);
|
||||
fail++;
|
||||
}
|
||||
|
||||
if (fail) {
|
||||
fprintf(stderr, "wwispread: %d check(s) failed\n", fail);
|
||||
|
||||
Reference in New Issue
Block a user