From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id A7823385AC22 for ; Tue, 9 Aug 2022 13:34:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A7823385AC22 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E73DC116ED1; Tue, 9 Aug 2022 09:34:51 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id mQcxzdgEaoKW; Tue, 9 Aug 2022 09:34:51 -0400 (EDT) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id 9423E116C89; Tue, 9 Aug 2022 09:34:50 -0400 (EDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 279DYZxH2212220 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 9 Aug 2022 10:34:38 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Cc: Jeremy Bennett , Craig Blackmore , Graham Markall , Martin Jambor , Jan Hubicka , Richard Biener , Jim Wilson Subject: Re: [PATCH v2 02/10] Introduce strub: torture tests for C and C++ Organization: Free thinker, does not speak for AdaCore References: Errors-To: aoliva@lxoliva.fsfla.org Date: Tue, 09 Aug 2022 10:34:35 -0300 In-Reply-To: (Alexandre Oliva's message of "Fri, 29 Jul 2022 03:25:15 -0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2022 13:34:56 -0000 Ping? https://gcc.gnu.org/pipermail/gcc-patches/2022-July/599011.html Here's an incremental patch for some of these tests, that avoids some relatively rare spurious failures. diff --git a/gcc/testsuite/c-c++-common/torture/strub-run1.c b/gcc/testsuite/c-c++-common/torture/strub-run1.c index b24a1c7a345fa..7458b3fb54da5 100644 --- a/gcc/testsuite/c-c++-common/torture/strub-run1.c +++ b/gcc/testsuite/c-c++-common/torture/strub-run1.c @@ -80,11 +80,16 @@ internal () int main () { - if (!look_for_string (callable ())) - __builtin_abort (); - if (look_for_string (at_calls ())) - __builtin_abort (); - if (look_for_string (internal ())) - __builtin_abort (); + /* Since these test check stack contents above the top of the stack, an + unexpected asynchronous signal or interrupt might overwrite the bits we + expect to find and cause spurious fails. Tolerate one such overall + spurious fail by retrying. */ + int i = 1; + while (!look_for_string (callable ())) + if (!i--) __builtin_abort (); + while (look_for_string (at_calls ())) + if (!i--) __builtin_abort (); + while (look_for_string (internal ())) + if (!i--) __builtin_abort (); __builtin_exit (0); } diff --git a/gcc/testsuite/c-c++-common/torture/strub-run2.c b/gcc/testsuite/c-c++-common/torture/strub-run2.c index 1df2ffe2fe58c..5d60a7775f4bb 100644 --- a/gcc/testsuite/c-c++-common/torture/strub-run2.c +++ b/gcc/testsuite/c-c++-common/torture/strub-run2.c @@ -69,11 +69,16 @@ internal () int main () { - if (!look_for_string (callable ())) - __builtin_abort (); - if (look_for_string (at_calls ())) - __builtin_abort (); - if (look_for_string (internal ())) - __builtin_abort (); + /* Since these test check stack contents above the top of the stack, an + unexpected asynchronous signal or interrupt might overwrite the bits we + expect to find and cause spurious fails. Tolerate one such overall + spurious fail by retrying. */ + int i = 1; + while (!look_for_string (callable ())) + if (!i--) __builtin_abort (); + while (look_for_string (at_calls ())) + if (!i--) __builtin_abort (); + while (look_for_string (internal ())) + if (!i--) __builtin_abort (); __builtin_exit (0); } diff --git a/gcc/testsuite/c-c++-common/torture/strub-run3.c b/gcc/testsuite/c-c++-common/torture/strub-run3.c index afbc2cc9ab484..c2ad710858e87 100644 --- a/gcc/testsuite/c-c++-common/torture/strub-run3.c +++ b/gcc/testsuite/c-c++-common/torture/strub-run3.c @@ -65,11 +65,16 @@ internal () int main () { - if (!look_for_string (callable ())) - __builtin_abort (); - if (look_for_string (at_calls ())) - __builtin_abort (); - if (look_for_string (internal ())) - __builtin_abort (); + /* Since these test check stack contents above the top of the stack, an + unexpected asynchronous signal or interrupt might overwrite the bits we + expect to find and cause spurious fails. Tolerate one such overall + spurious fail by retrying. */ + int i = 1; + while (!look_for_string (callable ())) + if (!i--) __builtin_abort (); + while (look_for_string (at_calls ())) + if (!i--) __builtin_abort (); + while (look_for_string (internal ())) + if (!i--) __builtin_abort (); __builtin_exit (0); } diff --git a/gcc/testsuite/c-c++-common/torture/strub-run4.c b/gcc/testsuite/c-c++-common/torture/strub-run4.c index 5300f1d330b87..3b36b8e5d68ef 100644 --- a/gcc/testsuite/c-c++-common/torture/strub-run4.c +++ b/gcc/testsuite/c-c++-common/torture/strub-run4.c @@ -95,7 +95,12 @@ internal () int __attribute__ ((__strub__ ("disabled"))) main () { - if (look_for_string (internal ())) - __builtin_abort (); + /* Since these test check stack contents above the top of the stack, an + unexpected asynchronous signal or interrupt might overwrite the bits we + expect to find and cause spurious fails. Tolerate one such overall + spurious fail by retrying. */ + int i = 1; + while (look_for_string (internal ())) + if (!i--) __builtin_abort (); __builtin_exit (0); } -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer Disinformation flourishes because many people care deeply about injustice but very few check the facts. Ask me about