Skip to content

Commit 9da248d

Browse files
committed
wip: expose all env vars
1 parent 67150ac commit 9da248d

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

  • src/run/runner/wall_time/perf

src/run/runner/wall_time/perf/mod.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,29 @@ impl PerfRunner {
109109
}
110110
};
111111

112-
let runner_mode = std::env::var("CODSPEED_RUNNER_MODE").unwrap_or_default();
113-
let codspeed_env = std::env::var("CODSPEED_ENV").unwrap_or_default();
112+
let forwarded_env = [
113+
"CODSPEED_RUNNER_MODE",
114+
"CODSPEED_ENV",
115+
"CODSPEED_PROFILE_FOLDER",
116+
"ARCH",
117+
"PYTHONHASHSEED",
118+
];
119+
let setenv = forwarded_env
120+
.into_iter()
121+
.map(|env| {
122+
let value = std::env::var(env).unwrap_or_default();
123+
124+
format!("--setenv={env}={value}")
125+
})
126+
.join(" ");
127+
114128
let uid = nix::unistd::Uid::current().as_raw();
115129
let gid = nix::unistd::Gid::current().as_raw();
116130
cmd.args([
117131
"-c",
118132
&format!(
119133
"sudo perf record {quiet_flag} --user-callchains --freq=999 --switch-output --control=fifo:{},{} --delay=-1 -g --call-graph={cg_mode} --output={} -- \
120-
systemd-run --scope --slice=codspeed.slice --same-dir --setenv=CODSPEED_ENV={codspeed_env} --setenv=CODSPEED_RUNNER_MODE={runner_mode} --uid={uid} --gid={gid} -- {bench_cmd}",
134+
systemd-run --scope --slice=codspeed.slice --same-dir --uid={uid} --gid={gid} {setenv} -- {bench_cmd}",
121135
perf_fifo.ctl_fifo_path.to_string_lossy(),
122136
perf_fifo.ack_fifo_path.to_string_lossy(),
123137
perf_file.path().to_string_lossy(),

0 commit comments

Comments
 (0)