From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2jVCIXYwuWEDGgAAWB0awg (envelope-from ) for ; Tue, 14 Dec 2021 19:01:58 -0500 Received: by simark.ca (Postfix, from userid 112) id 765811F0D2; Tue, 14 Dec 2021 19:01:58 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [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 314EC1F0BD for ; Tue, 14 Dec 2021 19:01:57 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 79FA3385840B for ; Wed, 15 Dec 2021 00:01:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 79FA3385840B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1639526516; bh=JiCEawIuiMHV2xvPACXoGn1dKxlYRSevV8veh2mYBlg=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=r4tsFme1tjAU567Cg5MJfAqK4l4UatDXJvocXK3enVNUc86JDQti8Pi0hZlJmvIqo OxaJ3OGU2obFkwgVpsD3epELcV8TbVWkwaHEPxM7UlKtT3QBm/keaNuoNHVZltgMZj JfgHCUv1q0I8KcwvJajRXG7nZ1gjfB+wl+TcT/Os= Received: from lndn.lancelotsix.com (lndn.lancelotsix.com [51.195.220.111]) by sourceware.org (Postfix) with ESMTPS id D57343858D28 for ; Wed, 15 Dec 2021 00:01:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D57343858D28 Received: from Plymouth (unknown [IPv6:2a02:390:9086:0:c851:d496:b69a:1c3c]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 1A12E80D5D; Wed, 15 Dec 2021 00:01:35 +0000 (UTC) Date: Wed, 15 Dec 2021 00:01:31 +0000 To: Pedro Alves Subject: Re: [PATCH 13/29] gdb/testsuite: Remove duplicates from gdb.base/dfp-exprs.exp Message-ID: <20211215000131.lvdpsdwcrlwyktgh@Plymouth> References: <20211121175636.779325-1-lsix@lancelotsix.com> <20211121175636.779325-14-lsix@lancelotsix.com> <0e6cef60-84ed-011b-8113-bc4bac1cce0e@palves.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0e6cef60-84ed-011b-8113-bc4bac1cce0e@palves.net> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Wed, 15 Dec 2021 00:01:35 +0000 (UTC) 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: , From: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" > Hmm, it's not super obvious to me what the intention was here. For one, I can't spot a pattern in > the sequence here. Am I missing it? > > If we alpha sort the lines (sort-lines in emacs), and then add the missing combinations, we end up with: > > # Keep the list alpha sorted. > gdb_test "p 1.2dd < 1.3dd" " = 1" > gdb_test "p 1.2dd < 1.3df" " = 1" > gdb_test "p 1.2dd < 1.3dl" " = 1" > gdb_test "p 1.2df < 1.3dd" " = 1" > gdb_test "p 1.2df < 1.3df" " = 1" > gdb_test "p 1.2df < 1.3dl" " = 1" > gdb_test "p 1.2dl < 1.3dd" " = 1" > gdb_test "p 1.2dl < 1.3df" " = 1" > gdb_test "p 1.2dl < 1.3dl" " = 1" > > But then, the == tests are also missing some combinations. I think that if we do this > programmatically with a for loop, we can exercise all the combinations in much clearer code, > removing the need to eyeball for all suffixes. See patch below. > > I've also added a lot more combinations, testing all comparison operators comprehensively. > > The result is 262 unique tests vs 104 today. > > Let me know what you think. > Hi, I actually like your approach very much. I goes beyond what I was looking for when I started this series, but I see no reason not to go the extra step. I am not sure if there an intention to be exhaustive in the test as it was. I have replaced my previous patch with yours locally (after adjusting the commit message, and re-testing). Thanks! Lancelot. --- >From 93433e04fb6ae38addf744b6b99602d689781f5a Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 10 Dec 2021 22:41:54 +0000 Subject: [PATCH] gdb/testsuite: Remove duplicates from gdb.base/dfp-exprs.exp When I run the testsuite, I have: Running ../gdb/testsuite/gdb.base/dfp-exprs.exp ... DUPLICATE: gdb.base/dfp-exprs.exp: p 1.2dl < 1.3df Replace hand-written tests checking various comparison operators between various decimal floating point types with a loop to programmatically generate all the combinations. This removes the need to eyeball for all suffixes, which lead to the original duplication. Also add a lot more combinations, testing all comparison operators comprehensively. The result is 262 unique tests vs 104 before this patch. Tested on x86_86-linux. Change-Id: Id215a3d610aa8e032bf06ee160b5e3aed4a92d1e --- gdb/testsuite/gdb.base/dfp-exprs.exp | 94 +++++++++++++++++----------- 1 file changed, 57 insertions(+), 37 deletions(-) diff --git a/gdb/testsuite/gdb.base/dfp-exprs.exp b/gdb/testsuite/gdb.base/dfp-exprs.exp index 355b8f04a1f..e735e6df6d8 100644 --- a/gdb/testsuite/gdb.base/dfp-exprs.exp +++ b/gdb/testsuite/gdb.base/dfp-exprs.exp @@ -122,43 +122,63 @@ proc test_dfp_arithmetic_expressions {} { gdb_test "p 1.2df + 1.2f" "Mixing decimal floating types with other floating types is not allowed." # Test other operations with DFP operands - gdb_test "p !0.df" " = 1" - gdb_test "p !0.dd" " = 1" - gdb_test "p !0.dl" " = 1" - gdb_test "p !0.5df" " = 0" - gdb_test "p !0.5dd" " = 0" - gdb_test "p !0.5dl" " = 0" - - gdb_test "p 1.2df == 1.2df" " = 1" - gdb_test "p 1.2df == 1.2dd" " = 1" - gdb_test "p 1.2df == 1.2dl" " = 1" - gdb_test "p 1.2dd == 1.2df" " = 1" - gdb_test "p 1.2dd == 1.2dl" " = 1" - gdb_test "p 1.2dl == 1.2df" " = 1" - gdb_test "p 1.2dl == 1.2dd" " = 1" - gdb_test "p 1.2df == 1.3df" " = 0" - gdb_test "p 1.2df == 1.3dd" " = 0" - gdb_test "p 1.2df == 1.3dl" " = 0" - gdb_test "p 1.2dd == 1.3df" " = 0" - gdb_test "p 1.2dd == 1.3dl" " = 0" - gdb_test "p 1.2dl == 1.3df" " = 0" - gdb_test "p 1.2dl == 1.3dd" " = 0" - - gdb_test "p +1.2df" " = 1.2" - gdb_test "p +1.2dd" " = 1.2" - gdb_test "p +1.2dl" " = 1.2" - - gdb_test "p 1.2df < 1.3df" " = 1" - gdb_test "p 1.2df < 1.3dd" " = 1" - gdb_test "p 1.2dl < 1.3df" " = 1" - gdb_test "p 1.2dd < 1.3dd" " = 1" - gdb_test "p 1.2dd < 1.3dl" " = 1" - gdb_test "p 1.2dl < 1.3dl" " = 1" - gdb_test "p 1.2dl < 1.3df" " = 1" - gdb_test "p 1.2df > 1" " = 1" - gdb_test "p 1.2dl > 2" " = 0" - gdb_test "p 2 > 1.2dd" " = 1" - gdb_test "p 2 > 3.1dl" " = 0" + + set dsuffix {"dd" "df" "dl"} + + foreach l $dsuffix { + foreach r $dsuffix { + gdb_test "p 1.2${l} == 1.2${r}" " = 1" + gdb_test "p 1.2${l} == 1.3${r}" " = 0" + + gdb_test "p 1.2${l} < 1.2${r}" " = 0" + gdb_test "p 1.2${l} < 1.3${r}" " = 1" + gdb_test "p 1.3${l} < 1.2${r}" " = 0" + + gdb_test "p 1.2${l} > 1.2${r}" " = 0" + gdb_test "p 1.2${l} > 1.3${r}" " = 0" + gdb_test "p 1.3${l} > 1.2${r}" " = 1" + + gdb_test "p 1.2${l} <= 1.2${r}" " = 1" + gdb_test "p 1.2${l} <= 1.3${r}" " = 1" + gdb_test "p 1.3${l} <= 1.2${r}" " = 0" + + gdb_test "p 1.2${l} >= 1.2${r}" " = 1" + gdb_test "p 1.2${l} >= 1.3${r}" " = 0" + gdb_test "p 1.3${l} >= 1.2${r}" " = 1" + } + + gdb_test "p !0.${l}" " = 1" + gdb_test "p !0.5${l}" " = 0" + + gdb_test "p +1.2${l}" " = 1.2" + + # This checks GDB doesn't convert to int and rounds up/down. + gdb_test "p 1.2${l} == 1" " = 0" + gdb_test "p 1.2${l} == 2" " = 0" + + gdb_test "p 1.2${l} == 1.2" \ + "Mixing decimal floating types with other floating types is not allowed\\." + + gdb_test "p 1.2${l} > 1" " = 1" + gdb_test "p 1.2${l} > 2" " = 0" + gdb_test "p 1.2${l} >= 1" " = 1" + gdb_test "p 1.2${l} >= 2" " = 0" + + gdb_test "p 1.2${l} < 1" " = 0" + gdb_test "p 1.2${l} < 2" " = 1" + gdb_test "p 1.2${l} <= 1" " = 0" + gdb_test "p 1.2${l} <= 2" " = 1" + + gdb_test "p 1 < 1.2${l}" " = 1" + gdb_test "p 2 < 1.2${l}" " = 0" + gdb_test "p 1 <= 1.2${l}" " = 1" + gdb_test "p 2 <= 1.2${l}" " = 0" + + gdb_test "p 1 > 1.2${l}" " = 0" + gdb_test "p 2 > 1.2${l}" " = 1" + gdb_test "p 1 >= 1.2${l}" " = 0" + gdb_test "p 2 >= 1.2${l}" " = 1" + } } proc test_dfp_conversions {} {