|
1 | 1 | use super::helpers::validate_walltime_results; |
| 2 | +use super::isolation::wrap_with_isolation; |
2 | 3 | use super::perf::PerfRunner; |
3 | 4 | use crate::executor::Executor; |
4 | 5 | use crate::executor::ExecutorConfig; |
5 | 6 | use crate::executor::ToolStatus; |
6 | 7 | use crate::executor::helpers::command::CommandBuilder; |
7 | | -use crate::executor::helpers::env::{ |
8 | | - build_path_env, get_base_injected_env, is_codspeed_debug_enabled, |
9 | | -}; |
| 8 | +use crate::executor::helpers::env::{build_path_env, get_base_injected_env}; |
10 | 9 | use crate::executor::helpers::get_bench_command::get_bench_command; |
11 | 10 | use crate::executor::helpers::run_command_with_log_pipe::run_command_with_log_pipe; |
12 | 11 | use crate::executor::helpers::run_with_env::wrap_with_env; |
@@ -105,28 +104,12 @@ impl WallTimeExecutor { |
105 | 104 | bench_cmd.arg(script_file.path()); |
106 | 105 | let (mut bench_cmd, env_file) = wrap_with_env(bench_cmd, &extra_env)?; |
107 | 106 |
|
108 | | - let mut cmd_builder = CommandBuilder::new("systemd-run"); |
109 | 107 | if let Some(cwd) = &config.working_directory { |
110 | 108 | let abs_cwd = canonicalize(cwd)?; |
111 | | - cmd_builder.current_dir(abs_cwd); |
| 109 | + bench_cmd.current_dir(abs_cwd); |
112 | 110 | } |
113 | | - if !is_codspeed_debug_enabled() { |
114 | | - cmd_builder.arg("--quiet"); |
115 | | - } |
116 | | - // Remarks: |
117 | | - // - We're using --scope so that perf is able to capture the events of the benchmark process. |
118 | | - // - We can't user `--user` here because we need to run in `codspeed.slice`, otherwise we'd run in |
119 | | - // user.slice` (which is isolated). We can use `--gid` and `--uid` to run the command as the current user. |
120 | | - // - We must use `bash` here instead of `sh` since `source` isn't available when symlinked to `dash`. |
121 | | - // - We have to pass the environment variables because `--scope` only inherits the system and not the user environment variables. |
122 | | - cmd_builder.arg("--slice=codspeed.slice"); |
123 | | - cmd_builder.arg("--scope"); |
124 | | - cmd_builder.arg("--same-dir"); |
125 | | - cmd_builder.arg(format!("--uid={}", nix::unistd::Uid::current().as_raw())); |
126 | | - cmd_builder.arg(format!("--gid={}", nix::unistd::Gid::current().as_raw())); |
127 | | - cmd_builder.args(["--"]); |
128 | | - |
129 | | - bench_cmd.wrap_with(cmd_builder); |
| 111 | + |
| 112 | + let bench_cmd = wrap_with_isolation(bench_cmd)?; |
130 | 113 |
|
131 | 114 | Ok((env_file, script_file, bench_cmd)) |
132 | 115 | } |
|
0 commit comments