[v2,1/1] testsuite, threads: fix LD_LIBRARY_PATH in 'tls-sepdebug.exp'

Message ID 20240923074242.6253-2-stephan.rohr@intel.com
State New
Headers
Series fix LD_LIBRARY_PATH in 'tls-sepdebug.exp' |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed

Commit Message

Rohr, Stephan Sept. 23, 2024, 7:42 a.m. UTC
  From: "Rohr, Stephan" <stephan.rohr@intel.com>

Some compilers (e.g. the Intel compiler) may dynamically link against
dependencies.  The test uses the 'set env' command to set the
LD_LIBRARY_PATH to a test specific value.  Update the 'set env' command
to also provide the users LD_LIBARY_PATH to gdb.
---
 gdb/testsuite/gdb.threads/tls-sepdebug.exp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
  

Comments

Tom Tromey Sept. 23, 2024, 4:35 p.m. UTC | #1
>>>>> "Stephan" == Stephan Rohr <stephan.rohr@intel.com> writes:

Stephan> From: "Rohr, Stephan" <stephan.rohr@intel.com>
Stephan> Some compilers (e.g. the Intel compiler) may dynamically link against
Stephan> dependencies.  The test uses the 'set env' command to set the
Stephan> LD_LIBRARY_PATH to a test specific value.  Update the 'set env' command
Stephan> to also provide the users LD_LIBARY_PATH to gdb.

Ok.  Thank you.
Approved-By: Tom Tromey <tom@tromey.com>

Tom
  

Patch

diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug.exp b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
index 14a0c45c7d9..4a322e05fc0 100644
--- a/gdb/testsuite/gdb.threads/tls-sepdebug.exp
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
@@ -65,16 +65,21 @@  if  { [gdb_compile_pthreads \
 }
 
 set absdir [file dirname [standard_output_file ${binsharedbase}]]
+if { [info exists ::env(LD_LIBRARY_PATH)] } {
+    set ld_library_path $::env(LD_LIBRARY_PATH)
+} else {
+    set ld_library_path ""
+}
 
-foreach ld_library_path [list $absdir [relative_filename [pwd] $absdir]] \
+foreach library_path [list $absdir [relative_filename [pwd] $absdir]] \
 	name { absolute relative } {
     with_test_prefix $name {
 
 	# Restart, but defer loading until after setting LD_LIBRARY_PATH.
 	clean_restart
-
-	gdb_test_no_output "set env LD_LIBRARY_PATH=$ld_library_path" \
-			   "set env LD_LIBRARY_PATH"
+	gdb_test_no_output \
+	    "set env LD_LIBRARY_PATH=$ld_library_path:$library_path" \
+	    "set env LD_LIBRARY_PATH"
 
 	gdb_load ${binmainfile}