Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests not working with a different CARGO_TARGET_DIR. #8982

Merged
merged 1 commit into from
Dec 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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