From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KgDtA+/cs2G4ZgAAWB0awg (envelope-from ) for ; Fri, 10 Dec 2021 18:04:15 -0500 Received: by simark.ca (Postfix, from userid 112) id F218A1F0D0; Fri, 10 Dec 2021 18:04:14 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.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 8D9EC1EDEE for ; Fri, 10 Dec 2021 18:04:13 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 054E63857C69 for ; Fri, 10 Dec 2021 23:04:13 +0000 (GMT) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by sourceware.org (Postfix) with ESMTPS id 0E476385801D for ; Fri, 10 Dec 2021 23:04:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0E476385801D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f48.google.com with SMTP id p18so7932957wmq.5 for ; Fri, 10 Dec 2021 15:04:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=1WDJXcAEk5v6iLOaQ/qo5s1mC8wXh0MXsoARsYEP9kM=; b=Qeei5t0/+V1I8Zcyr6AwjAYZlienTn6JmouUVt6Ng+Zh53vVLjZlCYfbsT/9huX7me HbxTNifVo2CCXXKkzsOxXKYNqPiBodtMZG9LnuNe6lxq/KDsko97YidwRwIbAF8naEnp 4hU5VSchWkjiujESWAGvzj8FBM6mlp+f9Ceq5rCUC98siyG7H0XyA0CoJcinIknaEp7y 66dDHWQ42cfL+CB43ny7QxyoeWbxJgpkSljeiHYOP4qO8ZwNrH3HdJxWbD/U4HOPZHBo FUYmFcfCYgMrmzBX7zOtiy3wE2lR0aI6C6rK21J/7hoF1y7jXntzLIsoxMgYUnkKTbf+ OoSA== X-Gm-Message-State: AOAM531bl93lSjKa87jTbfwzKhLmb2iuX/YmjaeH+jb9KcDpJTSyyknm FXq/PUIZ1ULnVtSnQtA7oCc= X-Google-Smtp-Source: ABdhPJxq8f5kh174hKo89nAZv5HQwlG4J+gZG9pTXKVetXXvKBTqfJ2TzE7x+XZN7sqKVXs7P3GwgQ== X-Received: by 2002:a7b:c145:: with SMTP id z5mr19816254wmi.131.1639177439796; Fri, 10 Dec 2021 15:03:59 -0800 (PST) Received: from ?IPV6:2001:8a0:f912:1a00:d3db:ac91:4b9e:1449? ([2001:8a0:f912:1a00:d3db:ac91:4b9e:1449]) by smtp.gmail.com with ESMTPSA id y6sm3820587wrh.18.2021.12.10.15.03.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Dec 2021 15:03:58 -0800 (PST) Message-ID: <0e6cef60-84ed-011b-8113-bc4bac1cce0e@palves.net> Date: Fri, 10 Dec 2021 23:03:57 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH 13/29] gdb/testsuite: Remove duplicates from gdb.base/dfp-exprs.exp Content-Language: en-US To: Lancelot SIX , gdb-patches@sourceware.org References: <20211121175636.779325-1-lsix@lancelotsix.com> <20211121175636.779325-14-lsix@lancelotsix.com> From: Pedro Alves In-Reply-To: <20211121175636.779325-14-lsix@lancelotsix.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2021-11-21 17:56, Lancelot SIX via Gdb-patches wrote: > 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 > > Fix by removing the duplicated test. > > Tested on x86_64-linux. > --- > gdb/testsuite/gdb.base/dfp-exprs.exp | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/gdb/testsuite/gdb.base/dfp-exprs.exp b/gdb/testsuite/gdb.base/dfp-exprs.exp > index 355b8f04a1f..cce743d3ffe 100644 > --- a/gdb/testsuite/gdb.base/dfp-exprs.exp > +++ b/gdb/testsuite/gdb.base/dfp-exprs.exp > @@ -154,7 +154,6 @@ proc test_dfp_arithmetic_expressions {} { > 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" 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. > gdb_test "p 1.2df > 1" " = 1" > gdb_test "p 1.2dl > 2" " = 0" > gdb_test "p 2 > 1.2dd" " = 1" > >From fe8eed9a83b6c5608bc3b7d496a438628e7fc3a5 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 10 Dec 2021 22:41:54 +0000 Subject: [PATCH] Programmatic 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 {} { base-commit: 43f7c3581f5c615b65f7c15c298c9be20c2597cf -- 2.26.2