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
{ } {
10 proc check_effective_target_c
++ { } {
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
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"
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"
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
{
61 unsupported
"$subdir $offload_target offloading"
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"
74 # Copy ptx file (TEMPORARY)
75 remote_download host $srcdir/libgomp.oacc-c-c++-common/subr.ptx
78 lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/libgomp.oacc-c-c++-common"
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"
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
{
113 set-torture
-options
[list \
117 set-torture
-options
[list \
123 gcc
-dg
-runtest $tests
"$tagopt" ""
127 if { $blddir
!= "" } {
129 unset lang_include_flags
130 unset libstdc
++_library_path
131 unset lang_library_paths