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

Message ID 20240918120729.902296-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 fail Test failed

Commit Message

Rohr, Stephan Sept. 18, 2024, 12:07 p.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 | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
  

Comments

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

Stephan> +set ld_library_path $::env(LD_LIBRARY_PATH)
 
I think this will error if LD_LIBRARY_PATH isn't already in the
environment:

murgatroyd. tclsh
% global env
% set env(NOSUCHVAR) 
can't read "env(NOSUCHVAR)": no such variable

Tom
  

Patch

diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug.exp b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
index 14a0c45c7d9..5a42342045a 100644
--- a/gdb/testsuite/gdb.threads/tls-sepdebug.exp
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
@@ -65,16 +65,17 @@  if  { [gdb_compile_pthreads \
 }
 
 set absdir [file dirname [standard_output_file ${binsharedbase}]]
+set ld_library_path $::env(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}