beads/scripts/test.sh
obsidian e533064122 feat: remove embedded Dolt mode, keep server-only connections (bd-esqfe)
Remove the embedded Dolt driver (dolthub/driver) and all associated code,
keeping only server-mode connections via MySQL protocol to dolt sql-server.

Key changes:
- Remove dolthub/driver dependency and go-icu-regex vendored dep
- Remove embedded connection path, access locks, bootstrap, nocgo stubs
- Remove CGO build tags from all ~40 files
- Remove CGO/ICU settings from Makefile and scripts/test.sh
- Simplify configfile: Dolt is always server mode now
- Update doctor checks, factory, daemon guard for server-only
- Binary size reduced from ~120MB to ~44MB

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/polecats/obsidian
Rig: beads
Role: polecats
2026-02-05 21:30:53 -08:00

104 lines
2.2 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:-}"
COVERAGE="${TEST_COVER:-}"
COVERPROFILE="${TEST_COVERPROFILE:-/tmp/beads.coverage.out}"
COVERPKG="${TEST_COVERPKG:-}"
# 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
if [[ -n "$COVERAGE" ]]; then
CMD+=(-covermode=atomic -coverprofile "$COVERPROFILE")
if [[ -n "$COVERPKG" ]]; then
CMD+=(-coverpkg "$COVERPKG")
fi
fi
CMD+=("${PACKAGES[@]}")
echo "Running: ${CMD[*]}" >&2
echo "Skipping: $SKIP_PATTERN" >&2
echo "" >&2
"${CMD[@]}"
status=$?
if [[ -n "$COVERAGE" ]]; then
total=$(go tool cover -func="$COVERPROFILE" | awk '/^total:/ {print $NF}')
echo "Total coverage: ${total} (profile: ${COVERPROFILE})" >&2
fi
exit $status