Skip to content

Commit

Permalink
Auto merge of #8982 - ehuss:fix-alt-target-tests, r=alexcrichton
Browse files Browse the repository at this point in the history
Fix tests not working with a different CARGO_TARGET_DIR.

Fixes #8980
  • Loading branch information
bors committed Dec 16, 2020
2 parents 310994c + 0ac41f0 commit 4f0adae
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions tests/testsuite/standard_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use cargo_test_support::registry::{Dependency, Package};
use cargo_test_support::ProjectBuilder;
use cargo_test_support::{is_nightly, paths, project, rustc_host, Execs};
use std::path::PathBuf;
use std::path::{Path, PathBuf};

struct Setup {
rustc_wrapper: PathBuf,
Expand Down Expand Up @@ -131,15 +131,7 @@ fn setup() -> Option<Setup> {
fn enable_build_std(e: &mut Execs, setup: &Setup) {
// First up, force Cargo to use our "mock sysroot" which mimics what
// libstd looks like upstream.
let root = paths::root();
let root = root
.parent() // chop off test name
.unwrap()
.parent() // chop off `citN`
.unwrap()
.parent() // chop off `target`
.unwrap()
.join("tests/testsuite/mock-std");
let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/testsuite/mock-std");
e.env("__CARGO_TESTS_ONLY_SRC_ROOT", &root);

e.masquerade_as_nightly_cargo();
Expand Down

0 comments on commit 4f0adae

Please sign in to comment.