aboutsummaryrefslogtreecommitdiff
path: root/tests/test.sh
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 10:05:40 +0000
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 10:05:40 +0000
commitce920b6ff47f32bc06dd27124e1b882f82f3d6ae (patch)
tree89f3dac0aa670294053320599a742d670c0ec5a4 /tests/test.sh
parenttodo: tick the parity runner; zc0 follow-ups it found (diff)
split compiler.zc into files by phase
src/compiler/compiler.zc is now twelve files under src/compiler/, listed in order in src/compiler/parts. cat of the parts in order is byte-identical to the old file, so every compiler and image except the language server's is unchanged. no function was edited. consumers read the list: the makefile, bootstrap-check, genmap (which still writes one compiler.zc into a generated map directory), tinyvm.bat, test.sh, test_win.ps1 and the lsp drivers. the language server embeds each part and serves them joined as the one document tinyvm:/compiler.zc.
Diffstat (limited to 'tests/test.sh')
-rwxr-xr-xtests/test.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/test.sh b/tests/test.sh
index 709d09c..f418319 100755
--- a/tests/test.sh
+++ b/tests/test.sh
@@ -25,7 +25,9 @@
cd "$(dirname "$0")/.."; T=$(mktemp -d); trap 'rm -rf $T' EXIT
ok=0; bad=0
chk(){ if [ "$1" = "$2" ]; then echo "ok $3"; ok=$((ok+1)); else echo "FAIL $3: got [$1]"; bad=$((bad+1)); fi; }
-src(){ cat src/runtime/rt.zc src/core/core.zc src/compiler/compiler.zc; }
+# the compiler is the files listed in src/compiler/parts, in that order
+ccparts(){ tr -d '\r' < src/compiler/parts | sed 's|^|src/compiler/|'; }
+src(){ cat src/runtime/rt.zc src/core/core.zc $(ccparts); }
# -j N runs N sections at a time: j is how many cores to use. each section
# writes its own log, so the output still reads in the order it always did.
JOBS=1; QUICK=0; SELECT=""
@@ -64,7 +66,7 @@ mkdir -p build && $CC -shared -fPIC -w tests/data/sbv.c -o build/sbv.so || exit
selfc(){ (cat src/tools/build.zc; printf '`'; src) | $1 > $2; }
-# bootstrap: zc0 (c) -> g0, g0 compiles compiler.zc -> g1, g1 compiles it -> g2.
+# bootstrap: zc0 (c) -> g0, g0 compiles the compiler -> g1, g1 compiles it -> g2.
# each stage's core embeds the image in its own directory
mkdir $T/s0 $T/s1
src | $T/zc0 > $T/s0/g0.bin && $T/mkg < $T/s0/g0.bin > $T/s0/genome.bin || exit 1
@@ -226,7 +228,7 @@ s_interp() {
grep -v '^ok' $T/arrays.out
chk $r 0 "native array receiver, algorithm and ownership contracts"
# actors are a library: nothing the compiler compiles or reads by default mentions them
- chk "$(grep -il actor src/compiler/compiler.zc src/runtime/rt.zc src/core/core.zc src/lib/std.zc src/lib/icon.zc src/tools/build.zc | wc -l)" "0" "no actor code in the compiler or anything it reads by default"
+ chk "$(grep -il actor $(ccparts) src/runtime/rt.zc src/core/core.zc src/lib/std.zc src/lib/icon.zc src/tools/build.zc | wc -l)" "0" "no actor code in the compiler or anything it reads by default"
python3 tests/drivers/actor_test.py $T/zy > $T/actor.out 2>&1; r=$?
grep -v '^ok' $T/actor.out
chk $r 0 "native isolated actor acceptance, rejection and regression fixtures"
@@ -523,7 +525,9 @@ s_lsp() {
done
chk "$($lsp < examples/struct_closure_opt.zc | grep -c error)" "0" "lsp: methods and closures check clean"
# a file of a larger build checks on its own: its bodyless declarations are not errors in check mode
- for f in src/runtime/rt.zc src/runtime/run.zc src/compiler/compiler.zc src/lsp/server.zc; do chk "$($lsp < $f | grep -c ': error:')" "0" "lsp: $f checks alone"; done
+ for f in src/runtime/rt.zc src/runtime/run.zc src/lsp/server.zc; do chk "$($lsp < $f | grep -c ': error:')" "0" "lsp: $f checks alone"; done
+ # the compiler is several files that only make sense together: check them as one document
+ chk "$(cat $(ccparts) | $lsp | grep -c ': error:')" "0" "lsp: the compiler (src/compiler/parts) checks alone"
chk "$($lsp < tests/programs/decl_undefined.zc)" "no errors" "lsp: a bodyless declaration is not an error in check mode"
chk "$($lsp < tests/programs/undefined_call.zc | grep -c ': error:')" "1" "lsp: a call to a name nothing defines is still an error"
chk "$($lsp --annotate < tests/programs/annotate.zc | md5sum)" "$(md5sum < tests/programs/annotate.expected)" "lsp --annotate writes the types the compiler can see into a program"