]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Testsuite: Add 'torture-init-done', and use it to conditionalize implicit 'torture...
authorThomas Schwinge <thomas@codesourcery.com>
Wed, 10 May 2023 07:17:47 +0000 (09:17 +0200)
committerThomas Schwinge <thomas@codesourcery.com>
Thu, 11 May 2023 08:03:58 +0000 (10:03 +0200)
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
gcc/testsuite/lib/gfortran-dg.exp
gcc/testsuite/lib/obj-c++-dg.exp
gcc/testsuite/lib/objc-dg.exp
gcc/testsuite/lib/torture-options.exp

index 693cbdd7511af65bebfd4ffa45a0395ebd7a1228..4ed4233efff9389c06c0233e66d465fa7c14ed65 100644 (file)
@@ -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
     }
 }
index 3c813d3c8fb7c438d79fae4bd7e83dc11a66b07a..e85f791fa9400c42bd6b6181e1c95a7c1e5e4fa7 100644 (file)
@@ -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
     }
 }
index 9123240f033a08b89419ce29d45a2d4b921326a3..8deaed005dc90ba8649cf6e24324675445a49bec 100644 (file)
@@ -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
index 9ca751c8f48248041217bd5c3e0040dd09a49f1c..cf08cdcabbd7af08d909ae3cada59cb02c4418a7 100644 (file)
@@ -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
     }
 }
index 394418e9a02fa1ca561bf88fd0096c1dd82f06c8..d00d07e9378d3fb9e572fc10bd57a0e077899a91 100644 (file)
@@ -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