-
Notifications
You must be signed in to change notification settings - Fork 3
Generate debug output for all regression tests #1307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AdrianDAlessandro
wants to merge
1
commit into
main
Choose a base branch
from
debug-test-output
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+34
−10
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,13 @@ macro_rules! define_regression_test_with_extra_args { | |
| ($example:ident, $extra_args:expr) => { | ||
| #[test] | ||
| fn $example() { | ||
| run_regression_test(stringify!($example), $extra_args); | ||
| run_regression_test(stringify!($example), $extra_args, false); | ||
| } | ||
| }; | ||
| ($example:ident, $extra_args:expr, $debug_model:literal) => { | ||
| #[test] | ||
| fn $example() { | ||
| run_regression_test(stringify!($example), $extra_args, $debug_model); | ||
| } | ||
| }; | ||
|
Comment on lines
+35
to
40
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed! |
||
| } | ||
|
|
@@ -50,7 +56,7 @@ pub(crate) use define_regression_test; | |
| #[allow(unused_macros)] | ||
| macro_rules! define_regression_test_with_debug_files { | ||
| ($example:ident) => { | ||
| define_regression_test_with_extra_args!($example, &["--debug-model"]); | ||
| define_regression_test_with_extra_args!($example, &[], true); | ||
| }; | ||
| } | ||
| #[allow(unused_imports)] | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,10 @@ define_regression_test_with_patches!(simple_ironing_out); | |
| const FLOAT_CMP_TOLERANCE: f64 = 1e-10; | ||
|
|
||
| /// Run a regression test for the given example with optional extra arguments to `muse2 run`. | ||
| fn run_regression_test(example: &str, extra_args: &[&str]) { | ||
| /// | ||
| /// The `debug-model` flag is always used so the debug files are available to examine. The debug | ||
| /// files are only tested when the `debug_model` flag is true. | ||
| fn run_regression_test(example: &str, extra_args: &[&str], debug_model: bool) { | ||
|
Comment on lines
40
to
+44
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also true. Worth fixing up |
||
| // Allow user to set output dir for regression tests so they can examine results. This is | ||
| // principally intended for use by CI. | ||
| let tmp: TempDir; | ||
|
|
@@ -51,17 +54,20 @@ fn run_regression_test(example: &str, extra_args: &[&str]) { | |
|
|
||
| // Invoke muse2 | ||
| let output_dir_str = output_dir.to_string_lossy(); | ||
| let mut args = vec!["example", "run", example, "--output-dir", &output_dir_str]; | ||
| let mut args = vec![ | ||
| "example", | ||
| "run", | ||
| example, | ||
| "--debug-model", | ||
| "--output-dir", | ||
| &output_dir_str, | ||
| ]; | ||
| args.extend(extra_args); | ||
| assert_muse2_runs(&args); | ||
|
|
||
| // Check that the output files match (approximately) | ||
| let test_data_dir = PathBuf::from(format!("tests/data/{example}")); | ||
| compare_output_dirs( | ||
| &output_dir, | ||
| &test_data_dir, | ||
| extra_args.contains(&"--debug-model"), | ||
| ); | ||
| compare_output_dirs(&output_dir, &test_data_dir, debug_model); | ||
| } | ||
|
|
||
| fn compare_output_dirs(cur_output_dir1: &Path, test_data_dir: &Path, debug_model: bool) { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd do this for clarity, regardless of the point about relying on brittle lifetime rules ☝️