]> git.lizzy.rs Git - rust.git/blob - tests/dogfood.rs
Merge #3400
[rust.git] / tests / dogfood.rs
1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10
11 #[test]
12 fn dogfood() {
13     if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) {
14         return;
15     }
16     let root_dir = std::env::current_dir().unwrap();
17     for d in &[".", "clippy_lints", "rustc_tools_util", "clippy_dev"] {
18         std::env::set_current_dir(root_dir.join(d)).unwrap();
19         let output = std::process::Command::new("cargo")
20             .arg("run")
21             .arg("--bin")
22             .arg("cargo-clippy")
23             .arg("--all-features")
24             .arg("--manifest-path")
25             .arg(root_dir.join("Cargo.toml"))
26             .args(&["--", "-W clippy::internal -W clippy::pedantic"])
27             .env("CLIPPY_DOGFOOD", "true")
28             .output()
29             .unwrap();
30         println!("status: {}", output.status);
31         println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
32         println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
33
34         assert!(output.status.success());
35     }
36 }