From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id mOpfDiJA1l+WNAAAWB0awg (envelope-from ) for ; Sun, 13 Dec 2020 11:24:02 -0500 Received: by simark.ca (Postfix, from userid 112) id 38D131F0AA; Sun, 13 Dec 2020 11:24:02 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI,RDNS_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B43C91E965 for ; Sun, 13 Dec 2020 11:24:01 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5DEB23857004; Sun, 13 Dec 2020 16:24:01 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 549993857004 for ; Sun, 13 Dec 2020 16:23:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 549993857004 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6A8BEAC10; Sun, 13 Dec 2020 16:23:57 +0000 (UTC) Subject: Re: [PATCH][gdb/testsuite] Fix gdb.base/endianity.exp with gcc-4.8 To: Joel Brobecker References: <20201210152945.GA16462@delia> <20201213135632.GE366101@adacore.com> From: Tom de Vries Message-ID: <57aa2ba0-4590-a901-8de9-7f916f02ae1a@suse.de> Date: Sun, 13 Dec 2020 17:23:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201213135632.GE366101@adacore.com> Content-Type: multipart/mixed; boundary="------------5B45F78B987449C4358D2AAF" Content-Language: en-US X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" This is a multi-part message in MIME format. --------------5B45F78B987449C4358D2AAF Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 12/13/20 2:56 PM, Joel Brobecker wrote: > Hi Tom, > >> When running test-case gdb.base/endianity.exp using gcc-4.8, we get: >> ... >> (gdb) x/x &o.v^M >> 0x7fffffffd120: 0x00000004^M >> (gdb) XFAIL: gdb.base/endianity.exp: x/x &o.v >> x/xh &o.w^M >> 0x7fffffffd124: 0x0003^M >> (gdb) FAIL: gdb.base/endianity.exp: x/xh &o.w >> ... >> >> The gcc 4.8 compiler does not support the scalar_storage_order attribute, so >> the testcase is compiled without that attribute, and the expected results are >> different. >> >> This is why there's the first XFAIL, and we could xfail the second FAIL for the >> same reason. >> >> Instead, fix this by adapting the expected values based on whether the attribute >> has been used in endianity.c. >> >> Also, remove hard-coding of the byte order in the expected memory printing. >> >> Tested on x86_64-linux, with gcc-4.8, gcc-7, and clang-10. >> >> >> Any comments? > > For me, the whole point of this testcase is to test SSO, so if > the compiler doesn't support it, the testcase loses its value > entirely (to my eyes anyway). As a result of this, I dont' think > bringing the extra complexity that you are suggesting is bringing > any value -- I might argue that it's now hard to read the testcase > an understand what we're trying to do (sorry!). > Np, that's also good feedback, thanks. > In my opinion, rather than an XFAIL, we should just only do > the second half of the testcase if the compiler supports it, > than xfailing the tests. So I would do: > > if { ([test_compiler_info {gcc-[0-5]-*}] || ![test_compiler_info gcc*]) } { > # The rest of the testcase requires Scalar Storage Order support. > # This compiler does not support it, so skip the rest. > return > } > Ack, committed as below. Thanks, - Tom --------------5B45F78B987449C4358D2AAF Content-Type: text/x-patch; charset=UTF-8; name="0001-gdb-testsuite-Fix-gdb.base-endianity.exp-with-gcc-4.8.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename*0="0001-gdb-testsuite-Fix-gdb.base-endianity.exp-with-gcc-4.8.p"; filename*1="atch" [gdb/testsuite] Fix gdb.base/endianity.exp with gcc-4.8 When running test-case gdb.base/endianity.exp using gcc-4.8, we get: ... (gdb) x/x &o.v^M 0x7fffffffd120: 0x00000004^M (gdb) XFAIL: gdb.base/endianity.exp: x/x &o.v x/xh &o.w^M 0x7fffffffd124: 0x0003^M (gdb) FAIL: gdb.base/endianity.exp: x/xh &o.w ... The gcc 4.8 compiler does not support the scalar_storage_order attribute, so the testcase is compiled without that attribute, and the expected results are different. Fix this by rather than xfailing, skipping the tests if the compiler does not support the scalar_storage_order attribute. Tested on x86_64-linux, with gcc-4.8, gcc-7, and clang-10. gdb/testsuite/ChangeLog: 2020-12-10 Tom de Vries PR testsuite/26953 * gdb.base/endianity.exp: Skip tests requiring scalar_storage_order attribute support if compiler doesn't support it. --- gdb/testsuite/gdb.base/endianity.exp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/gdb.base/endianity.exp b/gdb/testsuite/gdb.base/endianity.exp index 2fa9ed3bf1..4520799d04 100644 --- a/gdb/testsuite/gdb.base/endianity.exp +++ b/gdb/testsuite/gdb.base/endianity.exp @@ -34,12 +34,15 @@ gdb_test "print o.x = 2" "= 2" gdb_test "print o.f = 1.5" "= 1.5" gdb_test "print o.d = -23.125" "= -23.125" -# scalar_storage_order requires gcc >= 6 +gdb_test "print o" "= {v = 4, w = 3, x = 2, f = 1.5, cplx = 1.25 \\+ 7.25i, d = -23.125}" \ + "print o after assignment" + if { ([test_compiler_info {gcc-[0-5]-*}] || ![test_compiler_info gcc*]) } { - setup_xfail "*-*-*" + # The rest of the testcase requires Scalar Storage Order support. + # This compiler does not support it, so skip the rest. + return -1 } + gdb_test "x/x &o.v" "0x04000000" gdb_test "x/xh &o.w" "0x0300" -gdb_test "print o" "= {v = 4, w = 3, x = 2, f = 1.5, cplx = 1.25 \\+ 7.25i, d = -23.125}" \ - "print o after assignment" --------------5B45F78B987449C4358D2AAF--