Files
ww/test/wcc/954_tuprecv_run.c
Hojun-Cho 07b3c74ab0 test: migrate Fam8 tuple value tests to @test + reject carriers (#5-C2)
fold-2 chunk C2 (drew's Fam8-13 plan): 14 tuple value-row C drivers migrate to
15 test/lang/*_test.ww @test row-tables (the +1 is 954_tuprecv, slimmed not
deleted -- its value rows split out while the asserttyped-stamp dimension stays
as a carrier-split C pin, mutation-proven non-vacuous). Reject rows move to 32
test/wcc/data/*/case.ww //ww:error carriers (runww asserts the substring in
BOTH stages). The test-lang byte-id (LANGBYTEID) gate gives cs==ww automatically
and is strictly more sensitive than re-running the wwstage leg; floor 59->74.
Tuple surfaced zero cs!=ww as the plan predicted -- no value-only carve. The 945
trio folds in here; 940_global_sret / 940_str_forrange / 926_tagscr untouched
(routed to drew per-file). Test count 402->388 = the 14 retired drivers.
2026-06-24 01:44:13 +09:00

97 lines
3.1 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 <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[64], rmcmd[160], srcp[128], errf[128], cmd[2048];
snprintf(tmpdir, sizeof tmpdir, "/tmp/wwtuprecv_%d", getpid());
mkdir(tmpdir, 0755);
snprintf(rmcmd, sizeof rmcmd, "rm -rf %s", tmpdir);
snprintf(srcp, sizeof srcp, "%s/ctl_destr.ww", tmpdir);
snprintf(errf, sizeof errf, "%s/err.txt", tmpdir);
FILE *f = fopen(srcp, "wb");
if (f == NULL) { runwait(rmcmd); return 1; }
fputs(src, f);
fclose(f);
int fail = 0;
/* 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++;
}
runwait(rmcmd);
if (fail) return 1;
printf("tuprecv: asserttyped-absence pin ok (#121)\n");
return 0;
}