aboutsummaryrefslogtreecommitdiff
path: root/gprofng/src
diff options
context:
space:
mode:
authorVladimir Mezentsev <vladimir.mezentsev@oracle.com>2024-01-19 18:40:21 -0800
committerVladimir Mezentsev <vladimir.mezentsev@oracle.com>2024-01-22 09:56:42 -0800
commitc37ad9ea1618969273b3a3b75278b0e96bb63a78 (patch)
treedc94b2e961e9d828fe08fc5a20f92afe1ee81f94 /gprofng/src
parente97522312be8a4e666aaa69ddd3f2107c1e38582 (diff)
downloadbinutils-c37ad9ea1618969273b3a3b75278b0e96bb63a78.zip
binutils-c37ad9ea1618969273b3a3b75278b0e96bb63a78.tar.gz
binutils-c37ad9ea1618969273b3a3b75278b0e96bb63a78.tar.bz2
Fix 31252 gprofng causes testsuite parallel jobs fail
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.
Diffstat (limited to 'gprofng/src')
-rw-r--r--gprofng/src/envsets.cc36
1 files changed, 29 insertions, 7 deletions
diff --git a/gprofng/src/envsets.cc b/gprofng/src/envsets.cc
index 1ca39ed..9cef745 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;