* ci(F4): advisory Linux-cross-built Windows test binaries, macOS cache restore Side-by-side rollout slice of the PR CI -> 5 min plan (F4): - Add pr.yml `windows-test-binaries`: a Linux job that cross-compiles bd.exe and two go-test-c binaries (cgo and nocgo) for windows/amd64 via mingw (CC/CXX=x86_64-w64-mingw32-*, matching release.yml's goreleaser setup), driven by a committed manifest (scripts/ci/windows-test-binaries.txt) and build script (scripts/ci/build-windows-test-binaries.sh). Artifacts are uploaded and consumed by two new advisory "-prebuilt" twins (test-windows-liveness-prebuilt, worktree-remove-windows-prebuilt) that run the identical test selection/flags/env (including BEADS_TEST_REPO_ROOT) against the prebuilt binaries via scripts/ci/run-go-test-binary.sh and scripts/test.sh's new BEADS_TEST_PREBUILT_TEST_BINARY short-circuit. - The original native Windows jobs are untouched and remain required; the new jobs are advisory only (not in CI_GATE_REQUIRED) for this rollout phase. Flipping to the cross-built path later is a one-line CI_GATE_REQUIRED change. - Add main.yml `windows-test-binaries-cache`: seeds the Go build cache for the cross-compile toolchain/packages on a schedule, mirroring the existing module/build cache warmers; reorder build-artifacts' warm-cache step to precede the module-cache save for a cleaner build -> warm -> save grouping. - Restore macOS's native build-cache save step in main.yml (lost during an earlier job consolidation). - Remove the non-required "Test (macos-latest)" full-suite job from PRs; the native macOS gate jobs still run, so required coverage is unaffected. This does drop a non-required pre-merge macOS race signal; see docs/notes for the accepted tradeoff. - Add scripts/windows_test_binaries_manifest_test.go: policy tests pinning the manifest's three advisory-phase entries, pinning the mingw toolchain to release.yml's, checking consumer jobs only reference manifest-listed binaries, checking upload/download artifact names and `needs` match, checking the prebuilt jobs select exactly the same tests (-run literals) as their native counterparts, and checking none of the new jobs reference secrets (fork safety). All mutation-tested. - Add two scripts/ci_workflow_apt_get_timeout_test.go budget entries for the new "Install mingw cross-compiler" steps. - Fix two latent Bazel-only scripts_test failures surfaced while wiring the new test file into scripts/BUILD.bazel: materialize cmd/bd's sources via the existing //cmd/bd:go_srcs filegroup so sourceRepoRoot(t)-based package-directory checks work under Bazel's runfiles root, and strip Bazel's own TEST_TIMEOUT env var before exercising scripts/test.sh's hardcoded default in test_script_test.go (name collision with test.sh's own override knob). Verified: go test ./scripts/...; bazel --nohome_rc test //scripts:scripts_test; actionlint; shellcheck; make ci-pr-policy; make bazel-sync-check; a from-scratch /tmp clone cross-build using the exact job commands (cold 130.2s, warm/cache-hit 30.3s, PE32+ x86-64 validity via file/objdump, byte-identical SHA-256 across cold/warm/traced runs); wine -test.list confirms TestPrimeBinaryPortfolio/TestIsServerProbablyRunning* present in the cgo binary and the full TestWorktreeRemove* family (including Windows-specific variants) present in the nocgo binary. Scoping note: only 2 of the spec's 4 consumer jobs (liveness, worktree-remove) get prebuilt twins, and only 3 of 8 spec-listed manifest binaries are built this slice; preflight, doc-freshness and credential-fixture consumers are deferred as documented follow-up. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix(ci): address F4 review findings (SF-1..SF-6 + nits) Addresses the F4 review (~/beads-bazel-plan/f4/review.md): no blockers, six substantive findings plus several nits. - SF-1: main.yml's windows-test-binaries-cache job now seeds the Windows cross-compile cache from both runner selections pr.yml's consumer job can land on (Blacksmith for same-repo PRs/merge_group, ubuntu-latest for forks/Dependabot) via a 2-leg matrix with identical keys/paths, instead of a single ubuntu-latest leg Blacksmith runners can never see. - SF-2: removed the two consumer-less "Warm non-race Go build cache (test-only packages)" steps from main.yml (build-artifacts, test macOS leg); they had no real consumer and cost ~270s on main's macOS leg for nothing. - SF-3: scripts/ci/run-go-test-binary.sh now injects the same -test.timeout=10m default (when -timeout is omitted) and unconditional -test.paniconexit0 flag `go test` itself injects; added timeout-minutes to test-windows-liveness-prebuilt; added a direct regression test (TestRunGoTestBinaryDefaultsTimeoutWhenOmitted) for the omitted-timeout branch, which no path through scripts/test.sh can reach (test.sh always supplies its own -timeout default first). - SF-4: scripts/test.sh's BEADS_TEST_PREBUILT_TEST_BINARY branch now runs run-go-test-binary.sh as a child process (capturing and re-exiting its status) instead of `exec`-ing it, so the EXIT trap (beads_test_env_cleanup) still runs and the per-run BEADS_TEST_ENV_ROOT temp dir (and, with BEADS_TEST_SHARED_SERVER=1, the shared dolt sql-server) is cleaned up instead of leaked/orphaned. - SF-5: closed the five surviving mutations (cgo/nocgo swap between the Windows prebuilt twins, dropped -count=1, an unguarded twin in ci-gate.needs, a goreleaser compiler change, a PKGDIR change) with dedicated policy tests, and replaced the three-edits-per-job required/ advisory toggle with a single committed WINDOWS_PREBUILT_REQUIRED flag (pr.yml top-level env) in the style of the existing BAZEL_RETIRES_LEGACY_* flags: both Windows pairs are now unconditionally in ci-gate.needs and always evaluated, and only which pair lands in CI_GATE_REQUIRED vs. CI_GATE_SKIPPED_OK is decided by the flag, in one place. - SF-6: dropped the //cmd/bd:go_srcs data dep from scripts_test; the prebuilt-binary contract test now exercises ./scripts/ci (already a data dep of this target) instead of ./cmd/bd, since it never builds or runs the real package. - Nits: removed dangling ~/beads-bazel-plan references and a nonexistent test name from committed comments; log the resolved mingw-w64 version when cross-compiling; removed a no-op shellcheck disable comment; documented why run-go-test-binary.sh's BEADS_TEST_REPO_ROOT re-export doesn't race beads_test_env_enter's unset; rewrote the pr.yml tombstone comment for the removed macOS PR job to state the actual, narrower tradeoff instead of an overclaiming "main.yml covers this" statement. Verified: bazel --nohome_rc test //scripts:scripts_test passes; actionlint clean on pr.yml/main.yml; shellcheck clean on all edited scripts (only pre-existing, unrelated warnings remain elsewhere); make bazel-sync-check and make ci-pr-policy both pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix(scripts): isolate prebuilt-binary contract test from ambient hermetic env TestTestScriptPrebuiltTestBinaryContract's "cleans up BEADS_TEST_ENV_ROOT after the binary exits" subtest (added for F4 review finding SF-4) passed locally but failed in CI's scripts-go-checks/scripts-test leg. scripts/ci/scripts-go-test.sh (the CI driver for this package's `go test ./scripts/...` run) calls beads_test_env_enter in its own shell before invoking go test, so BEADS_TEST_ENV_ACTIVE=1 and an outer BEADS_TEST_ENV_ROOT are already present in this test binary's own os.Environ(). runTestScriptPrebuiltBinary built the scripts/test.sh subprocess's env from os.Environ() (minus TEST_TIMEOUT), so that ambient state leaked through. Inside the subprocess, scripts/test.sh's own beads_test_env_enter call (test.sh:17) saw the already-active guard and no-opped: no new root, no new EXIT trap armed in that process - so the fake binary observed the outer, still-alive root, and the subtest's "directory is gone after test.sh exits" assertion failed, even though the SF-4 fix (run the prebuilt binary as a child instead of exec'ing it) is correct. Every real production caller of scripts/test.sh's prebuilt path (pr.yml's Windows liveness/worktree-remove prebuilt steps) runs it as the first command of a fresh GitHub Actions `run:` step, never nested under an already-entered hermetic env, so this nesting is purely an artifact of this test binary's own ambient environment under scripts-go-test.sh, not a real CI behavior gap. Strip BEADS_TEST_ENV_ACTIVE/_ROOT/_DISABLE/_KEEP (alongside the existing TEST_TIMEOUT filter) from the child env in runTestScriptPrebuiltBinary so the subtest deterministically exercises scripts/test.sh's real top-level, non-nested invocation regardless of what ambient hermetic-env state this test binary itself happens to be running under. Verified: reproduced the CI failure locally by exporting BEADS_TEST_ENV_ACTIVE=1/BEADS_TEST_ENV_ROOT before `go test ./scripts/...`; confirmed the fix resolves it; re-ran bazel test //scripts:scripts_test and scripts/ci/scripts-go-test.sh directly, both pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
292 lines
11 KiB
Bash
Executable file
292 lines
11 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"
|
|
|
|
# Canonical build flags (GOFLAGS=-tags=gms_pure_go, CGO_ENABLED=1).
|
|
# Opt-in ICU-path coverage remains available via scripts/test-icu-path.sh.
|
|
# shellcheck source=../.buildflags
|
|
source "$REPO_ROOT/.buildflags"
|
|
# shellcheck source=ci/lib/test-env.sh
|
|
source "$REPO_ROOT/scripts/ci/lib/test-env.sh"
|
|
|
|
beads_test_env_enter
|
|
|
|
# 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 is go test's PER-PACKAGE deadline — a hang backstop, not a
|
|
# performance budget: it costs nothing while packages pass. The floor is set
|
|
# by cmd/bd, the slowest package: measured 2026-07-26 on a busy darwin fleet
|
|
# box (wy-4mtr0), its default suite is ~1090s of test time across ~1490 tests
|
|
# (mostly serial — subprocess tests that spawn bd + embedded Dolt per
|
|
# invocation, largely t.Setenv-bound so they cannot t.Parallel), giving
|
|
# ~18min wall WITH the prebuilt-binary fast path below already removing the
|
|
# in-test `go build` steps. 3m could never fit that, which made every
|
|
# full-suite run FAIL with a package deadline panic naming no failing test.
|
|
# 25m holds the measurement plus fleet-load headroom (the passing full-suite
|
|
# acceptance run clocked cmd/bd at 870s under -p 4 package concurrency).
|
|
# Raise via TEST_TIMEOUT; don't lower it below cmd/bd's measured runtime.
|
|
TIMEOUT="${TEST_TIMEOUT:-25m}"
|
|
GO_TEST_PKG_PARALLEL="${GO_TEST_PKG_PARALLEL:-4}"
|
|
GO_TEST_PARALLEL="${GO_TEST_PARALLEL:-4}"
|
|
SKIP_PATTERN=$(build_skip_pattern)
|
|
VERBOSE="${TEST_VERBOSE:-}"
|
|
RUN_PATTERN="${TEST_RUN:-}"
|
|
COUNT="${TEST_COUNT:-}"
|
|
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
|
|
;;
|
|
-count)
|
|
COUNT="$2"
|
|
shift 2
|
|
;;
|
|
-count=*)
|
|
# Explicit case (rather than falling into the package catch-all
|
|
# below): BEADS_TEST_PREBUILT_TEST_BINARY mode requires PACKAGES
|
|
# to hold exactly the real package, and `go test` itself only
|
|
# tolerates "-count=1" landing after the package list by
|
|
# accident of its own permissive flag scanning.
|
|
COUNT="${1#-count=}"
|
|
shift
|
|
;;
|
|
*)
|
|
PACKAGES+=("$1")
|
|
shift
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Default to all packages if none specified
|
|
if [[ ${#PACKAGES[@]} -eq 0 ]]; then
|
|
PACKAGES=("./...")
|
|
fi
|
|
|
|
# Prebuild bd once for subprocess-style tests (wy-4mtr0). cmd/bd has a dozen
|
|
# test helpers that otherwise each `go build` the full bd binary inside the
|
|
# test run — on a busy machine those link steps alone can blow the package
|
|
# deadline, and one helper used to silently fall back to a stale repo-root
|
|
# ./bd. CI already exports BEADS_TEST_BD_BINARY from a prebuilt artifact
|
|
# (.github/workflows/main.yml); this gives the local runner the same fast
|
|
# path. A caller-supplied BEADS_TEST_BD_BINARY always wins; skipped when the
|
|
# requested packages cannot include cmd/bd.
|
|
if [[ -z "${BEADS_TEST_BD_BINARY:-}" ]]; then
|
|
case " ${PACKAGES[*]} " in
|
|
# Any recursive pattern (./..., ./cmd/...) can expand to cmd/bd.
|
|
*"..."* | *"cmd/bd"*)
|
|
if [[ -n "${BEADS_TEST_ENV_ROOT:-}" ]]; then
|
|
PREBUILT_BD_DIR="$BEADS_TEST_ENV_ROOT/prebuilt-bd"
|
|
else
|
|
PREBUILT_BD_DIR=$(mktemp -d "${TMPDIR:-/tmp}/beads-prebuilt-bd-XXXXXX")
|
|
fi
|
|
mkdir -p "$PREBUILT_BD_DIR"
|
|
echo "Prebuilding bd for subprocess tests..." >&2
|
|
PREBUILT_BD_BIN="$PREBUILT_BD_DIR/bd$(go env GOEXE)"
|
|
if go build -o "$PREBUILT_BD_BIN" "$REPO_ROOT/cmd/bd"; then
|
|
export BEADS_TEST_BD_BINARY="$PREBUILT_BD_BIN"
|
|
echo "Prebuilt bd: $BEADS_TEST_BD_BINARY" >&2
|
|
else
|
|
echo "WARN: bd prebuild failed; tests will build their own binaries" >&2
|
|
fi
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
# Optional: start a single shared Dolt test server for all packages.
|
|
# When BEADS_TEST_SHARED_SERVER=1, we start one dolt sql-server and export
|
|
# BEADS_DOLT_PORT (plus BEADS_TEST_SHARED_DOLT_SERVER set to that same port,
|
|
# which marks it as ours rather than inherited) so every test package reuses it
|
|
# instead of spawning its own. This reduces 8-16+ concurrent dolt processes down
|
|
# to 1. Packages whose TestMain can start a Dolt container still prefer the
|
|
# container: it overwrites both port variables on success. Nothing starts when
|
|
# either port variable is already set: a port someone else named is not ours to
|
|
# vouch for. beads_test_env_enter cleared both above, so one can only still be
|
|
# set here when that isolation was skipped (e.g. BEADS_TEST_ENV_DISABLE=1).
|
|
if [[ "${BEADS_TEST_SHARED_SERVER:-}" == "1" && -z "${BEADS_DOLT_PORT:-}" && -z "${BEADS_DOLT_SERVER_PORT:-}" ]]; then
|
|
if command -v dolt &>/dev/null; then
|
|
SHARED_DOLT_DIR=$(mktemp -d /tmp/beads-shared-test-dolt-XXXXXX)
|
|
DOLT_ROOT_PATH="$SHARED_DOLT_DIR"
|
|
export DOLT_ROOT_PATH
|
|
|
|
dolt config --global --add user.name "beads-test" 2>/dev/null
|
|
dolt config --global --add user.email "test@beads.local" 2>/dev/null
|
|
|
|
SHARED_DB_DIR="$SHARED_DOLT_DIR/data"
|
|
mkdir -p "$SHARED_DB_DIR"
|
|
(cd "$SHARED_DB_DIR" && dolt init) >/dev/null 2>&1
|
|
|
|
# Find a free port
|
|
SHARED_PORT=$(python3 -c 'import socket; s=socket.socket(); s.bind(("127.0.0.1",0)); print(s.getsockname()[1]); s.close()')
|
|
|
|
dolt sql-server -H 127.0.0.1 -P "$SHARED_PORT" --no-auto-commit \
|
|
--data-dir "$SHARED_DB_DIR" &>/dev/null &
|
|
SHARED_DOLT_PID=$!
|
|
|
|
# Wait for server to accept connections (up to 30s)
|
|
for i in $(seq 1 60); do
|
|
if nc -z 127.0.0.1 "$SHARED_PORT" 2>/dev/null; then
|
|
break
|
|
fi
|
|
sleep 0.5
|
|
done
|
|
|
|
if nc -z 127.0.0.1 "$SHARED_PORT" 2>/dev/null; then
|
|
export BEADS_DOLT_PORT="$SHARED_PORT"
|
|
# Mark the port as harness-provisioned. testutil's
|
|
# EnsureDoltContainerForTestMain clears an ambient BEADS_DOLT_PORT
|
|
# whenever it is left without a container (gm-2g3g5r: an inherited
|
|
# port can be a production server), which would erase the server we
|
|
# just started on any host without Docker -- this flow's primary
|
|
# audience. The marker is what distinguishes "a test server we
|
|
# allocated" from "whatever the environment happened to name". Its
|
|
# value is the port it vouches for, so it covers the BEADS_DOLT_PORT
|
|
# exported above and no other variable; it is exported only here,
|
|
# only after the server answered, and only for a port this script
|
|
# allocated itself (the guard above requires both port variables to
|
|
# have been unset).
|
|
export BEADS_TEST_SHARED_DOLT_SERVER="$SHARED_PORT"
|
|
export BEADS_TEST_MODE=1
|
|
echo "Shared test Dolt server started on port $SHARED_PORT (PID $SHARED_DOLT_PID)" >&2
|
|
cleanup_shared_server() {
|
|
kill "$SHARED_DOLT_PID" 2>/dev/null || true
|
|
wait "$SHARED_DOLT_PID" 2>/dev/null || true
|
|
rm -rf "$SHARED_DOLT_DIR"
|
|
}
|
|
trap 'cleanup_shared_server; beads_test_env_cleanup' EXIT
|
|
else
|
|
echo "WARN: shared Dolt server failed to start, falling back to per-package servers" >&2
|
|
kill "$SHARED_DOLT_PID" 2>/dev/null || true
|
|
rm -rf "$SHARED_DOLT_DIR"
|
|
fi
|
|
fi
|
|
elif [[ "${BEADS_TEST_SHARED_SERVER:-}" == "1" ]]; then
|
|
echo "WARN: BEADS_TEST_SHARED_SERVER=1 ignored: BEADS_DOLT_PORT or BEADS_DOLT_SERVER_PORT is already set, so no shared server was started" >&2
|
|
fi
|
|
|
|
# BEADS_TEST_PREBUILT_TEST_BINARY short-circuits straight to a `go test -c`
|
|
# binary (typically cross-compiled on a different host; see
|
|
# scripts/ci/build-windows-test-binaries.sh and
|
|
# scripts/ci/run-go-test-binary.sh) instead of invoking `go test`. It still
|
|
# gets test.sh's env isolation (beads_test_env_enter above), the .test-skip
|
|
# pattern, and the -p/-parallel/-timeout defaults -- only the final
|
|
# build-or-run step differs. Exactly one package is required: a prebuilt
|
|
# binary is compiled from one package, so "./..." or a multi-package list has
|
|
# no single binary to run.
|
|
if [[ -n "${BEADS_TEST_PREBUILT_TEST_BINARY:-}" ]]; then
|
|
if [[ ${#PACKAGES[@]} -ne 1 ]]; then
|
|
echo "BEADS_TEST_PREBUILT_TEST_BINARY requires exactly one package, got: ${PACKAGES[*]:-<none>}" >&2
|
|
exit 2
|
|
fi
|
|
|
|
RUN_ARGS=("$BEADS_TEST_PREBUILT_TEST_BINARY" "${PACKAGES[0]}")
|
|
RUN_ARGS+=(-timeout "$TIMEOUT" -parallel "$GO_TEST_PARALLEL")
|
|
if [[ -n "$VERBOSE" ]]; then
|
|
RUN_ARGS+=(-v)
|
|
fi
|
|
if [[ -n "$SKIP_PATTERN" ]]; then
|
|
RUN_ARGS+=(-skip "$SKIP_PATTERN")
|
|
fi
|
|
if [[ -n "$RUN_PATTERN" ]]; then
|
|
RUN_ARGS+=(-run "$RUN_PATTERN")
|
|
fi
|
|
if [[ -n "$COUNT" ]]; then
|
|
RUN_ARGS+=(-count "$COUNT")
|
|
fi
|
|
|
|
echo "Running (prebuilt binary): ${RUN_ARGS[*]}" >&2
|
|
echo "Skipping: $SKIP_PATTERN" >&2
|
|
echo "" >&2
|
|
# Run as a child, not `exec`: `exec` would replace this shell's image
|
|
# before the EXIT trap armed above (cleanup_shared_server,
|
|
# beads_test_env_cleanup via beads_test_env_enter) ever runs, leaking
|
|
# the per-run BEADS_TEST_ENV_ROOT temp dir and, with
|
|
# BEADS_TEST_SHARED_SERVER=1, orphaning the shared dolt sql-server
|
|
# process. Capturing and re-exiting the status preserves the same exit
|
|
# code `exec` would have, with the trap still firing on the way out.
|
|
"$REPO_ROOT/scripts/ci/run-go-test-binary.sh" "${RUN_ARGS[@]}"
|
|
status=$?
|
|
exit $status
|
|
fi
|
|
|
|
# Build go test command
|
|
CMD=(go test -p "$GO_TEST_PKG_PARALLEL" -parallel "$GO_TEST_PARALLEL" -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 "$COUNT" ]]; then
|
|
CMD+=(-count "$COUNT")
|
|
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
|