Skip to content

Commit 88bac1f

Browse files
committed
remove procsrv module
1 parent 6f21239 commit 88bac1f

File tree

3 files changed

+28
-51
lines changed

3 files changed

+28
-51
lines changed

src/tools/compiletest/src/main.rs

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ use util::logv;
3939

4040
use self::header::EarlyProps;
4141

42-
pub mod procsrv;
4342
pub mod util;
4443
mod json;
4544
pub mod header;

src/tools/compiletest/src/procsrv.rs

-46
This file was deleted.

src/tools/compiletest/src/runtest.rs

+28-4
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,35 @@ use errors::{self, ErrorKind, Error};
1717
use filetime::FileTime;
1818
use json;
1919
use header::TestProps;
20-
use procsrv;
2120
use test::TestPaths;
2221
use util::logv;
2322

23+
use std::collections::HashMap;
2424
use std::collections::HashSet;
2525
use std::env;
26+
use std::ffi::OsString;
2627
use std::fs::{self, File, create_dir_all};
2728
use std::io::prelude::*;
2829
use std::io::{self, BufReader};
2930
use std::path::{Path, PathBuf};
3031
use std::process::{Command, Output, ExitStatus, Stdio};
3132
use std::str;
32-
use std::collections::HashMap;
3333

3434
use extract_gdb_version;
3535

36+
/// The name of the environment variable that holds dynamic library locations.
37+
pub fn dylib_env_var() -> &'static str {
38+
if cfg!(windows) {
39+
"PATH"
40+
} else if cfg!(target_os = "macos") {
41+
"DYLD_LIBRARY_PATH"
42+
} else if cfg!(target_os = "haiku") {
43+
"LIBRARY_PATH"
44+
} else {
45+
"LD_LIBRARY_PATH"
46+
}
47+
}
48+
3649
pub fn run(config: Config, testpaths: &TestPaths) {
3750
match &*config.target {
3851

@@ -1318,7 +1331,18 @@ actual:\n\
13181331
.stderr(Stdio::piped())
13191332
.stdin(Stdio::piped());
13201333

1321-
procsrv::add_target_env(&mut command, lib_path, aux_path);
1334+
// Need to be sure to put both the lib_path and the aux path in the dylib
1335+
// search path for the child.
1336+
let mut path = env::split_paths(&env::var_os(dylib_env_var()).unwrap_or(OsString::new()))
1337+
.collect::<Vec<_>>();
1338+
if let Some(p) = aux_path {
1339+
path.insert(0, PathBuf::from(p))
1340+
}
1341+
path.insert(0, PathBuf::from(lib_path));
1342+
1343+
// Add the new dylib search path var
1344+
let newpath = env::join_paths(&path).unwrap();
1345+
command.env(dylib_env_var(), newpath);
13221346

13231347
let mut child = command.spawn().expect(&format!("failed to exec `{:?}`", &command));
13241348
if let Some(input) = input {
@@ -2077,7 +2101,7 @@ actual:\n\
20772101
.env("RUSTDOC",
20782102
cwd.join(&self.config.rustdoc_path.as_ref().expect("--rustdoc-path passed")))
20792103
.env("TMPDIR", &tmpdir)
2080-
.env("LD_LIB_PATH_ENVVAR", procsrv::dylib_env_var())
2104+
.env("LD_LIB_PATH_ENVVAR", dylib_env_var())
20812105
.env("HOST_RPATH_DIR", cwd.join(&self.config.compile_lib_path))
20822106
.env("TARGET_RPATH_DIR", cwd.join(&self.config.run_lib_path))
20832107
.env("LLVM_COMPONENTS", &self.config.llvm_components)

0 commit comments

Comments
 (0)