Skip to content

Commit 3bf0cff

Browse files
committed
fix(walltime): ensure perf also fails when the command fails
1 parent f4e13b2 commit 3bf0cff

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/run/runner/tests.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,16 @@ fi
285285
.await
286286
.unwrap();
287287
}
288+
289+
// Ensure that commands that fail actually fail
290+
#[rstest::rstest]
291+
#[tokio::test]
292+
async fn test_walltime_executor_fails(#[values(false, true)] enable_perf: bool) {
293+
let (system_info, run_data, _temp_dir) = create_test_setup().await;
294+
let (_permit, executor) = get_walltime_executor().await;
295+
296+
let config = walltime_config("exit 1", enable_perf);
297+
let result = executor.run(&config, &system_info, &run_data, &None).await;
298+
assert!(result.is_err(), "Command should fail");
299+
}
288300
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ impl PerfRunner {
150150
let perf_data_file_path = profile_folder.join(PERF_DATA_FILE_NAME);
151151

152152
let raw_command = format!(
153-
"{} | cat > {}",
153+
"set -o pipefail && {} | cat > {}",
154154
&cmd_builder.as_command_line(),
155155
perf_data_file_path.to_string_lossy()
156156
);
157-
let mut wrapped_builder = CommandBuilder::new("sh");
157+
let mut wrapped_builder = CommandBuilder::new("bash");
158158
wrapped_builder.args(["-c", &raw_command]);
159159

160160
// IMPORTANT: Preserve the working directory from the original command

0 commit comments

Comments
 (0)