From 38528210d3eb3da198be6900378f9e9d1ff10b53 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Sat, 1 Nov 2014 16:25:26 +0100 Subject: [PATCH] libgomp testsuite: Get rid of 'lang_test_file_found' 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 | 21 ++++++----- libgomp/testsuite/libgomp.c++/c++.exp | 29 ++++++--------- libgomp/testsuite/libgomp.fortran/fortran.exp | 32 +++++++---------- libgomp/testsuite/libgomp.oacc-c++/c++.exp | 35 ++++++------------- .../libgomp.oacc-fortran/fortran.exp | 32 +++++++---------- 5 files changed, 55 insertions(+), 94 deletions(-) diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index dce33d788cc..c30fa4ed24b 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -240,24 +240,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_library_path - global lang_link_flags - global lang_include_flags - global lang_source_re - if { [info exists lang_test_file_found] } { - if { $blddir != "" } { + 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 + if { [info exists lang_link_flags] } { 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 { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { diff --git a/libgomp/testsuite/libgomp.c++/c++.exp b/libgomp/testsuite/libgomp.c++/c++.exp index 797a05ca870..8307baf32fc 100644 --- a/libgomp/testsuite/libgomp.c++/c++.exp +++ b/libgomp/testsuite/libgomp.c++/c++.exp @@ -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,16 +32,14 @@ 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]]] +set ld_library_path $always_ld_library_path 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 ":${blddir}/${lang_library_path}" } append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] set_ld_library_path_env_vars @@ -60,7 +53,6 @@ if { $lang_test_file_found } { # 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 diff --git a/libgomp/testsuite/libgomp.fortran/fortran.exp b/libgomp/testsuite/libgomp.fortran/fortran.exp index 16ce9d3e023..d98739c8c99 100644 --- a/libgomp/testsuite/libgomp.fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.fortran/fortran.exp @@ -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,25 +27,24 @@ 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}]] +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}/" - set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}:${blddir}/${quadmath_library_path}" + append ld_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 { @@ -64,7 +58,6 @@ if { $lang_test_file_found } { # 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 diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp index 060aaa27419..5e4f7049349 100644 --- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp +++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp @@ -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" - } -} elseif { [info exists GXX_UNDER_TEST] } { - set lang_test_file_found 1 -} else { - puts "GXX_UNDER_TEST not defined, 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] } { + verbose -log "GXX_UNDER_TEST not defined, will not execute c++ tests" + return } set lang_link_flags "-lstdc++" @@ -43,16 +38,14 @@ 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]]] +set ld_library_path $always_ld_library_path 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 ":${blddir}/${lang_library_path}" } append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] set_ld_library_path_env_vars @@ -137,11 +130,6 @@ if { $lang_test_file_found } { gcc-dg-runtest $tests "$tagopt" "" } unset offload_target -} else { - # Call this once, which placates the subsequent torture-finish. - set-torture-options [list \ - { INVALID } ] -} # 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 diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp index 9af526007cf..a590558a195 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp @@ -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,25 +30,24 @@ 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}]] +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}/" - set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}:${blddir}/${quadmath_library_path}" + append ld_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 { @@ -114,7 +108,6 @@ if { $lang_test_file_found } { 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 -- 2.34.1