11//! Test tasks with feature matrix testing.
22
3- use crate :: environment:: { cargo, get_crate_dirs, quiet_println, CONFIG_FILE_PATH } ;
3+ use crate :: environment:: { get_crate_dirs, quiet_println, CONFIG_FILE_PATH } ;
4+ use crate :: quiet_cmd;
45use crate :: toolchain:: { check_toolchain, Toolchain } ;
56use serde:: Deserialize ;
67use std:: ffi:: OsStr ;
@@ -173,7 +174,7 @@ fn do_test(sh: &Shell, config: &TestConfig) -> Result<(), Box<dyn std::error::Er
173174 quiet_println ( "Running basic tests" ) ;
174175
175176 // Basic test (includes build).
176- cargo ( sh, "test" ) . run ( ) ?;
177+ quiet_cmd ! ( sh, "cargo --locked test" ) . run ( ) ?;
177178
178179 // Run examples.
179180 for example in & config. examples {
@@ -183,18 +184,18 @@ fn do_test(sh: &Shell, config: &TestConfig) -> Result<(), Box<dyn std::error::Er
183184 1 => {
184185 // Format: "name" - run with default features.
185186 let name = parts[ 0 ] ;
186- cargo ( sh, "run --example {name}" ) . run ( ) ?;
187+ quiet_cmd ! ( sh, "cargo --locked run --example {name}" ) . run ( ) ?;
187188 }
188189 2 => {
189190 let name = parts[ 0 ] ;
190191 let features = parts[ 1 ] ;
191192
192193 if features == "-" {
193194 // Format: "name:-" - run with no-default-features.
194- cargo ( sh, "run --no-default-features --example {name}" ) . run ( ) ?;
195+ quiet_cmd ! ( sh, "cargo --locked run --no-default-features --example {name}" ) . run ( ) ?;
195196 } else {
196197 // Format: "name:features" - run with specific features.
197- cargo ( sh, "run --example {name} --features={features}" ) . run ( ) ?;
198+ quiet_cmd ! ( sh, "cargo --locked run --example {name} --features={features}" ) . run ( ) ?;
198199 }
199200 }
200201 _ => {
@@ -219,7 +220,7 @@ fn do_feature_matrix(sh: &Shell, config: &TestConfig) -> Result<(), Box<dyn std:
219220 for features in & config. exact_features {
220221 let features_str = features. join ( " " ) ;
221222 quiet_println ( & format ! ( "Testing exact features: {}" , features_str) ) ;
222- cargo ( sh, "test --no-default-features --features={features_str}" ) . run ( ) ?;
223+ quiet_cmd ! ( sh, "cargo --locked test --no-default-features --features={features_str}" ) . run ( ) ?;
223224 }
224225 return Ok ( ( ) ) ;
225226 }
@@ -228,17 +229,17 @@ fn do_feature_matrix(sh: &Shell, config: &TestConfig) -> Result<(), Box<dyn std:
228229 if !config. features_with_no_std . is_empty ( ) {
229230 let no_std = FeatureFlag :: NoStd ;
230231 quiet_println ( "Testing no-std" ) ;
231- cargo ( sh, "test --no-default-features --features={no_std}" ) . run ( ) ?;
232+ quiet_cmd ! ( sh, "cargo --locked test --no-default-features --features={no_std}" ) . run ( ) ?;
232233
233234 loop_features ( sh, Some ( FeatureFlag :: NoStd ) , & config. features_with_no_std ) ?;
234235 } else {
235236 quiet_println ( "Testing no-default-features" ) ;
236- cargo ( sh, "test --no-default-features" ) . run ( ) ?;
237+ quiet_cmd ! ( sh, "cargo --locked test --no-default-features" ) . run ( ) ?;
237238 }
238239
239240 // Test all features.
240241 quiet_println ( "Testing all-features" ) ;
241- cargo ( sh, "test --all-features" ) . run ( ) ?;
242+ quiet_cmd ! ( sh, "cargo --locked test --all-features" ) . run ( ) ?;
242243
243244 // Test features with std.
244245 if !config. features_with_std . is_empty ( ) {
@@ -290,21 +291,21 @@ fn loop_features<S: AsRef<str>>(
290291 // Test all features together.
291292 let all_features = combine_features ( base, features) ;
292293 quiet_println ( & format ! ( "Testing features: {}" , all_features) ) ;
293- cargo ( sh, "test --no-default-features --features={all_features}" ) . run ( ) ?;
294+ quiet_cmd ! ( sh, "cargo --locked test --no-default-features --features={all_features}" ) . run ( ) ?;
294295
295296 // Test each feature individually and all pairs (only if more than one feature).
296297 if features. len ( ) > 1 {
297298 for i in 0 ..features. len ( ) {
298299 let feature_combo = combine_features ( base, & features[ i..=i] ) ;
299300 quiet_println ( & format ! ( "Testing features: {}" , feature_combo) ) ;
300- cargo ( sh, "test --no-default-features --features={feature_combo}" ) . run ( ) ?;
301+ quiet_cmd ! ( sh, "cargo --locked test --no-default-features --features={feature_combo}" ) . run ( ) ?;
301302
302303 // Test all pairs with features[i].
303304 for j in ( i + 1 ) ..features. len ( ) {
304305 let pair = [ & features[ i] , & features[ j] ] ;
305306 let feature_combo = combine_features ( base, & pair) ;
306307 quiet_println ( & format ! ( "Testing features: {}" , feature_combo) ) ;
307- cargo ( sh, "test --no-default-features --features={feature_combo}" ) . run ( ) ?;
308+ quiet_cmd ! ( sh, "cargo --locked test --no-default-features --features={feature_combo}" ) . run ( ) ?;
308309 }
309310 }
310311 }
0 commit comments