Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 36 additions & 26 deletions src/executor/helpers/introspected_golang/go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,44 @@ if [ $# -eq 0 ]; then
exit $?
fi

# Check if first argument is "test"
if [ "$1" = "test" ]; then
debug_log "Detected 'test' command, routing to go-runner"
# Route command based on first argument
case "$1" in
test)
debug_log "Detected 'test' command, routing to go-runner"

# Find go-runner or install if not found
GO_RUNNER=$(which codspeed-go-runner 2>/dev/null || true)
if [ -z "$GO_RUNNER" ]; then
# Build the installer URL with the specified version or use latest
INSTALLER_VERSION="${CODSPEED_GO_RUNNER_VERSION:-latest}"
if [ "$INSTALLER_VERSION" = "latest" ]; then
DOWNLOAD_URL="http://github.com/CodSpeedHQ/codspeed-go/releases/latest/download/codspeed-go-runner-installer.sh"
echo "::warning::Installing the latest version of codspeed-go-runner. This can silently introduce breaking changes. We recommend pinning a specific version via the \`go-runner-version\` option in the action." >&2
else
DOWNLOAD_URL="http://github.com/CodSpeedHQ/codspeed-go/releases/download/v${INSTALLER_VERSION}/codspeed-go-runner-installer.sh"
fi

debug_log "Installing go-runner from: $DOWNLOAD_URL"
curl -fsSL "$DOWNLOAD_URL" | bash -s -- --quiet
# Find go-runner or install if not found
GO_RUNNER=$(which codspeed-go-runner 2>/dev/null || true)
fi
if [ -z "$GO_RUNNER" ]; then
# Build the installer URL with the specified version or use latest
INSTALLER_VERSION="${CODSPEED_GO_RUNNER_VERSION:-latest}"
if [ "$INSTALLER_VERSION" = "latest" ]; then
DOWNLOAD_URL="http://github.com/CodSpeedHQ/codspeed-go/releases/latest/download/codspeed-go-runner-installer.sh"
echo "::warning::Installing the latest version of codspeed-go-runner. This can silently introduce breaking changes. We recommend pinning a specific version via the \`go-runner-version\` option in the action." >&2
else
DOWNLOAD_URL="http://github.com/CodSpeedHQ/codspeed-go/releases/download/v${INSTALLER_VERSION}/codspeed-go-runner-installer.sh"
fi

debug_log "Using go-runner at: $GO_RUNNER"
debug_log "Full command: RUST_LOG=info $GO_RUNNER $*"
debug_log "Installing go-runner from: $DOWNLOAD_URL"
curl -fsSL "$DOWNLOAD_URL" | bash -s -- --quiet
GO_RUNNER=$(which codspeed-go-runner 2>/dev/null || true)
fi

"$GO_RUNNER" "$@"
else
debug_log "Detected non-test command ('$1'), routing to standard go binary"
debug_log "Full command: $REAL_GO $*"
"$REAL_GO" "$@"
fi
debug_log "Using go-runner at: $GO_RUNNER"
debug_log "Full command: RUST_LOG=info $GO_RUNNER $*"

"$GO_RUNNER" "$@"
;;
run)
debug_log "Detected 'run' command, injecting -work -ldflags flags"
# Insert flags after 'run' but before other arguments
# This is needed because GOFLAGS cannot handle spaces in ldflags...
debug_log "Full command: $REAL_GO run -work -ldflags=\"-s=false -w=false\" ${*:2}"
"$REAL_GO" run -work -ldflags="-s=false -w=false" "${@:2}"
;;
*)
debug_log "Detected non-test command ('$1'), routing to standard go binary"
debug_log "Full command: $REAL_GO $*"
"$REAL_GO" "$@"
;;
esac
exit $?
1 change: 1 addition & 0 deletions src/executor/wall_time/perf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ impl BenchmarkData {
// maps from /tmp to the profile folder. We have to write our own perf
// maps to these files AFTERWARDS, otherwise it'll be overwritten!
let bench_pids = symbols_by_pid.keys().copied().collect();
debug!("Harvesting perf maps and jit dumps for pids: {bench_pids:?}");
harvest_perf_maps_for_pids(path_ref, &bench_pids)
.await
.map_err(|e| {
Expand Down
Loading