Files
floci/compatibility-tests/lib/run-bats-with-junit.sh
T
Conor Heine eeefb729c4 test: move compatibility tests into this repo (#225)
* test: move compatibility tests into this repo
* fix: add StatisticValues parsing to CloudWatchMetricsJsonHandler
* fix: add missing required abstract methods to EmulatorConfig in EventBridgeSchedulerIntegrationTest
* test: add sdk tests for multipart S3 copy coverage
* fix: cover and fix smithy cbor and multipart s3 copy regressions
* test: migrate more test coverage to new folder
* test: add missing ec2 expectation in healthcheck test
* docs: update READMEs in `./compatibility-tests`
2026-04-06 09:35:53 -05:00

38 lines
900 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <test-path> <junit-xml-path> [bats-args...]" >&2
exit 1
fi
TEST_PATH="$1"
JUNIT_XML_PATH="$2"
shift 2
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
BATS_BIN="$REPO_ROOT/lib/bats-core/bin/bats"
if [ ! -x "$BATS_BIN" ]; then
echo "Error: bats-core not found at $BATS_BIN. Run 'just setup-bats' first." >&2
exit 1
fi
mkdir -p "$(dirname "$JUNIT_XML_PATH")"
REPORT_DIR="$(mktemp -d "${TMPDIR:-/tmp}/bats-junit-XXXXXX")"
trap 'rm -rf "$REPORT_DIR"' EXIT
set +e
"$BATS_BIN" --report-formatter junit -o "$REPORT_DIR" "$@" "$TEST_PATH"
BATS_STATUS=$?
set -e
if [ ! -f "$REPORT_DIR/report.xml" ]; then
echo "Error: expected JUnit report at $REPORT_DIR/report.xml" >&2
exit 1
fi
mv "$REPORT_DIR/report.xml" "$JUNIT_XML_PATH"
exit "$BATS_STATUS"