Remove xfail for hppa*-*-hpux* from stdatomic-flag.c and stdatomic-flag-2.c
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c++ / c++.exp
blob7b2315e406f2370c2c17f2a2bd9eee301d1d49c5
1 # This whole file adapted from libgomp.c++/c++.exp.
3 load_lib libgomp-dg.exp
4 load_gcc_lib gcc-dg.exp
5 load_gcc_lib torture-options.exp
7 proc check_effective_target_c { } {
8 return 0
10 proc check_effective_target_c++ { } {
11 return 1
14 if { $blddir != "" } {
15 set libstdc++_library_path "../libstdc++-v3/src/.libs"
16 set shlib_ext [get_shlib_extension]
17 if { ![file exists "${blddir}/${libstdc++_library_path}/libstdc++.a"]
18 && ![file exists "${blddir}/${libstdc++_library_path}/libstdc++.${shlib_ext}"] } {
19 verbose -log "No libstdc++ library found, will not execute c++ tests"
20 unset libstdc++_library_path
21 return
23 lappend lang_library_paths ${libstdc++_library_path}
24 } elseif { ![info exists GXX_UNDER_TEST] } {
25 verbose -log "GXX_UNDER_TEST not defined, will not execute c++ tests"
26 return
28 if { $blddir != "" } {
29 set lang_source_re {^.*\.[cC]$}
30 set lang_include_flags [exec sh ${blddir}/../libstdc++-v3/scripts/testsuite_flags --build-includes]
32 lappend ALWAYS_CFLAGS "compiler=$GXX_UNDER_TEST"
34 # Initialize dg.
35 dg-init
36 torture-init
38 # Turn on OpenACC.
39 lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
41 # Gather a list of all tests.
42 set tests [lsort [concat \
43 [find $srcdir/$subdir *.C] \
44 [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *.c]]]
46 set ld_library_path $always_ld_library_path
47 if { $blddir != "" } {
48 append ld_library_path ":${blddir}/${libstdc++_library_path}"
50 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
51 set_ld_library_path_env_vars
53 # Test with all available offload targets, and with offloading disabled.
54 foreach offload_target [concat [split $offload_targets ","] "disable"] {
55 global openacc_device_type
56 set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
57 set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
59 switch $openacc_device_type {
60 "" {
61 unsupported "$subdir $offload_target offloading"
62 continue
64 host {
65 set acc_mem_shared 1
67 nvidia {
68 if { ![check_effective_target_openacc_nvidia_accel_present] } {
69 # Don't bother; execution testing is going to FAIL.
70 untested "$subdir $offload_target offloading: supported, but hardware not accessible"
71 continue
74 # Copy ptx file (TEMPORARY)
75 remote_download host $srcdir/libgomp.oacc-c-c++-common/subr.ptx
77 # Where timer.h lives
78 lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/libgomp.oacc-c-c++-common"
80 set acc_mem_shared 0
82 radeon {
83 if { ![check_effective_target_openacc_radeon_accel_present] } {
84 # Don't bother; execution testing is going to FAIL.
85 untested "$subdir $offload_target offloading: supported, but hardware not accessible"
86 continue
89 set acc_mem_shared 0
91 default {
92 error "Unknown OpenACC device type: $openacc_device_type (offload target: $offload_target)"
95 set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
97 # To avoid compilation overhead, and to keep simple '-foffload=[...]'
98 # handling in test cases, by default only build for the offload target
99 # that we're actually going to test.
100 set tagopt "$tagopt -foffload=$offload_target"
101 # Force usage of the corresponding OpenACC device type.
102 setenv ACC_DEVICE_TYPE $openacc_device_type
104 # To get better test coverage for device-specific code that is only
105 # ever used in offloading configurations, we'd like more thorough
106 # testing for test cases that deal with offloading, which most of all
107 # OpenACC test cases are. We enable torture testing, but limit it to
108 # -O0 and -O2 only, to avoid testing times exploding too much, under
109 # the assumption that between -O0 and -O[something] there is the
110 # biggest difference in the overall structure of the generated code.
111 switch -glob $offload_target {
112 disable {
113 set-torture-options [list \
114 { -O2 } ]
116 default {
117 set-torture-options [list \
118 { -O0 } \
119 { -O2 } ]
123 gcc-dg-runtest $tests "$tagopt" ""
125 unset offload_target
127 if { $blddir != "" } {
128 unset lang_source_re
129 unset lang_include_flags
130 unset libstdc++_library_path
131 unset lang_library_paths
134 # All done.
135 torture-finish
136 dg-finish