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.
118 lines
3.5 KiB
C
118 lines
3.5 KiB
C
/*
|
|
* 954_tuprecv_run — carrier-split residue of #102 (16B whole-tuple-from-call
|
|
* receive). The VALUE rows and the cs==ww .s byte-id dimension migrated to the
|
|
* fold-2 row-table test/lang/tuprecv_test.ww (cstage run via test-lang + cs==ww
|
|
* via test-lang-byteid). What CANNOT ride a value/byte-id @test is the third
|
|
* dimension the old driver also carried: a tool-OUTPUT assertion that w6c_ww
|
|
* emits NO `asserttyped:` diagnostic on the un-annotated float-destructure
|
|
* binding `let (f, i) = mk()` — the #121 A-narrow stamp net. That is the same
|
|
* category as the Class-A asm-presence twins the Fam-7 commit deliberately KEPT
|
|
* (a diagnostic-observer grep, not a value or byte-id check), so it stays here
|
|
* as a minimal retained pin rather than being silently dropped (drew ruling,
|
|
* #5-C2).
|
|
*
|
|
* Non-vacuous: pre-stamp (HEAD before #121) w6c_ww fired `asserttyped` on the
|
|
* f64 binding ident (nil n.type_); post-fix the binder carries the checker
|
|
* stamp and the diagnostic is absent. wwstage-only — cstage's check.c has no ww
|
|
* asserttyped walker, so the pin invokes w6c_ww directly.
|
|
*/
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <errno.h>
|
|
#include <unistd.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/wait.h>
|
|
|
|
static int
|
|
runwait(const char *cmd)
|
|
{
|
|
int rc = system(cmd);
|
|
if (rc == -1) return -1;
|
|
if (WIFEXITED(rc)) return WEXITSTATUS(rc);
|
|
return -1;
|
|
}
|
|
|
|
/* the ctl_destr construct: an un-annotated float-destructure binding. */
|
|
static const char *src =
|
|
"package main;\n"
|
|
"fn mk() (f64, i64) = { return (2.5, 7); };\n"
|
|
"export fn main() i32 = {\n"
|
|
"\tlet (f, i) = mk();\n"
|
|
"\treturn (f: i32) + (i: i32);\n"
|
|
"};\n";
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
const char *bin = getenv("BIN");
|
|
if (!bin) bin = "out/bin";
|
|
char absbin[1024];
|
|
if (bin[0] != '/') {
|
|
char cwd[1024];
|
|
if (getcwd(cwd, sizeof cwd) == NULL) return 1;
|
|
snprintf(absbin, sizeof absbin, "%s/%s", cwd, bin);
|
|
bin = absbin;
|
|
}
|
|
|
|
char w6c_ww[1100];
|
|
snprintf(w6c_ww, sizeof w6c_ww, "%s/w6c_ww", bin);
|
|
if (access(w6c_ww, X_OK) != 0) {
|
|
fprintf(stderr, "tuprecv: w6c_ww missing — cannot run the "
|
|
"asserttyped-absence pin\n");
|
|
return 1;
|
|
}
|
|
|
|
char tmpdir[] = "/tmp/wwtuprecv_XXXXXX";
|
|
if (mkdtemp(tmpdir) == NULL) {
|
|
fprintf(stderr, "tuprecv: mkdtemp failed\n");
|
|
return 1;
|
|
}
|
|
char srcp[128], errf[128], cmd[2048];
|
|
snprintf(srcp, sizeof srcp, "%s/ctl_destr.ww", tmpdir);
|
|
snprintf(errf, sizeof errf, "%s/err.txt", tmpdir);
|
|
|
|
int fail = 0;
|
|
FILE *f = fopen(srcp, "wb");
|
|
if (f == NULL) {
|
|
fprintf(stderr, "tuprecv: source open failed\n");
|
|
fail++;
|
|
goto cleanup;
|
|
}
|
|
int writefail = fputs(src, f) == EOF;
|
|
if (fclose(f) != 0) writefail = 1;
|
|
if (writefail) {
|
|
fprintf(stderr, "tuprecv: source write failed\n");
|
|
fail++;
|
|
goto cleanup;
|
|
}
|
|
|
|
/* w6c_ww must compile the construct cleanly AND emit no asserttyped. */
|
|
snprintf(cmd, sizeof cmd, "%s -o /dev/null %s 2>%s", w6c_ww, srcp, errf);
|
|
if (runwait(cmd) != 0) {
|
|
fprintf(stderr, "tuprecv: w6c_ww failed to compile the "
|
|
"float-destructure construct\n");
|
|
fail++;
|
|
}
|
|
snprintf(cmd, sizeof cmd, "grep -q asserttyped %s", errf);
|
|
if (runwait(cmd) == 0) {
|
|
fprintf(stderr, "tuprecv: w6c_ww emitted asserttyped on the "
|
|
"un-annotated float destructure binding (#121 stamp net)\n");
|
|
fail++;
|
|
}
|
|
|
|
cleanup:
|
|
{
|
|
int cleanfail = 0;
|
|
if (unlink(errf) != 0 && errno != ENOENT) cleanfail = 1;
|
|
if (unlink(srcp) != 0 && errno != ENOENT) cleanfail = 1;
|
|
if (rmdir(tmpdir) != 0) cleanfail = 1;
|
|
if (cleanfail) {
|
|
fprintf(stderr, "tuprecv: temporary cleanup failed\n");
|
|
fail++;
|
|
}
|
|
}
|
|
if (fail) return 1;
|
|
printf("tuprecv: asserttyped-absence pin ok (#121)\n");
|
|
return 0;
|
|
}
|