gcc/libphobos/testsuite/libphobos.shared/shared.exp
Iain Buclaw 0d6aae249d libphobos: Replace library check programs with dg-runtest
Fixes multilib handling when running the libphobos testsuite.

libphobos/ChangeLog:

2019-04-12  Iain Buclaw  <ibuclaw@gdcproject.org>

	PR d/89255
	* configure.ac (ENABLE_SHARED, ENABLE_STATIC): Remove conditionals.
	* configure: Regenerate.
	* d_rules.am (%.t.lo, %.t.o): Remove rules.
	(unittest_static_LINK, unittest_LINK, libgdruntime_t_la_LINK,
	libgphobos_t_la_LINK): Remove variables.
	* libdruntime/Makefile.am (DRUNTIME_TEST_LOBJECTS,
	DRUNTIME_TEST_OBJECTS, check_PROGRAMS, check_LTLIBRARIES,
	unittest_static_SOURCES, unittest_static_LIBTOOLFLAGS,
	unittest_static_LDFLAGS, unittest_static_LDADD,
	EXTRA_unittest_static_DEPENDENCIES, libgdruntime_t_la_SOURCES,
	libgdruntime_t_la_LIBTOOLFLAGS, libgdruntime_t_la_LDFLAGS,
	libgdruntime_t_la_LIBADD, EXTRA_libgdruntime_t_la_DEPENDENCIES,
	unittest_SOURCES, unittest_LIBTOOLFLAGS, unittest_LDFLAGS,
	unittest_LDADD): Remove variables.
	(clean-local): Remove rule.
	* libdruntime/Makefile.in: Regenerate.
	* src/Makefile.am (PHOBOS_TEST_LOBJECTS,
	PHOBOS_TEST_OBJECTS, check_PROGRAMS, check_LTLIBRARIES,
	unittest_static_SOURCES, unittest_static_LIBTOOLFLAGS,
	unittest_static_LDFLAGS, unittest_static_LDADD,
	EXTRA_unittest_static_DEPENDENCIES, libgdruntime_t_la_SOURCES,
	libgdruntime_t_la_LIBTOOLFLAGS, libgdruntime_t_la_LDFLAGS,
	libgdruntime_t_la_LIBADD, EXTRA_libgdruntime_t_la_DEPENDENCIES,
	unittest_SOURCES, unittest_LIBTOOLFLAGS, unittest_LDFLAGS,
	unittest_LDADD): Remove variables.
	(clean-local): Remove rule.
	* src/Makefile.in: Regenerate.
	* testsuite/lib/libphobos.exp (libphobos_test_name): New global.
	(libphobos_init): Set libphobos_test_name.
	(libphobos-dg-test): Override name if libphobos_test_name is set.
	(filter_libphobos_unittests): New proc.
	* testsuite/libphobos.aa/aa.exp: Don't load libphobos-dg.exp.
	* testsuite/libphobos.cycles/cycles.exp: Set libphobos_test_name.
	* testsuite/libphobos.druntime/druntime.exp: New file.
	* testsuite/libphobos.druntime_shared/druntime_shared.exp: New file.
	* testsuite/libphobos.phobos/phobos.exp: New file.
	* testsuite/libphobos.phobos_shared/phobos_shared.exp: New file.
	* testsuite/libphobos.shared/shared.exp: Use dg-runtest to run tests.
	* testsuite/libphobos.hash/hash.exp: Don't load libphobos-dg.exp
	* testsuite/libphobos.init_fini/init_fini.exp: Likewise.
	* testsuite/libphobos.thread/thread.exp: Likewise.
	* testsuite/libphobos.typeinfo/typeinfo.exp: Likewise.
	* testsuite/libphobos.unittests/unittests.exp: Remove.
	* testsuite/test_runner.d: Remove.
	* testsuite/testsuite_flags.in: Add phobos to --gdcpaths.

From-SVN: r270302
2019-04-12 06:25:17 +00:00

109 lines
3.6 KiB
Plaintext

# Copyright (C) 2017-2019 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
load_lib libphobos-dg.exp
# Immediately exit if target doesn't support shared.
if { ![is-effective-target shared] } {
return
}
# If a testcase doesn't have special options, use these.
if ![info exists DEFAULT_CFLAGS] then {
set DEFAULT_CFLAGS "-g"
}
#
# Build all shared libraries, used as dependencies for other tests.
#
proc shared_library { source destfile options } {
global DEFAULT_DFLAGS
global all_libraries
# Compiling with -fno-gnu-unique as tests call dlopen/dlclose multiple times on the same library.
lappend options "additional_flags=$DEFAULT_DFLAGS -fno-gnu-unique -fpic -shared -shared-libphobos"
set comp_output [libphobos_target_compile "$source" "$destfile" "executable" $options]
if ![ string match "" $comp_output ] {
fail "libphobos.shared/[file tail $source]"
verbose -log $comp_output
return 1
}
lappend all_libraries $destfile
}
# lib.so
shared_library "$srcdir/$subdir/lib.d" "lib.so" ""
# liblinkdep.so
shared_library "$srcdir/$subdir/liblinkdep.d" "liblinkdep.so" \
[list "additional_flags=-I$srcdir/$subdir lib.so"]
# libloaddep.so
shared_library "$srcdir/$subdir/libloaddep.d" "libloaddep.so" ""
# lib_13414.so
shared_library "$srcdir/$subdir/lib_13414.d" "lib_13414.so" ""
# plugin.so
shared_library "$srcdir/$subdir/plugin.d" "plugin1.so" ""
shared_library "$srcdir/$subdir/plugin.d" "plugin2.so" ""
# Initialize dg.
dg-init
# Main loop.
dg-runtest "$srcdir/$subdir/link.d" "-I$srcdir/$subdir lib.so -shared-libphobos" \
"$DEFAULT_DFLAGS"
dg-runtest "$srcdir/$subdir/link_linkdep.d" \
"-I$srcdir/$subdir liblinkdep.so lib.so -shared-libphobos" \
"$DEFAULT_DFLAGS"
dg-runtest "$srcdir/$subdir/link_loaddep.d" \
"-I$srcdir/$subdir libloaddep.so -shared-libphobos" "$DEFAULT_DFLAGS"
# dlopen() tests.
if [is-effective-target dlopen] {
dg-runtest "$srcdir/$subdir/load.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS"
dg-runtest "$srcdir/$subdir/load_linkdep.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS"
dg-runtest "$srcdir/$subdir/load_loaddep.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS"
dg-runtest "$srcdir/$subdir/load_13414.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS"
dg-runtest "$srcdir/$subdir/finalize.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS"
}
# C program link tests.
if { [is-effective-target dlopen] && [is-effective-target pthread] } {
dg-runtest "$srcdir/$subdir/linkD.c" "lib.so -ldl -pthread" "$DEFAULT_CFLAGS"
dg-runtest "$srcdir/$subdir/linkDR.c" "-shared-libphobos -ldl -pthread" "$DEFAULT_CFLAGS"
dg-runtest "$srcdir/$subdir/host.c" "-ldl -pthread" "$DEFAULT_CFLAGS"
# Test requires a command line argument to be passed to the program.
set libphobos_run_args "${blddir}/src/.libs/libgphobos.${shlib_ext}"
dg-runtest "$srcdir/$subdir/loadDR.c" "-ldl -pthread -g" "$DEFAULT_CFLAGS"
set libphobos_run_args ""
}
# All done.
dg-finish
# Remove all libraries built before running tests.
foreach lib $all_libraries {
catch "file delete -force -- $lib"
}