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
9 set shlib_ext
[get_shlib_extension
]
10 set lang_link_flags
"-lstdc++"
11 set lang_test_file_found
0
12 set lang_library_path
"../libstdc++-v3/src/.libs"
13 if [info exists lang_include_flags
] then {
14 unset lang_include_flags
22 lappend ALWAYS_CFLAGS
"additional_flags=-fopenacc"
24 #
Switch into C
++ mode. Otherwise
, the libgomp.oacc
-c
-c
++-common
/*.c
25 # files would be compiled as C files.
26 set SAVE_GCC_UNDER_TEST
"$GCC_UNDER_TEST"
27 set GCC_UNDER_TEST
"$GCC_UNDER_TEST -x c++"
29 set blddir
[lookfor_file
[get_multilibs
] libgomp
]
32 if { $blddir
!= "" } {
33 # Look
for a static libstdc
++ first.
34 if [file
exists "${blddir}/${lang_library_path}/libstdc++.a"] {
35 set lang_test_file
"${lang_library_path}/libstdc++.a"
36 set lang_test_file_found
1
37 # We may have a shared only build
, so look
for a shared libstdc
++.
38 } elseif
[file
exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] {
39 set lang_test_file
"${lang_library_path}/libstdc++.${shlib_ext}"
40 set lang_test_file_found
1
42 puts
"No libstdc++ library found, will not execute c++ tests"
44 } elseif
{ [info exists GXX_UNDER_TEST
] } {
45 set lang_test_file_found
1
46 # Needs to exist
for libgomp.exp.
49 puts
"GXX_UNDER_TEST not defined, will not execute c++ tests"
52 if { $lang_test_file_found
} {
53 # Gather a list of all tests.
54 set tests
[lsort
[concat \
55 [find $srcdir
/$subdir
*.C
] \
56 [find $srcdir
/$subdir
/..
/libgomp.oacc
-c
-c
++-common
*.c
]]]
58 if { $blddir
!= "" } {
59 set ld_library_path
"$always_ld_library_path:${blddir}/${lang_library_path}"
61 set ld_library_path
"$always_ld_library_path"
63 append ld_library_path
[gcc
-set-multilib
-library
-path $GCC_UNDER_TEST
]
64 set_ld_library_path_env_vars
66 set flags_file
"${blddir}/../libstdc++-v3/scripts/testsuite_flags"
67 if { [file
exists $flags_file
] } {
68 set libstdcxx_includes
[exec sh $flags_file
--build
-includes
]
70 set libstdcxx_includes
""
73 # Test OpenACC with available accelerators.
74 foreach offload_target_openacc $offload_targets_s_openacc
{
75 set tagopt
"-DACC_DEVICE_TYPE_$offload_target_openacc=1"
77 switch $offload_target_openacc
{
82 if { ![check_effective_target_openacc_nvidia_accel_present
] } {
83 # Don
't bother; execution testing is going to FAIL.
84 untested "$subdir $offload_target_openacc offloading"
88 # Copy ptx file (TEMPORARY)
89 remote_download host $srcdir/libgomp.oacc-c-c++-common/subr.ptx
92 lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/libgomp.oacc-c-c++-common"
100 set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
102 setenv ACC_DEVICE_TYPE $offload_target_openacc
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 $offload_target_openacc
{
113 set-torture
-options
[list \
117 set-torture
-options
[list \
123 gcc
-dg
-runtest $tests
"$tagopt" "$libstdcxx_includes"
126 #
Call this once
, which placates the subsequent torture
-finish.
127 set-torture
-options
[list \
132 set GCC_UNDER_TEST
"$SAVE_GCC_UNDER_TEST"