12# make check: lint, unit tests, the excelize oracle and the end-to-end3# tests run at once, each into a log of its own printed whole when it4# ends, so their output never interleaves; then the speed gate and the5# timed tests run alone, on a CPU no other tests share. Exits 1 if any6# phase failed. See docs/contributing/testing.md.7set -u8cd "$(dirname "$0")/.."9MAKE=${MAKE:-make}1011out=$(mktemp -d)12trap 'rm -rf "$out"' EXIT13start=$(date +%s)14fail=""1516phase() {17 "$MAKE" --no-print-directory "$1" >"$out/$1" 2>&118 echo $? >"$out/$1.status"19 date +%s >"$out/$1.end"20}2122report() {23 status=$(cat "$out/$1.status")24 took=$(($(cat "$out/$1.end") - start))25 if [ "$status" = 0 ]; then26 echo "=== $1: ok, done at ${took}s"27 else28 echo "=== $1: FAILED, done at ${took}s"29 fail="$fail $1"30 fi31 cat "$out/$1"32}3334# e2e first: it's the longest.35for p in e2e test lint oracle; do36 phase "$p" &37 eval "pid_$p=$!"38done39for p in lint oracle test e2e; do40 eval "wait \$pid_$p"41 report "$p"42done4344phase speed45report speed4647echo "=== make check: $(($(date +%s) - start))s"48if [ -n "$fail" ]; then49 echo "failed:$fail"50 exit 151fi