Skip to content

Commit 4a9a9e3

Browse files
committed
Always enable debug_model for regression tests
The debug files won't be compared to anything, but it's useful to have them for debugging test failures.
1 parent a504bb1 commit 4a9a9e3

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

tests/regression.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,27 @@ fn run_regression_test_debug_opt(example_name: &str, debug_model: bool) {
4343
let opts = RunOpts {
4444
output_dir: Some(output_dir.clone()),
4545
overwrite: false,
46-
debug_model,
46+
debug_model: true, // NB: Always enable this as it helps to have the files for debugging
4747
};
4848
handle_example_run_command(example_name, &opts, Some(Settings::default())).unwrap();
4949

5050
let test_data_dir = PathBuf::from(format!("tests/data/{example_name}"));
51-
compare_output_dirs(&output_dir, &test_data_dir);
51+
compare_output_dirs(&output_dir, &test_data_dir, debug_model);
5252
}
5353

54-
fn compare_output_dirs(output_dir1: &Path, output_dir2: &Path) {
55-
let file_names1 = get_csv_file_names(output_dir1);
56-
let file_names2 = get_csv_file_names(output_dir2);
54+
fn compare_output_dirs(cur_output_dir1: &Path, test_data_dir: &Path, debug_model: bool) {
55+
let mut file_names1 = get_csv_file_names(cur_output_dir1);
56+
if !debug_model {
57+
file_names1.retain(|name| !name.starts_with("debug_"));
58+
}
59+
let file_names2 = get_csv_file_names(test_data_dir);
5760

5861
// Check that output files haven't been added/removed
5962
assert!(file_names1 == file_names2);
6063

6164
let mut errors = Vec::new();
6265
for file_name in file_names1 {
63-
compare_lines(output_dir1, output_dir2, &file_name, &mut errors);
66+
compare_lines(cur_output_dir1, test_data_dir, &file_name, &mut errors);
6467
}
6568

6669
assert!(

0 commit comments

Comments
 (0)