Repository navigation
CI: run the full green battery (build :test) on linux presubmit - #791
Merged
Merged
Conversation
The linux self-host check built and fixpoint-verified the compiler but stopped short of the test suite -- the same gap Eric flags when he asks for the "green battery" as a gate. Extend the job to run `build :test` after fixpoint so every push/PR exercises the standing battery: behavior, native compile-error/codegen/spec/phase, comptime-diff, debug-alloc, lexer/parser/internals, deep-debug-tool (which asserts `analyze audit:all` + `audit:storage`), CLI self-host, and c-migrator suites, plus `test-green` evidence recording. `:test` is a strict superset of the previous build+fixpoint work and reuses the already-built compiler from the build step (no rebuild), so the job is renamed to "green battery (linux x86_64)". Driven with the seed for the same reason as :build/:fixpoint -- the freshly built tip compiler is post-str-flip and cannot run this era's build.w.
Codegen emits discriminant-independent str-drops that call rt_payload_start_is_owned on any slot content, owned or not. On x86_64 a garbage or non-canonical high-half pointer read as a negative i64 would underflow `payload - RT_ALLOC_HEADER_SIZE` and trap before the slab search could reject it. Reject any payload below RT_ALLOC_HEADER_SIZE up front so the guard no-ops rather than faulting on non-owned bytes.
with_fiber_start subtracted 32 from rsp before calling the fiber body. prepare_initial_context hands over rsp ≡ 8 (mod 16) as a fake post-call frame; a following `call` pushes another 8, so the body was entered at rsp ≡ 0 — misaligned by 8, faulting the first stack `movaps` in any async trampoline. Subtract 24 (≡ 8 mod 16) instead: the body is entered at the SysV-required rsp ≡ 8, and 24 bytes still cover the three 8-byte out-slots. Fixes both the linux and darwin x86_64 fiber stubs.
The inline-asm behavior tests hardcode aarch64 register names and the target-guard fixtures assumed an aarch64 host, so they failed on an x86_64 CI runner. Add a `//! requires-arch:` test directive (parsed in main.w, canonicalizing aarch64/x86_64 ISA spellings) and gate the arm64-only asm tests to aarch64. The target-guard spec/error fixtures grow host-agnostic mirrors so they assert the right selected definition on whichever architecture is active.
Three linux-libc gaps broke the migrator's variadic/stdio/POSIX cases: - va_list: glibc/aarch64 lower it as `__va_list_tag[N]`, which has no spellable field layout, so the bridge demoted it to `c_void` — a non-value type that `check` rejects, breaking every migrated variadic function. Detect it structurally (canonical ConstantArray whose element record is __va_list_tag) in type_from_libclang and lower to a target-sized `[u8; N]` buffer; LLVM's va_start/va_end intrinsics only need correctly-sized storage. Darwin's char* va_list is unaffected (it lowers through the pointer path). - stdio globals: glibc exports stdin/stdout/stderr as real symbols (Darwin uses __stdinp/__stdoutp/__stderrp). Declare both sets in std.libc; migrated output is target-specific so only the active target's set is ever referenced. - header parse: add -D_DEFAULT_SOURCE at the clang parse sites so glibc exposes realpath/mkstemp and other BSD/POSIX decls the migrator needs. selfhost fixtures assert host-appropriate symbols.
ehartford
added a commit
that referenced
this pull request
Oct 23, 2026
…s c-migrator-basic-tests (#2576) * std.libc gains C's stdio input and string scanning families: fscanf, ungetc, strcoll, strspn, strcspn, strpbrk, strncat M*LIB's upstream B+tree test (tests/test-mbptree.c with m-string.h and tests/test-obj.h, the Phase 4 gate) parses through `fscanf`/`ungetc` and scans with `strpbrk`/`strspn`/`strcspn`/`strcoll`; the migrator refused each as an "unsupported filtered system variable". All seven are C standard: std.libc declares them, the migrator's libc allowlist and its ownership observer list admit them (none retains a pointer it is handed), and libc-surface-check's standard list names them. * A declaration directly under a case label is the arm's local `default: int d1 = c - '0'; int d2 = ...; return d2 + 1;` (m-string.h's octal escape parser) bailed at the DeclStmt: a switch arm's statements were lowered one by one with the switch's scope, and only a compound block threaded declarations through `lower_decl_stmt_structural`. An arm's statement now lowers through `lower_arm_stmt_ir`: a declaration is the arm's local, scoped to the arm as a block's is to the block, and the arm's scope threads through its later statements. Fixture: switch_arm_decl. * The gate runs c-migrator-basic-tests; macro_body_string_literal expects the C pointer a variadic literal is CLAUDE.md names c-migrator-basic-tests in the gate's fixed list; build.w's list did not have it, so the target ran only under the release tier's c-migrator-tests and a red landed on main unseen: #2556's rule renders a string literal in a variadic position as C's `const char*` (`c"…".ptr`), and the #791 fixture still expected a With `str` there. The rule is right: a `str` in a variadic C slot is read as two words (`fprintf(..., "%s|%d", "compress", 7)` prints `compress|8`, the str's length; filed as #2574 for the compiler). The fixture expects the pointer, and the gate runs the target. * A call through `(1 ? f : g)` calls the chosen arm M*LIB's M_IF selects a function by a literal condition (`(1 ? m_string_cat_printf : m_string_printf)(s, "%s", x)`); lowered as a conditional over two function values it was refused, since a `...` function is called directly, never used as a value. A conditional callee whose condition is an integer literal, or that literal compared with zero, folds to its arm before the call is built. Fixture: ternary_callee. A runtime condition (`(append ? m_string_cat_cstr : m_string_set_cstr)(s, "[")`) lowers as one call per arm under the condition, the arguments lowered once and shared (one arm runs, as in C); the then-arm's declaration coerces them, since C requires the arms' types to agree. --------- Co-authored-by: Eric Hartford <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The linux self-host check built and fixpoint-verified the compiler but stopped short of the test suite — the same gap surfaced when the "green battery" is asked for as the gate. This extends the linux job to run
build :testafter fixpoint, so every push/PR exercises the standing battery.What
:testcovers:testis a Group target that runs:analyze audit:all+audit:storagetest-greenevidence recordingWhy this shape
:testis a strict superset of the previous build+fixpoint work and reuses the already-built compiler from the build step (no rebuild), so it's one job, not a duplicate bootstrap. The job is renamed to green battery (linux x86_64) to reflect that it now runs the full standing battery.:build/:fixpoint— the freshly built tip compiler is post-str-flip and cannot run this era'sbuild.w. The seed runsbuild.w, whose test actions invoke the already-builtout/release/bin/withon the fixtures.Not included here (deliberately):
:move-audit/:drop-auditare the ownership-isolation gates (they needsrc/mainas a baseline compiler) and:last-green/ reseed are local maintainer evidence steps — none belong in a standing presubmit. Follow-ups can extend the battery to macOS and Windows once linux is shown green.