diff mbox

gfortran-dg-runtest, torture options

Message ID 87k37uvhjr.fsf@schwinge.name
State New
Headers show

Commit Message

Thomas Schwinge July 3, 2014, 10:54 a.m. UTC
Hi!

On Tue, 13 Aug 2013 13:06:30 +0200, I wrote:
> I noticed something strange in the libgomp testresults (but not
> necessarily specific to libgomp): an "arbitrary" set of the Fortran
> execution tests are run just for -O, and others for each of the full set
> of torture options: -O0, -O1, -O2, and so on.  After some time I realized
> it's the set of tests that contain an explicit »dg-do run« directive that
> are run for all torture levels, and the tests that inherit the default
> »set dg-do-what-default run« from libgomp/testsuite/lib/libgomp.exp are
> only run for -O.  This is coming from the special handling in
> gcc/testsuite/lib/gfortran-dg.exp:gfortran-dg-test (which seems to be
> present approximately "forever").  Should this consider the
> dg-do-what-default case, too?  Why is torture testing done only for
> execution tests?  And, why only for Fortran?  Is this behavior generally
> intentional -- of course, bigger testing coverage is nice, but this seems
> a bit arbitrary to me?

Thanks Janis and Mikael for your replies (nearly a year ago...), but
still my questions remain to be answered: in my understanding, the
libgomp testsuite is not the place for compiler torture testing
(different optimization flags and all that -- and, that is done for
Fortran only; gfortran-dg-runtest), but rather, I understand the libgomp
testsuite to be the place for libgomp library testing ;-), and hence I
propose to remove that special casing of Fortran test cases:



A follow-up patch could then be to remove all the redundant »dg-do run«
directives from the individual test cases, as that's the default set in
libgomp/testsuite/lib/libgomp.exp: »set dg-do-what-default run«.


Grüße,
 Thomas

Comments

Jakub Jelinek July 3, 2014, 10:58 a.m. UTC | #1
On Thu, Jul 03, 2014 at 12:54:32PM +0200, Thomas Schwinge wrote:
> Thanks Janis and Mikael for your replies (nearly a year ago...), but
> still my questions remain to be answered: in my understanding, the
> libgomp testsuite is not the place for compiler torture testing
> (different optimization flags and all that -- and, that is done for
> Fortran only; gfortran-dg-runtest), but rather, I understand the libgomp
> testsuite to be the place for libgomp library testing ;-), and hence I
> propose to remove that special casing of Fortran test cases:

No, it is intentional that we torture test those, libgomp is the place
for all OpenMP runtime tests, not just for library testing.

	Jakub
Thomas Schwinge July 3, 2014, 11:06 a.m. UTC | #2
Hi!

On Thu, 3 Jul 2014 12:58:32 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Jul 03, 2014 at 12:54:32PM +0200, Thomas Schwinge wrote:
> > Thanks Janis and Mikael for your replies (nearly a year ago...), but
> > still my questions remain to be answered: in my understanding, the
> > libgomp testsuite is not the place for compiler torture testing
> > (different optimization flags and all that -- and, that is done for
> > Fortran only; gfortran-dg-runtest), but rather, I understand the libgomp
> > testsuite to be the place for libgomp library testing ;-), and hence I
> > propose to remove that special casing of Fortran test cases:
> 
> No, it is intentional that we torture test those, libgomp is the place
> for all OpenMP runtime tests, not just for library testing.

But then, the obvious question: why for Fortran only, but not for C and
C++?


Grüße,
 Thomas
Jakub Jelinek July 3, 2014, 11:09 a.m. UTC | #3
On Thu, Jul 03, 2014 at 01:06:48PM +0200, Thomas Schwinge wrote:
> On Thu, 3 Jul 2014 12:58:32 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> > On Thu, Jul 03, 2014 at 12:54:32PM +0200, Thomas Schwinge wrote:
> > > Thanks Janis and Mikael for your replies (nearly a year ago...), but
> > > still my questions remain to be answered: in my understanding, the
> > > libgomp testsuite is not the place for compiler torture testing
> > > (different optimization flags and all that -- and, that is done for
> > > Fortran only; gfortran-dg-runtest), but rather, I understand the libgomp
> > > testsuite to be the place for libgomp library testing ;-), and hence I
> > > propose to remove that special casing of Fortran test cases:
> > 
> > No, it is intentional that we torture test those, libgomp is the place
> > for all OpenMP runtime tests, not just for library testing.
> 
> But then, the obvious question: why for Fortran only, but not for C and
> C++?

Fortran has far more tests with arrays etc. that testing just -O0 or -O2 is
insufficient, that is typically not the case for C/C++.

	Jakub
diff mbox

Patch

--- libgomp/testsuite/lib/libgomp-dg.exp
+++ libgomp/testsuite/lib/libgomp-dg.exp
@@ -5,3 +5,19 @@  proc libgomp-dg-test { prog do_what extra_tool_flags } {
 proc libgomp-dg-prune { system text } {
     return [gcc-dg-prune $system $text]
 }
+
+# Modified dg-runtest that deal with Fortran modules cleanup.
+proc dg-runtest-fortran { testcases flags default-extra-flags } {
+    global runtests
+
+    foreach testcase $testcases {
+	# If we're only testing specific files and this isn't one of them, skip it.
+	if {![runtest_file_p $runtests $testcase]} {
+	    continue
+	}
+	verbose "Testing [file tail [file dirname $testcase]]/[file tail $testcase]"
+	list-module-names $testcase
+	dg-test $testcase $flags ${default-extra-flags}
+	cleanup-modules ""
+    }
+}
--- libgomp/testsuite/libgomp.fortran/fortran.exp
+++ libgomp/testsuite/libgomp.fortran/fortran.exp
@@ -11,6 +11,10 @@  set lang_link_flags	"-lgfortran"
 set lang_test_file_found 0
 set quadmath_library_path "../libquadmath/.libs"
 
+# If a testcase doesn't have special options, use these.
+if ![info exists DEFAULT_CFLAGS] then {
+    set DEFAULT_CFLAGS "-O2"
+}
 
 # Initialize dg.
 dg-init
@@ -60,7 +64,7 @@  if { $lang_test_file_found } {
     set_ld_library_path_env_vars
 
     # Main loop.
-    gfortran-dg-runtest $tests ""
+    dg-runtest-fortran $tests "" $DEFAULT_CFLAGS
 }
 
 # All done.