1load_lib libgomp-dg.exp
2load_gcc_lib gcc-dg.exp
3
4global shlib_ext
5
6set shlib_ext [get_shlib_extension]
7set lang_link_flags "-lstdc++"
8set lang_test_file_found 0
9set lang_library_path "../libstdc++-v3/src/.libs"
10if [info exists lang_include_flags] then {
11    unset lang_include_flags
12}
13
14# Initialize dg.
15dg-init
16
17# Turn on OpenMP.
18lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
19
20set blddir [lookfor_file [get_multilibs] libgomp]
21
22
23if { $blddir != "" } {
24    # Look for a static libstdc++ first.
25    if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] {
26        set lang_test_file "${lang_library_path}/libstdc++.a"
27        set lang_test_file_found 1
28        # We may have a shared only build, so look for a shared libstdc++.
29    } elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] {
30        set lang_test_file "${lang_library_path}/libstdc++.${shlib_ext}"
31        set lang_test_file_found 1
32    } else {
33        puts "No libstdc++ library found, will not execute c++ tests"
34    }
35} elseif { [info exists GXX_UNDER_TEST] } {
36    set lang_test_file_found 1
37    # Needs to exist for libgomp.exp.
38    set lang_test_file ""
39} else {
40    puts "GXX_UNDER_TEST not defined, will not execute c++ tests"
41}
42
43if { $lang_test_file_found } {
44    # Gather a list of all tests.
45    set tests [lsort [find $srcdir/$subdir *.C]]
46
47    if { $blddir != "" } {
48        set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
49    } else {
50        set ld_library_path "$always_ld_library_path"
51    }
52    append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
53    set_ld_library_path_env_vars
54
55    set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
56    if { [file exists $flags_file] } {
57	set libstdcxx_includes [exec sh $flags_file --build-includes]
58    } else {
59	set libstdcxx_includes ""
60    }
61
62    # Main loop.
63    dg-runtest $tests "" $libstdcxx_includes
64}
65
66# All done.
67dg-finish
68