Hi Jakub, all,

Am 27.03.25 um 20:04 schrieb Jakub Jelinek:
On Thu, Mar 27, 2025 at 07:34:14PM +0100, Jakub Jelinek wrote:
The following patch runs the test only in the -O3 -g case (just using -O3
there would run it twice, once with
-O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions
and once with
-O3 -g

The -O3 from dg-options can be dropped too.

Some tests (e.g. in testsuite/gcc.dg/torture/) use e.g.
/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */
so the test is run just with -O2 by default, but when testing with
GCC_TEST_RUN_EXPENSIVE=1 it cycles through everything.  Note, you'd need
to drop the -O3 from dg-options in that case for sure, because with explicit
-O3 option in there it cycles through -O0 -O3, -O1 -O3, -O2 -O3,
-O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer 
-finline-functions -O3,
-O3 -g -O3, -Os -O3.

Though, seeing 395 gfortran.dg/*.f90 tests with dg-options or
dg-additional-options including -O, perhaps better might be to hack up
the gfortran.dg/dg.exp and libgomp.fortran/fortran.exp drivers so that
they actually don't cycle through options if -O appears anywhere in
dg-options/dg-additional-options.

What do you think about that?

For gcc.dg/torture/ and g++.dg/torture/, IMHO explicit -O in
dg-options/dg-additional-options is always a bug, either the test shouldn't
be in torture subdirectory and have the explicit -O, or it shouldn't have
them and cycle through everything.

But in gfortran.dg case when the default is to cycle for all tests...

I don't think we want to change the default for gfortran.dg,
at least not now.  And not in any of the subdirectories, which
I normally do not touch.

It would be great to have an easy-to-use way to run selected tests
only once, for the following reasons (just my opinion):

(1) A certain runtime test is expensive.  Here I did not know that there
    is a variable GCC_TEST_RUN_EXPENSIVE, but this seems to suppress
    running a certain test completely.  This may be too much, and it
    appears that gfortran.dg does not yet support this.

(2) A certain runtime test actually tests the runtime *library*.
    Cycling through options then provides no insight and is just a
    waste of my time as voluntary developer.  The only way to cycle
    here I can imagine would involve e.g. lto.

(3) ...

I like the idea of having a way to control how expensive tests
can be.  For example, several of the tests that check inline code
generation in the Fortran FE would need only a small subset of
the options being tested in regtesting, unless one really works
on that particular Frontend code in question.

It would be really helpful to have an easy-to-use way to specify
if a test should cycle over options, or just one, (or a list?).
Given that it is apparently difficult to write a simple dg-directive
correctly, more is likely less... ;-)  The dg-skip-if seems to be
very non-intuitive for the current purpose.

(And I did stumple over the two spaces in { dg-do  run } myself before.)

Cheers,
Harald

        Jakub



Reply via email to