]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp testsuite: Get rid of 'lang_test_file_found'
authorThomas Schwinge <thomas@codesourcery.com>
Sat, 1 Nov 2014 15:25:26 +0000 (16:25 +0100)
committerThomas Schwinge <thomas@codesourcery.com>
Fri, 12 May 2023 07:15:31 +0000 (09:15 +0200)
Instead, 'return' early from the '*.exp' files that we're not able to test.
Also, change 'puts' into 'verbose -log'.  While re-indenting the previous
'if { $lang_test_file_found } { [...] }' code, also simplify 'ld_library_path'
setup.

libgomp/
* testsuite/lib/libgomp.exp (libgomp_target_compile): Don't look
at 'lang_test_file_found'.
* testsuite/libgomp.c++/c++.exp: Don't set and use it, and instead
'return' early if not able to test.  Simplify 'ld_library_path' setup.
* testsuite/libgomp.fortran/fortran.exp: Likewise.
* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.

libgomp/testsuite/lib/libgomp.exp
libgomp/testsuite/libgomp.c++/c++.exp
libgomp/testsuite/libgomp.fortran/fortran.exp
libgomp/testsuite/libgomp.oacc-c++/c++.exp
libgomp/testsuite/libgomp.oacc-fortran/fortran.exp

index aae7149a97df502f5fb11a52aa5317a706e5a136..2295fbbbd417da4cf11014bc9e35e49f919d03bb 100644 (file)
@@ -234,24 +234,23 @@ proc libgomp_target_compile { source dest type options } {
     global gluefile wrap_flags
     global ALWAYS_CFLAGS
     global GCC_UNDER_TEST
-    global lang_test_file_found
+
+    global lang_source_re lang_include_flags
+    if { [info exists lang_include_flags] \
+        && [regexp ${lang_source_re} ${source}] } {
+       lappend options "additional_flags=${lang_include_flags}"
+    }
+
     global lang_library_path
+    if { [info exists lang_library_path] } {
+       # Some targets use libgfortran.a%s in their specs, so they need
+       # a -B option for uninstalled testing.
+       lappend options "additional_flags=-B${blddir}/${lang_library_path}"
+       lappend options "ldflags=-L${blddir}/${lang_library_path}"
+    }
     global lang_link_flags
-    global lang_include_flags
-    global lang_source_re
-
-    if { [info exists lang_test_file_found] } {
-        if { $blddir != "" } {
-            # Some targets use libgfortran.a%s in their specs, so they need
-            # a -B option for uninstalled testing.
-            lappend options "additional_flags=-B${blddir}/${lang_library_path}"
-            lappend options "ldflags=-L${blddir}/${lang_library_path}"
-        }
-        lappend options "ldflags=${lang_link_flags}"
-       if { [info exists lang_include_flags] \
-            && [regexp ${lang_source_re} ${source}] } {
-           lappend options "additional_flags=${lang_include_flags}"
-       }
+    if { [info exists lang_link_flags] } {
+       lappend options "ldflags=${lang_link_flags}"
     }
 
     if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
index 797a05ca870e0a6103bdd1ca3d33567d244be481..8307baf32fcf588c4085fbd3741ad349f5fe2f17 100644 (file)
@@ -1,23 +1,18 @@
 load_lib libgomp-dg.exp
 load_gcc_lib gcc-dg.exp
 
-set lang_test_file_found 0
 if { $blddir != "" } {
     set lang_library_path "../libstdc++-v3/src/.libs"
     set shlib_ext [get_shlib_extension]
-    # Look for a static libstdc++ first.
-    if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] {
-        set lang_test_file_found 1
-        # We may have a shared only build, so look for a shared libstdc++.
-    } elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] {
-        set lang_test_file_found 1
-    } else {
-        puts "No libstdc++ library found, will not execute c++ tests"
+    if { ![file exists "${blddir}/${lang_library_path}/libstdc++.a"]
+        && ![file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] } {
+       verbose -log "No libstdc++ library found, will not execute c++ tests"
+       unset lang_library_path
+       return
     }
-} elseif { [info exists GXX_UNDER_TEST] } {
-    set lang_test_file_found 1
-} else {
-    puts "GXX_UNDER_TEST not defined, will not execute c++ tests"
+} elseif { ![info exists GXX_UNDER_TEST] } {
+    verbose -log "GXX_UNDER_TEST not defined, will not execute c++ tests"
+    return
 }
 set lang_link_flags "-lstdc++"
 
@@ -37,31 +32,28 @@ lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
 set SAVE_GCC_UNDER_TEST "$GCC_UNDER_TEST"
 set GCC_UNDER_TEST "$GCC_UNDER_TEST -x c++"
 
-if { $lang_test_file_found } {
-    # Gather a list of all tests.
-    set tests [lsort [concat \
-                         [find $srcdir/$subdir *.C] \
-                         [find $srcdir/$subdir/../libgomp.c-c++-common *.c]]]
+# Gather a list of all tests.
+set tests [lsort [concat \
+                     [find $srcdir/$subdir *.C] \
+                     [find $srcdir/$subdir/../libgomp.c-c++-common *.c]]]
 
-    if { $blddir != "" } {
-        set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
-    } else {
-        set ld_library_path "$always_ld_library_path"
-    }
-    append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
-    set_ld_library_path_env_vars
-
-    set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
-    if { $blddir != ""
-        && [file exists $flags_file] } {
-       set lang_source_re {^.*\.[cC]$}
-       set lang_include_flags [exec sh $flags_file --build-includes]
-    }
+set ld_library_path $always_ld_library_path
+if { $blddir != "" } {
+    append ld_library_path ":${blddir}/${lang_library_path}"
+}
+append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
+set_ld_library_path_env_vars
 
-    # Main loop.
-    dg-runtest $tests "" $DEFAULT_CFLAGS
+set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
+if { $blddir != ""
+     && [file exists $flags_file] } {
+    set lang_source_re {^.*\.[cC]$}
+    set lang_include_flags [exec sh $flags_file --build-includes]
 }
 
+# Main loop.
+dg-runtest $tests "" $DEFAULT_CFLAGS
+
 # See above.
 set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
 
@@ -73,7 +65,6 @@ if { $blddir != "" } {
     unset lang_library_path
 }
 unset lang_link_flags
-unset lang_test_file_found
 
 # All done.
 dg-finish
index 16ce9d3e02393c15952da4a2f54c060b5ba4b893..d98739c8c99d512859822dfc5971c5258686f6ac 100644 (file)
@@ -2,23 +2,18 @@ load_lib libgomp-dg.exp
 load_gcc_lib gcc-dg.exp
 load_gcc_lib gfortran-dg.exp
 
-set lang_test_file_found 0
 if { $blddir != "" } {
     set lang_library_path "../libgfortran/.libs"
     set shlib_ext [get_shlib_extension]
-    # Look for a static libgfortran first.
-    if [file exists "${blddir}/${lang_library_path}/libgfortran.a"] {
-        set lang_test_file_found 1
-       # We may have a shared only build, so look for a shared libgfortran.
-    } elseif [file exists "${blddir}/${lang_library_path}/libgfortran.${shlib_ext}"] {
-        set lang_test_file_found 1
-    } else {
-        puts "No libgfortran library found, will not execute fortran tests"
+    if { ![file exists "${blddir}/${lang_library_path}/libgfortran.a"]
+        && ![file exists "${blddir}/${lang_library_path}/libgfortran.${shlib_ext}"] } {
+        verbose -log "No libgfortran library found, will not execute fortran tests"
+       unset lang_library_path
+       return
     }
-} elseif [info exists GFORTRAN_UNDER_TEST] {
-    set lang_test_file_found 1
-} else {
-    puts "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests"
+} elseif { ![info exists GFORTRAN_UNDER_TEST] } {
+    verbose -log "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests"
+    return
 }
 if { $blddir != "" } {
     set lang_source_re {^.*\.[fF](|90|95|03|08)$}
@@ -32,39 +27,37 @@ dg-init
 # Turn on OpenMP.
 lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
 
-if { $lang_test_file_found } {
-    # Gather a list of all tests.
-    set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]]
+# Gather a list of all tests.
+set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]]
 
-    if { $blddir != "" } {
-       set quadmath_library_path "../libquadmath/.libs"
-       if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"]
-            || [file exists "${blddir}/${quadmath_library_path}/libquadmath.${shlib_ext}"] } {
-           lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${quadmath_library_path}/"
-           # Allow for spec subsitution.
-           lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/${quadmath_library_path}/"
-           set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}:${blddir}/${quadmath_library_path}"
-           append lang_link_flags " -lquadmath"
-       } else {
-           set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
-       }
-       unset quadmath_library_path
-    } else {
-        set ld_library_path "$always_ld_library_path"
-        if { [check_no_compiler_messages has_libquadmath executable {
-                 int main() {return 0;}
-              } "-lgfortran -lquadmath"] } then {
-            append lang_link_flags " -lquadmath"
-        }
-    }
-    append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
-    set_ld_library_path_env_vars
+set ld_library_path $always_ld_library_path
+if { $blddir != "" } {
+    append ld_library_path ":${blddir}/${lang_library_path}"
 
-    # For Fortran we're doing torture testing, as Fortran has far more tests
-    # with arrays etc. that testing just -O0 or -O2 is insufficient, that is
-    # typically not the case for C/C++.
-    gfortran-dg-runtest $tests "" ""
+    set quadmath_library_path "../libquadmath/.libs"
+    if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"]
+        || [file exists "${blddir}/${quadmath_library_path}/libquadmath.${shlib_ext}"] } {
+       lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${quadmath_library_path}/"
+       # Allow for spec subsitution.
+       lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/${quadmath_library_path}/"
+       append ld_library_path ":${blddir}/${quadmath_library_path}"
+       append lang_link_flags " -lquadmath"
+    }
+    unset quadmath_library_path
+} else {
+    if { [check_no_compiler_messages has_libquadmath executable {
+             int main() {return 0;}
+          } "-lgfortran -lquadmath"] } then {
+       append lang_link_flags " -lquadmath"
+    }
 }
+append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
+set_ld_library_path_env_vars
+
+# For Fortran we're doing torture testing, as Fortran has far more tests
+# with arrays etc. that testing just -O0 or -O2 is insufficient, that is
+# typically not the case for C/C++.
+gfortran-dg-runtest $tests "" ""
 
 if { $blddir != "" } {
     unset lang_source_re
@@ -72,7 +65,6 @@ if { $blddir != "" } {
     unset lang_library_path
 }
 unset lang_link_flags
-unset lang_test_file_found
 
 # All done.
 dg-finish
index 060aaa27419ca295e18dccd68b0625732c18529e..5e4f704934904058766dab7c35029bdae95e48e8 100644 (file)
@@ -11,23 +11,18 @@ proc check_effective_target_c++ { } {
     return 1
 }
 
-set lang_test_file_found 0
 if { $blddir != "" } {
     set lang_library_path "../libstdc++-v3/src/.libs"
     set shlib_ext [get_shlib_extension]
-    # Look for a static libstdc++ first.
-    if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] {
-        set lang_test_file_found 1
-        # We may have a shared only build, so look for a shared libstdc++.
-    } elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] {
-        set lang_test_file_found 1
-    } else {
-        puts "No libstdc++ library found, will not execute c++ tests"
+    if { ![file exists "${blddir}/${lang_library_path}/libstdc++.a"]
+        && ![file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] } {
+        verbose -log "No libstdc++ library found, will not execute c++ tests"
+       unset lang_library_path
+       return
     }
-} elseif { [info exists GXX_UNDER_TEST] } {
-    set lang_test_file_found 1
-} else {
-    puts "GXX_UNDER_TEST not defined, will not execute c++ tests"
+} elseif { ![info exists GXX_UNDER_TEST] } {
+    verbose -log "GXX_UNDER_TEST not defined, will not execute c++ tests"
+    return
 }
 set lang_link_flags "-lstdc++"
 
@@ -43,105 +38,98 @@ lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
 set SAVE_GCC_UNDER_TEST "$GCC_UNDER_TEST"
 set GCC_UNDER_TEST "$GCC_UNDER_TEST -x c++"
 
-if { $lang_test_file_found } {
-    # Gather a list of all tests.
-    set tests [lsort [concat \
-                         [find $srcdir/$subdir *.C] \
-                         [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *.c]]]
+# Gather a list of all tests.
+set tests [lsort [concat \
+                     [find $srcdir/$subdir *.C] \
+                     [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *.c]]]
 
-    if { $blddir != "" } {
-        set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
-    } else {
-        set ld_library_path "$always_ld_library_path"
-    }
-    append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
-    set_ld_library_path_env_vars
-
-    set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
-    if { $blddir != ""
-        && [file exists $flags_file] } {
-       set lang_source_re {^.*\.[cC]$}
-       set lang_include_flags [exec sh $flags_file --build-includes]
-    }
+set ld_library_path $always_ld_library_path
+if { $blddir != "" } {
+    append ld_library_path ":${blddir}/${lang_library_path}"
+}
+append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
+set_ld_library_path_env_vars
+
+set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
+if { $blddir != ""
+     && [file exists $flags_file] } {
+    set lang_source_re {^.*\.[cC]$}
+    set lang_include_flags [exec sh $flags_file --build-includes]
+}
 
-    # Test with all available offload targets, and with offloading disabled.
-    foreach offload_target [concat [split $offload_targets ","] "disable"] {
-       global openacc_device_type
-       set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
-       set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
+# Test with all available offload targets, and with offloading disabled.
+foreach offload_target [concat [split $offload_targets ","] "disable"] {
+    global openacc_device_type
+    set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
+    set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
-       switch $openacc_device_type {
-           "" {
-               unsupported "$subdir $offload_target offloading"
+    switch $openacc_device_type {
+       "" {
+           unsupported "$subdir $offload_target offloading"
+           continue
+       }
+       host {
+           set acc_mem_shared 1
+       }
+       nvidia {
+           if { ![check_effective_target_openacc_nvidia_accel_present] } {
+               # Don't bother; execution testing is going to FAIL.
+               untested "$subdir $offload_target offloading: supported, but hardware not accessible"
                continue
            }
-           host {
-               set acc_mem_shared 1
-           }
-           nvidia {
-               if { ![check_effective_target_openacc_nvidia_accel_present] } {
-                   # Don't bother; execution testing is going to FAIL.
-                   untested "$subdir $offload_target offloading: supported, but hardware not accessible"
-                   continue
-               }
 
-               # Copy ptx file (TEMPORARY)
-               remote_download host $srcdir/libgomp.oacc-c-c++-common/subr.ptx
+           # Copy ptx file (TEMPORARY)
+           remote_download host $srcdir/libgomp.oacc-c-c++-common/subr.ptx
 
-               # Where timer.h lives
-               lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/libgomp.oacc-c-c++-common"
+           # Where timer.h lives
+           lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/libgomp.oacc-c-c++-common"
 
-               set acc_mem_shared 0
-           }
-           radeon {
-               if { ![check_effective_target_openacc_radeon_accel_present] } {
-                   # Don't bother; execution testing is going to FAIL.
-                   untested "$subdir $offload_target offloading: supported, but hardware not accessible"
-                   continue
-               }
-
-               set acc_mem_shared 0
-           }
-           default {
-               error "Unknown OpenACC device type: $openacc_device_type (offload target: $offload_target)"
-           }
+           set acc_mem_shared 0
        }
-       set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
-
-       # To avoid compilation overhead, and to keep simple '-foffload=[...]'
-       # handling in test cases, by default only build for the offload target
-       # that we're actually going to test.
-       set tagopt "$tagopt -foffload=$offload_target"
-       # Force usage of the corresponding OpenACC device type.
-       setenv ACC_DEVICE_TYPE $openacc_device_type
-
-       # To get better test coverage for device-specific code that is only
-       # ever used in offloading configurations, we'd like more thorough
-       # testing for test cases that deal with offloading, which most of all
-       # OpenACC test cases are.  We enable torture testing, but limit it to
-       # -O0 and -O2 only, to avoid testing times exploding too much, under
-       # the assumption that between -O0 and -O[something] there is the
-       # biggest difference in the overall structure of the generated code.
-       switch -glob $offload_target {
-           disable {
-               set-torture-options [list \
-                                        { -O2 } ]
-           }
-           default {
-               set-torture-options [list \
-                                        { -O0 } \
-                                        { -O2 } ]
+       radeon {
+           if { ![check_effective_target_openacc_radeon_accel_present] } {
+               # Don't bother; execution testing is going to FAIL.
+               untested "$subdir $offload_target offloading: supported, but hardware not accessible"
+               continue
            }
-       }
 
-       gcc-dg-runtest $tests "$tagopt" ""
+           set acc_mem_shared 0
+       }
+       default {
+           error "Unknown OpenACC device type: $openacc_device_type (offload target: $offload_target)"
+       }
     }
-    unset offload_target
-} else {
-    # Call this once, which placates the subsequent torture-finish.
-    set-torture-options [list \
-                            { INVALID } ]
+    set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
+
+    # To avoid compilation overhead, and to keep simple '-foffload=[...]'
+    # handling in test cases, by default only build for the offload target
+    # that we're actually going to test.
+    set tagopt "$tagopt -foffload=$offload_target"
+    # Force usage of the corresponding OpenACC device type.
+    setenv ACC_DEVICE_TYPE $openacc_device_type
+
+    # To get better test coverage for device-specific code that is only
+    # ever used in offloading configurations, we'd like more thorough
+    # testing for test cases that deal with offloading, which most of all
+    # OpenACC test cases are.  We enable torture testing, but limit it to
+    # -O0 and -O2 only, to avoid testing times exploding too much, under
+    # the assumption that between -O0 and -O[something] there is the
+    # biggest difference in the overall structure of the generated code.
+    switch -glob $offload_target {
+       disable {
+           set-torture-options [list \
+                                    { -O2 } ]
+       }
+       default {
+           set-torture-options [list \
+                                    { -O0 } \
+                                    { -O2 } ]
+       }
+    }
+
+    gcc-dg-runtest $tests "$tagopt" ""
 }
+unset offload_target
 
 # See above.
 set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
@@ -154,7 +142,6 @@ if { $blddir != "" } {
     unset lang_library_path
 }
 unset lang_link_flags
-unset lang_test_file_found
 
 # All done.
 torture-finish
index 9af526007cf8cd4444be2e588a49f9caa923809f..a590558a1950fb5fcd0c86902ef2bc9608c89ee9 100644 (file)
@@ -4,23 +4,18 @@ load_lib libgomp-dg.exp
 load_gcc_lib gcc-dg.exp
 load_gcc_lib gfortran-dg.exp
 
-set lang_test_file_found 0
 if { $blddir != "" } {
     set lang_library_path "../libgfortran/.libs"
     set shlib_ext [get_shlib_extension]
-    # Look for a static libgfortran first.
-    if [file exists "${blddir}/${lang_library_path}/libgfortran.a"] {
-        set lang_test_file_found 1
-       # We may have a shared only build, so look for a shared libgfortran.
-    } elseif [file exists "${blddir}/${lang_library_path}/libgfortran.${shlib_ext}"] {
-        set lang_test_file_found 1
-    } else {
-        puts "No libgfortran library found, will not execute fortran tests"
+    if { ![file exists "${blddir}/${lang_library_path}/libgfortran.a"]
+        && ![file exists "${blddir}/${lang_library_path}/libgfortran.${shlib_ext}"] } {
+        verbose -log "No libgfortran library found, will not execute fortran tests"
+       unset lang_library_path
+       return
     }
-} elseif [info exists GFORTRAN_UNDER_TEST] {
-    set lang_test_file_found 1
-} else {
-    puts "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests"
+} elseif { ![info exists GFORTRAN_UNDER_TEST] } {
+    verbose -log "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests"
+    return
 }
 if { $blddir != "" } {
     set lang_source_re {^.*\.[fF](|90|95|03|08)$}
@@ -35,86 +30,84 @@ dg-init
 lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
 
 
-if { $lang_test_file_found } {
-    # Gather a list of all tests.
-    set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]]
-
-    if { $blddir != "" } {
-       set quadmath_library_path "../libquadmath/.libs"
-       if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"]
-            || [file exists "${blddir}/${quadmath_library_path}/libquadmath.${shlib_ext}"] } {
-           lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${quadmath_library_path}/"
-           # Allow for spec subsitution.
-           lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/${quadmath_library_path}/"
-           set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}:${blddir}/${quadmath_library_path}"
-           append lang_link_flags " -lquadmath"
-       } else {
-           set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
-       }
-       unset quadmath_library_path
-    } else {
-        set ld_library_path "$always_ld_library_path"
-        if { [check_no_compiler_messages has_libquadmath executable {
-                 int main() {return 0;}
-              } "-lgfortran -lquadmath"] } then {
-            append lang_link_flags " -lquadmath"
-        }
+# Gather a list of all tests.
+set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]]
+
+set ld_library_path $always_ld_library_path
+if { $blddir != "" } {
+    append ld_library_path ":${blddir}/${lang_library_path}"
+
+    set quadmath_library_path "../libquadmath/.libs"
+    if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"]
+        || [file exists "${blddir}/${quadmath_library_path}/libquadmath.${shlib_ext}"] } {
+       lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${quadmath_library_path}/"
+       # Allow for spec subsitution.
+       lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/${quadmath_library_path}/"
+       append ld_library_path ":${blddir}/${quadmath_library_path}"
+       append lang_link_flags " -lquadmath"
     }
-    append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
-    set_ld_library_path_env_vars
-
-    # Test with all available offload targets, and with offloading disabled.
-    foreach offload_target [concat [split $offload_targets ","] "disable"] {
-       global openacc_device_type
-       set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
-       set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
-
-       switch $openacc_device_type {
-           "" {
-               unsupported "$subdir $offload_target offloading"
+    unset quadmath_library_path
+} else {
+    if { [check_no_compiler_messages has_libquadmath executable {
+             int main() {return 0;}
+          } "-lgfortran -lquadmath"] } then {
+       append lang_link_flags " -lquadmath"
+    }
+}
+append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
+set_ld_library_path_env_vars
+
+# Test with all available offload targets, and with offloading disabled.
+foreach offload_target [concat [split $offload_targets ","] "disable"] {
+    global openacc_device_type
+    set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
+    set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
+
+    switch $openacc_device_type {
+       "" {
+           unsupported "$subdir $offload_target offloading"
+           continue
+       }
+       host {
+           set acc_mem_shared 1
+       }
+       nvidia {
+           if { ![check_effective_target_openacc_nvidia_accel_present] } {
+               # Don't bother; execution testing is going to FAIL.
+               untested "$subdir $offload_target offloading: supported, but hardware not accessible"
                continue
            }
-           host {
-               set acc_mem_shared 1
-           }
-           nvidia {
-               if { ![check_effective_target_openacc_nvidia_accel_present] } {
-                   # Don't bother; execution testing is going to FAIL.
-                   untested "$subdir $offload_target offloading: supported, but hardware not accessible"
-                   continue
-               }
-
-               set acc_mem_shared 0
-           }
-           radeon {
-               if { ![check_effective_target_openacc_radeon_accel_present] } {
-                   # Don't bother; execution testing is going to FAIL.
-                   untested "$subdir $offload_target offloading: supported, but hardware not accessible"
-                   continue
-               }
-
-               set acc_mem_shared 0
-           }
-           default {
-               error "Unknown OpenACC device type: $openacc_device_type (offload target: $offload_target)"
+
+           set acc_mem_shared 0
+       }
+       radeon {
+           if { ![check_effective_target_openacc_radeon_accel_present] } {
+               # Don't bother; execution testing is going to FAIL.
+               untested "$subdir $offload_target offloading: supported, but hardware not accessible"
+               continue
            }
+
+           set acc_mem_shared 0
+       }
+       default {
+           error "Unknown OpenACC device type: $openacc_device_type (offload target: $offload_target)"
        }
-       set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
-
-       # To avoid compilation overhead, and to keep simple '-foffload=[...]'
-       # handling in test cases, by default only build for the offload target
-       # that we're actually going to test.
-       set tagopt "$tagopt -foffload=$offload_target"
-       # Force usage of the corresponding OpenACC device type.
-       setenv ACC_DEVICE_TYPE $openacc_device_type
-
-       # For Fortran we're doing torture testing, as Fortran has far more tests
-       # with arrays etc. that testing just -O0 or -O2 is insufficient, that is
-       # typically not the case for C/C++.
-       gfortran-dg-runtest $tests "$tagopt" ""
     }
-    unset offload_target
+    set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
+
+    # To avoid compilation overhead, and to keep simple '-foffload=[...]'
+    # handling in test cases, by default only build for the offload target
+    # that we're actually going to test.
+    set tagopt "$tagopt -foffload=$offload_target"
+    # Force usage of the corresponding OpenACC device type.
+    setenv ACC_DEVICE_TYPE $openacc_device_type
+
+    # For Fortran we're doing torture testing, as Fortran has far more tests
+    # with arrays etc. that testing just -O0 or -O2 is insufficient, that is
+    # typically not the case for C/C++.
+    gfortran-dg-runtest $tests "$tagopt" ""
 }
+unset offload_target
 
 if { $blddir != "" } {
     unset lang_source_re
@@ -122,7 +115,6 @@ if { $blddir != "" } {
     unset lang_library_path
 }
 unset lang_link_flags
-unset lang_test_file_found
 
 # All done.
 dg-finish