diff mbox

Also test -O0 for OpenACC C, C++ offloading test cases

Message ID 87mvph9zxz.fsf@hertz.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge March 29, 2016, 1:27 p.m. UTC
Hi!

On Thu, 24 Mar 2016 22:31:29 +0100, I wrote:
> --- libgomp/testsuite/libgomp.oacc-c++/c++.exp
> +++ libgomp/testsuite/libgomp.oacc-c++/c++.exp

>  # Initialize dg.
>  dg-init
> +torture-init
>  
>  # Turn on OpenACC.
>  lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
> @@ -104,7 +101,26 @@ if { $lang_test_file_found } {
>  
>  	setenv ACC_DEVICE_TYPE $offload_target_openacc
>  
> -	dg-runtest $tests "$tagopt" "$libstdcxx_includes $DEFAULT_CFLAGS"
> +	# To get better test coverage for device-specific code that is only
> +	# ever used in offloading configurations, we'd like more thorough
> +	# testing for test cases that deal with offloading, which most of all
> +	# OpenACC test cases are.  We enable torture testing, but limit it to
> +	# -O0 and -O2 only, to avoid testing times exploding too much, under
> +	# the assumption that between -O0 and -O[something] there is the
> +	# biggest difference in the overall structure of the generated code.
> +	switch $offload_target_openacc {
> +	    host {
> +		set-torture-options [list \
> +					 { -O2 } ]
> +	    }
> +	    default {
> +		set-torture-options [list \
> +					 { -O0 } \
> +					 { -O2 } ]
> +	    }
> +	}
> +
> +	gcc-dg-runtest $tests "$tagopt" "$libstdcxx_includes"
>      }
>  }
>  
> @@ -112,4 +128,5 @@ if { $lang_test_file_found } {
>  set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
>  
>  # All done.
> +torture-finish
>  dg-finish

In a nvptx-none configuration (that is, without libstdc++), this caused:

     Running [...]/libgomp/testsuite/libgomp.oacc-c++/c++.exp ...
    +ERROR: tcl error sourcing [...]/libgomp/testsuite/libgomp.oacc-c++/c++.exp
    +ERROR: torture-finish: torture_without_loops is not defined
    +    while executing
    +"error "torture-finish: torture_without_loops is not defined""
    +    invoked from within
    +"if [info exists torture_without_loops] {
    +      unset torture_without_loops
    +    } else {
    +      error "torture-finish: torture_without_loops is not defined"
    +    }"
    +    (procedure "torture-finish" line 4)
    +    invoked from within
    +"torture-finish"
    +    (file "[...]/libgomp/testsuite/libgomp.oacc-c++/c++.exp" line 131)
    +    invoked from within
    +"source [...]/libgomp/testsuite/libgomp.oacc-c++/c++.exp"
    +    ("uplevel" body line 1)
    +    invoked from within
    +"uplevel #0 source [...]/libgomp/testsuite/libgomp.oacc-c++/c++.exp"
    +    invoked from within
    +"catch "uplevel #0 source $test_file_name""
     Running [...]/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp ...

torture_with_loops and torture_without_loops are set in
gcc/testsuite/lib/torture-options.exp:set-torture-options -- which we
don't call in libgomp.oacc-c++/c++.exp if skipping C++ testing.  As
obvious, fixed in r234519 as follows:

commit 53c452eee566d997bdef3ee0b20e7bb4485d77a4
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue Mar 29 13:24:22 2016 +0000

    Avoid ERROR in libgomp.oacc-c++/c++.exp in non-C++ configurations
    
    	libgomp/
    	* testsuite/libgomp.oacc-c++/c++.exp [!lang_test_file_found]: Call
    	set-torture-options.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234519 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog                          |    5 +++++
 libgomp/testsuite/libgomp.oacc-c++/c++.exp |    4 ++++
 2 files changed, 9 insertions(+)



Grüße
 Thomas
diff mbox

Patch

diff --git libgomp/ChangeLog libgomp/ChangeLog
index e0cd567..f4f30fb 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -1,3 +1,8 @@ 
+2016-03-29  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* testsuite/libgomp.oacc-c++/c++.exp [!lang_test_file_found]: Call
+	set-torture-options.
+
 2016-03-24  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* testsuite/libgomp.oacc-c++/c++.exp: Set up torture testing, use
diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
index bbdbe2f..608b298 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -122,6 +122,10 @@  if { $lang_test_file_found } {
 
 	gcc-dg-runtest $tests "$tagopt" "$libstdcxx_includes"
     }
+} else {
+    # Call this once, which placates the subsequent torture-finish.
+    set-torture-options [list \
+			     { INVALID } ]
 }
 
 # See above.