Skip to content

Commit 0549516

Browse files
authored
Rollup merge of #99602 - RalfJung:xsv, r=Mark-Simulacrum
cargotest: do not run quickcheck tests in xsv Fixes #73514 I know #70659 discusses a larger overhaul of cargotest, but that seems to have stalled and I'd like to fix the immediate issue of PRs failing due to random test failures in xsv. This still runs the vast majority of tests by numbers: ``` test result: ok. 394 passed; 0 failed; 0 ignored; 0 measured; 32 filtered out; finished in 1.84s ``` So the loss in test coverage is hopefully not too big.
2 parents e51a476 + 77be253 commit 0549516

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

src/tools/cargotest/main.rs

+28-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ struct Test {
1111
packages: &'static [&'static str],
1212
features: Option<&'static [&'static str]>,
1313
manifest_path: Option<&'static str>,
14+
/// `filters` are passed to libtest (i.e., after a `--` in the `cargo test` invocation).
15+
filters: &'static [&'static str],
1416
}
1517

1618
const TEST_REPOS: &[Test] = &[
@@ -22,6 +24,7 @@ const TEST_REPOS: &[Test] = &[
2224
packages: &[],
2325
features: None,
2426
manifest_path: None,
27+
filters: &[],
2528
},
2629
Test {
2730
name: "ripgrep",
@@ -31,6 +34,7 @@ const TEST_REPOS: &[Test] = &[
3134
packages: &[],
3235
features: None,
3336
manifest_path: None,
37+
filters: &[],
3438
},
3539
Test {
3640
name: "tokei",
@@ -40,6 +44,7 @@ const TEST_REPOS: &[Test] = &[
4044
packages: &[],
4145
features: None,
4246
manifest_path: None,
47+
filters: &[],
4348
},
4449
Test {
4550
name: "xsv",
@@ -49,6 +54,21 @@ const TEST_REPOS: &[Test] = &[
4954
packages: &[],
5055
features: None,
5156
manifest_path: None,
57+
// Many tests here use quickcheck and some of them can fail randomly, so only run deterministic tests.
58+
filters: &[
59+
"test_flatten::",
60+
"test_fmt::",
61+
"test_headers::",
62+
"test_index::",
63+
"test_join::",
64+
"test_partition::",
65+
"test_search::",
66+
"test_select::",
67+
"test_slice::",
68+
"test_split::",
69+
"test_stats::",
70+
"test_table::",
71+
],
5272
},
5373
Test {
5474
name: "servo",
@@ -60,6 +80,7 @@ const TEST_REPOS: &[Test] = &[
6080
packages: &["selectors"],
6181
features: None,
6282
manifest_path: None,
83+
filters: &[],
6384
},
6485
Test {
6586
name: "diesel",
@@ -75,6 +96,7 @@ const TEST_REPOS: &[Test] = &[
7596
// not any other crate present in the diesel workspace
7697
// (This is required to set the feature flags above)
7798
manifest_path: Some("diesel/Cargo.toml"),
99+
filters: &[],
78100
},
79101
];
80102

@@ -97,7 +119,8 @@ fn test_repo(cargo: &Path, out_dir: &Path, test: &Test) {
97119
if let Some(lockfile) = test.lock {
98120
fs::write(&dir.join("Cargo.lock"), lockfile).unwrap();
99121
}
100-
if !run_cargo_test(cargo, &dir, test.packages, test.features, test.manifest_path) {
122+
if !run_cargo_test(cargo, &dir, test.packages, test.features, test.manifest_path, test.filters)
123+
{
101124
panic!("tests failed for {}", test.repo);
102125
}
103126
}
@@ -155,6 +178,7 @@ fn run_cargo_test(
155178
packages: &[&str],
156179
features: Option<&[&str]>,
157180
manifest_path: Option<&str>,
181+
filters: &[&str],
158182
) -> bool {
159183
let mut command = Command::new(cargo_path);
160184
command.arg("test");
@@ -174,6 +198,9 @@ fn run_cargo_test(
174198
command.arg("-p").arg(name);
175199
}
176200

201+
command.arg("--");
202+
command.args(filters);
203+
177204
let status = command
178205
// Disable rust-lang/cargo's cross-compile tests
179206
.env("CFG_DISABLE_CROSS_TESTS", "1")

0 commit comments

Comments
 (0)