Fix compile-test tests to work with the new ui_test crate

This commit is contained in:
Philipp Krones 2023-07-02 15:07:39 +02:00
parent 0cbe963e51
commit de69d556eb
No known key found for this signature in database
GPG Key ID: 1CA0DF2AF59D68A5
3 changed files with 9 additions and 26 deletions

View File

@ -9,6 +9,7 @@ members = [
"src/tools/cargotest",
"src/tools/clippy",
"src/tools/clippy/clippy_dev",
"src/tools/clippy/clippy_test_deps",
"src/tools/compiletest",
"src/tools/error_index_generator",
"src/tools/linkchecker",

View File

@ -788,27 +788,15 @@ impl Step for Clippy {
cargo.add_rustc_lib_path(builder, compiler);
let mut cargo = prepare_cargo_test(cargo, &[], &[], "clippy", compiler, host, builder);
// propagate --bless
if builder.config.cmd.bless() {
cargo.env("BLESS", "Gesundheit");
}
if builder.try_run(&mut cargo).is_ok() {
// The tests succeeded; nothing to do.
return;
}
if !builder.config.cmd.bless() {
crate::detail_exit_macro!(1);
}
let mut cargo = builder.cargo(compiler, Mode::ToolRustc, SourceType::InTree, host, "run");
cargo.arg("-p").arg("clippy_dev");
// clippy_dev gets confused if it can't find `clippy/Cargo.toml`
cargo.current_dir(&builder.src.join("src").join("tools").join("clippy"));
if builder.config.rust_optimize.is_release() {
cargo.env("PROFILE", "release");
} else {
cargo.env("PROFILE", "debug");
}
cargo.arg("--");
cargo.arg("bless");
builder.run(&mut cargo.into());
}
}

View File

@ -31,7 +31,7 @@ fn base_config(test_dir: &str) -> compiletest::Config {
},
dependencies_crate_manifest_path: Some("clippy_test_deps/Cargo.toml".into()),
target: None,
out_dir: "target/ui_test".into(),
out_dir: PathBuf::from(std::env::var_os("CARGO_TARGET_DIR").unwrap_or("target".into())).join("ui_test"),
..compiletest::Config::rustc(Path::new("tests").join(test_dir))
};
@ -116,10 +116,7 @@ fn run_ui_toml() {
config.stderr_filter(
&regex::escape(
&std::path::Path::new(file!())
.parent()
.unwrap()
.canonicalize()
&fs::canonicalize("tests")
.unwrap()
.parent()
.unwrap()
@ -175,10 +172,7 @@ fn run_ui_cargo() {
config.stderr_filter(
&regex::escape(
&std::path::Path::new(file!())
.parent()
.unwrap()
.canonicalize()
&fs::canonicalize("tests")
.unwrap()
.parent()
.unwrap()