2018-10-06 11:18:06 -05:00
|
|
|
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
|
2017-12-15 03:02:39 -06:00
|
|
|
#[test]
|
|
|
|
fn dogfood() {
|
2018-09-30 05:59:15 -05:00
|
|
|
if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) {
|
2018-01-18 15:02:58 -06:00
|
|
|
return;
|
|
|
|
}
|
2017-12-15 03:02:39 -06:00
|
|
|
let root_dir = std::env::current_dir().unwrap();
|
2018-09-26 05:32:20 -05:00
|
|
|
for d in &[".", "clippy_lints", "rustc_tools_util", "clippy_dev"] {
|
2017-12-15 03:02:39 -06:00
|
|
|
std::env::set_current_dir(root_dir.join(d)).unwrap();
|
|
|
|
let output = std::process::Command::new("cargo")
|
|
|
|
.arg("run")
|
2018-03-15 10:08:49 -05:00
|
|
|
.arg("--bin")
|
|
|
|
.arg("cargo-clippy")
|
2018-09-26 05:32:20 -05:00
|
|
|
.arg("--all-features")
|
2018-03-15 10:08:49 -05:00
|
|
|
.arg("--manifest-path")
|
|
|
|
.arg(root_dir.join("Cargo.toml"))
|
2018-09-26 05:32:20 -05:00
|
|
|
.args(&["--", "-W clippy::internal"])
|
2018-04-01 02:28:53 -05:00
|
|
|
.env("CLIPPY_DOGFOOD", "true")
|
2018-03-15 10:08:49 -05:00
|
|
|
.output()
|
|
|
|
.unwrap();
|
2017-12-15 03:02:39 -06:00
|
|
|
println!("status: {}", output.status);
|
|
|
|
println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
|
|
|
|
println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
|
|
|
|
|
|
|
|
assert!(output.status.success());
|
|
|
|
}
|
|
|
|
}
|