Skip to content

Commit

Permalink
tests: dogfood: run tests with debuginfo=0 reducing dogfood target di…
Browse files Browse the repository at this point in the history
…r size even further.
  • Loading branch information
matthiaskrgr committed Sep 11, 2019
1 parent 34dc078 commit a1ecf39
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tests/dogfood.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#[test]
fn dogfood() {
fn dogfood_clippy() {
// run clippy on itself and fail the test if lint warnings are reported
if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) {
return;
}
let root_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let clippy_cmd = std::path::Path::new(&root_dir)
let clippy_binary = std::path::Path::new(&root_dir)
.join("target")
.join(env!("PROFILE"))
.join("cargo-clippy");

let output = std::process::Command::new(clippy_cmd)
let output = std::process::Command::new(clippy_binary)
.current_dir(root_dir)
.env("CLIPPY_DOGFOOD", "1")
.env("CARGO_INCREMENTAL", "0")
Expand All @@ -20,6 +21,7 @@ fn dogfood() {
.args(&["-D", "clippy::all"])
.args(&["-D", "clippy::internal"])
.args(&["-D", "clippy::pedantic"])
.arg("-Cdebuginfo=0") // disable debuginfo to generate less data in the target dir
.output()
.unwrap();
println!("status: {}", output.status);
Expand All @@ -30,12 +32,13 @@ fn dogfood() {
}

#[test]
fn dogfood_tests() {
fn dogfood_subprojects() {
// run clippy on remaining subprojects and fail the test if lint warnings are reported
if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) {
return;
}
let root_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let clippy_cmd = std::path::Path::new(&root_dir)
let clippy_binary = std::path::Path::new(&root_dir)
.join("target")
.join(env!("PROFILE"))
.join("cargo-clippy");
Expand All @@ -48,14 +51,15 @@ fn dogfood_tests() {
"clippy_dev",
"rustc_tools_util",
] {
let output = std::process::Command::new(&clippy_cmd)
let output = std::process::Command::new(&clippy_binary)
.current_dir(root_dir.join(d))
.env("CLIPPY_DOGFOOD", "1")
.env("CARGO_INCREMENTAL", "0")
.arg("clippy")
.arg("--")
.args(&["-D", "clippy::all"])
.args(&["-D", "clippy::pedantic"])
.arg("-Cdebuginfo=0") // disable debuginfo to generate less data in the target dir
.output()
.unwrap();
println!("status: {}", output.status);
Expand Down

0 comments on commit a1ecf39

Please sign in to comment.