Skip to content

Commit 2534ae5

Browse files
feat: accept simulation as runner mode
1 parent 2359e53 commit 2534ae5

4 files changed

Lines changed: 23 additions & 1 deletion

File tree

src/run/config.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ impl TryFrom<RunArgs> for Config {
7272
let upload_url = Url::parse(&raw_upload_url)
7373
.map_err(|e| anyhow!("Invalid upload URL: {raw_upload_url}, {e}"))?;
7474

75+
// Emit deprecation warning if using "instrumentation" mode
76+
if args.mode == RunnerMode::Instrumentation {
77+
warn!(
78+
"The 'instrumentation' runner mode is deprecated and will be removed in a future version. \
79+
Please use 'simulation' instead."
80+
);
81+
}
82+
7583
Ok(Self {
7684
upload_url,
7785
token: args.token,

src/run/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ pub struct RunArgs {
138138
#[serde(rename_all = "lowercase")]
139139
pub enum RunnerMode {
140140
Instrumentation,
141+
Simulation,
141142
Walltime,
142143
}
143144

src/run/runner/helpers/env.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ pub fn get_base_injected_env(
66
mode: RunnerMode,
77
profile_folder: &Path,
88
) -> HashMap<&'static str, String> {
9+
let runner_mode_internal_env_value = match mode {
10+
RunnerMode::Instrumentation => "instrumentation",
11+
// While the runner now deprecates the usage of instrumentation with a message, we
12+
// internally still use instrumentation temporarily to give time to users to upgrade their
13+
// integrations to a version that accepts both instrumentation and simulation.
14+
RunnerMode::Simulation => "instrumentation",
15+
RunnerMode::Walltime => "walltime",
16+
};
917
HashMap::from([
1018
("PYTHONHASHSEED", "0".into()),
1119
(
@@ -18,7 +26,10 @@ pub fn get_base_injected_env(
1826
),
1927
("ARCH", ARCH.into()),
2028
("CODSPEED_ENV", "runner".into()),
21-
("CODSPEED_RUNNER_MODE", mode.to_string()),
29+
(
30+
"CODSPEED_RUNNER_MODE",
31+
runner_mode_internal_env_value.into(),
32+
),
2233
(
2334
"CODSPEED_PROFILE_FOLDER",
2435
profile_folder.to_string_lossy().to_string(),

src/run/runner/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ impl Display for RunnerMode {
2222
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2323
match self {
2424
RunnerMode::Instrumentation => write!(f, "instrumentation"),
25+
RunnerMode::Simulation => write!(f, "simulation"),
2526
RunnerMode::Walltime => write!(f, "walltime"),
2627
}
2728
}
@@ -32,6 +33,7 @@ pub const EXECUTOR_TARGET: &str = "executor";
3233
pub fn get_executor_from_mode(mode: &RunnerMode) -> Box<dyn Executor> {
3334
match mode {
3435
RunnerMode::Instrumentation => Box::new(ValgrindExecutor),
36+
RunnerMode::Simulation => Box::new(ValgrindExecutor),
3537
RunnerMode::Walltime => Box::new(WallTimeExecutor::new()),
3638
}
3739
}

0 commit comments

Comments
 (0)