test(ffi-linkage): xfail export fn called from C via AOT (Phase 2.0)
Phase 2 of the extern/export stream verifies `export` (define + expose a
C-ABI sx symbol) end-to-end. C->sx-by-name linkage cannot work under the
corpus's `sx run` JIT mode — a JIT-resident symbol is invisible to a
dlopen'd C dylib's flat-namespace lookup — so this lands a new AOT
execution mode for the corpus: an `expected/<name>.aot` marker switches an
example from JIT `sx run` to a `sx build` + execute flow, linking the sx
object with its C `#source` companions into a native binary.
example/1226 defines `sx_square :: (n: i32) -> i32 export { ... }` and a
companion .c that declares `extern int sx_square(int)` and calls it back.
RED: with `export` not yet lowered, the AOT link fails with an undefined
`_sx_square` (the define path still emits it `internal` + with an implicit
ctx slot, and lazy lowering leaves an uncalled export fn as a bodiless
declare). Phase 2.1 greens it.
Also retires the standalone `tests/run_examples.sh` runner — `zig build
test` (src/corpus_run.test.zig) is now the sole corpus runner, and the
shell mirror would have needed its own AOT-mode port to stay in lockstep.
verify-step.sh drops its redundant step (zig build test already runs the
corpus); CLAUDE.md documents the `.aot` mode.
This commit is contained in:
15
CLAUDE.md
15
CLAUDE.md
@@ -430,15 +430,11 @@ After any compiler change:
|
||||
preferred way to update snapshots — no shell script needed.
|
||||
- A test is still keyed off its `expected/<name>.exit` marker, so seed an
|
||||
empty marker first for a brand-new example (see "Adding a feature").
|
||||
3. **Standalone corpus run** (optional): `bash tests/run_examples.sh`
|
||||
- Runs the corpus independent of `zig build test` (used by
|
||||
`tools/verify-step.sh`). `--update` still regenerates snapshots and
|
||||
produces byte-identical output to `-Dupdate-goldens`.
|
||||
- Every test must show `ok` (currently 626); zero failures, zero timeouts.
|
||||
- Uses GNU `timeout`/`gtimeout` when present (Homebrew coreutils on macOS)
|
||||
and runs without a per-test wall-clock guard when neither is found.
|
||||
- The two normalizers (`normalize`/`normalize_ir` in the script and the
|
||||
mirrors in `src/corpus_run.test.zig`) must stay in lockstep.
|
||||
`zig build test` is the only way to run the corpus — there is no standalone
|
||||
shell runner (the legacy `tests/run_examples.sh` was removed). An
|
||||
`expected/<name>.aot` marker switches an example from JIT `sx run` to a
|
||||
`sx build` + execute flow (needed to exercise a C-ABI symbol exported FROM sx
|
||||
— a JIT-resident symbol is invisible to a dlopen'd C dylib).
|
||||
|
||||
### Test layout
|
||||
|
||||
@@ -495,7 +491,6 @@ There is no monolithic smoke file — each feature is its own focused example.
|
||||
| `issues/NNNN-slug.md` | Open-issue / bug-report writeup (mark RESOLVED in a banner when fixed; the `.md` stays). |
|
||||
| `issues/NNNN-slug.sx` (+ `issues/NNNN-slug/`) | The issue's minimal repro, co-located with the `.md`. A repro with an `issues/expected/NNNN-slug.exit` marker runs in the suite; unpinned ones don't. |
|
||||
| `src/corpus_run.test.zig` | The corpus runner inside `zig build test` — spawns `sx` per example, diffs stdout/stderr/exit (+ optional IR); regenerates snapshots under `-Dupdate-goldens`. |
|
||||
| `tests/run_examples.sh` | Standalone shell runner (used by `tools/verify-step.sh`); same compare + `--update` as the Zig test. |
|
||||
|
||||
### Unit test file convention
|
||||
|
||||
|
||||
Reference in New Issue
Block a user