public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Christophe Lyon <christophe.lyon@linaro.org>, <gcc-patches@gcc.gnu.org>
Cc: Richard Biener <rguenther@suse.de>, Jan Hubicka <hubicka@ucw.cz>,
	"Rainer Orth" <ro@cebitec.uni-bielefeld.de>,
	Mike Stump <mikestump@comcast.net>
Subject: Testsuite: Add 'torture-init-done', and use it to conditionalize implicit 'torture-init' (was: Testsuite: Add missing 'torture-init'/'torture-finish' around 'LTO_TORTURE_OPTIONS' usage (was: Let each 'lto_init' determine the default 'LTO_OPTIONS', and 'torture-init' the 'LTO_TORTURE_OPTIONS'))
Date: Wed, 10 May 2023 09:51:50 +0200	[thread overview]
Message-ID: <87fs84sjxl.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <CAPS5khYkHstE2QKZkTpY4z7sanutoYMHzP_X7QOmr8bBEhE=_Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3982 bytes --]

Hi Christophe!

On 2023-05-09T21:14:07+0200, Christophe Lyon <christophe.lyon@linaro.org> wrote:
> On Tue, 9 May 2023 at 17:17, Christophe Lyon <christophe.lyon@linaro.org>
> wrote:
>> On Tue, 9 May 2023 at 11:00, Thomas Schwinge <thomas@codesourcery.com>
>> wrote:
>>> On 2023-05-09T09:32:55+0200, Christophe Lyon <christophe.lyon@linaro.org>
>>> wrote:
>>> > On Wed, 3 May 2023 at 13:47, Richard Biener via Gcc-patches <
>>> gcc-patches@gcc.gnu.org> wrote:
>>> >> On Wed, 3 May 2023, Thomas Schwinge wrote:
>>> >> > "Let each 'lto_init' determine the default 'LTO_OPTIONS', and
>>> 'torture-init' the 'LTO_TORTURE_OPTIONS'"?
>>> >
>>> > This is causing issues on arm/aarch64, including:
>>> >
>>> > ERROR: can't read "LTO_TORTURE_OPTIONS": no such variable
>>> > in gcc.target/arm/acle/acle.exp:
>>> >
>>> > ERROR: torture-init: LTO_TORTURE_OPTIONS is not empty as expected
>>> > in gcc.target/aarch64/sls-mitigation/sls-mitigation.exp,
>>> > gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp,
>>> > gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp,
>>> > gcc.target/aarch64/torture/aarch64-torture.exp
>>> >
>>> > and maybe others
>>> >
>>> > Are other targets affected too?
>>>
>>> Sorry for that -- it means, the safe-guards I added are working as
>>> expected.
>>>
>>> Please test whether all these issues are gone with the attached
>>> "Testsuite: Add missing 'torture-init'/'torture-finish' around
>>> 'LTO_TORTURE_OPTIONS' usage"?
>>
>> Your patch seemed reasonable,  but it doesn't work :-(
>>
>> Well now I get:
>> ERROR: torture-init: LTO_TORTURE_OPTIONS is not empty as expected
>> because gcc-dg-runtest itself calls torture-init
>>
>> but I'm not sure where LTO_TORTURE_OPTIONS is set
>
> Just checking, are you able to test your changes on arm (a cross toolchain
> is OK) ?

Sorry, I don't currently have an arm/aarch64 toolchain built.

> The problem shows up even if running only acle.exp, so it's quick once you
> have built the toolchain once.

I did a quick hack:

    --- gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-mitigation.exp
    +++ gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-mitigation.exp
    @@ -22,3 +21,0 @@
    -if {![istarget aarch64*-*-*] } then {
    -  return
    -}
    --- gcc/testsuite/gcc.target/arm/acle/acle.exp
    +++ gcc/testsuite/gcc.target/arm/acle/acle.exp
    @@ -20,3 +19,0 @@
    -if ![istarget arm*-*-*] then {
    -  return
    -}

..., and confirm to run into the DejaGnu/TCL ERRORs in my
x86_64-pc-linux-gnu testing.

> I spent some time looking at it, and the conflict is that the .exp file
> calls torture-init and gcc-dg-runtest, which in turn calls torture-init
> again, leading to the error.

I see, thanks -- and sorry, once again.

> I haven't checked the details of why there are similar failures on aarch64.

I now understand that the problem is the following: most of all '*.exp'
files have 'torture-init' followed by 'set-torture-options' before
'gcc-dg-runtest' etc., and therefore don't run into the latter's
"Some callers set torture options themselves; don't override those."
code.  Some '*.exp' files however do 'torture-init' but not
'set-torture-options', and therefore we can't any longer conditionalize
the implicit 'torture-init' by '![torture-options-exist]'.
Please in addition to the earlier
"Testsuite: Add missing 'torture-init'/'torture-finish' around 'LTO_TORTURE_OPTIONS' usage"
also apply the attached
"Testsuite: Add 'torture-init-done', and use it to conditionalize implicit 'torture-init'".
That hopefully should restore sanity -- if not, I'll get arm/aarch64
toolchains built.


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Testsuite-Add-torture-init-done-and-use-it-to-condit.patch --]
[-- Type: text/x-diff, Size: 6517 bytes --]

From 4a069073834c5b710e17315c0844f1212fa54164 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 10 May 2023 09:17:47 +0200
Subject: [PATCH] Testsuite: Add 'torture-init-done', and use it to
 conditionalize implicit 'torture-init'

Recent commit d6654a4be3ba44c0d57be7c8a51d76d9721345e1
"Let each 'lto_init' determine the default 'LTO_OPTIONS', and 'torture-init' the 'LTO_TORTURE_OPTIONS'"
made 'torture-init' non-idempotent re 'LTO_TORTURE_OPTIONS', in order to catch
certain classes of errors.  Now, most of all '*.exp' files have 'torture-init'
followed by 'set-torture-options' before 'gcc-dg-runtest' etc., and therefore
don't run into the latter's
"Some callers set torture options themselves; don't override those." code.
Some '*.exp' files however do 'torture-init' but not 'set-torture-options', and
therefore we can't any longer conditionalize the implicit 'torture-init' by
'![torture-options-exist]'.

	gcc/testsuite/
	* lib/torture-options.exp (torture-init-done): Add.
	* lib/gcc-dg.exp (gcc-dg-runtest): Use it to conditionalize
	implicit 'torture-init'.
	* lib/gfortran-dg.exp (gfortran-dg-runtest): Likewise.
	* lib/obj-c++-dg.exp (obj-c++-dg-runtest): Likewise.
	* lib/objc-dg.exp (objc-dg-runtest): Likewise.
---
 gcc/testsuite/lib/gcc-dg.exp          | 8 ++++++--
 gcc/testsuite/lib/gfortran-dg.exp     | 8 ++++++--
 gcc/testsuite/lib/obj-c++-dg.exp      | 8 ++++++--
 gcc/testsuite/lib/objc-dg.exp         | 8 ++++++--
 gcc/testsuite/lib/torture-options.exp | 6 ++++++
 5 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 693cbdd7511..4ed4233efff 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -568,11 +568,15 @@ proc search_for { file pattern } {
 proc gcc-dg-runtest { testcases flags default-extra-flags } {
     global runtests
 
+    # Some callers initialize torture testing themselves; don't override those.
+    set existing_torture_init [torture-init-done]
+    if { $existing_torture_init == 0 } {
+	torture-init
+    }
     # Some callers set torture options themselves; don't override those.
     set existing_torture_options [torture-options-exist]
     if { $existing_torture_options == 0 } {
 	global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
-	torture-init
 	set-torture-options $DG_TORTURE_OPTIONS [list {}] $LTO_TORTURE_OPTIONS
     }
     dump-torture-options
@@ -603,7 +607,7 @@ proc gcc-dg-runtest { testcases flags default-extra-flags } {
 	}
     }
 
-    if { $existing_torture_options == 0 } {
+    if { $existing_torture_init == 0 } {
 	torture-finish
     }
 }
diff --git a/gcc/testsuite/lib/gfortran-dg.exp b/gcc/testsuite/lib/gfortran-dg.exp
index 3c813d3c8fb..e85f791fa94 100644
--- a/gcc/testsuite/lib/gfortran-dg.exp
+++ b/gcc/testsuite/lib/gfortran-dg.exp
@@ -126,11 +126,15 @@ proc gfortran-dg-runtest { testcases flags default-extra-flags } {
     global runtests
     global torture_with_loops
 
+    # Some callers initialize torture testing themselves; don't override those.
+    set existing_torture_init [torture-init-done]
+    if { $existing_torture_init == 0 } {
+	torture-init
+    }
     # Some callers set torture options themselves; don't override those.
     set existing_torture_options [torture-options-exist]
     if { $existing_torture_options == 0 } {
 	global DG_TORTURE_OPTIONS
-	torture-init
 	set-torture-options $DG_TORTURE_OPTIONS
     }
     dump-torture-options
@@ -160,7 +164,7 @@ proc gfortran-dg-runtest { testcases flags default-extra-flags } {
 	}
     }
 
-    if { $existing_torture_options == 0 } {
+    if { $existing_torture_init == 0 } {
 	torture-finish
     }
 }
diff --git a/gcc/testsuite/lib/obj-c++-dg.exp b/gcc/testsuite/lib/obj-c++-dg.exp
index 9123240f033..8deaed005dc 100644
--- a/gcc/testsuite/lib/obj-c++-dg.exp
+++ b/gcc/testsuite/lib/obj-c++-dg.exp
@@ -32,11 +32,15 @@ proc obj-c++-dg-prune { system text } {
 proc obj-c++-dg-runtest { testcases flags default-extra-flags } {
     global runtests
 
+    # Some callers initialize torture testing themselves; don't override those.
+    set existing_torture_init [torture-init-done]
+    if { $existing_torture_init == 0 } {
+	torture-init
+    }
     # Some callers set torture options themselves; don't override those.
     set existing_torture_options [torture-options-exist]
     if { $existing_torture_options == 0 } {
 	global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
-	torture-init
 	set-torture-options $DG_TORTURE_OPTIONS [list {}] $LTO_TORTURE_OPTIONS
     }
     dump-torture-options
@@ -67,7 +71,7 @@ proc obj-c++-dg-runtest { testcases flags default-extra-flags } {
 	}
     }
 
-    if { $existing_torture_options == 0 } {
+    if { $existing_torture_init == 0 } {
 	torture-finish
     }
 }
\ No newline at end of file
diff --git a/gcc/testsuite/lib/objc-dg.exp b/gcc/testsuite/lib/objc-dg.exp
index 9ca751c8f48..cf08cdcabbd 100644
--- a/gcc/testsuite/lib/objc-dg.exp
+++ b/gcc/testsuite/lib/objc-dg.exp
@@ -33,11 +33,15 @@ proc objc-dg-prune { system text } {
 proc objc-dg-runtest { testcases flags default-extra-flags } {
     global runtests
 
+    # Some callers initialize torture testing themselves; don't override those.
+    set existing_torture_init [torture-init-done]
+    if { $existing_torture_init == 0 } {
+	torture-init
+    }
     # Some callers set torture options themselves; don't override those.
     set existing_torture_options [torture-options-exist]
     if { $existing_torture_options == 0 } {
 	global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
-	torture-init
 	set-torture-options $DG_TORTURE_OPTIONS [list {}] $LTO_TORTURE_OPTIONS
     }
     dump-torture-options
@@ -68,7 +72,7 @@ proc objc-dg-runtest { testcases flags default-extra-flags } {
 	}
     }
 
-    if { $existing_torture_options == 0 } {
+    if { $existing_torture_init == 0 } {
 	torture-finish
     }
 }
diff --git a/gcc/testsuite/lib/torture-options.exp b/gcc/testsuite/lib/torture-options.exp
index 394418e9a02..d00d07e9378 100644
--- a/gcc/testsuite/lib/torture-options.exp
+++ b/gcc/testsuite/lib/torture-options.exp
@@ -51,6 +51,12 @@ proc torture-init { args } {
     }
 }
 
+# Return 1 if 'torture-init' has already been done, 0 otherwise.
+proc torture-init-done { args } {
+    global LTO_TORTURE_OPTIONS
+    return [info exists LTO_TORTURE_OPTIONS]
+}
+
 # Return 1 if torture options have already been set, 0 otherwise.
 proc torture-options-exist { args } {
     global torture_with_loops
-- 
2.34.1


  reply	other threads:[~2023-05-10  7:52 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27 17:54 Update testsuite to run with slim LTO Jan Hubicka
2011-09-30 14:56 ` Diego Novillo
2011-10-20 19:34 ` Breakage with "Update testsuite to run with slim LTO" Hans-Peter Nilsson
2011-10-20 19:53   ` Andi Kleen
2011-10-21  0:39   ` Jan Hubicka
2011-10-21  5:22     ` [RFA:] fix breakage " Hans-Peter Nilsson
2011-10-21  9:58       ` Jan Hubicka
2011-10-21 12:23         ` Iain Sandoe
2011-10-21 12:35           ` Rainer Orth
2011-10-21 16:20             ` Jan Hubicka
2011-10-21 17:40               ` Hans-Peter Nilsson
2011-10-21 18:52                 ` Jan Hubicka
2011-10-21 19:56                   ` Hans-Peter Nilsson
2011-10-24 12:08             ` Richard Guenther
2011-10-28 14:59       ` ping: [RFA:] testsuite infrastructure for options implied by dg-final methods Hans-Peter Nilsson
2011-11-04 13:56         ` ping*2: " Hans-Peter Nilsson
2011-11-04 17:05           ` Mike Stump
2011-11-04 17:54             ` Hans-Peter Nilsson
2011-11-04 18:14               ` Mike Stump
2011-11-04 18:16                 ` Hans-Peter Nilsson
2023-05-03 11:16 ` Let each 'lto_init' determine the default 'LTO_OPTIONS', and 'torture-init' the 'LTO_TORTURE_OPTIONS' (was: Update testsuite to run with slim LTO) Thomas Schwinge
2023-05-03 11:46   ` Richard Biener
2023-05-09  7:32     ` Christophe Lyon
2023-05-09  9:00       ` Testsuite: Add missing 'torture-init'/'torture-finish' around 'LTO_TORTURE_OPTIONS' usage (was: Let each 'lto_init' determine the default 'LTO_OPTIONS', and 'torture-init' the 'LTO_TORTURE_OPTIONS') Thomas Schwinge
2023-05-09 15:17         ` Christophe Lyon
2023-05-09 19:14           ` Christophe Lyon
2023-05-10  7:51             ` Thomas Schwinge [this message]
2023-05-10 13:42               ` Testsuite: Add 'torture-init-done', and use it to conditionalize implicit 'torture-init' (was: Testsuite: Add missing 'torture-init'/'torture-finish' around 'LTO_TORTURE_OPTIONS' usage (was: Let each 'lto_init' determine the default 'LTO_OPTIONS', and 'torture-init' the 'LTO_TORTURE_OPTIONS')) Christophe Lyon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fs84sjxl.fsf@euler.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=christophe.lyon@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=mikestump@comcast.net \
    --cc=rguenther@suse.de \
    --cc=ro@cebitec.uni-bielefeld.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).