add zig3 wrapper

This commit is contained in:
2026-02-16 08:58:14 +00:00
parent ef619fdec8
commit 84a9758a49
3 changed files with 19 additions and 12 deletions

View File

@@ -18,17 +18,18 @@ edit `astgen.c`. The worker handles all of that.
1. **NEVER stop early.** Do not pause to ask the user if you should continue.
Do not summarize remaining work and wait. Keep looping until every test is
enabled and passing.
2. **ALWAYS run `zig build all-zig0 -Dvalgrind |& grep -v Warning | head -20`
yourself before committing.** Never trust the worker's claim that tests pass
— verify it. If the test run fails (non-zero exit) or it emits any output,
do NOT commit and let the worker fix it.
2. **ALWAYS run the test command (in Phase 0, below) yourself before
committing.** Never trust the worker's claim that tests pass — verify it. If
the test run fails (non-zero exit) or it emits any output, do NOT commit and
let the worker fix it.
## Phase 0: Check for leftovers
Before enabling anything new, run the existing tests:
```sh
zig build test-zig0 -Dzig0-cc=tcc 2>&1 | head -20
cd ~/code/zig
./zig3 build test-zig0 -Dzig0-cc=tcc 2>&1 | head -20
```
If tests **FAIL**: dispatch a worker (Step 4 below) with context
@@ -75,7 +76,7 @@ line to enable the test.
Run:
```sh
zig build test-zig0 -Dzig0-cc=tcc 2>&1 | head -10
./zig3 build test-zig0 -Dzig0-cc=tcc 2>&1 | head -10
```
Capture only the first ~10 lines. This tells you pass/fail at a glance
without bloating your context. The worker will run the full test itself.
@@ -107,7 +108,7 @@ The worker returns a structured result. Extract:
**You MUST verify before committing.** Run:
```sh
zig build all-zig0 -Dvalgrind |& grep -v Warning | head -10 ; echo "EXIT: $?"
./zig3 build all-zig0 -Dvalgrind |& grep -v Warning | head -10 ; echo "EXIT: $?"
```
Check two things only: (1) EXIT is 0, (2) the ~10 lines of output
@@ -150,6 +151,6 @@ Go back to Step 1. **Never stop early** — continue until all
When no disabled tests remain, run:
zig build all-zig0 -Dvalgrind
./zig3 build all-zig0 -Dvalgrind
If that fails, go back to Phase 0 (treat it as a leftover).

View File

@@ -26,7 +26,8 @@ return a result.
### Step 1: Run the full test
```sh
zig build test-zig0 -Dzig0-cc=tcc 2>&1
cd ~/code/zig
./zig3 build test-zig0 -Dzig0-cc=tcc 2>&1
```
Record the full output. If tests pass, skip to Step 5.
@@ -64,7 +65,7 @@ Apply the minimal mechanical change to `astgen.c` to match the upstream.
Make ONE change at a time. After each change, run:
```sh
zig build test-zig0 -Dzig0-cc=tcc 2>&1 | head -20
./zig3 build test-zig0 -Dzig0-cc=tcc 2>&1 | head -20
```
Check that no previously-passing tests broke. If your change causes
@@ -92,7 +93,7 @@ above the commented corpus entry).
prefix back) and add a TODO comment above it describing the remaining diff.
4. Final verification — this must exit 0 with no output:
zig build all-zig0 -Dvalgrind |& grep -v Warning | head -100
./zig3 build all-zig0 -Dvalgrind |& grep -v Warning | head -100
### Step 6: Return result
@@ -126,6 +127,6 @@ COMMIT_MSG: <one-line descriptive message about what was ported/fixed>
Zig one, which is the source of the bug. So standard "bug hunting" methods no
longer apply — making implementations consistent is a much better approach
in all ways.
- From `zig build` commands, use *only* `zig build *-zig0`. Other `zig build`
- From `./zig3 build` commands, use *only* `./zig3 build *-zig0`. Other `./zig3 build`
commands may start building/testing zig itself, which takes ages and is
wholly unnecessary.

5
zig3 Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
export LD_LIBRARY_PATH=$(dirname $(ldd `which cppcheck` | awk '/libstdc\+\+\.so\.6/ {print $3}'))
exec zig-out/bin/zig "$@"