Skip to content

Commit d988734

Browse files
committed
Auto merge of #10418 - Jarcho:finish_dogfood, r=flip1995
Run dogfood to completion Run dogfood on all packages before failing the test. Failing early is painful on lints which trigger on multiple crates. changelog: None
2 parents 1a11ad7 + 69a1100 commit d988734

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

tests/dogfood.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
88
#![warn(rust_2018_idioms, unused_lifetimes)]
99

10+
use itertools::Itertools;
1011
use std::path::PathBuf;
1112
use std::process::Command;
1213
use test_utils::IS_RUSTC_TEST_SUITE;
@@ -19,17 +20,27 @@ fn dogfood_clippy() {
1920
return;
2021
}
2122

23+
let mut failed_packages = Vec::new();
24+
2225
// "" is the root package
23-
for package in &[
26+
for package in [
2427
"",
2528
"clippy_dev",
2629
"clippy_lints",
2730
"clippy_utils",
2831
"lintcheck",
2932
"rustc_tools_util",
3033
] {
31-
run_clippy_for_package(package, &["-D", "clippy::all", "-D", "clippy::pedantic"]);
34+
if !run_clippy_for_package(package, &["-D", "clippy::all", "-D", "clippy::pedantic"]) {
35+
failed_packages.push(if package.is_empty() { "root" } else { package });
36+
}
3237
}
38+
39+
assert!(
40+
!failed_packages.is_empty(),
41+
"Dogfood failed for packages `{}`",
42+
failed_packages.iter().format(", "),
43+
)
3344
}
3445

3546
#[test]
@@ -71,7 +82,7 @@ fn run_metadata_collection_lint() {
7182
run_clippy_for_package("clippy_lints", &["-A", "unfulfilled_lint_expectations"]);
7283
}
7384

74-
fn run_clippy_for_package(project: &str, args: &[&str]) {
85+
fn run_clippy_for_package(project: &str, args: &[&str]) -> bool {
7586
let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
7687

7788
let mut command = Command::new(&*test_utils::CARGO_CLIPPY_PATH);
@@ -107,5 +118,5 @@ fn run_clippy_for_package(project: &str, args: &[&str]) {
107118
println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
108119
println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
109120

110-
assert!(output.status.success());
121+
output.status.success()
111122
}

0 commit comments

Comments
 (0)