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.
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
}
}
- if { $existing_torture_options == 0 } {
+ if { $existing_torture_init == 0 } {
torture-finish
}
}
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
}
}
- if { $existing_torture_options == 0 } {
+ if { $existing_torture_init == 0 } {
torture-finish
}
}
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
}
}
- if { $existing_torture_options == 0 } {
+ if { $existing_torture_init == 0 } {
torture-finish
}
}
\ No newline at end of file
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
}
}
- if { $existing_torture_options == 0 } {
+ if { $existing_torture_init == 0 } {
torture-finish
}
}
}
}
+# 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