# 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