Skip to content

Commit

Permalink
Use dogfood_runner for deterministic test ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
waynr committed Dec 6, 2018
1 parent 1db535a commit 66251c3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/dogfood.rs
Expand Up @@ -8,14 +8,19 @@
// except according to those terms.

#[test]
fn dogfood_runner() {
dogfood();
dogfood_tests();
}

fn dogfood() {
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).join("target/debug/cargo-clippy");

println!("{:?}", clippy_cmd);
std::env::set_current_dir(root_dir).unwrap();
let output = std::process::Command::new(clippy_cmd)
.arg("clippy")
.arg("--all-targets")
Expand All @@ -33,7 +38,6 @@ fn dogfood() {
assert!(output.status.success());
}

#[test]
fn dogfood_tests() {
if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) {
return;
Expand Down Expand Up @@ -64,5 +68,4 @@ fn dogfood_tests() {

assert!(output.status.success());
}
std::env::set_current_dir(root_dir).unwrap();
}

0 comments on commit 66251c3

Please sign in to comment.