Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 36s
lib/smalltalk/runtime.sx (72 forms):
- Numeric helpers: abs/max/min/gcd/lcm/quo/rem/mod/even?/odd?/floor/ceil/truncate/round.
- Character: st-char-value/from-int/is-letter?/is-digit?/uppercase?/lowercase?/
separator?/as-uppercase/as-lowercase/digit-value. SX chars via char->integer.
- Array: 1-indexed mutable arrays backed by dict {__st_array__ size "1" v1 ...};
at/at-put!/do/->list/list->array/copy-from-to.
- Dictionary: any-key hash map via list-of-pairs + linear scan;
at/at-put!/includes-key?/at-default/remove-key!/keys/values/do/do-associations.
- Set: backed by SX make-set; set-member?/add!/includes?/remove! take (set item) order.
- WriteStream/ReadStream: dict-backed buffers; printString for nil/bool/number/
string/symbol/char/list/array.
lib/smalltalk/tests/runtime.sx + lib/smalltalk/test.sh: 86/86 pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
72 lines
1.9 KiB
Bash
Executable File
72 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# lib/smalltalk/test.sh — smoke-test the Smalltalk runtime layer.
|
|
# Uses sx_server.exe epoch protocol.
|
|
#
|
|
# Usage:
|
|
# bash lib/smalltalk/test.sh
|
|
# bash lib/smalltalk/test.sh -v
|
|
|
|
set -uo pipefail
|
|
cd "$(git rev-parse --show-toplevel)"
|
|
|
|
SX_SERVER="${SX_SERVER:-hosts/ocaml/_build/default/bin/sx_server.exe}"
|
|
if [ ! -x "$SX_SERVER" ]; then
|
|
SX_SERVER="/root/rose-ash/hosts/ocaml/_build/default/bin/sx_server.exe"
|
|
fi
|
|
if [ ! -x "$SX_SERVER" ]; then
|
|
echo "ERROR: sx_server.exe not found. Run: cd hosts/ocaml && dune build"
|
|
exit 1
|
|
fi
|
|
|
|
VERBOSE="${1:-}"
|
|
TMPFILE=$(mktemp); trap "rm -f $TMPFILE" EXIT
|
|
|
|
cat > "$TMPFILE" << 'EPOCHS'
|
|
(epoch 1)
|
|
(load "spec/stdlib.sx")
|
|
(load "lib/smalltalk/runtime.sx")
|
|
(epoch 2)
|
|
(load "lib/smalltalk/tests/runtime.sx")
|
|
(epoch 3)
|
|
(eval "(list st-test-pass st-test-fail)")
|
|
EPOCHS
|
|
|
|
OUTPUT=$(timeout 60 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
|
|
|
LINE=$(echo "$OUTPUT" | awk '/^\(ok-len 3 / {getline; print; exit}')
|
|
if [ -z "$LINE" ]; then
|
|
LINE=$(echo "$OUTPUT" | grep -E '^\(ok 3 \([0-9]+ [0-9]+\)\)' | tail -1 \
|
|
| sed -E 's/^\(ok 3 //; s/\)$//')
|
|
fi
|
|
if [ -z "$LINE" ]; then
|
|
echo "ERROR: could not extract summary"
|
|
echo "$OUTPUT" | tail -10
|
|
exit 1
|
|
fi
|
|
|
|
P=$(echo "$LINE" | sed -E 's/^\(([0-9]+) ([0-9]+)\).*/\1/')
|
|
F=$(echo "$LINE" | sed -E 's/^\(([0-9]+) ([0-9]+)\).*/\2/')
|
|
TOTAL=$((P + F))
|
|
|
|
if [ "$F" -eq 0 ]; then
|
|
echo "ok $P/$TOTAL lib/smalltalk tests passed"
|
|
else
|
|
echo "FAIL $P/$TOTAL passed, $F failed"
|
|
# Print failure details
|
|
TMPFILE2=$(mktemp)
|
|
cat > "$TMPFILE2" << 'EPOCHS2'
|
|
(epoch 1)
|
|
(load "spec/stdlib.sx")
|
|
(load "lib/smalltalk/runtime.sx")
|
|
(epoch 2)
|
|
(load "lib/smalltalk/tests/runtime.sx")
|
|
(epoch 3)
|
|
(eval "(map (fn (f) (get f \"name\")) st-test-fails)")
|
|
EPOCHS2
|
|
FAILS=$(timeout 60 "$SX_SERVER" < "$TMPFILE2" 2>/dev/null | grep -E '^\(ok 3 ' || true)
|
|
rm -f "$TMPFILE2"
|
|
echo " Failures: $FAILS"
|
|
fi
|
|
|
|
[ "$F" -eq 0 ]
|