You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.1 KiB

  1. #!/usr/bin/env bash
  2. #
  3. # This is a convenience script that takes a list of testnet manifests
  4. # as arguments and runs each one of them sequentially. If a testnet
  5. # fails, the container logs are dumped to stdout along with the testnet
  6. # manifest, but the remaining testnets are still run.
  7. #
  8. # This is mostly used to run generated networks in nightly CI jobs.
  9. #
  10. set -euo pipefail
  11. if [[ $# == 0 ]]; then
  12. echo "Usage: $0 [MANIFEST...]" >&2
  13. exit 1
  14. fi
  15. FAILED=()
  16. for MANIFEST in "$@"; do
  17. START=$SECONDS
  18. echo "==> Running testnet $MANIFEST..."
  19. if ! ./build/runner -f "$MANIFEST"; then
  20. echo "==> Testnet $MANIFEST failed, dumping manifest..."
  21. cat "$MANIFEST"
  22. echo "==> Dumping container logs for $MANIFEST..."
  23. ./build/runner -f "$MANIFEST" logs
  24. echo "==> Cleaning up failed testnet $MANIFEST..."
  25. ./build/runner -f "$MANIFEST" cleanup
  26. FAILED+=("$MANIFEST")
  27. fi
  28. echo "==> Completed testnet $MANIFEST in $(( SECONDS - START ))s"
  29. echo ""
  30. done
  31. if [[ ${#FAILED[@]} -ne 0 ]]; then
  32. echo "${#FAILED[@]} testnets failed:"
  33. for MANIFEST in "${FAILED[@]}"; do
  34. echo "- $MANIFEST"
  35. done
  36. exit 1
  37. else
  38. echo "All testnets successful"
  39. fi