From 71b838d03533d1dbd94553f21ad4e8e439365d04 Mon Sep 17 00:00:00 2001 From: Daniel Santos Date: Mon, 10 Apr 2017 17:45:35 +0000 Subject: [PATCH] re PR testsuite/79867 ([cygwin] LD_LIBRARY_PATH ignored, contaminating (nearly?) all test results) 2017-04-10 Daniel Santos PR testsuite/79867 * lib/target-libpath.exp: Merge in cygwin fix from libffi. From-SVN: r246813 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/lib/target-libpath.exp | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8df659e25e1..b87d0eeedde 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-04-10 Daniel Santos + + PR testsuite/79867 + * lib/target-libpath.exp: Merge in cygwin fix from libffi. + 2017-04-10 Marek Polacek PR sanitizer/80348 diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp index 9b3e201ed68..b6d01b31016 100644 --- a/gcc/testsuite/lib/target-libpath.exp +++ b/gcc/testsuite/lib/target-libpath.exp @@ -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 + } } ####################################### -- 2.30.2