test.sh (1474 bytes)
1 #!/bin/sh 2 # test.sh -- run the test layers in order, each on a freshly booted chip: 3 # 1-2 assembler encodings vs GNU as (asm-tests.txt) 4 # 3 kernel words over the serial console (kernel-tests.txt) 5 # 4 the Scheme regression suite (conformance.txt in the core) 6 # 4 SUITE=1: chibi-scheme's R7RS suite (tests/r7rs/results.txt in the core; about 10 minutes) 7 # Tools come from PATH unless set: SBCL, QEMU, ARM_AS, ARM_OBJCOPY. PORT is the first TCP port. 8 HERE=$(cd "$(dirname "$0")" && pwd) 9 CORE=${FORTHLISP_CORE:-$HERE}; [ -f "$CORE/host.lisp" ] || CORE=$HERE/../forthlisp # core repo checkout 10 SBCL=${SBCL:-sbcl} 11 PORT=${PORT:-4480} 12 rc=0 13 "$SBCL" --script "$HERE/asm-test.lisp" > "$HERE/asm-tests.txt" 2>&1 || rc=1 14 tail -1 "$HERE/asm-tests.txt" 15 "$HERE/build-firmware.sh" || exit 1 16 onchip() { # onchip OUTFILE host.lisp-args... 17 out=$1; shift 18 "${QEMU:-qemu-system-arm}" -M netduinoplus2 -kernel "$HERE/kernel-f446.bin" -display none \ 19 -monitor none -serial null -serial tcp:127.0.0.1:$PORT,server,nowait 2>/dev/null & 20 qp=$! 21 PORT=$PORT "$SBCL" --script "$CORE/host.lisp" "$@" > /tmp/forthlisp-test-$PORT.log 2>&1 || rc=1 22 kill $qp 2>/dev/null 23 grep -E "^FAIL|tests: |conformance: |r7rs suite: |^FAILED" /tmp/forthlisp-test-$PORT.log > "$out" 24 tail -1 "$out" 25 PORT=$((PORT + 1)) 26 } 27 onchip "$HERE/kernel-tests.txt" ktest "$HERE/forth-tests.txt" 28 onchip "$CORE/conformance.txt" test 29 [ -n "$SUITE" ] && onchip /tmp/forthlisp-suite-summary.txt suite 30 exit $rc