Overview: Added comprehensive test infrastructure to handle the large test suite (41K LOC, 313 tests in cmd/bd alone) with automatic skipping of known broken tests. Changes: - .test-skip: List of broken tests to skip (with GH issue references) - scripts/test.sh: Smart test runner that auto-skips broken tests - docs/TESTING.md: Comprehensive testing guide - .claude/test-strategy.md: Quick reference for AI agents - Updated Makefile to use new test script Known Issues Filed: - GH #355: TestFallbackToDirectModeEnablesFlush (database deadlock) - GH #356: TestFindJSONLPathDefault (wrong JSONL filename) Performance: 3min total (180s compilation, 3.8s execution) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
87 lines
1.8 KiB
Bash
Executable File
87 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Test runner that automatically skips known broken tests
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
SKIP_FILE="$REPO_ROOT/.test-skip"
|
|
|
|
# Build skip pattern from .test-skip file
|
|
build_skip_pattern() {
|
|
if [[ ! -f "$SKIP_FILE" ]]; then
|
|
echo ""
|
|
return
|
|
fi
|
|
|
|
# Read non-comment, non-empty lines and join with |
|
|
local pattern=$(grep -v '^#' "$SKIP_FILE" | grep -v '^[[:space:]]*$' | paste -sd '|' -)
|
|
echo "$pattern"
|
|
}
|
|
|
|
# Default values
|
|
TIMEOUT="${TEST_TIMEOUT:-3m}"
|
|
SKIP_PATTERN=$(build_skip_pattern)
|
|
VERBOSE="${TEST_VERBOSE:-}"
|
|
RUN_PATTERN="${TEST_RUN:-}"
|
|
|
|
# Parse arguments
|
|
PACKAGES=()
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
-v|--verbose)
|
|
VERBOSE="-v"
|
|
shift
|
|
;;
|
|
-timeout)
|
|
TIMEOUT="$2"
|
|
shift 2
|
|
;;
|
|
-run)
|
|
RUN_PATTERN="$2"
|
|
shift 2
|
|
;;
|
|
-skip)
|
|
# Allow additional skip patterns
|
|
if [[ -n "$SKIP_PATTERN" ]]; then
|
|
SKIP_PATTERN="$SKIP_PATTERN|$2"
|
|
else
|
|
SKIP_PATTERN="$2"
|
|
fi
|
|
shift 2
|
|
;;
|
|
*)
|
|
PACKAGES+=("$1")
|
|
shift
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Default to all packages if none specified
|
|
if [[ ${#PACKAGES[@]} -eq 0 ]]; then
|
|
PACKAGES=("./...")
|
|
fi
|
|
|
|
# Build go test command
|
|
CMD=(go test -timeout "$TIMEOUT")
|
|
|
|
if [[ -n "$VERBOSE" ]]; then
|
|
CMD+=(-v)
|
|
fi
|
|
|
|
if [[ -n "$SKIP_PATTERN" ]]; then
|
|
CMD+=(-skip "$SKIP_PATTERN")
|
|
fi
|
|
|
|
if [[ -n "$RUN_PATTERN" ]]; then
|
|
CMD+=(-run "$RUN_PATTERN")
|
|
fi
|
|
|
|
CMD+=("${PACKAGES[@]}")
|
|
|
|
echo "Running: ${CMD[*]}" >&2
|
|
echo "Skipping: $SKIP_PATTERN" >&2
|
|
echo "" >&2
|
|
|
|
exec "${CMD[@]}"
|