forked from Imagelibrary/binutils-gdb
I add two new targets (check-extra, check-install) for gprofng testing: `make check` runs sanity testing for gprofng and takes ~30 secunds. `make check-extra` runs all gprofng tests and takes ~20 minutus. `make check-install` runs all gprofng tests and uses gprofng installation. On aarch64, there are unwind problems in libgp-collector.so. I set ACCT_FILTER to temporarily ignore problematic functions. gprofng/ChangeLog 2023-05-25 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/29470 * Makefile.am: Add check-extra, check-install. * Makefile.in: Rebuild * testsuite/config/default.exp: Set the GPROFNG variable. * testsuite/gprofng.display/display.exp: Updated the test list. * testsuite/gprofng.display/jsynprog/Intface.java: Correct copyright. * testsuite/gprofng.display/jsynprog/Launcher.java: Likewise. * testsuite/gprofng.display/jsynprog/Makefile: Likewise. * testsuite/gprofng.display/jsynprog/Routine.java: Likewise. * testsuite/gprofng.display/jsynprog/Sub_Routine.java: Likewise. * testsuite/gprofng.display/jsynprog/cloop.cc: Likewise. * testsuite/gprofng.display/jsynprog/jsynprog.h: Likewise. * testsuite/gprofng.display/jsynprog/jsynprog.java: Correct copyright. Add the -j option to run the selected functions. * testsuite/gprofng.display/synprog/check_results.pl: Remove unused environment variable. * testsuite/gprofng.display/synprog/synprog.c: Updated DEFAULT_COMMAND. * testsuite/lib/Makefile.skel: Apply $(ACCT_FILTER). * testsuite/lib/acct.pm: Ignore errors when $(ACCT_FILTER) is set. * testsuite/lib/display-lib.exp: Add TARGET_FLAGS in make_args.
107 lines
3.6 KiB
Plaintext
107 lines
3.6 KiB
Plaintext
# Support routines for display-testing machinery in gprofng testsuite.
|
|
# Copyright (C) 1994-2023 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.
|
|
|
|
# Run the COMMAND on the host and return a list of the form
|
|
# { exit-status OUTPUT }.
|
|
proc run_native_host_cmd { command } {
|
|
global link_output
|
|
global ld
|
|
|
|
verbose -log "$command"
|
|
set run_output ""
|
|
try {
|
|
set run_output [exec "sh" "-c" "$command" "2>@1"]
|
|
set status 0
|
|
} trap CHILDSTATUS {results options} {
|
|
set status [lindex [dict get $options -errorcode] 2]
|
|
set run_output $results
|
|
}
|
|
regsub "\n$" $run_output "" run_output
|
|
if { [lindex $status 0] != 0 && [string match "" $run_output] } then {
|
|
append run_output "child process exited abnormally"
|
|
}
|
|
|
|
if [string match "" $run_output] then {
|
|
return ""
|
|
}
|
|
|
|
return [list [lindex $status 0] $run_output]
|
|
}
|
|
|
|
# Run a display test in DIR.
|
|
# Unanswered questions: do we want to cycle through compilation flags,
|
|
# display options, collect flags, app options? Do we want these to be
|
|
# set on a per-app basis? (If so, they should probably be driven by a
|
|
# file in the test dir.)
|
|
proc run_display_test { dir cflags gprofflags tflags } {
|
|
global srcdir MAKE CC CFLAGS LDFLAGS LIBS BUILDDIR
|
|
set stripped [string map {" " ""} $dir]
|
|
set testdir [string map {" " ""} "$dir.$cflags,$gprofflags"]
|
|
set sdir "$srcdir/gprofng.display/$dir"
|
|
set tdir "tmpdir/$testdir"
|
|
send_log "create dir: $tdir\n"
|
|
set output [run_native_host_cmd "mkdir -p $tdir"]
|
|
set gprofng $::env(GPROFNG)
|
|
|
|
set fd [open "$tdir/rules.txt" "w"]
|
|
switch -regexp -- $testdir {
|
|
{-p,on.*-h,on} {
|
|
set DISPLAY_FLAGS "-metrics i.totalcpu:i.cycles -func"
|
|
puts $fd "Cpu, 2, 0\n"
|
|
puts $fd "Cycles, 2, 1\n"
|
|
}
|
|
{-h,on} {
|
|
set DISPLAY_FLAGS "-metrics i.cycles -func"
|
|
puts $fd "Cycles, 2, 0\n"
|
|
}
|
|
default {
|
|
set DISPLAY_FLAGS "-metrics i.totalcpu -func"
|
|
puts $fd "Cpu, 2, 0\n"
|
|
}
|
|
}
|
|
close $fd
|
|
|
|
set make_args "-f $sdir/Makefile srcdir=\"$sdir\" builddir=\"$BUILDDIR\" \
|
|
VPATH=\"$dir\" CC=\"$CC\" CFLAGS=\"$cflags\" LDFLAGS=\"$LDFLAGS\" \
|
|
TARGET_FLAGS=\"$tflags\" \
|
|
DISPLAY_FLAGS=\"$DISPLAY_FLAGS\" \
|
|
COLLECT_FLAGS=\"$gprofflags\" GPROFNG=\"$gprofng\" MAKE=\"$MAKE\""
|
|
set output [run_native_host_cmd "cd $tdir && $MAKE $make_args all"]
|
|
# send_log "run_native_host_cmd output:\n$output\n"
|
|
if { [lindex $output 0] != 0 } then {
|
|
set out [lindex $output 1]
|
|
if {[file exists "$tdir/diff.out"]} then {
|
|
send_log "comparison of results in $dir failed:\n$out\n"
|
|
set pltf [exec uname -i]
|
|
if { $pltf == "aarch64" } {
|
|
xfail $dir
|
|
return 0
|
|
}
|
|
perror "comparison of results in $dir failed"
|
|
} else {
|
|
send_log "compilation of test program in $dir failed:\n$out\n"
|
|
perror "compilation of test program in $dir failed"
|
|
}
|
|
fail $dir
|
|
return 0
|
|
}
|
|
pass $dir
|
|
}
|