re PR testsuite/79867 ([cygwin] LD_LIBRARY_PATH ignored, contaminating (nearly?) all test results)

2017-04-10  Daniel Santos <daniel.santos@pobox.com>

	PR testsuite/79867
	* lib/target-libpath.exp: Merge in cygwin fix from libffi.

From-SVN: r246813
This commit is contained in:
Daniel Santos 2017-04-10 17:45:35 +00:00 committed by Mike Stump
parent 98a7a34e26
commit 71b838d035
2 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2017-04-10 Daniel Santos <daniel.santos@pobox.com>
PR testsuite/79867
* lib/target-libpath.exp: Merge in cygwin fix from libffi.
2017-04-10 Marek Polacek <polacek@redhat.com>
PR sanitizer/80348

View File

@ -23,6 +23,7 @@ set orig_shlib_path_saved 0
set orig_ld_library_path_32_saved 0
set orig_ld_library_path_64_saved 0
set orig_dyld_library_path_saved 0
set orig_path_saved 0
set orig_gcc_exec_prefix_saved 0
set orig_gcc_exec_prefix_checked 0
@ -55,6 +56,7 @@ proc set_ld_library_path_env_vars { } {
global orig_ld_library_path_32_saved
global orig_ld_library_path_64_saved
global orig_dyld_library_path_saved
global orig_path_saved
global orig_gcc_exec_prefix_saved
global orig_gcc_exec_prefix_checked
global orig_ld_library_path
@ -63,6 +65,7 @@ proc set_ld_library_path_env_vars { } {
global orig_ld_library_path_32
global orig_ld_library_path_64
global orig_dyld_library_path
global orig_path
global orig_gcc_exec_prefix
global env
@ -110,6 +113,10 @@ proc set_ld_library_path_env_vars { } {
set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)"
set orig_dyld_library_path_saved 1
}
if [info exists env(PATH)] {
set orig_path "$env(PATH)"
set orig_path_saved 1
}
}
# We need to set ld library path in the environment. Currently,
@ -164,6 +171,13 @@ proc set_ld_library_path_env_vars { } {
} else {
setenv DYLD_LIBRARY_PATH "$ld_library_path"
}
if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
if { $orig_path_saved } {
setenv PATH "$ld_library_path:$orig_path"
} else {
setenv PATH "$ld_library_path"
}
}
verbose -log "LD_LIBRARY_PATH=[getenv LD_LIBRARY_PATH]"
verbose -log "LD_RUN_PATH=[getenv LD_RUN_PATH]"
@ -201,12 +215,14 @@ proc restore_ld_library_path_env_vars { } {
global orig_ld_library_path_32_saved
global orig_ld_library_path_64_saved
global orig_dyld_library_path_saved
global orig_path_saved
global orig_ld_library_path
global orig_ld_run_path
global orig_shlib_path
global orig_ld_library_path_32
global orig_ld_library_path_64
global orig_dyld_library_path
global orig_path
global env
restore_gcc_exec_prefix_env_var
@ -245,6 +261,11 @@ proc restore_ld_library_path_env_vars { } {
} elseif [info exists env(DYLD_LIBRARY_PATH)] {
unsetenv DYLD_LIBRARY_PATH
}
if { $orig_path_saved } {
setenv PATH "$orig_path"
} elseif [info exists env(PATH)] {
unsetenv PATH
}
}
#######################################