diff --git a/mk/platform.mk b/mk/platform.mk index 9bfae5e9691..0dbefc3518c 100644 --- a/mk/platform.mk +++ b/mk/platform.mk @@ -105,10 +105,9 @@ ifdef CFG_UNIXY CFG_PATH_MUNGE := true CFG_EXE_SUFFIX := CFG_LDPATH := - CFG_RUN=$(CFG_LDENV)=$(1) $(2) - CFG_RUN_TARG=$(call CFG_RUN,$(CFG_BUILD_DIR)/$(HOST_LIB$(1)),$(2)) - CFG_RUN_TEST=$(call CFG_RUN,$(call CFG_TESTLIB,$(1)),\ - $(CFG_VALGRIND) $(1)) + CFG_RUN=$(2) + CFG_RUN_TARG=$(call CFG_RUN,,$(2)) + CFG_RUN_TEST=$(call CFG_RUN,,$(CFG_VALGRIND) $(1)) CFG_LIBUV_LINK_FLAGS=-lpthread ifdef CFG_ENABLE_MINGW_CROSS diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index 6a40aaccaf4..1563e3112ca 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -131,7 +131,7 @@ fn worker(p: port) { let spawnproc = bind run::spawn_process(execparms.prog, execparms.args, pipe_in.in, pipe_out.out, pipe_err.out); - let pid = with_lib_path(execparms.lib_path, spawnproc); + let pid = maybe_with_lib_path(execparms.lib_path, spawnproc); os::libc::close(pipe_in.in); os::libc::close(pipe_out.out); @@ -151,6 +151,18 @@ fn worker(p: port) { } } +// Only windows needs to set the library path +#[cfg(target_os = "win32")] +fn maybe_with_lib_path<@T>(path: str, f: fn() -> T) -> T { + with_lib_path(path, f) +} + +#[cfg(target_os = "linux")] +#[cfg(target_os = "macos")] +fn maybe_with_lib_path<@T>(_path: str, f: fn() -> T) -> T { + f() +} + fn with_lib_path<@T>(path: str, f: fn() -> T) -> T { let maybe_oldpath = getenv(util::lib_path_env_var()); append_lib_path(path); diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index de188f3927e..ebedb4f0685 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -310,6 +310,14 @@ fn program_output(cx: cx, testfile: str, lib_path: str, prog: str, cmdline: cmdline}; } +// Linux and mac don't require adjusting the library search path +#[cfg(target_os = "linux")] +#[cfg(target_os = "macos")] +fn make_cmdline(_libpath: str, prog: str, args: [str]) -> str { + #fmt["%s %s", prog, str::connect(args, " ")] +} + +#[cfg(target_os = "win32")] fn make_cmdline(libpath: str, prog: str, args: [str]) -> str { #fmt["%s %s %s", lib_path_cmd_prefix(libpath), prog, str::connect(args, " ")]