Skip to content

Commit de69d55

Browse files
committed
Fix compile-test tests to work with the new ui_test crate
1 parent 0cbe963 commit de69d55

File tree

3 files changed

+9
-26
lines changed

3 files changed

+9
-26
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ members = [
99
"src/tools/cargotest",
1010
"src/tools/clippy",
1111
"src/tools/clippy/clippy_dev",
12+
"src/tools/clippy/clippy_test_deps",
1213
"src/tools/compiletest",
1314
"src/tools/error_index_generator",
1415
"src/tools/linkchecker",

src/bootstrap/test.rs

+5-17
Original file line numberDiff line numberDiff line change
@@ -788,27 +788,15 @@ impl Step for Clippy {
788788
cargo.add_rustc_lib_path(builder, compiler);
789789
let mut cargo = prepare_cargo_test(cargo, &[], &[], "clippy", compiler, host, builder);
790790

791+
// propagate --bless
792+
if builder.config.cmd.bless() {
793+
cargo.env("BLESS", "Gesundheit");
794+
}
795+
791796
if builder.try_run(&mut cargo).is_ok() {
792797
// The tests succeeded; nothing to do.
793798
return;
794799
}
795-
796-
if !builder.config.cmd.bless() {
797-
crate::detail_exit_macro!(1);
798-
}
799-
800-
let mut cargo = builder.cargo(compiler, Mode::ToolRustc, SourceType::InTree, host, "run");
801-
cargo.arg("-p").arg("clippy_dev");
802-
// clippy_dev gets confused if it can't find `clippy/Cargo.toml`
803-
cargo.current_dir(&builder.src.join("src").join("tools").join("clippy"));
804-
if builder.config.rust_optimize.is_release() {
805-
cargo.env("PROFILE", "release");
806-
} else {
807-
cargo.env("PROFILE", "debug");
808-
}
809-
cargo.arg("--");
810-
cargo.arg("bless");
811-
builder.run(&mut cargo.into());
812800
}
813801
}
814802

src/tools/clippy/tests/compile-test.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn base_config(test_dir: &str) -> compiletest::Config {
3131
},
3232
dependencies_crate_manifest_path: Some("clippy_test_deps/Cargo.toml".into()),
3333
target: None,
34-
out_dir: "target/ui_test".into(),
34+
out_dir: PathBuf::from(std::env::var_os("CARGO_TARGET_DIR").unwrap_or("target".into())).join("ui_test"),
3535
..compiletest::Config::rustc(Path::new("tests").join(test_dir))
3636
};
3737

@@ -116,10 +116,7 @@ fn run_ui_toml() {
116116

117117
config.stderr_filter(
118118
&regex::escape(
119-
&std::path::Path::new(file!())
120-
.parent()
121-
.unwrap()
122-
.canonicalize()
119+
&fs::canonicalize("tests")
123120
.unwrap()
124121
.parent()
125122
.unwrap()
@@ -175,10 +172,7 @@ fn run_ui_cargo() {
175172

176173
config.stderr_filter(
177174
&regex::escape(
178-
&std::path::Path::new(file!())
179-
.parent()
180-
.unwrap()
181-
.canonicalize()
175+
&fs::canonicalize("tests")
182176
.unwrap()
183177
.parent()
184178
.unwrap()

0 commit comments

Comments
 (0)