mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
Show progress while running dogfood test
This commit is contained in:
parent
0ee9f44568
commit
0b0c39ca4d
@ -4,7 +4,7 @@ uibless = "test --test compile-test -- -- --bless"
|
|||||||
bless = "test -- -- --bless"
|
bless = "test -- -- --bless"
|
||||||
dev = "run --package clippy_dev --bin clippy_dev --manifest-path clippy_dev/Cargo.toml --"
|
dev = "run --package clippy_dev --bin clippy_dev --manifest-path clippy_dev/Cargo.toml --"
|
||||||
lintcheck = "run --package lintcheck --bin lintcheck --manifest-path lintcheck/Cargo.toml -- "
|
lintcheck = "run --package lintcheck --bin lintcheck --manifest-path lintcheck/Cargo.toml -- "
|
||||||
collect-metadata = "test --test dogfood --features internal -- run_metadata_collection_lint --ignored"
|
collect-metadata = "test --test dogfood --features internal -- collect_metadata"
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
# -Zbinary-dep-depinfo allows us to track which rlib files to use for compiling UI tests
|
# -Zbinary-dep-depinfo allows us to track which rlib files to use for compiling UI tests
|
||||||
|
@ -34,7 +34,6 @@ ui_test = "0.24"
|
|||||||
regex = "1.5.5"
|
regex = "1.5.5"
|
||||||
toml = "0.7.3"
|
toml = "0.7.3"
|
||||||
walkdir = "2.3"
|
walkdir = "2.3"
|
||||||
# This is used by the `collect-metadata` alias.
|
|
||||||
filetime = "0.2.9"
|
filetime = "0.2.9"
|
||||||
itertools = "0.12"
|
itertools = "0.12"
|
||||||
|
|
||||||
@ -63,3 +62,7 @@ rustc_private = true
|
|||||||
[[test]]
|
[[test]]
|
||||||
name = "compile-test"
|
name = "compile-test"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
|
[[test]]
|
||||||
|
name = "dogfood"
|
||||||
|
harness = false
|
||||||
|
@ -7,23 +7,41 @@
|
|||||||
#![warn(rust_2018_idioms, unused_lifetimes)]
|
#![warn(rust_2018_idioms, unused_lifetimes)]
|
||||||
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::{self, IsTerminal};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
use std::time::SystemTime;
|
||||||
use test_utils::IS_RUSTC_TEST_SUITE;
|
use test_utils::IS_RUSTC_TEST_SUITE;
|
||||||
|
use ui_test::Args;
|
||||||
|
|
||||||
mod test_utils;
|
mod test_utils;
|
||||||
|
|
||||||
#[test]
|
fn main() {
|
||||||
fn dogfood_clippy() {
|
|
||||||
if IS_RUSTC_TEST_SUITE {
|
if IS_RUSTC_TEST_SUITE {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let args = Args::test().unwrap();
|
||||||
|
|
||||||
|
if args.list {
|
||||||
|
if !args.ignored {
|
||||||
|
println!("dogfood: test");
|
||||||
|
}
|
||||||
|
} else if !args.skip.iter().any(|arg| arg == "dogfood") {
|
||||||
|
if args.filters.iter().any(|arg| arg == "collect_metadata") {
|
||||||
|
collect_metadata();
|
||||||
|
} else {
|
||||||
|
dogfood();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn dogfood() {
|
||||||
let mut failed_packages = Vec::new();
|
let mut failed_packages = Vec::new();
|
||||||
|
|
||||||
// "" is the root package
|
|
||||||
for package in [
|
for package in [
|
||||||
"",
|
"./",
|
||||||
"clippy_dev",
|
"clippy_dev",
|
||||||
"clippy_lints",
|
"clippy_lints",
|
||||||
"clippy_utils",
|
"clippy_utils",
|
||||||
@ -31,6 +49,7 @@ fn dogfood_clippy() {
|
|||||||
"lintcheck",
|
"lintcheck",
|
||||||
"rustc_tools_util",
|
"rustc_tools_util",
|
||||||
] {
|
] {
|
||||||
|
println!("linting {package}");
|
||||||
if !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 });
|
failed_packages.push(if package.is_empty() { "root" } else { package });
|
||||||
}
|
}
|
||||||
@ -43,12 +62,8 @@ fn dogfood_clippy() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
fn collect_metadata() {
|
||||||
#[ignore]
|
assert!(cfg!(feature = "internal"));
|
||||||
#[cfg(feature = "internal")]
|
|
||||||
fn run_metadata_collection_lint() {
|
|
||||||
use std::fs::File;
|
|
||||||
use std::time::SystemTime;
|
|
||||||
|
|
||||||
// Setup for validation
|
// Setup for validation
|
||||||
let metadata_output_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("util/gh-pages/lints.json");
|
let metadata_output_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("util/gh-pages/lints.json");
|
||||||
@ -101,6 +116,10 @@ fn run_clippy_for_package(project: &str, args: &[&str]) -> bool {
|
|||||||
.arg("--all-targets")
|
.arg("--all-targets")
|
||||||
.arg("--all-features");
|
.arg("--all-features");
|
||||||
|
|
||||||
|
if !io::stdout().is_terminal() {
|
||||||
|
command.arg("-q");
|
||||||
|
}
|
||||||
|
|
||||||
if let Ok(dogfood_args) = std::env::var("__CLIPPY_DOGFOOD_ARGS") {
|
if let Ok(dogfood_args) = std::env::var("__CLIPPY_DOGFOOD_ARGS") {
|
||||||
for arg in dogfood_args.split_whitespace() {
|
for arg in dogfood_args.split_whitespace() {
|
||||||
command.arg(arg);
|
command.arg(arg);
|
||||||
@ -119,11 +138,5 @@ fn run_clippy_for_package(project: &str, args: &[&str]) -> bool {
|
|||||||
command.args(["-A", "unknown_lints"]);
|
command.args(["-A", "unknown_lints"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let output = command.output().unwrap();
|
command.status().unwrap().success()
|
||||||
|
|
||||||
println!("status: {}", output.status);
|
|
||||||
println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
|
|
||||||
println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
|
|
||||||
|
|
||||||
output.status.success()
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user