Skip to content

Commit ff1f98d

Browse files
committed
fix(go): prevent running with valgrind
1 parent 0d43ca2 commit ff1f98d

File tree

6 files changed

+15
-5
lines changed

6 files changed

+15
-5
lines changed

src/run/runner/wall_time/introspected_golang/go.sh renamed to src/run/runner/helpers/introspected_golang/go.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ debug_log() {
1111
debug_log "Called with arguments: $*"
1212
debug_log "Number of arguments: $#"
1313

14+
15+
# Currently only walltime is supported
16+
if [ "${CODSPEED_RUNNER_MODE:-}" != "walltime" ]; then
17+
echo "WARNING: Go benchmarks can only be run with walltime"
18+
exit 1
19+
fi
20+
1421
# Find the real go binary, so that we don't end up in infinite recursion
1522
REAL_GO=$(which -a go | grep -v "$(realpath "$0")" | head -1)
1623
if [ -z "$REAL_GO" ]; then
File renamed without changes.

src/run/runner/helpers/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pub mod env;
22
pub mod get_bench_command;
3+
pub mod introspected_golang;
34
pub mod profile_folder;
45
pub mod run_command_with_log_pipe;
56
pub mod setup;

src/run/runner/valgrind/measure.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use crate::prelude::*;
22
use crate::run::runner::RunnerMode;
33
use crate::run::runner::helpers::env::get_base_injected_env;
44
use crate::run::runner::helpers::get_bench_command::get_bench_command;
5+
use crate::run::runner::helpers::introspected_golang;
56
use crate::run::runner::helpers::run_command_with_log_pipe::run_command_with_log_pipe;
67
use crate::run::runner::valgrind::helpers::ignored_objects_path::get_objects_path_to_ignore;
78
use crate::run::runner::valgrind::helpers::introspected_nodejs::setup_introspected_nodejs;
@@ -90,11 +91,13 @@ pub async fn measure(
9091
.env(
9192
"PATH",
9293
format!(
93-
"{}:{}",
94+
"{}:{}:{}",
9495
setup_introspected_nodejs()
9596
.map_err(|e| anyhow!("failed to setup NodeJS introspection. {}", e))?
96-
.to_str()
97-
.unwrap(),
97+
.to_string_lossy(),
98+
introspected_golang::setup_introspected_go()
99+
.map_err(|e| anyhow!("failed to setup Go introspection. {}", e))?
100+
.to_string_lossy(),
98101
env::var("PATH").unwrap_or_default(),
99102
),
100103
);

src/run/runner/wall_time/executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use crate::run::instruments::mongo_tracer::MongoTracer;
55
use crate::run::runner::executor::Executor;
66
use crate::run::runner::helpers::env::{get_base_injected_env, is_codspeed_debug_enabled};
77
use crate::run::runner::helpers::get_bench_command::get_bench_command;
8+
use crate::run::runner::helpers::introspected_golang::setup_introspected_go;
89
use crate::run::runner::helpers::run_command_with_log_pipe::run_command_with_log_pipe;
9-
use crate::run::runner::wall_time::introspected_golang::setup_introspected_go;
1010
use crate::run::runner::{ExecutorName, RunData};
1111
use crate::run::{check_system::SystemInfo, config::Config};
1212
use async_trait::async_trait;

src/run/runner/wall_time/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
pub mod executor;
2-
pub mod introspected_golang;
32
pub mod perf;

0 commit comments

Comments
 (0)