On 10/17/2017 02:51 PM, Tom de Vries wrote:
On 10/17/2017 01:19 PM, Thomas Schwinge wrote:
Hi!

On Mon, 16 Oct 2017 10:49:45 +0200, Tom de Vries<tom_devr...@mentor.com>  wrote:
this patch enables some openacc test-cases for non-nvidia devices.

Committed.
Thanks!

--- a/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90
@@ -1,4 +1,4 @@
-! { dg-do run  { target openacc_nvidia_accel_selected } }
+! { dg-skip-if "" { *-*-* } { "-DACC_MEM_SHARED=1" } }
[...]
To restore the torture testing that we like to do for Fortran test cases,
I committed the following in trunk r253808, as obvious:

It's not obvious to me.

Given that lib/libgomp.exp contains:
...
set dg-do-what-default run
...
I'd expect adding '! dg-do run' to have no effect.


I found the culprit, in gfortran-dg-runtest:
...
# 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_with_loops
        } else {
            set option_list [list { -O } ]
        }
...
This doesn't take dg-do-what-default into account. [ Note that this search also triggers on '! bla bla dg-do run bla bla' ]

Attached patch fixes this.

Tested on x86_64 with test-case libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90.

Verified that that adding '! dg-do compiler' switches back to running with '-O'.

OK, if full testing is ok?

Thanks,
- Tom

diff --git a/gcc/testsuite/lib/gfortran-dg.exp b/gcc/testsuite/lib/gfortran-dg.exp
index 27b2a69..82222c3 100644
--- a/gcc/testsuite/lib/gfortran-dg.exp
+++ b/gcc/testsuite/lib/gfortran-dg.exp
@@ -125,6 +125,7 @@ proc gfortran-dg-prune { system text } {
 proc gfortran-dg-runtest { testcases flags default-extra-flags } {
     global runtests
     global DG_TORTURE_OPTIONS torture_with_loops
+    global dg-do-what-default
 
     torture-init
     set-torture-options $DG_TORTURE_OPTIONS
@@ -136,9 +137,22 @@ proc gfortran-dg-runtest { testcases flags default-extra-flags } {
 	    continue
         }
 
+	set dorun 0
+	if [expr [search_for $test "\{ dg-do "]] {
+	    # We set dg-do
+	    if [expr [search_for $test "\{ dg-do run"]] {
+		# We set dg-do to run
+		set dorun 1
+	    }
+	} else {
+	    # We don't set dg-do, use the default
+	    if { ${dg-do-what-default} == "run" } {
+		set dorun 1
+	    }
+	}
 	# 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"]] {
+	if { $dorun } {
 	    set option_list $torture_with_loops
 	} else {
 	    set option_list [list { -O } ]

Reply via email to