aboutsummaryrefslogtreecommitdiff
path: root/tests/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test.sh')
-rwxr-xr-xtests/test.sh12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/test.sh b/tests/test.sh
index ae404d9..22fdf30 100755
--- a/tests/test.sh
+++ b/tests/test.sh
@@ -52,9 +52,10 @@ ROOT=$T
CC=${CC:-$(sh src/tools/findcc.sh)} || exit 1
export CC
-# the language server runs on the interpreter unless the host has the arm64 jit, and a
-# check of a large document then takes many seconds: stretch the drivers' deadlines
-if [ -z "${ZC_TEST_TIMEOUT_SCALE:-}" ]; then case "$(uname -m)" in arm64|aarch64) ZC_TEST_TIMEOUT_SCALE=1;; *) ZC_TEST_TIMEOUT_SCALE=8;; esac; fi
+# the language server runs on the interpreter unless the host has a jit (arm64, or x86-64
+# linux), and a check of a large document then takes many seconds: stretch the drivers'
+# deadlines. the x86-64 jit gets a little room, since it does not compile o3 regions
+if [ -z "${ZC_TEST_TIMEOUT_SCALE:-}" ]; then case "$(uname -s)-$(uname -m)" in *-arm64|*-aarch64) ZC_TEST_TIMEOUT_SCALE=1;; Linux-x86_64) ZC_TEST_TIMEOUT_SCALE=2;; *) ZC_TEST_TIMEOUT_SCALE=8;; esac; fi
export ZC_TEST_TIMEOUT_SCALE
# the default map, generated as make does it, and the tools built against it
$CC -O2 -w -fwrapv src/tools/genmap.c -o $T/genmap || exit 1
@@ -129,6 +130,7 @@ run(){ # $1 = vm command, $2 = label
chk "$($vm < tests/programs/genmeth.zc | md5sum)" "$(md5sum < tests/programs/genmeth.expected)" "$l methods of generic structs are compiled per type arguments"
chk "$($vm < tests/programs/static.zc)" "14 5 9" "$l static functions of a struct are called as Struct.name(args)"
chk "$($vm < tests/programs/struct_const.zc)" "24 49 24 23 19 55 12 99" "$l constants declared in a struct are reached as Struct.NAME, and by bare name in its methods"
+ chk "$($vm < tests/programs/struct_static_call.zc)" "3 100 11 8 1010 7" "$l a static function of a struct is called by its bare name in its methods, and wins over a global of the same name"
chk "$($vm < tests/programs/methodown.zc)" "7 9" "$l struct methods and functions return owned objects (.u)"
chk "$($vm < tests/programs/typedmethods.zc)" "14 5 13" "$l struct methods declare a return type and typed parameters"
chk "$($vm < tests/programs/enumscope.zc)" "0 5 6 blue" "$l enum members are reached as Enum.MEMBER, also in a case"
@@ -159,6 +161,9 @@ hello world!42
1
1
0" "$l capture.start() collects output and end() hands back the string"
+ chk "$($vm < tests/programs/capture_long.zc)" "7
+256
+v" "$l a full capture is still terminated inside its buffer"
chk "$($vm < tests/programs/sys.zc)" "2 zy time" "$l syscalls: write, read, time"
chk "$($vm < tests/programs/memleak.zc)" $'leak: line 8 3 words\n1' "$l memdebug names a live allocation"
chk "$($vm < tests/programs/uaf.zc)" $'zc: line 10: warning: use after free: this storage\'s lifetime ended on line 9\nzy: use after free from line 7' "$l memdebug: use after free"
@@ -354,6 +359,7 @@ s_runonly() {
runonly wide tests/programs/wide.zc
runonly selfpatch examples/selfpatch.zc
runonly gc tests/programs/gc.zc
+ runonly voidmain tests/programs/void_main.zc
runonly float tests/programs/float.zc
runonly ftruth tests/programs/ftruth.zc
runonly ftext tests/programs/ftext.zc