From: Janis Johnson Date: Thu, 15 May 2008 16:59:21 +0000 (+0000) Subject: libgomp.exp: Load torture-options.exp from gcc lib. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=91a5b3943e8999959d65206ae75ae63d488ffa43;p=gcc.git libgomp.exp: Load torture-options.exp from gcc lib. libgomp: * testsuite/lib/libgomp.exp: Load torture-options.exp from gcc lib. gcc/doc: * doc/sourcebuild.texi: Document support for torture tests. gcc/testsuite: * lib/torture-options.exp: New support for torture options. * lib/gfortran-dg.exp (gfortran-dg-runtest): Use new torture procs. * lib/c-torture.exp: Define C_TORTURE_OPTIONS instead of TORTURE_OPTIONS; don't define torture_with_loops and torture_without_loops. * lib/gcc-dg.exp: Define DG_TORTURE_OPTIONS instead of TORTURE_OPTIONS; don't define torture_with_loops and torture_without_loops. (gcc-dg-runtest): Use new torture procs if no torture options defined. * lib/fortran-torture.exp: Define FORTRAN_TORTURE_OPTIONS instead of TORTURE_OPTIONS. (fortran-torture-execute): Use torture_with_loops instead of TORTURE_OPTIONS. (fortran-torture): Ditto. * lib/objc-torture.exp: Define OBJC_TORTURE_OPTIONS instead of TORTURE_OPTIONS; don't define torture_with_loops and torture_without_loops. * gcc.c-torture/execute/execute.exp: Use new torture procs. * gcc.c-torture/execute/builtins/builtins.exp: Ditto. * gcc.c-torture/execute/ieee/ieee.exp: Ditto. * gcc.c-torture/unsorted/unsorted.exp: Ditto. * gfortran.fortran-torture/execute/execute.exp: Ditto. * gfortran.fortran-torture/compile/compile.exp: Ditto. * gcc.target/x86_64/abi/abi-x86_64.exp: Ditto. * gcc.target/i386/math-torture/math-torture.exp: Define MATH_TORTURE_OPTIONS, use new torture procs. * gcc.dg/pch/pch.exp: Use new torture procs. * gcc.dg/format/format.exp: Ditto. * gcc.misc-tests/i386-prefetch.exp: Ditto. * gcc.misc-tests/dectest.exp: Ditto. * objc.dg/pch/pch.exp: Ditto. * objc/execute/execute.exp: Ditto. * objc/execute/exceptions/exceptions.exp: Ditto. * objc/compile/compile.exp: Ditto. From-SVN: r135381 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ff5aa2b9502..579a7c98ef9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2008-05-15 Janis Johnson + + * doc/sourcebuild.texi: Document support for torture tests. + 2008-05-15 Uros Bizjak * config/i386/sse.md (*vec_concatv2sf_sse4_1): Add "m" constraint diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 896190cd536..6c551aa8156 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -822,6 +822,7 @@ here; FIXME: document the others. * gcov Testing:: Support for testing gcov. * profopt Testing:: Support for testing profile-directed optimizations. * compat Testing:: Support for testing binary compatibility. +* Torture Tests:: Support for torture testing using multiple options. @end menu @node Test Idioms @@ -1531,3 +1532,43 @@ This command can be used in a secondary source file to specify that compilation is expected to fail for particular options on particular targets. @end table + +@node Torture Tests +@subsection Support for torture testing using multiple options + +Throughout the compiler testsuite there are several directories whose +tests are run multiple times, each with a different set of options. +These are known as torture tests. +@file{gcc/testsuite/lib/torture-options.exp} defines procedures to +set up these lists: + +@table @code +@item torture-init +Initialize use of torture lists. +@item set-torture-options +Set lists of torture options to use for tests with and without loops. +Optionally combine a set of torture options with a set of other +options, as is done with Objective-C runtime options. +@item torture-finish +Finalize use of torture lists. +@end table + +The @file{.exp} file for a set of tests that use torture options must +include calls to these three procecures if: + +@itemize bullet +@item It calls @code{gcc-dg-runtest} and overrides @var{DG_TORTURE_OPTIONS}. + +@item It calls @var{$@{tool@}}@code{-torture} or +@var{$@{tool@}}@code{-torture-execute}, where @var{tool} is @code{c}, +@code{fortran}, or @code{objc}. + +@item It calls @code{dg-pch}. +@end itemize + +It is not necessary for a @file{.exp} file that calls @code{gcc-dg-runtest} +to call the torture procedures if the tests should use the list in +@var{DG_TORTURE_OPTIONS} defined in @file{gcc-dg.exp}. + +Most uses of torture options can override the default lists by defining +@var{TORTURE_OPTIONS} in a @file{.dejagnurc} file. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fae0f99623b..0f3a4ea724f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,42 @@ +2008-05-15 Janis Johnson + + * lib/torture-options.exp: New support for torture options. + * lib/gfortran-dg.exp (gfortran-dg-runtest): Use new torture + procs. + * lib/c-torture.exp: Define C_TORTURE_OPTIONS instead of + TORTURE_OPTIONS; don't define torture_with_loops and + torture_without_loops. + * lib/gcc-dg.exp: Define DG_TORTURE_OPTIONS instead of + TORTURE_OPTIONS; don't define torture_with_loops and + torture_without_loops. + (gcc-dg-runtest): Use new torture procs if no torture options + defined. + * lib/fortran-torture.exp: Define FORTRAN_TORTURE_OPTIONS instead of + TORTURE_OPTIONS. + (fortran-torture-execute): Use torture_with_loops instead of + TORTURE_OPTIONS. + (fortran-torture): Ditto. + * lib/objc-torture.exp: Define OBJC_TORTURE_OPTIONS instead of + TORTURE_OPTIONS; don't define torture_with_loops and + torture_without_loops. + * gcc.c-torture/execute/execute.exp: Use new torture procs. + * gcc.c-torture/execute/builtins/builtins.exp: Ditto. + * gcc.c-torture/execute/ieee/ieee.exp: Ditto. + * gcc.c-torture/unsorted/unsorted.exp: Ditto. + * gfortran.fortran-torture/execute/execute.exp: Ditto. + * gfortran.fortran-torture/compile/compile.exp: Ditto. + * gcc.target/x86_64/abi/abi-x86_64.exp: Ditto. + * gcc.target/i386/math-torture/math-torture.exp: Define + MATH_TORTURE_OPTIONS, use new torture procs. + * gcc.dg/pch/pch.exp: Use new torture procs. + * gcc.dg/format/format.exp: Ditto. + * gcc.misc-tests/i386-prefetch.exp: Ditto. + * gcc.misc-tests/dectest.exp: Ditto. + * objc.dg/pch/pch.exp: Ditto. + * objc/execute/execute.exp: Ditto. + * objc/execute/exceptions/exceptions.exp: Ditto. + * objc/compile/compile.exp: Ditto. + 2008-05-15 Richard Guenther PR tree-optimization/36245 diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp index 5aff873451f..e82d2fddfd0 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp @@ -13,8 +13,12 @@ # that needs them. They shouldn't call any external functions in case # those functions were overridden too. +load_lib torture-options.exp load_lib c-torture.exp +torture-init +set-torture-options $C_TORTURE_OPTIONS + set additional_flags "" if [istarget "powerpc-*-darwin*"] { lappend additional_flags "-Wl,-multiply_defined,suppress" @@ -28,3 +32,5 @@ foreach src [lsort [find $srcdir/$subdir *.c]] { $additional_flags } } + +torture-finish diff --git a/gcc/testsuite/gcc.c-torture/execute/execute.exp b/gcc/testsuite/gcc.c-torture/execute/execute.exp index 2214b9d1e42..f0e379f3849 100644 --- a/gcc/testsuite/gcc.c-torture/execute/execute.exp +++ b/gcc/testsuite/gcc.c-torture/execute/execute.exp @@ -28,8 +28,12 @@ if $tracelevel then { } # load support procs +load_lib torture-options.exp load_lib c-torture.exp +torture-init +set-torture-options $C_TORTURE_OPTIONS + # # main test loop # @@ -42,3 +46,5 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { c-torture-execute $src } + +torture-finish diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp b/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp index d02471b865d..3d7e56c6b30 100644 --- a/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp @@ -21,6 +21,7 @@ # Load support procs. load_lib gcc-dg.exp +load_lib torture-options.exp # These tests come from Torbjorn Granlund's (tege@cygnus.com) # C torture test suite, and other contributors. @@ -32,6 +33,9 @@ if $tracelevel then { strace $tracelevel } +torture-init +set-torture-options $C_TORTURE_OPTIONS + set additional_flags "" # We must use -ffloat-store/-mieee to ensure that excess precision on some @@ -70,4 +74,5 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { } # All done. +torture-finish gcc_finish diff --git a/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp b/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp index d300d9e9468..dbcea137a00 100644 --- a/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp +++ b/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp @@ -30,6 +30,10 @@ if $tracelevel then { # load support procs load_lib c-torture.exp +load_lib torture-options.exp + +torture-init +set-torture-options $C_TORTURE_OPTIONS # # This loop will run c-torture on any *.c file found in this directory. @@ -52,3 +56,5 @@ foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { c-torture $testcase } + +torture-finish diff --git a/gcc/testsuite/gcc.dg/format/format.exp b/gcc/testsuite/gcc.dg/format/format.exp index 2f2124148ed..352149850e3 100644 --- a/gcc/testsuite/gcc.dg/format/format.exp +++ b/gcc/testsuite/gcc.dg/format/format.exp @@ -17,47 +17,18 @@ # Don't run this directory with any default CFLAGS, but run tests with # and without -DWIDE. -if [info exists TORTURE_OPTIONS] { - set old_TORTURE_OPTIONS $TORTURE_OPTIONS -} elseif [info exists old_TORTURE_OPTIONS] { - unset old_TORTURE_OPTIONS -} -if [info exists torture_with_loops] { - set old_torture_with_loops $torture_with_loops -} elseif [info exists old_torture_with_loops] { - unset old_torture_with_loops -} -if [info exists torture_without_loops] { - set old_torture_without_loops $torture_without_loops -} elseif [info exists old_torture_without_loops] { - unset old_torture_without_loops -} -set TORTURE_OPTIONS [list { } { -DWIDE } ] -set torture_with_loops [list { } { -DWIDE } ] -set torture_without_loops [list { } { -DWIDE } ] - # Need to copy the format.h header. if [is_remote host] { remote_download host $srcdir/$subdir/format.h } load_lib gcc-dg.exp +load_lib torture-options.exp + +torture-init +set-torture-options [list { } { -DWIDE } ] dg-init gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" -if [info exists old_TORTURE_OPTIONS] { - set TORTURE_OPTIONS $old_TORTURE_OPTIONS -} else { - unset TORTURE_OPTIONS -} -if [info exists old_torture_with_loops] { - set torture_with_loops $old_torture_with_loops -} else { - unset torture_with_loops -} -if [info exists old_torture_without_loops] { - set torture_without_loops $old_torture_without_loops -} else { - unset torture_without_loops -} +torture-finish dg-finish diff --git a/gcc/testsuite/gcc.dg/pch/pch.exp b/gcc/testsuite/gcc.dg/pch/pch.exp index 77c5ff38fdc..e2ec69fd7bd 100644 --- a/gcc/testsuite/gcc.dg/pch/pch.exp +++ b/gcc/testsuite/gcc.dg/pch/pch.exp @@ -20,9 +20,12 @@ # Load support procs. load_lib gcc-dg.exp load_lib dg-pch.exp +load_lib torture-options.exp # Initialize `dg'. dg-init +torture-init +set-torture-options $DG_TORTURE_OPTIONS set old_dg_do_what_default "${dg-do-what-default}" @@ -56,4 +59,5 @@ file delete $testh set dg-do-what-default "$old_dg_do_what_default" # All done. +torture-finish dg-finish diff --git a/gcc/testsuite/gcc.misc-tests/dectest.exp b/gcc/testsuite/gcc.misc-tests/dectest.exp index 45225765ac7..435276d8160 100644 --- a/gcc/testsuite/gcc.misc-tests/dectest.exp +++ b/gcc/testsuite/gcc.misc-tests/dectest.exp @@ -20,7 +20,7 @@ # # Contributed by Ben Elliston . -set TORTURE_OPTIONS [list {} -O1 -O2 -O3 -Os -msoft-float] +set DEC_TORTURE_OPTIONS [list {} -O1 -O2 -O3 -Os -msoft-float] proc target-specific-flags {} { set result "-frounding-math " @@ -30,6 +30,7 @@ proc target-specific-flags {} { # Load support procs (borrow these from c-torture). load_lib c-torture.exp load_lib target-supports.exp +load_lib torture-options.exp # Skip these tests for targets that don't support this extension. if { ![check_effective_target_dfp] } { @@ -516,6 +517,11 @@ if [catch {set testdir $env(DECTEST)}] { return } +torture-init +set-torture-options $DEC_TORTURE_OPTIONS + note "Using tests in $testdir" dfp-run-tests [lsort [glob -nocomplain $testdir/*.decTest]] unset testdir + +torture-finish diff --git a/gcc/testsuite/gcc.misc-tests/i386-prefetch.exp b/gcc/testsuite/gcc.misc-tests/i386-prefetch.exp index 2601d7e2de4..c4c2bbccb04 100644 --- a/gcc/testsuite/gcc.misc-tests/i386-prefetch.exp +++ b/gcc/testsuite/gcc.misc-tests/i386-prefetch.exp @@ -84,32 +84,24 @@ if $tracelevel then { # Load support procs. load_lib gcc-dg.exp +load_lib torture-options.exp # Initialize harness. dg-init +torture-init -# Save these. They are needed if testsuite loops over multiple ABIs -set saved_torture_with_loops $torture_with_loops -set saved_torture_without_loops $torture_without_loops - -set torture_with_loops $PREFETCH_NONE -set torture_without_loops $PREFETCH_NONE +set-torture-options $PREFETCH_NONE gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-none-*.c]] "" -set torture_with_loops $PREFETCH_SSE -set torture_without_loops $PREFETCH_SSE +set-torture-options $PREFETCH_SSE gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-sse-*.c]] "" -set torture_with_loops $PREFETCH_3DNOW -set torture_without_loops $PREFETCH_3DNOW +set-torture-options $PREFETCH_3DNOW gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-3dnow-*.c]] "" -set torture_with_loops $PREFETCH_ATHLON -set torture_without_loops $PREFETCH_ATHLON +set-torture-options $PREFETCH_ATHLON gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-athlon-*.c]] "" -set torture_with_loops $saved_torture_with_loops -set torture_without_loops $saved_torture_without_loops - +torture-finish dg-finish diff --git a/gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp b/gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp index 2bd847d4df6..43ea6ea2f7d 100644 --- a/gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp +++ b/gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp @@ -5,7 +5,7 @@ if { ![istarget i?86*-*-*] && ![istarget x86_64-*-*] } then { return } -set TORTURE_OPTIONS [list \ +set MATH_TORTURE_OPTIONS [list \ { -O0 } \ { -O0 -mfpmath=387 } \ { -O0 -msse -mno-sse2 -mfpmath=sse } \ @@ -29,8 +29,14 @@ set TORTURE_OPTIONS [list \ { -O2 -msse -mno-sse2 -mfpmath=sse,387 -ffast-math } \ { -O2 -msse -msse2 -mfpmath=sse,387 -ffast-math } \ ] + load_lib gcc-dg.exp +load_lib torture-options.exp + +torture-init +set-torture-options $MATH_TORTURE_OPTIONS dg-init gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] "" +torture-finish dg-finish diff --git a/gcc/testsuite/gcc.target/x86_64/abi/abi-x86_64.exp b/gcc/testsuite/gcc.target/x86_64/abi/abi-x86_64.exp index 3b2e3184464..4f9fd46441f 100644 --- a/gcc/testsuite/gcc.target/x86_64/abi/abi-x86_64.exp +++ b/gcc/testsuite/gcc.target/x86_64/abi/abi-x86_64.exp @@ -19,6 +19,7 @@ load_lib c-torture.exp load_lib target-supports.exp +load_lib torture-options.exp if { (![istarget x86_64-*-*] && ![istarget i?86-*-*]) || ![is-effective-target lp64] } then { @@ -26,6 +27,8 @@ if { (![istarget x86_64-*-*] && ![istarget i?86-*-*]) } +torture-init +set-torture-options $C_TORTURE_OPTIONS set additional_flags "-W -Wall" foreach src [lsort [find $srcdir/$subdir test_*.c]] { @@ -41,3 +44,5 @@ foreach src [lsort [find $srcdir/$subdir test_*.c]] { } } } + +torture-finish diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/compile.exp b/gcc/testsuite/gfortran.fortran-torture/compile/compile.exp index d52b730646a..b18e25c5f6f 100644 --- a/gcc/testsuite/gfortran.fortran-torture/compile/compile.exp +++ b/gcc/testsuite/gfortran.fortran-torture/compile/compile.exp @@ -23,6 +23,10 @@ if $tracelevel then { # load support procs load_lib fortran-torture.exp +load_lib torture-options.exp + +torture-init +set-torture-options $FORTRAN_TORTURE_OPTIONS foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.f]] { # If we're only testing specific files and this isn't one of them, skip it. @@ -94,3 +98,5 @@ foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.F08]] { } fortran-torture $testcase } + +torture-finish diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/execute.exp b/gcc/testsuite/gfortran.fortran-torture/execute/execute.exp index d22372ad0da..157c2404601 100644 --- a/gcc/testsuite/gfortran.fortran-torture/execute/execute.exp +++ b/gcc/testsuite/gfortran.fortran-torture/execute/execute.exp @@ -27,6 +27,10 @@ if $tracelevel then { # load support procs load_lib fortran-torture.exp +load_lib torture-options.exp + +torture-init +set-torture-options $FORTRAN_TORTURE_OPTIONS foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.f]] { # If we're only testing specific files and this isn't one of them, skip it. @@ -98,3 +102,5 @@ foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.F08]] { } fortran-torture-execute $testcase } + +torture-finish diff --git a/gcc/testsuite/lib/c-torture.exp b/gcc/testsuite/lib/c-torture.exp index abd2eb6b743..6413b2d85ba 100644 --- a/gcc/testsuite/lib/c-torture.exp +++ b/gcc/testsuite/lib/c-torture.exp @@ -22,7 +22,9 @@ load_lib target-libpath.exp # The default option list can be overridden by # TORTURE_OPTIONS="{ { list1 } ... { listN } }" -if ![info exists TORTURE_OPTIONS] { +if [info exists TORTURE_OPTIONS] { + set C_TORTURE_OPTIONS $TORTURE_OPTIONS +} else { # It is theoretically beneficial to group all of the O2/O3 options together, # as in many cases the compiler will generate identical executables for # all of them--and the c-torture testsuite will skip testing identical @@ -30,7 +32,7 @@ if ![info exists TORTURE_OPTIONS] { # Also note that -finline-functions is explicitly included in one of the # items below, even though -O3 is also specified, because some ports may # choose to disable inlining functions by default, even when optimizing. - set TORTURE_OPTIONS [list \ + set C_TORTURE_OPTIONS [list \ { -O0 } \ { -O1 } \ { -O2 } \ @@ -55,17 +57,6 @@ if { $orig_environment_saved == 0 } { set_ld_library_path_env_vars } -# Split TORTURE_OPTIONS into two choices: one for testcases with loops and -# one for testcases without loops. - -set torture_with_loops $TORTURE_OPTIONS -set torture_without_loops "" -foreach option $TORTURE_OPTIONS { - if ![string match "*loop*" $option] { - lappend torture_without_loops $option - } -} - # # c-torture-compile -- runs the Tege C-torture test # diff --git a/gcc/testsuite/lib/fortran-torture.exp b/gcc/testsuite/lib/fortran-torture.exp index f169c6cc729..3286ad91e8a 100644 --- a/gcc/testsuite/lib/fortran-torture.exp +++ b/gcc/testsuite/lib/fortran-torture.exp @@ -25,7 +25,9 @@ load_lib target-supports.exp # The default option list can be overridden by # TORTURE_OPTIONS="{ { list1 } ... { listN } }" -if ![info exists TORTURE_OPTIONS] { +if [info exists TORTURE_OPTIONS] { + set FORTRAN_TORTURE_OPTIONS $TORTURE_OPTIONS +} else { # determine if host supports vectorization, and the necessary set # of options, based on code from testsuite/vect/vect.exp @@ -59,7 +61,7 @@ if ![info exists TORTURE_OPTIONS] { set test_tree_vectorize 0 } - set TORTURE_OPTIONS [list \ + set FORTRAN_TORTURE_OPTIONS [list \ { -O0 } { -O1 } { -O2 } \ { -O2 -fomit-frame-pointer -finline-functions } \ { -O2 -fomit-frame-pointer -finline-functions -funroll-loops } \ @@ -68,7 +70,7 @@ if ![info exists TORTURE_OPTIONS] { { -Os }] if { $test_tree_vectorize } { - lappend TORTURE_OPTIONS $vectorizer_options + lappend FORTRAN_TORTURE_OPTIONS $vectorizer_options } } @@ -174,7 +176,7 @@ proc fortran-torture-execute { src } { global srcdir tmpdir global tool global compiler_conditional_xfail_data - global TORTURE_OPTIONS + global torture_with_loops # Check for alternate driver. set additional_flags "" @@ -188,7 +190,7 @@ proc fortran-torture-execute { src } { } # Setup the options for the testcase run. - set option_list $TORTURE_OPTIONS + set option_list $torture_with_loops set executable $tmpdir/[file tail [file rootname $src].x] regsub "(?q)$srcdir/" $src "" testcase @@ -348,7 +350,7 @@ proc search_for_re { file pattern } { proc fortran-torture { args } { global srcdir subdir global compiler_conditional_xfail_data - global TORTURE_OPTIONS + global torture_with_loops set src [lindex $args 0] if { [llength $args] > 1 } { @@ -373,7 +375,7 @@ proc fortran-torture { args } { } # loop through all the options - set option_list $TORTURE_OPTIONS + set option_list $torture_with_loops foreach option $option_list { # torture_compile_xfail is set by the .x script (if present) diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 1d462135c8e..ad5fc26c73f 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -26,12 +26,15 @@ load_lib scanipa.exp load_lib prune.exp load_lib libgloss.exp load_lib target-libpath.exp +load_lib torture-options.exp # We set LC_ALL and LANG to C so that we get the same error messages as expected. setenv LC_ALL C setenv LANG C -if ![info exists TORTURE_OPTIONS] { +if [info exists TORTURE_OPTIONS] { + set DG_TORTURE_OPTIONS $TORTURE_OPTIONS +} else { # It is theoretically beneficial to group all of the O2/O3 options together, # as in many cases the compiler will generate identical executables for # all of them--and the c-torture testsuite will skip testing identical @@ -39,7 +42,7 @@ if ![info exists TORTURE_OPTIONS] { # Also note that -finline-functions is explicitly included in one of the # items below, even though -O3 is also specified, because some ports may # choose to disable inlining functions by default, even when optimizing. - set TORTURE_OPTIONS [list \ + set DG_TORTURE_OPTIONS [list \ { -O0 } \ { -O1 } \ { -O2 } \ @@ -64,17 +67,6 @@ if { $orig_environment_saved == 0 } { set_ld_library_path_env_vars } -# Split TORTURE_OPTIONS into two choices: one for testcases with loops and -# one for testcases without loops. - -set torture_with_loops $TORTURE_OPTIONS -set torture_without_loops "" -foreach option $TORTURE_OPTIONS { - if ![string match "*loop*" $option] { - lappend torture_without_loops $option - } -} - # Define gcc callbacks for dg.exp. proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } { @@ -239,7 +231,17 @@ proc search_for { file pattern } { proc gcc-dg-runtest { testcases default-extra-flags } { global runtests + # 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 + foreach test $testcases { + global torture_with_loops torture_without_loops # If we're only testing specific files and this isn't one of # them, skip it. if ![runtest_file_p $runtests $test] { @@ -248,7 +250,6 @@ proc gcc-dg-runtest { testcases default-extra-flags } { # Look for a loop within the source code - if we don't find one, # don't pass -funroll[-all]-loops. - global torture_with_loops torture_without_loops if [expr [search_for $test "for*("]+[search_for $test "while*("]] { set option_list $torture_with_loops } else { @@ -262,6 +263,10 @@ proc gcc-dg-runtest { testcases default-extra-flags } { dg-test $test $flags ${default-extra-flags} } } + + if { $existing_torture_options == 0 } { + torture-finish + } } proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } { diff --git a/gcc/testsuite/lib/gfortran-dg.exp b/gcc/testsuite/lib/gfortran-dg.exp index 401651c2b79..d7b1f2d7824 100644 --- a/gcc/testsuite/lib/gfortran-dg.exp +++ b/gcc/testsuite/lib/gfortran-dg.exp @@ -15,6 +15,7 @@ # . load_lib gcc-dg.exp +load_lib torture-options.exp # Define gfortran callbacks for dg.exp. @@ -82,7 +83,10 @@ proc gfortran-dg-prune { system text } { # as c-torture does. proc gfortran-dg-runtest { testcases default-extra-flags } { global runtests - global TORTURE_OPTIONS + global DG_TORTURE_OPTIONS torture_with_loops + + torture-init + set-torture-options $DG_TORTURE_OPTIONS foreach test $testcases { # If we're only testing specific files and this isn't one of @@ -94,7 +98,7 @@ proc gfortran-dg-runtest { testcases default-extra-flags } { # look if this is dg-do-run test, in which case # we cycle through the option list, otherwise we don't if [expr [search_for $test "dg-do run"]] { - set option_list $TORTURE_OPTIONS + set option_list $torture_with_loops } else { set option_list [list { -O } ] } @@ -106,6 +110,8 @@ proc gfortran-dg-runtest { testcases default-extra-flags } { dg-test $test $flags ${default-extra-flags} } } + + torture-finish } proc gfortran-dg-debug-runtest { target_compile trivial opt_opts testcases } { diff --git a/gcc/testsuite/lib/objc-torture.exp b/gcc/testsuite/lib/objc-torture.exp index dda44d3abef..31967f4eabc 100644 --- a/gcc/testsuite/lib/objc-torture.exp +++ b/gcc/testsuite/lib/objc-torture.exp @@ -18,9 +18,6 @@ load_lib file-format.exp -# The default option list can be overridden by -# TORTURE_OPTIONS="{ { list1 } ... { listN } }" - if ![info exists OBJC_RUNTIME_OPTIONS] { set OBJC_RUNTIME_OPTIONS "" foreach type {-fgnu-runtime -fnext-runtime} { @@ -39,7 +36,12 @@ if ![info exists OBJC_RUNTIME_OPTIONS] { verbose -log "Using the following runtimes: $OBJC_RUNTIME_OPTIONS" -if ![info exists TORTURE_OPTIONS] { +# The default option list can be overridden by +# TORTURE_OPTIONS="{ { list1 } ... { listN } }" + +if [info exists TORTURE_OPTIONS] { + set OBJC_TORTURE_OPTIONS $TORTURE_OPTIONS +} else { # It is theoretically beneficial to group all of the O2/O3 options together, # as in many cases the compiler will generate identical executables for # all of them--and the objc-torture testsuite will skip testing identical @@ -47,7 +49,7 @@ if ![info exists TORTURE_OPTIONS] { # Also note that -finline-functions is explicitly included in one of the # items below, even though -O3 is also specified, because some ports may # choose to disable inlining functions by default, even when optimizing. - set TORTURE_OPTIONS [list \ + set OBJC_TORTURE_OPTIONS [list \ " -O0 " \ " -O1 " \ " -O2 " \ @@ -58,23 +60,6 @@ if ![info exists TORTURE_OPTIONS] { " -Os " ] } - -# Split TORTURE_OPTIONS into two choices: one for testcases with loops and -# one for testcases without loops. Add in the objc runtime options also. - -set torture_with_loops "" -set torture_without_loops "" -foreach objc_option $OBJC_RUNTIME_OPTIONS { - foreach option $TORTURE_OPTIONS { - - if ![string match "*loop*" $option] { - lappend torture_without_loops "$option $objc_option" - } - lappend torture_with_loops "$option $objc_option" - } -} - - # # objc-torture-compile -- runs the Tege OBJC-torture test # diff --git a/gcc/testsuite/lib/torture-options.exp b/gcc/testsuite/lib/torture-options.exp new file mode 100644 index 00000000000..7721f901bfe --- /dev/null +++ b/gcc/testsuite/lib/torture-options.exp @@ -0,0 +1,112 @@ +# Copyright (C) 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# Prepare to use a new set of torture options. +# +# Letting options leak from one set of tests to another can be confusing. +# Make sure variables are not set at the time we're called, because that +# would mean they were set without being cleared. +proc torture-init { args } { + global torture_without_loops global_with_loops + + if [info exists torture_without_loops] { + error "torture-init: torture_without_loops is not empty as expected" + } + if [info exists torture_with_loops] { + error "torture-init: torture_with_loops is not empty as expected" + } +} + +# Return 1 if torture options have already been set, 0 otherwise. +proc torture-options-exist { args } { + global torture_with_loops + return [info exists torture_with_loops] +} + +# Return 1 if compiler option ARG only affects loops, 0 otherwise. +proc contains-loop-option-p { arg } { + switch -glob -- $arg { + "*loop*" { return 1 } + default { return 0 } + } +} + +# Set torture options variables for tests with and without loops. +# +# Argument 0 is the list to use as torture options +# Argument 1 is the list to combine with the torture options. +proc set-torture-options { args } { + global torture_with_loops torture_without_loops + + set torture_list [lindex $args 0] + + if { [llength $args] != 1 } { + set other_list [lindex $args 1] + } else { + set other_list [list {}] + } + + set torture_with_loops "" + set torture_without_loops "" + foreach torture_opts $torture_list { + foreach other_opts $other_list { + # Remove trailing space[s] to match previous output. + set torture_opts [string trimright $torture_opts] + if ![contains-loop-option-p $torture_opts] { + lappend torture_without_loops "$torture_opts $other_opts" + } + lappend torture_with_loops "$torture_opts $other_opts" + } + } +} + +# Finish up after using a set of torture options. +# +# Letting options leak from one set of tests to another can be confusing. +# Make sure variables are set at the time we're called, and then unset +# them to prevent interference with other sets of tests. +proc torture-finish { args } { + global torture_without_loops torture_with_loops + + if [info exists torture_without_loops] { + unset torture_without_loops + } else { + error "torture-finish: torture_without_loops is not defined" + } + + if [info exists torture_with_loops] { + unset torture_with_loops + } else { + error "torture-finish: torture_with_loops is not defined" + } +} + +# Useful for debugging .exp files. +proc dump-torture-options { args } { + global torture_without_loops torture_with_loops + + if [info exists torture_without_loops] { + verbose "torture_without_loops = \"${torture_without_loops}\"" 1 + } else { + verbose "torture_without_loops is not defined" 1 + } + + if [info exists torture_with_loops] { + verbose "torture_with_loops = \"${torture_with_loops}\"" 1 + } else { + verbose "torture_with_loops is not defined" 1 + } +} diff --git a/gcc/testsuite/objc.dg/pch/pch.exp b/gcc/testsuite/objc.dg/pch/pch.exp index aa95b84cc27..95af1656864 100644 --- a/gcc/testsuite/objc.dg/pch/pch.exp +++ b/gcc/testsuite/objc.dg/pch/pch.exp @@ -20,10 +20,14 @@ # Load support procs. load_lib objc-dg.exp load_lib dg-pch.exp +load_lib torture-options.exp # Initialize `dg'. dg-init +torture-init +set-torture-options $DG_TORTURE_OPTIONS + set old_dg_do_what_default "${dg-do-what-default}" # Main loop. @@ -40,4 +44,5 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.m]] { set dg-do-what-default "$old_dg_do_what_default" # All done. +torture-finish dg-finish diff --git a/gcc/testsuite/objc/compile/compile.exp b/gcc/testsuite/objc/compile/compile.exp index 08d26326571..0f6a7e915c7 100644 --- a/gcc/testsuite/objc/compile/compile.exp +++ b/gcc/testsuite/objc/compile/compile.exp @@ -23,6 +23,10 @@ if $tracelevel then { # load support procs load_lib objc-torture.exp +load_lib torture-options.exp + +torture-init +set-torture-options $OBJC_TORTURE_OPTIONS $OBJC_RUNTIME_OPTIONS # # main test loop @@ -36,3 +40,5 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.m]] { objc-torture $src } + +torture-finish diff --git a/gcc/testsuite/objc/execute/exceptions/exceptions.exp b/gcc/testsuite/objc/execute/exceptions/exceptions.exp index 271a6174839..d3a37385746 100644 --- a/gcc/testsuite/objc/execute/exceptions/exceptions.exp +++ b/gcc/testsuite/objc/execute/exceptions/exceptions.exp @@ -27,6 +27,10 @@ lappend additional_flags "-fobjc-exceptions" # load support procs load_lib objc-torture.exp +load_lib torture-options.exp + +torture-init +set-torture-options $OBJC_TORTURE_OPTIONS $OBJC_RUNTIME_OPTIONS # # main test loop @@ -40,3 +44,5 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.m]] { objc-torture-execute $src $additional_flags } + +torture-finish diff --git a/gcc/testsuite/objc/execute/execute.exp b/gcc/testsuite/objc/execute/execute.exp index 38329f1a729..c69d9f4c70f 100644 --- a/gcc/testsuite/objc/execute/execute.exp +++ b/gcc/testsuite/objc/execute/execute.exp @@ -24,6 +24,10 @@ if $tracelevel then { # load support procs load_lib objc-torture.exp +load_lib torture-options.exp + +torture-init +set-torture-options $OBJC_TORTURE_OPTIONS $OBJC_RUNTIME_OPTIONS # # main test loop @@ -37,3 +41,5 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.m]] { objc-torture-execute $src } + +torture-finish diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 3e98750e751..f1f5a8ea70c 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,7 @@ +2008-05-15 Janis Johnson + + * testsuite/lib/libgomp.exp: Load torture-options.exp from gcc lib. + 2008-05-07 Jakub Jelinek PR middle-end/36106 diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index 2e9f9d8a726..274ee17f0a7 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -21,6 +21,7 @@ load_gcc_lib prune.exp load_gcc_lib target-libpath.exp load_gcc_lib wrapper.exp load_gcc_lib gcc-defs.exp +load_gcc_lib torture-options.exp load_gcc_lib gcc-dg.exp load_gcc_lib gfortran-dg.exp