From 66e97803490ef55770cee7db81eade2d05c4ea0a Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Fri, 13 Jan 2023 01:08:43 +0000 Subject: testsuite: extend timeout into all gm2 tests Add timeout capability to gm2-torture.exp. Also add a simple gm2_push_timeout/gm2_pop timeout facility and calibrate all tests to use the default of 10 seconds. 15 seconds (for the coroutine tests) and 60 seconds for whole program optimization. gcc/testsuite/ChangeLog: * gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp (timeout-dg.exp): Load. Call gm2_push_timeout 15. Call gm2_pop_timeout at the end. * gm2/link/min/pass/link-min-pass.exp: Set path argument to "". * gm2/switches/whole-program/pass/run/switches-whole-program-pass-run.exp: Call gm2_push_timeout 60. Call gm2_pop_timeout at the end. * lib/gm2-torture.exp (gm2_previous_timeout): Set to 10 or individual_timeout. Configure dejagnu to timeout for 10 seconds. (gm2_push_timeout): New proc. (gm2_pop_timeout): New proc. * lib/gm2.exp (gm2_previous_timeout): Set to 10 or individual_timeout. Configure dejagnu to timeout for 10 seconds. (gm2_push_timeout): New proc. (gm2_pop_timeout): New proc. Signed-off-by: Gaius Mulley --- .../pim/run/pass/coroutines-pim-run-pass.exp | 7 +++++ gcc/testsuite/gm2/link/min/pass/link-min-pass.exp | 2 +- .../pass/run/switches-whole-program-pass-run.exp | 3 ++ gcc/testsuite/lib/gm2-torture.exp | 31 +++++++++++++++++++ gcc/testsuite/lib/gm2.exp | 35 ++++++++++++++++++++++ 5 files changed, 77 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/testsuite/gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp b/gcc/testsuite/gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp index ec4bb0d..baf185f 100644 --- a/gcc/testsuite/gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp +++ b/gcc/testsuite/gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp @@ -24,11 +24,16 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp +load_lib timeout-dg.exp set gm2src ${srcdir}/../gm2 gm2_init_cor +# We should be able to compile, link or run in 15 seconds. +gm2_push_timeout 15 + + foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. if ![runtest_file_p $runtests $testcase] then { @@ -37,3 +42,5 @@ foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { gm2-torture-execute $testcase "" "pass" } + +gm2_pop_timeout diff --git a/gcc/testsuite/gm2/link/min/pass/link-min-pass.exp b/gcc/testsuite/gm2/link/min/pass/link-min-pass.exp index 6a6051f..88e4ed9 100644 --- a/gcc/testsuite/gm2/link/min/pass/link-min-pass.exp +++ b/gcc/testsuite/gm2/link/min/pass/link-min-pass.exp @@ -25,7 +25,7 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_init_min "${srcdir}/gm2/min/pass" +gm2_init_min "" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. diff --git a/gcc/testsuite/gm2/switches/whole-program/pass/run/switches-whole-program-pass-run.exp b/gcc/testsuite/gm2/switches/whole-program/pass/run/switches-whole-program-pass-run.exp index 4622103..3058b9a 100644 --- a/gcc/testsuite/gm2/switches/whole-program/pass/run/switches-whole-program-pass-run.exp +++ b/gcc/testsuite/gm2/switches/whole-program/pass/run/switches-whole-program-pass-run.exp @@ -25,6 +25,7 @@ if $tracelevel then { load_lib gm2-torture.exp gm2_init_pim "${srcdir}/gm2/switches/whole-program/run/pass" -fm2-whole-program +gm2_push_timeout 60 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. @@ -34,3 +35,5 @@ foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { gm2_target_compile $srcdir/$subdir/mystrlib.mod mystrlib.o object "-g -O3 -I$srcdir/$subdir/" gm2-torture $testcase } + +gm2_pop_timeout diff --git a/gcc/testsuite/lib/gm2-torture.exp b/gcc/testsuite/lib/gm2-torture.exp index 1783260..44d9d05 100644 --- a/gcc/testsuite/lib/gm2-torture.exp +++ b/gcc/testsuite/lib/gm2-torture.exp @@ -20,6 +20,35 @@ load_lib file-format.exp load_lib target-libpath.exp +load_lib timeout.exp +load_lib timeout-dg.exp + + +if {[info exists individual_timeout]} { + set gm2_previous_timeout $individual_timeout +} else { + set gm2_previous_timeout 10 +} + + +# We should be able to complete any test in 10 seconds. +dg-timeout S 10 + + +# only push one level. + +proc gm2_push_timeout { secs } { + global individual_timeout + set individual_timeout $secs +} + + +proc gm2_pop_timeout { } { + global individual_timeout + global gm2_previous_timeout + set individual_timeout $gm2_previous_timeout +} + # The default option list can be overridden by # TORTURE_OPTIONS="{ { list1 } ... { listN } }" @@ -272,6 +301,7 @@ proc gm2-torture-execute { sources args success } { set options "" lappend options "additional_flags=$option" + lappend options "timeout=[timeout_value]" if { $additional_flags != "" } { lappend options "additional_flags=$additional_flags" } @@ -290,6 +320,7 @@ proc gm2-torture-execute { sources args success } { # now link the test set options ${option}; + lappend options "timeout=[timeout_value]" if { [llength ${args}] > 0 } { lappend options "additional_flags=[lindex ${args} 0]" } diff --git a/gcc/testsuite/lib/gm2.exp b/gcc/testsuite/lib/gm2.exp index 0d8490c..f000eae 100644 --- a/gcc/testsuite/lib/gm2.exp +++ b/gcc/testsuite/lib/gm2.exp @@ -23,6 +23,36 @@ load_lib prune.exp load_lib gcc-defs.exp load_lib target-libpath.exp load_lib timeout.exp +load_lib timeout-dg.exp + + +if {[info exists individual_timeout]} { + set gm2_previous_timeout $individual_timeout +} else { + set gm2_previous_timeout 10 +} + + +# set gm2_previous_timeout $individual_timeout + +# We should be able to complete any test in 10 seconds. +dg-timeout S 10 + + +# only push one level. + +proc gm2_push_timeout { secs } { + global individual_timeout + set individual_timeout $secs +} + + +proc gm2_pop_timeout { } { + global individual_timeout + global gm2_previous_timeout + set individual_timeout $gm2_previous_timeout +} + # # GCC_UNDER_TEST is the compiler under test. @@ -137,8 +167,13 @@ proc gm2_init { args } { set gm2_link_path "[gm2_link_flags [get_multilibs]]"; verbose $gm2_link_path 1 + + # Set the default timeout value, larger tests can override + # this if necessary. + dg-timeout S 10 } + # # gm2_target_compile_default -- compile a source file # -- cgit v1.1