Skip to content

Commit 5c5cc2a

Browse files
authored
Merge pull request #678 from RalfJung/test-env
compiletest env var cleanup
2 parents 0e4f963 + 336a59d commit 5c5cc2a

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

tests/compiletest.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,6 @@ fn miri_pass(path: &str, target: &str, opt: bool) {
8787
compiletest::run_tests(&config);
8888
}
8989

90-
/// Ensures that the `MIRI_SYSROOT` env var is set.
91-
fn set_sysroot() {
92-
if std::env::var("MIRI_SYSROOT").is_ok() {
93-
// Nothing to do.
94-
return;
95-
}
96-
let sysroot = std::process::Command::new("rustc")
97-
.arg("--print")
98-
.arg("sysroot")
99-
.output()
100-
.expect("rustc not found")
101-
.stdout;
102-
let sysroot = String::from_utf8(sysroot).expect("sysroot is not utf8");
103-
std::env::set_var("MIRI_SYSROOT", sysroot.trim());
104-
}
105-
10690
fn get_host() -> String {
10791
let rustc = rustc_test_suite().unwrap_or(PathBuf::from("rustc"));
10892
let rustc_version = std::process::Command::new(rustc)
@@ -117,7 +101,7 @@ fn get_host() -> String {
117101
}
118102

119103
fn get_target() -> String {
120-
std::env::var("MIRI_TARGET").unwrap_or_else(|_| get_host())
104+
std::env::var("MIRI_COMPILETEST_TARGET").unwrap_or_else(|_| get_host())
121105
}
122106

123107
fn run_pass_miri(opt: bool) {
@@ -129,8 +113,6 @@ fn compile_fail_miri(opt: bool) {
129113
}
130114

131115
fn test_runner(_tests: &[&()]) {
132-
set_sysroot();
133-
134116
run_pass_miri(false);
135117
run_pass_miri(true);
136118

travis.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ echo
2222

2323
echo "Test miri with full MIR, on the host and other architectures"
2424
MIRI_SYSROOT="$MIRI_SYSROOT_BASE"/HOST cargo test --release --all-features
25-
MIRI_SYSROOT="$MIRI_SYSROOT_BASE" MIRI_TARGET="$FOREIGN_TARGET" cargo test --release --all-features
25+
MIRI_SYSROOT="$MIRI_SYSROOT_BASE" MIRI_COMPILETEST_TARGET="$FOREIGN_TARGET" cargo test --release --all-features
2626
echo
2727

2828
echo "Test cargo integration"

0 commit comments

Comments
 (0)