run-postgres-tests.sh 731 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. # Meson test wrapper for the live PostgreSQL integration suite.
  3. #
  4. # Skips (exit 77) when no server is reachable, so default `meson test`
  5. # stays green on machines without PostgreSQL. When PG_TEST_FORCE=1 the
  6. # ensure script's failure to bring a server up is a hard error instead.
  7. set -u
  8. SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
  9. ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
  10. if [ "${PG_TEST_FORCE:-0}" = "1" ]; then
  11. "$SCRIPT_DIR/ensure-postgres.sh" || exit 1
  12. else
  13. "$SCRIPT_DIR/ensure-postgres.sh" || {
  14. echo "# PostgreSQL integration tests: server unavailable, skipping"
  15. exit 77
  16. }
  17. fi
  18. export PG_TEST_CONN="${PG_TEST_CONN:-postgresql://postgres@/sqltest?host=/tmp/pgrun&port=5433}"
  19. exec "$@"