Vladimir Mezentsev 26f557af69 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.
2024-01-22 11:02:15 -08:00

72 lines
2.5 KiB
Plaintext

# Basic expect script for gprofng tests
# Copyright (C) 2021-2024 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# 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.
if {![info exists CC]} {
set CC [find_gcc]
}
if {![info exists CC_FOR_TARGET]} {
set CC_FOR_TARGET $CC
}
if {![info exists CFLAGS]} {
set CFLAGS "-g -O2"
}
remote_exec host "sh -c \"rm -rf tmpdir; mkdir -p tmpdir\""
if { "$CHECK_TARGET" == "check-install" } {
set ::env(GPROFNG) "$PREFIX/bin/gprofng"
} else {
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"
}
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)"
set TEST_TIMEOUT 300
load_lib display-lib.exp