#!/usr/bin/env bash # Run every verification case. A case that declares a precondition this machine # does not meet is counted as skipped and named - it is never counted as passed, # because a green tally that includes tests which did not run is worse than a # red one. set -uo pipefail cd "$(dirname "$0")/.." pass=0; fail=0; skip=0 failed=(); skipped=() for case in tests/nodes/*.json; do output=$(python3 scripts/verify-node.py "$case" 2>&1) case_status=$? name=$(basename "$case" .json) if [ $case_status -eq 0 ]; then pass=$((pass + 1)) elif [ $case_status -eq 2 ]; then skip=$((skip + 1)); skipped+=("$name: ${output#SKIP *: }") else fail=$((fail + 1)); failed+=("$name") printf '\n--- %s\n%s\n' "$name" "$output" fi done echo echo "passed $pass, failed $fail, skipped $skip" [ ${#skipped[@]} -gt 0 ] && printf 'skipped: %s\n' "${skipped[@]}" [ ${#failed[@]} -gt 0 ] && printf 'failed: %s\n' "${failed[@]}" exit $(( fail > 0 ? 1 : 0 ))