run-node-tests.sh 1006 B

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