2018-01-10 Richard Biener <rguenther@suse.de>
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / fortran.exp
blobd848ed4d47feb5b531c57282b033d4e774374046
1 load_lib libgomp-dg.exp
2 load_gcc_lib gcc-dg.exp
3 load_gcc_lib gfortran-dg.exp
5 global shlib_ext
6 global ALWAYS_CFLAGS
8 set shlib_ext [get_shlib_extension]
9 set lang_library_path "../libgfortran/.libs"
10 set lang_link_flags "-lgfortran -foffload=-lgfortran"
11 if [info exists lang_include_flags] then {
12 unset lang_include_flags
14 set lang_test_file_found 0
15 set quadmath_library_path "../libquadmath/.libs"
18 # Initialize dg.
19 dg-init
21 # Turn on OpenMP.
22 lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
24 if { $blddir != "" } {
25 set lang_source_re {^.*\.[fF](|90|95|03|08)$}
26 set lang_include_flags "-fintrinsic-modules-path=${blddir}"
27 # Look for a static libgfortran first.
28 if [file exists "${blddir}/${lang_library_path}/libgfortran.a"] {
29 set lang_test_file "${lang_library_path}/libgfortran.a"
30 set lang_test_file_found 1
31 # We may have a shared only build, so look for a shared libgfortran.
32 } elseif [file exists "${blddir}/${lang_library_path}/libgfortran.${shlib_ext}"] {
33 set lang_test_file "${lang_library_path}/libgfortran.${shlib_ext}"
34 set lang_test_file_found 1
35 } else {
36 puts "No libgfortran library found, will not execute fortran tests"
38 } elseif [info exists GFORTRAN_UNDER_TEST] {
39 set lang_test_file_found 1
40 # Needs to exist for libgomp.exp.
41 set lang_test_file ""
42 } else {
43 puts "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests"
46 if { $lang_test_file_found } {
47 # Gather a list of all tests.
48 set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]]
50 if { $blddir != "" } {
51 if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"]
52 || [file exists "${blddir}/${quadmath_library_path}/libquadmath.${shlib_ext}"] } {
53 lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${quadmath_library_path}/"
54 # Allow for spec subsitution.
55 lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/${quadmath_library_path}/"
56 set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}:${blddir}/${quadmath_library_path}"
57 } else {
58 set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
60 } else {
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 # For Fortran we're doing torture testing, as Fortran has far more tests
67 # with arrays etc. that testing just -O0 or -O2 is insufficient, that is
68 # typically not the case for C/C++.
69 gfortran-dg-runtest $tests "" ""
72 # All done.
73 dg-finish