test/wcc: extend carrier ownership to the bootstrap and platform gates

Same contract as the 27 repaired byte/artifact survivors: checked
acquisition, one all-exit cleanup funnel per carrier, ENOENT-tolerant
checked unlinks, exact-path deletion, and cleanup failure fails a
passing carrier without overwriting its diagnostic. Also closes the
vacuous-green channels: empty-artifact pairs no longer byte-compare
equal, capture and staging failures fail their row loudly, 950 requires
a clean checker exit on no-error rows and hard-fails on a missing
wwdump_ww, 992 keys its scratch per invocation so a failed cleanup
cannot leak stale objects into the next tool's compare, and 995 no
longer pre-sweeps a workdir it never created. No assertion is weakened;
990_selfhost is retired in the next commit rather than repaired.
This commit is contained in:
2026-08-07 23:28:49 +09:00
parent a87d931096
commit cdc8bda721
7 changed files with 332 additions and 105 deletions

View File

@@ -18,6 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/wait.h>
static int
@@ -53,12 +54,16 @@ slurp_eq(const char *a, const char *b)
return -1;
}
int rc = 0;
size_t nb = 0;
for (;;) {
int ca = fgetc(fa);
int cb = fgetc(fb);
if (ca != cb) { rc = -1; break; }
if (ca == EOF) break;
nb++;
}
/* two 0-byte artifacts must not compare green (pkgcache 0-byte poison). */
if (rc == 0 && nb == 0) rc = -1;
fclose(fa); fclose(fb);
return rc;
}
@@ -93,10 +98,10 @@ spawn_build(const char *bin, const char *cwd, struct buildjob *j)
{
snprintf(j->workdir, sizeof j->workdir, "/tmp/wwsr_%d_%s",
getpid(), j->tool);
char setup[256];
snprintf(setup, sizeof setup, "rm -rf %s && mkdir -p %s",
j->workdir, j->workdir);
if (runwait(setup) != 0) return -1;
if (mkdir(j->workdir, 0755) != 0) {
perror(j->workdir);
return -1;
}
char cmd[4096];
if (j->inc_local && j->inc_local[0]) {
@@ -115,7 +120,14 @@ spawn_build(const char *bin, const char *cwd, struct buildjob *j)
}
pid_t p = fork();
if (p < 0) return -1;
if (p < 0) {
char clean[128];
snprintf(clean, sizeof clean, "rm -rf %s", j->workdir);
if (runwait(clean) != 0)
fprintf(stderr, "self-rebuild: cleanup %s failed\n",
j->workdir);
return -1;
}
if (p == 0) {
int rc = system(cmd);
if (rc == -1) _exit(1);
@@ -162,7 +174,11 @@ collect_build(const char *bin, struct buildjob *j)
char cleanup[128];
snprintf(cleanup, sizeof cleanup, "rm -rf %s", j->workdir);
runwait(cleanup);
int cleanfail = runwait(cleanup) != 0;
if (cleanfail)
fprintf(stderr, "self-rebuild: cleanup %s failed\n", j->workdir);
if (cleanfail && rc == 0)
rc = -1;
return rc;
}