diff options
author | Vladimir Mezentsev <vladimir.mezentsev@oracle.com> | 2024-01-19 18:40:21 -0800 |
---|---|---|
committer | Andreas K. Hüttel <dilfridge@gentoo.org> | 2024-01-23 21:40:39 +0100 |
commit | 6b9c409e10475f9e1c71c8fe426cfac98be6d6d7 (patch) | |
tree | 621f42f534a4fd614aefc8146ac6f6ac12a0d508 | |
parent | aarch64-elf: FAIL: indirect call stub to BTI stub relaxation (diff) | |
download | binutils-gdb-gentoo/binutils-2.41.tar.gz binutils-gdb-gentoo/binutils-2.41.tar.bz2 binutils-gdb-gentoo/binutils-2.41.zip |
Fix 31252 gprofng causes testsuite parallel jobs failgentoo/binutils-2.41-5gentoo/binutils-2.41
Before running our tests, we made a fake installation into ./tmpdir.
This installation changes libopcodes.la in the build area.
Gas testing may fail if gas and gprofng tests are run in parallel.
I create a script to run gprofng. Inside this script, LD_LIBRARY_PATH,
GPROFNG_SYSCONFDIR are set.
putenv_libcollector_ld_misc() first uses $GPROFNG_PRELOAD_LIBDIRS to create
directories for SP_COLLECTOR_LIBRARY_PATH ($SP_COLLECTOR_LIBRARY_PATH is used
to set up LD_PRELOAD).
gprofng/ChangeLog
2024-01-19 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
PR gprofng/31252
PR gprofng/30808
* src/envsets.cc (putenv_libcollector_ld_misc): Use
$GPROFNG_PRELOAD_LIBDIRS first to build SP_COLLECTOR_LIBRARY_PATH.
* testsuite/config/default.exp: Create a script to run gprofng.
* testsuite/lib/display-lib.exp: Fix typo.
(cherry picked from commit 26f557af696726a8556bff12f54e4d05cd7a5034)
(cherry picked from commit 883df8a8c0afef2e1d0a17083d95001251f7d3f6)
-rw-r--r-- | gprofng/src/envsets.cc | 36 | ||||
-rw-r--r-- | gprofng/testsuite/config/default.exp | 37 | ||||
-rw-r--r-- | gprofng/testsuite/lib/display-lib.exp | 4 |
3 files changed, 57 insertions, 20 deletions
diff --git a/gprofng/src/envsets.cc b/gprofng/src/envsets.cc index 52d155160fc..40ee39dc328 100644 --- a/gprofng/src/envsets.cc +++ b/gprofng/src/envsets.cc @@ -146,20 +146,42 @@ collect::putenv_libcollector_ld_misc () // so that -agentlib:gp-collector works // and so that collect -F works with 32/64-bit mix of processes - // Set GPROFNG_PRELOAD_LIBDIRS + StringBuilder sb; + sb.append ("SP_COLLECTOR_LIBRARY_PATH="); + int len = sb.length (); + int cnt = 0; + char *fname; char *ev = getenv (GPROFNG_PRELOAD_LIBDIRS); char *libpath_list = NULL; - if (ev == NULL && settings->preload_libdirs == NULL) + if (ev) + { /* GPROFNG_PRELOAD_LIBDIRS is used only in the gprofng testing. + * Use these directories first. */ + ev = strdup (ev); + for (char *s = ev; s;) + { + char *s1 = strchr (s, ':'); + if (s1) + *(s1++) = 0; + fname = dbe_sprintf ("%s/%s", s, LIBGP_COLLECTOR); + if (access (fname, R_OK | F_OK) == 0) + { + if (++cnt != 1) + sb.append (':'); + sb.append (s); + } + free (fname); + s = s1; + } + free (ev); + ev = NULL; + } + if (settings->preload_libdirs == NULL) { settings->read_rc (false); ev = settings->preload_libdirs; } ev = dbe_strdup (ev); - StringBuilder sb; - sb.appendf ("%s=", "SP_COLLECTOR_LIBRARY_PATH"); - int len = sb.length (); - int cnt = 0; - char *fname = dbe_sprintf ("%s/%s/%s", LIBDIR, PACKAGE, LIBGP_COLLECTOR); + fname = dbe_sprintf ("%s/%s/%s", LIBDIR, PACKAGE, LIBGP_COLLECTOR); if (access (fname, R_OK | F_OK) == 0) { ++cnt; diff --git a/gprofng/testsuite/config/default.exp b/gprofng/testsuite/config/default.exp index c4a6588bb64..3828514c0b0 100644 --- a/gprofng/testsuite/config/default.exp +++ b/gprofng/testsuite/config/default.exp @@ -19,6 +19,7 @@ # MA 02110-1301, USA. # + # The "make check" target in the Makefile passes in # "CC=$(CC_FOR_TARGET)". But, if the user invokes runtest directly, # these flags may not be set. @@ -36,18 +37,32 @@ remote_exec host "sh -c \"rm -rf tmpdir; mkdir -p tmpdir\"" if { "$CHECK_TARGET" == "check-install" } { set ::env(GPROFNG) "$PREFIX/bin/gprofng" } else { - # Make a temporary install dir to run gprofng from, and point at it - remote_exec host "sh -c \"$MAKE -C .. install-gprofng MAKEFLAGS=program_transform_name= DESTDIR=$BUILDDIR/tmpdir/root\"" - set ::env(GPROFNG) [exec find $BUILDDIR/tmpdir -type f -name gprofng -perm -u+x | head -1] - - set x [exec find $BUILDDIR/tmpdir -type d -name gprofng | head -1] - set ::env(LD_LIBRARY_PATH) "$x:$x/.." - - set x [exec find $BUILDDIR/tmpdir -type f -name gprofng.rc | head -1] - set ::env(GPROFNG_SYSCONFDIR) [exec dirname $x] + set ld_library_path "${BUILDDIR}/src/.libs:${BUILDDIR}/libcollector/.libs" + set orig_ld_library_path "" + catch { set orig_ld_library_path $::env(LD_LIBRARY_PATH) } + if [file exists "${BUILDDIR}/../bfd/.libs/libbfd.a"] { + append ld_library_path ":${BUILDDIR}/../bfd/.libs" + } + if [file exists "${BUILDDIR}/../opcodes/.libs/libopcodes.a"] { + append ld_library_path ":${BUILDDIR}/../opcodes/.libs" + } + if [file exists "${BUILDDIR}/../libsframe/.libs/libsframe.a"] { + append ld_library_path ":${BUILDDIR}/../libsframe/.libs" + } + if [file exists "${BUILDDIR}/../libiberty/libiberty.a"] { + append ld_library_path ":${BUILDDIR}/../libiberty" + } - puts "### LD_LIBRARY_PATH: $env(LD_LIBRARY_PATH)" - puts "### GPROFNG_SYSCONFDIR: $env(GPROFNG_SYSCONFDIR)" + set f [open "gprofng_wraper" w+] + puts $f "#!/usr/bin/bash" + puts $f "LD_LIBRARY_PATH=$ld_library_path:$orig_ld_library_path" + puts $f "GPROFNG_SYSCONFDIR=$env(srcroot)/src" + puts $f "GPROFNG_PRELOAD_LIBDIRS=$BUILDDIR/libcollector/.libs" + puts $f "export LD_LIBRARY_PATH GPROFNG_SYSCONFDIR GPROFNG_PRELOAD_LIBDIRS" + puts $f "${BUILDDIR}/src/gprofng \"\$@\"" + close $f + file attributes gprofng_wraper -permissions +rx + set ::env(GPROFNG) "$BUILDDIR/gprofng_wraper" } puts "### GPROFNG: $env(GPROFNG)" diff --git a/gprofng/testsuite/lib/display-lib.exp b/gprofng/testsuite/lib/display-lib.exp index 50db4d5055a..6941d84761c 100644 --- a/gprofng/testsuite/lib/display-lib.exp +++ b/gprofng/testsuite/lib/display-lib.exp @@ -26,8 +26,8 @@ proc run_native_host_cmd { command } { verbose -log "$command" set run_output "" try { - send_log "% timeout $TEST_TIMEOUT sh -c '$command' 2>&1\n" - set run_output [exec "timeout" $TEST_TIMEOUT "sh" "-c" "$command" "2>&1"] + send_log "% timeout $TEST_TIMEOUT sh -c '$command' 2>@1\n" + set run_output [exec "timeout" $TEST_TIMEOUT "sh" "-c" "$command" "2>@1"] set status 0 } trap CHILDSTATUS {results options} { set status [lindex [dict get $options -errorcode] 2] |