| 1 |
load_lib libvtv-dg.exp |
| 2 |
load_gcc_lib scanlang.exp |
| 3 |
load_gcc_lib gcc-dg.exp |
| 4 |
|
| 5 |
global VTV_FLAGS |
| 6 |
set VTV_FLAGS [list {-O0} {-O2}] |
| 7 |
|
| 8 |
libvtv_init c++ |
| 9 |
|
| 10 |
set shlib_ext [get_shlib_extension] |
| 11 |
set lang_link_flags "-shared-libgcc -lstdc++" |
| 12 |
set lang_test_file_found 0 |
| 13 |
set lang_library_path "../libstdc++-v3/src/.libs" |
| 14 |
|
| 15 |
dg-init |
| 16 |
|
| 17 |
set blddir [lookfor_file [get_multilibs] libvtv] |
| 18 |
|
| 19 |
# Find the correct libstdc++ library to use. |
| 20 |
|
| 21 |
if { $blddir != "" } { |
| 22 |
# Look for a static libstdc++ first. |
| 23 |
if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] { |
| 24 |
set lang_test_file "${lang_library_path}/libstdc++.a" |
| 25 |
set lang_test_file_found 1 |
| 26 |
# We may have a shared only build, so look for a shared libstdc++. |
| 27 |
} elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] { |
| 28 |
set lang_test_file "${lang_library_path}/libstdc++.${shlib_ext}" |
| 29 |
set lang_test_file_found 1 |
| 30 |
} else { |
| 31 |
puts "looking for ${blddir}/${lang_library_path}/libstdc++.${shlib_ext}" |
| 32 |
puts "No libstdc++ library found, will not execute c++ tests" |
| 33 |
} |
| 34 |
} elseif { [info exists GXX_UNDER_TEST] } { |
| 35 |
set lang_test_file_found 1 |
| 36 |
# Needs to exist for libvtv.exp. |
| 37 |
set lang_test_file "" |
| 38 |
} else { |
| 39 |
puts "GXX_UNDER_TEST not defined, will not execute c++ tests" |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
global srcdir |
| 44 |
|
| 45 |
if { $lang_test_file_found } { |
| 46 |
# Set the path for finding libstdc++. |
| 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 |
# Make sure we can find the libstdc++ header files. |
| 56 |
set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags" |
| 57 |
if { [file exists $flags_file] } { |
| 58 |
set libstdcxx_includes [exec sh $flags_file --build-includes] |
| 59 |
} else { |
| 60 |
set libstdcxx_includes "" |
| 61 |
} |
| 62 |
|
| 63 |
# Run the tests with -fvtable-verify=std |
| 64 |
foreach flags $VTV_FLAGS { |
| 65 |
foreach srcfile [lsort [glob -nocomplain ${srcdir}/libvtv.cc/*.cc]] { |
| 66 |
dg-runtest $srcfile "$flags -fvtable-verify=std" $libstdcxx_includes |
| 67 |
} |
| 68 |
|
| 69 |
foreach srcfile [lsort [glob -nocomplain ${srcdir}/libvtv.cc/@*.list]] { |
| 70 |
dg-runtest $srcfile "$flags -fvtable-verify=std" $libstdcxx_includes |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
# Run the tests with -fvtable-verify=preinit |
| 75 |
foreach flags $VTV_FLAGS { |
| 76 |
foreach srcfile [lsort [glob -nocomplain ${srcdir}/libvtv.cc/*.cc]] { |
| 77 |
dg-runtest $srcfile "$flags -fvtable-verify=preinit" $libstdcxx_includes |
| 78 |
} |
| 79 |
|
| 80 |
foreach srcfile [lsort [glob -nocomplain ${srcdir}/libvtv.cc/@*.list]] { |
| 81 |
dg-runtest $srcfile "$flags -fvtable-verify=preinit" $libstdcxx_includes |
| 82 |
} |
| 83 |
} |
| 84 |
} |