@@ -47,6 +47,14 @@ pub fn get_test_name(tests_parent_folder: &Path, test_folder: &Path) -> String {
4747 . join ( "::" )
4848}
4949
50+ /// All `cargo` commands in the test runner use this helper function to
51+ /// compose command invocations.
52+ /// Whenever you want to set a particular `cargo` flag across all invocations
53+ /// (e.g. `-Zbuild-analysis`), do it here.
54+ fn cargo_cmd ( ) -> std:: process:: Command {
55+ Command :: new ( "cargo" )
56+ }
57+
5058/// Create a test case for each folder in `definition_directory`.
5159///
5260/// Each test will get a separate runtime environment—a sub-folder of `runtime_directory`. The
@@ -247,7 +255,7 @@ fn compile_generated_apps(
247255 return Ok ( ( Vec :: new ( ) , BTreeMap :: new ( ) ) ) ;
248256 }
249257 println ! ( "Compiling {} generated crates" , generated_crate_names. len( ) ) ;
250- let mut cmd = Command :: new ( "cargo" ) ;
258+ let mut cmd = cargo_cmd ( ) ;
251259 cmd. arg ( "check" ) . arg ( "--message-format" ) . arg ( "json" ) ;
252260 for name in & generated_crate_names {
253261 cmd. arg ( "-p" ) . arg ( name) ;
@@ -371,7 +379,7 @@ fn warm_up_target_dir(
371379
372380 let timer = std:: time:: Instant :: now ( ) ;
373381 println ! ( "Warming up the target directory" ) ;
374- let mut cmd = Command :: new ( "cargo" ) ;
382+ let mut cmd = cargo_cmd ( ) ;
375383 cmd. arg ( "build" ) ;
376384 for data in test_name2test_data. values ( ) {
377385 cmd. arg ( "-p" ) . arg ( data. blueprint_crate_name ( ) ) ;
@@ -950,7 +958,7 @@ fn build_integration_tests(test_dir: &Path, test_name2test_data: &BTreeMap<Strin
950958
951959 let timer = std:: time:: Instant :: now ( ) ;
952960 println ! ( "Building {n_integration_tests} integration tests, without running them" ) ;
953- let mut cmd = std :: process :: Command :: new ( "cargo" ) ;
961+ let mut cmd = cargo_cmd ( ) ;
954962 cmd. arg ( "test" ) . arg ( "--no-run" ) ;
955963 for test in test_name2test_data. values ( ) {
956964 cmd. arg ( "-p" ) . arg ( format ! ( "integration_{}" , test. name_hash) ) ;
@@ -970,7 +978,7 @@ fn build_integration_tests(test_dir: &Path, test_name2test_data: &BTreeMap<Strin
970978}
971979
972980fn application_integration_test ( test : & TestData ) -> Result < ( ) , anyhow:: Error > {
973- let output = std :: process :: Command :: new ( "cargo" )
981+ let output = cargo_cmd ( )
974982 // .env("RUSTFLAGS", "-Awarnings")
975983 . arg ( "t" )
976984 . arg ( "-p" )
0 commit comments