rm dead combined.ww + retarget 901 to sep-feed; sweep amalgamator remnants (M4 E4, #90)
The E3 flip (#87) made sep the sole compile path and deleted the
combined.ww writer, leaving the six committed *.combined.ww files dead.
Remove them and the last references to the retired amalgamator.
- rm the 6 tracked *.combined.ww (selfhost/cmd/{w6a,w6c,w6l,ww,wwdump}/
main.combined.ww + selfhost/test/smoke.combined.ww). Verified no live
build path or gate still feeds one as compiler INPUT.
- 901_asserttyped_gap: its 5 combined.ww gap fixtures were the last
combined.ww INPUT consumers (4 already missing/vacuous post-flip, only
smoke.combined.ww still fed). Retarget all 5 to sep-feed via a
resolveunit helper (whole-package-dir copy -> `ww build --sep` ->
<stem>.sepwork/__root.unit.ww), mirroring 990's #89 pattern; the 3
import-free test fixtures stay raw-fed. All 8 counts hold at 0 (A-D
coverage, vacuous since the flip, is live again).
- INV-2 (the driver's unresolvable-import-is-fatal guard) is KEPT; only
its "Mirrors the deleted expand" lineage tail is swept. The #110
combined_ww_fresh freshness gate was already removed in #89 (5f85852).
- Sweep dangling amalgamator lineage comments (build_one/buildone/expand/
peek_package/peekpackage + stale combined.ww/combined intermediates)
in cmd/ww/main.c + selfhost/cmd/ww/main.ww, symmetrically (rule-10),
and the stale Makefile combined.ww test-comments (enumcap bigmod.unit.ww
+ 784/787/792/794/848 sep .s cmp + make-smoke sep self-compile).
Closes M4 and epic #22. all 445 pass; 990/993/994/995 byte-id HOLD;
sizelint clean.
This commit is contained in:
@@ -12,13 +12,20 @@
|
||||
* without gating on the bail's exit so a regression names its class.
|
||||
*
|
||||
* This probe runs the wwstage checker (wwdump_ww -c) over the
|
||||
* gap-bearing combined.ww corpus, counts the per-file asserttyped
|
||||
* diagnostics on stderr, and pins each count against the manifest
|
||||
* below. A fresh nil-gap (count up) or a regressed fixed class (count
|
||||
* up from 0) fails loud; a fold that closes a class drives its count
|
||||
* down, which fails until the manifest is edited to match. Every class
|
||||
* has reached all-zero, so the manifest is now the all-closed floor
|
||||
* that holds the armed bail green.
|
||||
* gap-bearing corpus, counts the per-file asserttyped diagnostics on
|
||||
* stderr, and pins each count against the manifest below. A fresh
|
||||
* nil-gap (count up) or a regressed fixed class (count up from 0) fails
|
||||
* loud; a fold that closes a class drives its count down, which fails
|
||||
* until the manifest is edited to match. Every class has reached
|
||||
* all-zero, so the manifest is now the all-closed floor that holds the
|
||||
* armed bail green.
|
||||
*
|
||||
* #90 sep-feed: the E3 flip retired the combined.ww amalgamator, so the
|
||||
* library/selfhost gap fixtures (A-D) feed their RESOLVED sep unit (see
|
||||
* resolveunit — `ww build --sep` composes <stem>.sepwork/__root.unit.ww
|
||||
* from the dep `.wwi` stubs + the root body) rather than a pre-built
|
||||
* <stem>.combined.ww. The single-file, import-free test fixtures (E-G)
|
||||
* carry no imports and stay raw-fed.
|
||||
*
|
||||
* Gap classes (counts verified empirically at this revision):
|
||||
* A module-qual N_DOT call result checked_test 0 (closed)
|
||||
@@ -39,6 +46,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
static int
|
||||
@@ -82,6 +90,52 @@ slurp(const char *path, char **outbuf, size_t *outlen)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* resolveunit — compose <fixture>'s RESOLVED translation unit the way the
|
||||
* sep driver does. Mirrors 990_selfhost's resolveunit: copy the fixture's
|
||||
* whole package directory into a private /tmp dir (so a white-box `_test`
|
||||
* file's sibling package sources resolve, and the sepwork lands off the repo
|
||||
* tree), `ww build --sep <base>`, then read <stem>.sepwork/__root.unit.ww —
|
||||
* the single self-contained unit w6c/wwdump consume for the root. Feeding the
|
||||
* raw module file instead would leave its import refs (os/fmt/strconv …)
|
||||
* unresolved, a partial unit the asserttyped invariant must never see. The
|
||||
* link step fails for an import-only module (no main), but the unit is
|
||||
* written before the link, so we detect the artifact rather than gating on
|
||||
* the build exit. Writes the owning tmpdir into `td` (caller rm -rf's it) and
|
||||
* the unit path into `out`. Returns 0 on success, -1 otherwise. */
|
||||
static int
|
||||
resolveunit(const char *bin, const char *cwd, const char *fixture,
|
||||
int idx, char *td, size_t tdsz, char *out, size_t outsz)
|
||||
{
|
||||
char cmd[2048];
|
||||
snprintf(td, tdsz, "/tmp/atgap_ru_%d_%d", getpid(), idx);
|
||||
snprintf(cmd, sizeof cmd, "rm -rf %s", td);
|
||||
runwait(cmd);
|
||||
mkdir(td, 0755);
|
||||
const char *slash = strrchr(fixture, '/');
|
||||
const char *base = slash ? slash + 1 : fixture;
|
||||
char dir[1024];
|
||||
if (slash) {
|
||||
size_t dl = (size_t)(slash - fixture);
|
||||
if (dl >= sizeof dir) return -1;
|
||||
memcpy(dir, fixture, dl);
|
||||
dir[dl] = '\0';
|
||||
} else {
|
||||
dir[0] = '.'; dir[1] = '\0';
|
||||
}
|
||||
snprintf(cmd, sizeof cmd, "cp %s/%s/*.ww %s/ 2>/dev/null", cwd, dir, td);
|
||||
runwait(cmd);
|
||||
snprintf(cmd, sizeof cmd,
|
||||
"cd %s && timeout 180 %s/ww build --sep %s >/dev/null 2>&1",
|
||||
td, bin, base);
|
||||
runwait(cmd);
|
||||
char stem[1024];
|
||||
snprintf(stem, sizeof stem, "%s/%s", td, base);
|
||||
char *dot = strrchr(stem, '.');
|
||||
if (dot && strcmp(dot, ".ww") == 0) *dot = '\0';
|
||||
snprintf(out, outsz, "%s.sepwork/__root.unit.ww", stem);
|
||||
return access(out, 0) == 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
/* Count line-leading "asserttyped:" diagnostics; each warn is one such
|
||||
* line and no other wwdump output carries the prefix. */
|
||||
static int
|
||||
@@ -109,30 +163,47 @@ main(void)
|
||||
char cwd[1024];
|
||||
if (getcwd(cwd, sizeof cwd) == NULL) return 1;
|
||||
|
||||
struct { const char *rel; const char *cls; int want; } manifest[] = {
|
||||
{ "lib/math/checked/checked_test.combined.ww",
|
||||
"A module-qual N_DOT call result", 0 },
|
||||
{ "selfhost/test/smoke.combined.ww",
|
||||
"B fn-ptr struct-field call", 0 },
|
||||
{ "lib/encoding/utf8/utf8.combined.ww",
|
||||
"C abort intrinsic callee", 0 },
|
||||
{ "lib/fnmatch/fnmatchtest.combined.ww",
|
||||
"D module-leaf == type/fn name", 0 },
|
||||
{ "lib/math/random/random_test.combined.ww",
|
||||
"D module-leaf == type/fn name", 0 },
|
||||
/* sep=1 fixtures feed their resolved sep unit (resolveunit); sep=0
|
||||
* fixtures are import-free single files fed raw. */
|
||||
struct { const char *rel; const char *cls; int want; int sep; } manifest[] = {
|
||||
{ "lib/math/checked/checked_test.ww",
|
||||
"A module-qual N_DOT call result", 0, 1 },
|
||||
{ "selfhost/test/smoke.ww",
|
||||
"B fn-ptr struct-field call", 0, 1 },
|
||||
{ "lib/encoding/utf8/utf8.ww",
|
||||
"C abort intrinsic callee", 0, 1 },
|
||||
{ "lib/fnmatch/fnmatchtest.ww",
|
||||
"D module-leaf == type/fn name", 0, 1 },
|
||||
{ "lib/math/random/random_test.ww",
|
||||
"D module-leaf == type/fn name", 0, 1 },
|
||||
{ "test/wcc/901_enum_corpus.ww",
|
||||
"E computed enum-member value-expr", 0 },
|
||||
"E computed enum-member value-expr", 0, 0 },
|
||||
{ "test/wcc/901_forrange_tuple.ww",
|
||||
"F for-range tuple-destructure bind", 0 },
|
||||
"F for-range tuple-destructure bind", 0, 0 },
|
||||
{ "test/wcc/901_massign_blank.ww",
|
||||
"G tuple multi-assign discard `_`", 0 },
|
||||
{ NULL, NULL, 0 },
|
||||
"G tuple multi-assign discard `_`", 0, 0 },
|
||||
{ NULL, NULL, 0, 0 },
|
||||
};
|
||||
|
||||
int fail = 0, n = 0;
|
||||
for (int i = 0; manifest[i].rel; i++) {
|
||||
char src[2048], errf[64], cmd[4096];
|
||||
snprintf(src, sizeof src, "%s/%s", cwd, manifest[i].rel);
|
||||
char td[64] = {0}, unit[1280];
|
||||
if (manifest[i].sep) {
|
||||
if (resolveunit(bin, cwd, manifest[i].rel, i, td,
|
||||
sizeof td, unit, sizeof unit) != 0) {
|
||||
fprintf(stderr, "asserttyped_gap FAIL: %s [%s] "
|
||||
"no resolved sep unit\n",
|
||||
manifest[i].rel, manifest[i].cls);
|
||||
if (td[0]) { snprintf(cmd, sizeof cmd,
|
||||
"rm -rf %s", td); runwait(cmd); }
|
||||
fail++; n++;
|
||||
continue;
|
||||
}
|
||||
snprintf(src, sizeof src, "%s", unit);
|
||||
} else {
|
||||
snprintf(src, sizeof src, "%s/%s", cwd, manifest[i].rel);
|
||||
}
|
||||
snprintf(errf, sizeof errf, "/tmp/atgap_%d_%d.err", getpid(), i);
|
||||
snprintf(cmd, sizeof cmd,
|
||||
"timeout 180 %s/wwdump_ww -c %s >/dev/null 2>%s",
|
||||
@@ -152,6 +223,8 @@ main(void)
|
||||
fail++;
|
||||
}
|
||||
unlink(errf);
|
||||
if (td[0]) { snprintf(cmd, sizeof cmd, "rm -rf %s", td);
|
||||
runwait(cmd); }
|
||||
}
|
||||
|
||||
if (fail) {
|
||||
|
||||
@@ -113,7 +113,6 @@ probe_smoke(const char *bin)
|
||||
char tmp[1024];
|
||||
snprintf(tmp, sizeof tmp, "%s/smoke.s", tmpdir); unlink(tmp);
|
||||
snprintf(tmp, sizeof tmp, "%s/smoke.o", tmpdir); unlink(tmp);
|
||||
snprintf(tmp, sizeof tmp, "%s/smoke.combined.ww", tmpdir); unlink(tmp);
|
||||
rmdir(tmpdir);
|
||||
if (rc != 42) {
|
||||
fprintf(stderr, "smoke FAIL: exit=%d (want 42; the number "
|
||||
|
||||
Reference in New Issue
Block a user