diff --git a/src/executor/helpers/introspected_golang/go.sh b/src/executor/helpers/introspected_golang/go.sh index 0ff727db..10f4ce55 100755 --- a/src/executor/helpers/introspected_golang/go.sh +++ b/src/executor/helpers/introspected_golang/go.sh @@ -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 $? diff --git a/src/executor/wall_time/perf/mod.rs b/src/executor/wall_time/perf/mod.rs index e48e25d3..6792ba99 100644 --- a/src/executor/wall_time/perf/mod.rs +++ b/src/executor/wall_time/perf/mod.rs @@ -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| {