File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2162,6 +2162,7 @@ impl Config {
2162
2162
extra_test_bin_args : self . runnables_extraTestBinaryArgs ( source_root) . clone ( ) ,
2163
2163
extra_env : self . extra_env ( source_root) . clone ( ) ,
2164
2164
target_dir : self . target_dir_from_config ( source_root) ,
2165
+ set_test : true ,
2165
2166
}
2166
2167
}
2167
2168
@@ -2219,6 +2220,7 @@ impl Config {
2219
2220
extra_test_bin_args : self . runnables_extraTestBinaryArgs ( source_root) . clone ( ) ,
2220
2221
extra_env : self . check_extra_env ( source_root) ,
2221
2222
target_dir : self . target_dir_from_config ( source_root) ,
2223
+ set_test : * self . cfg_setTest ( source_root) ,
2222
2224
} ,
2223
2225
ansi_color_output : self . color_diagnostic_output ( ) ,
2224
2226
} ,
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ pub(crate) enum InvocationStrategy {
31
31
pub ( crate ) struct CargoOptions {
32
32
pub ( crate ) target_tuples : Vec < String > ,
33
33
pub ( crate ) all_targets : bool ,
34
+ pub ( crate ) set_test : bool ,
34
35
pub ( crate ) no_default_features : bool ,
35
36
pub ( crate ) all_features : bool ,
36
37
pub ( crate ) features : Vec < String > ,
@@ -54,7 +55,13 @@ impl CargoOptions {
54
55
cmd. args ( [ "--target" , target. as_str ( ) ] ) ;
55
56
}
56
57
if self . all_targets {
57
- cmd. arg ( "--all-targets" ) ;
58
+ if self . set_test {
59
+ cmd. arg ( "--all-targets" ) ;
60
+ } else {
61
+ // No --benches unfortunately, as this implies --tests (see https://github.com/rust-lang/cargo/issues/6454),
62
+ // and users setting `cfg.seTest = false` probably prefer disabling benches than enabling tests.
63
+ cmd. args ( [ "--lib" , "--bins" , "--examples" ] ) ;
64
+ }
58
65
}
59
66
if self . all_features {
60
67
cmd. arg ( "--all-features" ) ;
You can’t perform that action at this time.
0 commit comments