Skip to content

Commit

Permalink
Auto merge of rust-lang#10418 - Jarcho:finish_dogfood, r=flip1995
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Feb 28, 2023
2 parents 1a11ad7 + 69a1100 commit d988734
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions tests/dogfood.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
#![warn(rust_2018_idioms, unused_lifetimes)]

use itertools::Itertools;
use std::path::PathBuf;
use std::process::Command;
use test_utils::IS_RUSTC_TEST_SUITE;
Expand All @@ -19,17 +20,27 @@ fn dogfood_clippy() {
return;
}

let mut failed_packages = Vec::new();

// "" is the root package
for package in &[
for package in [
"",
"clippy_dev",
"clippy_lints",
"clippy_utils",
"lintcheck",
"rustc_tools_util",
] {
run_clippy_for_package(package, &["-D", "clippy::all", "-D", "clippy::pedantic"]);
if !run_clippy_for_package(package, &["-D", "clippy::all", "-D", "clippy::pedantic"]) {
failed_packages.push(if package.is_empty() { "root" } else { package });
}
}

assert!(
!failed_packages.is_empty(),
"Dogfood failed for packages `{}`",
failed_packages.iter().format(", "),
)
}

#[test]
Expand Down Expand Up @@ -71,7 +82,7 @@ fn run_metadata_collection_lint() {
run_clippy_for_package("clippy_lints", &["-A", "unfulfilled_lint_expectations"]);
}

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

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

assert!(output.status.success());
output.status.success()
}

0 comments on commit d988734

Please sign in to comment.