1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
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.
17 if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) {
20 let root_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
21 let clippy_cmd = std::path::Path::new(&root_dir)
23 .join(env!("PROFILE"))
24 .join("cargo-clippy");
26 std::env::set_current_dir(root_dir).unwrap();
27 let output = std::process::Command::new(clippy_cmd)
28 .env("CLIPPY_DOGFOOD", "1")
31 .arg("--all-features")
33 .args(&["-D", "clippy::all"])
34 .args(&["-D", "clippy::internal"])
35 .args(&["-D", "clippy::pedantic"])
38 println!("status: {}", output.status);
39 println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
40 println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
42 assert!(output.status.success());
46 if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) {
49 let root_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
50 let clippy_cmd = std::path::Path::new(&root_dir)
52 .join(env!("PROFILE"))
53 .join("cargo-clippy");
56 "clippy_workspace_tests",
57 "clippy_workspace_tests/src",
58 "clippy_workspace_tests/subcrate",
59 "clippy_workspace_tests/subcrate/src",
63 std::env::set_current_dir(root_dir.join(d)).unwrap();
64 let output = std::process::Command::new(&clippy_cmd)
65 .env("CLIPPY_DOGFOOD", "1")
68 .args(&["-D", "clippy::all"])
69 .args(&["-D", "clippy::pedantic"])
72 println!("status: {}", output.status);
73 println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
74 println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
76 assert!(output.status.success());