Skip to content

Commit 58a06d2

Browse files
author
i2cjak
authored
Merge pull request #148 from i2cjak/backplane/check-exit-fix
check.sh: proof and check modes exit 0 on a pass
2 parents f21778c + 95f0c1a commit 58a06d2

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎docs/boat.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ checkout).
3737
| `scripts/test.sh` (136 programs) | exit 0 | 294 s | 3.38 GB |
3838
| native `BACKPLANE_LOW_MEM=1 scripts/build-app.sh src/app/main.bend build/backplane` (4 GiB heap hint, one clang at a time; `CC=clang-19`, `libx11-dev`, `libasound2-dev` installed in the job, `BACKPLANE_GOOGLE_BAKE=0`) | exit 0 twice; the built binary starts `--headless` and answers `/hello` | 17–21 min | 6.7–7.1 GB (0.6–1.0 GB left free: tight) |
3939

40+
Run proofs and checks through `scripts/check.sh` (or `check.sh proof`): it
41+
sets what `bend PROOF.bend` needs, a 1 GiB stack (`ulimit -s 1048576`) and
42+
`BUN_JSC_maxPerThreadStackUsage=536870912`, and judges the output with
43+
`scripts/bendok.sh` (the "SOME PROOFS FAIL / N defs rely on unsafe or
44+
foreign code" notice with exit 1 is a pass). A raw `bend PROOF.bend` without
45+
both overflows the stack; that is a configuration error, not a failed proof.
46+
The runner raises the stack limit; it does not set the JSC variable.
47+
4048
Small (4 GB) is not validated for any of these. The native build at the default 8 GiB hint does not fit 8 GB (its emit alone is about 8.8 GB); use `BACKPLANE_LOW_MEM=1` there, or `--size large` (16 GB) if it starts failing.
4149

4250
The outcome arrives like any work: the command's exit code and the end of its output.

‎scripts/check.sh‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,7 @@ fi
150150
if [ $fail != 0 ]; then exit 1; fi
151151
# a full pass (type-check and every proof) is recorded for these inputs
152152
# (scripts/verified.sh); a check or proof alone records nothing
153-
[ "$mode" = all ] && { scripts/verified.sh mark check "$vkey" || true; }
153+
# (an `if`, not `[ ] &&`: as the last command a false test would be the
154+
# script's status, so `check.sh proof` and `check.sh check` exited 1 on a pass)
155+
if [ "$mode" = all ]; then scripts/verified.sh mark check "$vkey" || true; fi
156+
exit 0

‎test/tools/verified_test.sh‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,14 @@ BEND_FAKE=edit q scripts/test.sh; check "a file changed during the tests: not re
5050
check "mark with no key taken before records nothing" "$(scripts/verified.sh mark check '' 2>/dev/null || true; has check)" no
5151
check "mark with another state's key records nothing" "$(scripts/verified.sh mark check 0123 2>/dev/null || true; has check)" no
5252
rm src/core/bom.bend; q scripts/check.sh; check "a tracked file missing: no key, nothing recorded" "$(git checkout -q src/core/bom.bend; has check)" no
53+
# exit codes (check.sh once ended in a false `[ ] &&` and exited 1 on a pass)
54+
rc() { r=0; "$@" >/dev/null 2>&1 || r=$?; echo $r; }
55+
nz() { if [ "$1" != 0 ]; then echo nonzero; else echo 0; fi; }
56+
check "check.sh check: exit 0 on a pass" "$(rc scripts/check.sh check)" 0
57+
check "check.sh proof: exit 0 on a pass" "$(rc scripts/check.sh proof)" 0
58+
check "check.sh (all): exit 0 on a pass" "$(rc scripts/check.sh)" 0
59+
check "check.sh check: non-zero on a failure" "$(nz "$(rc env BEND_FAKE=fail scripts/check.sh check)")" nonzero
60+
check "check.sh proof: non-zero on a failure" "$(nz "$(rc env BEND_FAKE=fail scripts/check.sh proof)")" nonzero
61+
check "check.sh (all): non-zero on a failure" "$(nz "$(rc env BEND_FAKE=fail scripts/check.sh)")" nonzero
5362
check "no half-written record left" "$(ls "$BACKPLANE_VERIFIED" | grep -c '\.[0-9]*$' || true)" 0
5463
exit $fail

0 commit comments

Comments
 (0)