From patchwork Thu Sep 27 02:20:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 29558 Received: (qmail 120246 invoked by alias); 27 Sep 2018 02:20:23 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 119578 invoked by uid 89); 27 Sep 2018 02:20:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Sep 2018 02:20:20 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1g5LuZ-0005X5-Up from Sandra_Loosemore@mentor.com ; Wed, 26 Sep 2018 19:20:15 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Wed, 26 Sep 2018 19:20:13 -0700 Subject: Re: [patch, testsuite] Skip gnu-ifunc tests if building the testcase fails To: Rainer Orth CC: "gdb-patches@sourceware.org" References: <0416cc5d-337b-82ae-5f37-07f28eaa35b3@codesourcery.com> From: Sandra Loosemore Message-ID: Date: Wed, 26 Sep 2018 20:20:10 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: On 09/26/2018 05:50 AM, Rainer Orth wrote: > Hi Sandra, > >> gdb.base/gnu-ifunc.exp doesn't fail gracefully on targets that don't >> support this feature -- on nios2-linux-gnu I've seen TCL errors from trying >> to copy the nonexistent shared library that fails to build to the target. > > I just tried the patch on Solaris which also doesn't have (and never > will have) ifunc support: unfortunately, there's still lots of noise in > gdb.sum: > > [snip] > > It would be good to further reduce this. > > Btw., shouldn't gdb.compile/compile-ifunc.exp get similar treatment? Yeah, although that test is broken for other reasons in my environment. >> I see that ld/testsuite/ld-ifunc/ifunc.exp explicitly lists all the targets >> where IFUNC is expected to work, but it seemed more maintainable to me to >> tweak these gdb tests to pay attention to the return status from trying to >> build the test cases. Is this OK to commit? > > gcc has gcc/testsuite/lib/target-supports.exp (check_ifunc_available) > instead, again a compile test instead of a hardcoded list. I wonder, > though, if it wouldn't be better to run such a check early in the two > gdb ifunc tests and skip them if that fails, rather than producing lots > of noise and UNSUPPORTED tests? Here's a revised patch that adapts the same compile test that gcc uses. Is this one OK? -Sandra commit 03ae8dd2f9d2812b8d2744e8d78a3f6c4c65ed9b Author: Sandra Loosemore Date: Wed Sep 26 19:14:14 2018 -0700 Skip ifunc tests if no target support. 2018-09-26 Sandra Loosemore * lib/gdb.exp (skip_ifunc_tests): New. * gdb.base/gnu-ifunc.exp: Skip if no ifunc support. Handle other compile failures. * gdb.compile/compile-ifunc.exp: Skip if no ifunc support. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 2b4b097..c30db8f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2018-09-26 Sandra Loosemore + + * lib/gdb.exp (skip_ifunc_tests): New. + * gdb.base/gnu-ifunc.exp: Skip if no ifunc support. Handle + other compile failures. + * gdb.compile/compile-ifunc.exp: Skip if no ifunc support. + 2018-09-26 Andrew Burgess * gdb.base/large-frame-1.c: New file. diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.exp b/gdb/testsuite/gdb.base/gnu-ifunc.exp index d6ec698..322de5a 100644 --- a/gdb/testsuite/gdb.base/gnu-ifunc.exp +++ b/gdb/testsuite/gdb.base/gnu-ifunc.exp @@ -17,6 +17,10 @@ if {[skip_shlib_tests]} { return 0 } +if {[skip_ifunc_tests]} { + return 0 +} + standard_testfile .c set staticexecutable ${testfile}-static set staticbinfile [standard_output_file ${staticexecutable}] @@ -365,9 +369,10 @@ proc misc_tests {resolver_attr resolver_debug final_debug} { foreach_with_prefix resolver_attr {0 1} { foreach_with_prefix resolver_debug {0 1} { foreach_with_prefix final_debug {0 1} { - build $resolver_attr $resolver_debug $final_debug - misc_tests $resolver_attr $resolver_debug $final_debug - set-break $resolver_attr $resolver_debug $final_debug + if { [build $resolver_attr $resolver_debug $final_debug] != 0 } { + misc_tests $resolver_attr $resolver_debug $final_debug + set-break $resolver_attr $resolver_debug $final_debug + } } } } diff --git a/gdb/testsuite/gdb.compile/compile-ifunc.exp b/gdb/testsuite/gdb.compile/compile-ifunc.exp index 979e391..bb3af4d 100644 --- a/gdb/testsuite/gdb.compile/compile-ifunc.exp +++ b/gdb/testsuite/gdb.compile/compile-ifunc.exp @@ -13,6 +13,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +if {[skip_ifunc_tests]} { + return 0 +} + standard_testfile with_test_prefix "nodebug" { diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index f32abfe..2cdc80a 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2842,6 +2842,34 @@ gdb_caching_proc has_int128_cxx { return [gdb_int128_helper c++] } +# Return true if the IFUNC feature is unsupported. +gdb_caching_proc skip_ifunc_tests { + # Set up, compile, and execute a test program. + # Include the current process ID in the file names to prevent conflicts + # with invocations for multiple testsuites. + set src [standard_temp_file ifunc[pid].c] + set obj [standard_temp_file ifunc[pid].o] + + verbose -log "checking for ifunc support" + gdb_produce_source $src { + extern void f_ (); + typedef void F (void); + F* g (void) { return &f_; } + void f () __attribute__ ((ifunc ("g"))); + } + + set lines [gdb_compile $src $obj object {quiet}] + file delete $src + file delete $obj + + if ![string match "" $lines] then { + verbose -log "ifunc testfile compilation failed" + return 1 + } + verbose -log "ifunc testfile compilation successful" + return 0 +} + # Return whether we should skip tests for showing inlined functions in # backtraces. Requires get_compiler_info and get_debug_format.