/* * 989_letshadow_run — #152 regression pin. Compile + run the letshadow * fixture under the C-side `ww run` driver (cstage w6c) and assert exit 0. * * The bug (link-the-let-before-its-init) miscompiled IDENTICALLY on both * stages, so byte-id 990-997 is blind to it; only a runtime value check * catches the regression. Same thin-wrapper shape as 989_path_run. */ #include #include #include #include static int runwait(const char *cmd) { int rc = system(cmd); if (rc == -1) return -1; if (WIFEXITED(rc)) return WEXITSTATUS(rc); return 1; } 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 cwd[1024]; if (getcwd(cwd, sizeof cwd) == NULL) return 1; const char *src = "test/wcc/989_letshadow.ww"; char path[1024], cmd[2048]; snprintf(path, sizeof path, "%s/%s", cwd, src); snprintf(cmd, sizeof cmd, "%s/ww run %s", bin, path); int rc = runwait(cmd); if (rc != 0) { fprintf(stderr, "letshadow_run FAIL: %s exited %d " "(row %d miscompiled — #152)\n", src, rc, rc - 10); return 1; } printf("letshadow_run: %s ok\n", src); return 0; }