Commit 0d6aae24 by Iain Buclaw Committed by Iain Buclaw

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
parent c50eadba
2019-04-12 Iain Buclaw <ibuclaw@gdcproject.org>
* 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.
2019-03-26 Iain Buclaw <ibuclaw@gdcproject.org> 2019-03-26 Iain Buclaw <ibuclaw@gdcproject.org>
* libdruntime/Makefile.am (DRUNTIME_DSOURCES_DARWIN): Add * libdruntime/Makefile.am (DRUNTIME_DSOURCES_DARWIN): Add
......
...@@ -687,10 +687,6 @@ libphobos_builddir ...@@ -687,10 +687,6 @@ libphobos_builddir
get_gcc_base_ver get_gcc_base_ver
phobos_compiler_shared_flag phobos_compiler_shared_flag
phobos_compiler_pic_flag phobos_compiler_pic_flag
ENABLE_STATIC_FALSE
ENABLE_STATIC_TRUE
ENABLE_SHARED_FALSE
ENABLE_SHARED_TRUE
CPP CPP
OTOOL64 OTOOL64
OTOOL OTOOL
...@@ -11499,7 +11495,7 @@ else ...@@ -11499,7 +11495,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 11502 "configure" #line 11498 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -11605,7 +11601,7 @@ else ...@@ -11605,7 +11601,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 11608 "configure" #line 11604 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -13747,22 +13743,6 @@ GDCFLAGS=$lt_save_DFLAGS ...@@ -13747,22 +13743,6 @@ GDCFLAGS=$lt_save_DFLAGS
GDCFLAGS=$gdc_save_DFLAGS GDCFLAGS=$gdc_save_DFLAGS
if test "$enable_shared" = "yes"; then
ENABLE_SHARED_TRUE=
ENABLE_SHARED_FALSE='#'
else
ENABLE_SHARED_TRUE='#'
ENABLE_SHARED_FALSE=
fi
if test "$enable_static" = "yes"; then
ENABLE_STATIC_TRUE=
ENABLE_STATIC_FALSE='#'
else
ENABLE_STATIC_TRUE='#'
ENABLE_STATIC_FALSE=
fi
# libtool variables for Phobos shared and position-independent compiles. # libtool variables for Phobos shared and position-independent compiles.
# #
...@@ -15190,14 +15170,6 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then ...@@ -15190,14 +15170,6 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi fi
if test -z "${ENABLE_SHARED_TRUE}" && test -z "${ENABLE_SHARED_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_SHARED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_STATIC_TRUE}" && test -z "${ENABLE_STATIC_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_STATIC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${DRUNTIME_GC_ENABLE_TRUE}" && test -z "${DRUNTIME_GC_ENABLE_FALSE}"; then if test -z "${DRUNTIME_GC_ENABLE_TRUE}" && test -z "${DRUNTIME_GC_ENABLE_FALSE}"; then
as_fn_error $? "conditional \"DRUNTIME_GC_ENABLE\" was never defined. as_fn_error $? "conditional \"DRUNTIME_GC_ENABLE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5
......
...@@ -75,8 +75,6 @@ AC_SUBST(CFLAGS_FOR_BUILD) ...@@ -75,8 +75,6 @@ AC_SUBST(CFLAGS_FOR_BUILD)
LT_INIT(dlopen) LT_INIT(dlopen)
AM_PROG_LIBTOOL AM_PROG_LIBTOOL
WITH_LOCAL_DRUNTIME([LT_LANG([D])], []) WITH_LOCAL_DRUNTIME([LT_LANG([D])], [])
AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = "yes"])
AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = "yes"])
# libtool variables for Phobos shared and position-independent compiles. # libtool variables for Phobos shared and position-independent compiles.
# #
......
...@@ -33,29 +33,6 @@ toolexeclibdir = $(libphobos_toolexeclibdir) ...@@ -33,29 +33,6 @@ toolexeclibdir = $(libphobos_toolexeclibdir)
LTDCOMPILE = $(LIBTOOL) --tag=D $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ LTDCOMPILE = $(LIBTOOL) --tag=D $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(GDC) $(AM_DFLAGS) --mode=compile $(GDC) $(AM_DFLAGS)
# Unittest rules. Unfortunately we can't use _DFLAGS in automake without
# explicit D support, so use this hack.
# Compile D sources with libtool and test flags
%.t.lo : %.d
$(LTDCOMPILE) $(GDCFLAGSX) $(MULTIFLAGS) $(D_EXTRA_DFLAGS) -c -o $@ $<
# Compile objects for static linking with test flags
# Automake breaks empty rules, so use the shell NOP :
%.t.o : %.t.lo
@:
# Override executable linking commands: We have to use GDC for linking
# to make sure we link pthreads and other dependencies
unittest_static_LINK = $(LIBTOOL) --tag=D \
$(unittest_static_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
$(GDC) $(AM_CFLAGS) $(CFLAGS) $(unittest_static_LDFLAGS) \
$(LDFLAGS) -o $@
unittest_LINK = $(LIBTOOL) --tag=D \
$(unittest_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
$(GDC) $(AM_CFLAGS) $(CFLAGS) $(unittest_LDFLAGS) \
$(LDFLAGS) -o $@
# Also override library link commands: This is not strictly # Also override library link commands: This is not strictly
# required, but we want to record additional dependencies such # required, but we want to record additional dependencies such
# as pthread in the library # as pthread in the library
...@@ -63,15 +40,6 @@ libgdruntime_la_LINK = $(LIBTOOL) --tag=D $(AM_LIBTOOLFLAGS) \ ...@@ -63,15 +40,6 @@ libgdruntime_la_LINK = $(LIBTOOL) --tag=D $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(GDC) $(AM_CFLAGS) $(CFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(GDC) $(AM_CFLAGS) $(CFLAGS) \
$(libgdruntime_la_LDFLAGS) $(LDFLAGS) -o $@ $(libgdruntime_la_LDFLAGS) $(LDFLAGS) -o $@
libgdruntime_t_la_LINK = $(LIBTOOL) --tag=D $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(GDC) $(AM_CFLAGS) $(CFLAGS) \
$(libgdruntime_t_la_LDFLAGS) $(LDFLAGS) -o $@
libgphobos_la_LINK = $(LIBTOOL) --tag=D $(libgphobos_la_LIBTOOLFLAGS) \ libgphobos_la_LINK = $(LIBTOOL) --tag=D $(libgphobos_la_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(GDC) $(AM_CFLAGS) $(CFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(GDC) $(AM_CFLAGS) $(CFLAGS) \
$(libgphobos_la_LDFLAGS) $(LDFLAGS) -o $@ $(libgphobos_la_LDFLAGS) $(LDFLAGS) -o $@
libgphobos_t_la_LINK = $(LIBTOOL) --tag=D \
$(libgphobos_t_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
$(GDC) $(AM_CFLAGS) $(CFLAGS) $(libgphobos_t_la_LDFLAGS) \
$(LDFLAGS) -o $@
...@@ -93,18 +93,6 @@ ALL_DRUNTIME_COMPILE_DSOURCES += $(DRUNTIME_DSOURCES_GENERATED) ...@@ -93,18 +93,6 @@ ALL_DRUNTIME_COMPILE_DSOURCES += $(DRUNTIME_DSOURCES_GENERATED)
ALL_DRUNTIME_SOURCES = $(ALL_DRUNTIME_COMPILE_DSOURCES) $(DRUNTIME_CSOURCES) \ ALL_DRUNTIME_SOURCES = $(ALL_DRUNTIME_COMPILE_DSOURCES) $(DRUNTIME_CSOURCES) \
$(DRUNTIME_SSOURCES) $(DRUNTIME_SSOURCES)
DRUNTIME_TEST_LOBJECTS = $(ALL_DRUNTIME_COMPILE_DSOURCES:.d=.t.lo)
DRUNTIME_TEST_OBJECTS = $(ALL_DRUNTIME_COMPILE_DSOURCES:.d=.t.o)
# Main library build definitions
check_PROGRAMS =
if ENABLE_SHARED
check_LTLIBRARIES = libgdruntime_t.la
check_PROGRAMS += unittest
endif
if ENABLE_STATIC
check_PROGRAMS += unittest_static
endif
toolexeclib_LTLIBRARIES = libgdruntime.la toolexeclib_LTLIBRARIES = libgdruntime.la
libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES) libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES)
...@@ -114,36 +102,6 @@ libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \ ...@@ -114,36 +102,6 @@ libgdruntime_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../src,-Bgcc \
libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE) libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE)
libgdruntime_la_DEPENDENCIES = $(DRTSTUFF) libgdruntime_la_DEPENDENCIES = $(DRTSTUFF)
# For static unittest, link objects directly
unittest_static_SOURCES = ../testsuite/test_runner.d $(DRUNTIME_CSOURCES) \
$(DRUNTIME_SSOURCES)
unittest_static_LIBTOOLFLAGS =
unittest_static_LDFLAGS = -Wc,-nophoboslib
unittest_static_LDADD = $(DRUNTIME_TEST_OBJECTS) $(LIBATOMIC) $(LIBBACKTRACE)
EXTRA_unittest_static_DEPENDENCIES = $(DRUNTIME_TEST_OBJECTS)
# For unittest with dynamic library
libgdruntime_t_la_SOURCES = $(DRUNTIME_CSOURCES) $(DRUNTIME_SSOURCES)
libgdruntime_t_la_LIBTOOLFLAGS =
# Automake by default does not generate shared libs for non-installed
# libraries. Use -rpath to force shared lib generation.
libgdruntime_t_la_LDFLAGS = -Wc,-nophoboslib -rpath /foo -shared
libgdruntime_t_la_LIBADD = $(DRUNTIME_TEST_LOBJECTS) $(LIBATOMIC) $(LIBBACKTRACE)
EXTRA_libgdruntime_t_la_DEPENDENCIES = $(DRUNTIME_TEST_LOBJECTS)
# For unittest
unittest_SOURCES = ../testsuite/test_runner.d
unittest_LIBTOOLFLAGS =
unittest_LDFLAGS = -Wc,-nophoboslib
unittest_LDADD = libgdruntime_t.la
# Extra install and clean rules.
# This does not delete the .libs/.t.o files, but deleting
# the .lo is good enough to rerun the rules
clean-local:
rm -f $(DRUNTIME_TEST_LOBJECTS)
rm -f $(DRUNTIME_TEST_OBJECTS)
# Handles generated files as well # Handles generated files as well
install-data-local: install-data-local:
for file in $(ALL_DRUNTIME_INSTALL_DSOURCES); do \ for file in $(ALL_DRUNTIME_INSTALL_DSOURCES); do \
......
...@@ -35,8 +35,6 @@ ALL_PHOBOS_INSTALL_DSOURCES = $(PHOBOS_DSOURCES) ...@@ -35,8 +35,6 @@ ALL_PHOBOS_INSTALL_DSOURCES = $(PHOBOS_DSOURCES)
ALL_PHOBOS_COMPILE_DSOURCES = $(PHOBOS_DSOURCES) ALL_PHOBOS_COMPILE_DSOURCES = $(PHOBOS_DSOURCES)
ALL_PHOBOS_SOURCES = $(ALL_PHOBOS_COMPILE_DSOURCES) ALL_PHOBOS_SOURCES = $(ALL_PHOBOS_COMPILE_DSOURCES)
PHOBOS_TEST_LOBJECTS = $(ALL_PHOBOS_COMPILE_DSOURCES:.d=.t.lo)
PHOBOS_TEST_OBJECTS = $(ALL_PHOBOS_COMPILE_DSOURCES:.d=.t.o)
# Main library build definitions # Main library build definitions
if DRUNTIME_ZLIB_SYSTEM if DRUNTIME_ZLIB_SYSTEM
...@@ -44,14 +42,6 @@ if DRUNTIME_ZLIB_SYSTEM ...@@ -44,14 +42,6 @@ if DRUNTIME_ZLIB_SYSTEM
else else
ZLIB_SRC = $(ZLIB_CSOURCES) ZLIB_SRC = $(ZLIB_CSOURCES)
endif endif
check_PROGRAMS =
if ENABLE_SHARED
check_LTLIBRARIES = libgphobos_t.la
check_PROGRAMS += unittest
endif
if ENABLE_STATIC
check_PROGRAMS += unittest_static
endif
toolexeclib_DATA = libgphobos.spec toolexeclib_DATA = libgphobos.spec
toolexeclib_LTLIBRARIES = libgphobos.la toolexeclib_LTLIBRARIES = libgphobos.la
...@@ -62,35 +52,6 @@ libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \ ...@@ -62,35 +52,6 @@ libgphobos_la_LDFLAGS = -Wc,-nophoboslib,-dstartfiles,-B../libdruntime/gcc \
libgphobos_la_LIBADD = ../libdruntime/libgdruntime.la libgphobos_la_LIBADD = ../libdruntime/libgdruntime.la
libgphobos_la_DEPENDENCIES = libgphobos.spec libgphobos_la_DEPENDENCIES = libgphobos.spec
# For static unittest, link objects directly
unittest_static_SOURCES = ../testsuite/test_runner.d $(ZLIB_SRC)
unittest_static_LIBTOOLFLAGS =
unittest_static_LDFLAGS = -Wc,-nophoboslib -static-libtool-libs
unittest_static_LDADD = $(PHOBOS_TEST_OBJECTS) \
../libdruntime/libgdruntime.la
EXTRA_unittest_static_DEPENDENCIES = $(PHOBOS_TEST_OBJECTS)
# For unittest with dynamic library
libgphobos_t_la_SOURCES = $(ZLIB_SRC)
libgphobos_t_la_LIBTOOLFLAGS =
libgphobos_t_la_LDFLAGS = -Wc,-nophoboslib -rpath /foo -shared
libgphobos_t_la_LIBADD = $(PHOBOS_TEST_LOBJECTS) \
../libdruntime/libgdruntime.la
EXTRA_libgphobos_t_la_DEPENDENCIES = $(PHOBOS_TEST_LOBJECTS)
# For unittest
unittest_SOURCES = ../testsuite/test_runner.d
unittest_LIBTOOLFLAGS =
unittest_LDFLAGS = -Wc,-nophoboslib -shared
unittest_LDADD = libgphobos_t.la ../libdruntime/libgdruntime.la
# Extra install and clean rules.
# This does not delete the .libs/.t.o files, but deleting
# the .lo is good enough to rerun the rules
clean-local:
rm -f $(PHOBOS_TEST_LOBJECTS)
rm -f $(PHOBOS_TEST_OBJECTS)
# Handles generated files as well # Handles generated files as well
install-data-local: install-data-local:
for file in $(ALL_PHOBOS_INSTALL_DSOURCES); do \ for file in $(ALL_PHOBOS_INSTALL_DSOURCES); do \
......
...@@ -46,6 +46,12 @@ proc libphobos-dg-test { prog do_what extra_tool_flags } { ...@@ -46,6 +46,12 @@ proc libphobos-dg-test { prog do_what extra_tool_flags } {
set compile_type "" set compile_type ""
set output_file "" set output_file ""
global libphobos_test_name
if { $libphobos_test_name != "" } {
upvar name name
set name $libphobos_test_name
}
# Set up the compiler flags, based on what we're going to do. # Set up the compiler flags, based on what we're going to do.
switch $do_what { switch $do_what {
"run" { "run" {
...@@ -110,6 +116,10 @@ proc libphobos_init { args } { ...@@ -110,6 +116,10 @@ proc libphobos_init { args } {
global libphobos_run_args global libphobos_run_args
set libphobos_run_args "" set libphobos_run_args ""
# If the name of the test should be something else.
global libphobos_test_name
set libphobos_test_name ""
# Default settings. # Default settings.
set blddir [lookfor_file [get_multilibs] libphobos] set blddir [lookfor_file [get_multilibs] libphobos]
set flags_file "${blddir}/testsuite/testsuite_flags" set flags_file "${blddir}/testsuite/testsuite_flags"
...@@ -191,3 +201,20 @@ proc libphobos_target_compile { source dest type options } { ...@@ -191,3 +201,20 @@ proc libphobos_target_compile { source dest type options } {
return $comp_output return $comp_output
} }
#
# Helper used by libphobos and libdruntime unittest runner, filters out
# D sources that may contain a unittest function.
#
proc filter_libphobos_unittests { list } {
set res {}
foreach filename $list {
set fid [open $filename r]
if [regexp -- {unittest} [read $fid [file size $filename]]] {
lappend res $filename
}
close $fid
}
return $res
}
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
# along with GCC; see the file COPYING3. If not see # along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
load_lib libphobos-dg.exp
# Initialize dg. # Initialize dg.
dg-init dg-init
......
...@@ -41,8 +41,10 @@ foreach cycle_test $cycle_test_list { ...@@ -41,8 +41,10 @@ foreach cycle_test $cycle_test_list {
set expected_fail [lindex $cycle_test 2] set expected_fail [lindex $cycle_test 2]
foreach test $tests { foreach test $tests {
set libphobos_test_name "[dg-trim-dirname $srcdir $test] $libphobos_run_args"
set shouldfail $expected_fail set shouldfail $expected_fail
dg-test $test "" $DEFAULT_DFLAGS dg-runtest $test "" $DEFAULT_DFLAGS
set libphobos_test_name ""
} }
set shouldfail 0 set shouldfail 0
......
# Copyright (C) 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/>.
# Immediately exit if we can't run target executables.
if { ![isnative] || ![is-effective-target static] } {
return
}
# Gather a list of all tests.
set tests [lsort [filter_libphobos_unittests [find $srcdir/../libdruntime "*.d"]]]
# Initialize dg.
dg-init
# Main loop.
foreach test $tests {
set libphobos_test_name "$subdir/[dg-trim-dirname $srcdir/../libdruntime $test]"
dg-runtest $test "" "-fmain -fbuilding-libphobos-tests"
set libphobos_test_name ""
}
# All done.
dg-finish
# Copyright (C) 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/>.
# Immediately exit if we can't run target executables.
if { ![isnative] || ![is-effective-target shared] } {
return
}
# Gather a list of all tests.
set tests [lsort [filter_libphobos_unittests [find $srcdir/../libdruntime "*.d"]]]
# Initialize dg.
dg-init
# Main loop.
foreach test $tests {
set libphobos_test_name "$subdir/[dg-trim-dirname $srcdir/../libdruntime $test]"
dg-runtest $test "-fversion=Shared -shared-libphobos" \
"-fmain -fbuilding-libphobos-tests -fno-moduleinfo"
set libphobos_test_name ""
}
# All done.
dg-finish
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
# along with GCC; see the file COPYING3. If not see # along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
load_lib libphobos-dg.exp
# Initialize dg. # Initialize dg.
dg-init dg-init
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
# along with GCC; see the file COPYING3. If not see # along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
load_lib libphobos-dg.exp
# Initialize dg. # Initialize dg.
dg-init dg-init
......
# Copyright (C) 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/>.
# Immediately exit if we can't run target executables.
if { ![isnative] || ![is-effective-target static] } {
return
}
# Gather a list of all tests.
set tests [lsort [filter_libphobos_unittests [find $srcdir/../src "*.d"]]]
# Initialize dg.
dg-init
# Main loop.
foreach test $tests {
set libphobos_test_name "$subdir/[dg-trim-dirname $srcdir/../src $test]"
dg-runtest $test "" "-fmain -fbuilding-libphobos-tests"
set libphobos_test_name ""
}
# All done.
dg-finish
# Copyright (C) 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/>.
# Immediately exit if we can't run target executables.
if { ![isnative] || ![is-effective-target shared] } {
return
}
# Gather a list of all tests.
set tests [lsort [filter_libphobos_unittests [find $srcdir/../src "*.d"]]]
# Initialize dg.
dg-init
# Main loop.
foreach test $tests {
set libphobos_test_name "$subdir/[dg-trim-dirname $srcdir/../src $test]"
dg-runtest $test "-fversion=Shared -shared-libphobos" \
"-fmain -fbuilding-libphobos-tests -fno-moduleinfo"
set libphobos_test_name ""
}
# All done.
dg-finish
...@@ -68,34 +68,34 @@ shared_library "$srcdir/$subdir/plugin.d" "plugin2.so" "" ...@@ -68,34 +68,34 @@ shared_library "$srcdir/$subdir/plugin.d" "plugin2.so" ""
dg-init dg-init
# Main loop. # Main loop.
dg-test "$srcdir/$subdir/link.d" "-I$srcdir/$subdir lib.so -shared-libphobos" \ dg-runtest "$srcdir/$subdir/link.d" "-I$srcdir/$subdir lib.so -shared-libphobos" \
"$DEFAULT_DFLAGS" "$DEFAULT_DFLAGS"
dg-test "$srcdir/$subdir/link_linkdep.d" \ dg-runtest "$srcdir/$subdir/link_linkdep.d" \
"-I$srcdir/$subdir liblinkdep.so lib.so -shared-libphobos" \ "-I$srcdir/$subdir liblinkdep.so lib.so -shared-libphobos" \
"$DEFAULT_DFLAGS" "$DEFAULT_DFLAGS"
dg-test "$srcdir/$subdir/link_loaddep.d" \ dg-runtest "$srcdir/$subdir/link_loaddep.d" \
"-I$srcdir/$subdir libloaddep.so -shared-libphobos" "$DEFAULT_DFLAGS" "-I$srcdir/$subdir libloaddep.so -shared-libphobos" "$DEFAULT_DFLAGS"
# dlopen() tests. # dlopen() tests.
if [is-effective-target dlopen] { if [is-effective-target dlopen] {
dg-test "$srcdir/$subdir/load.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS" dg-runtest "$srcdir/$subdir/load.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS"
dg-test "$srcdir/$subdir/load_linkdep.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS" dg-runtest "$srcdir/$subdir/load_linkdep.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS"
dg-test "$srcdir/$subdir/load_loaddep.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS" dg-runtest "$srcdir/$subdir/load_loaddep.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS"
dg-test "$srcdir/$subdir/load_13414.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS" dg-runtest "$srcdir/$subdir/load_13414.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS"
dg-test "$srcdir/$subdir/finalize.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS" dg-runtest "$srcdir/$subdir/finalize.d" "-shared-libphobos -ldl" "$DEFAULT_DFLAGS"
} }
# C program link tests. # C program link tests.
if { [is-effective-target dlopen] && [is-effective-target pthread] } { if { [is-effective-target dlopen] && [is-effective-target pthread] } {
dg-test "$srcdir/$subdir/linkD.c" "lib.so -ldl -pthread" "$DEFAULT_CFLAGS" dg-runtest "$srcdir/$subdir/linkD.c" "lib.so -ldl -pthread" "$DEFAULT_CFLAGS"
dg-test "$srcdir/$subdir/linkDR.c" "-shared-libphobos -ldl -pthread" "$DEFAULT_CFLAGS" dg-runtest "$srcdir/$subdir/linkDR.c" "-shared-libphobos -ldl -pthread" "$DEFAULT_CFLAGS"
dg-test "$srcdir/$subdir/host.c" "-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. # Test requires a command line argument to be passed to the program.
set libphobos_run_args "${blddir}/src/.libs/libgphobos.${shlib_ext}" set libphobos_run_args "${blddir}/src/.libs/libgphobos.${shlib_ext}"
dg-test "$srcdir/$subdir/loadDR.c" "-ldl -pthread -g" "$DEFAULT_CFLAGS" dg-runtest "$srcdir/$subdir/loadDR.c" "-ldl -pthread -g" "$DEFAULT_CFLAGS"
set libphobos_run_args "" set libphobos_run_args ""
} }
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
# along with GCC; see the file COPYING3. If not see # along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
load_lib libphobos-dg.exp
# Initialize dg. # Initialize dg.
dg-init dg-init
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
# along with GCC; see the file COPYING3. If not see # along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
load_lib libphobos-dg.exp
# Initialize dg. # Initialize dg.
dg-init dg-init
......
# 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/>.
# Immediately exit if we can't run target executables.
if { ![isnative] } {
return
}
proc unittest_list_modules { prog } {
# Running the test runner without arguments prints a list of all
# modules that have unittests compiled in.
set result [libphobos_load "$prog" "" ""]
return [lindex $result 1]
}
# Runs all unittests for each module compiled into the test program.
proc unittest_run_tests { name prog } {
foreach module [unittest_list_modules $prog] {
set result [libphobos_load "$prog" "$module" ""]
set status [lindex $result 0]
$status "libphobos.unittests/$name/$module"
}
}
proc unittester { name prog } {
if [file exists $prog] {
unittest_run_tests $name $prog
}
}
# List of test runners.
if [is-effective-target static] {
unittester "druntime/static" "$objdir/../libdruntime/unittest_static$exeext"
unittester "phobos/static" "$objdir/../src/unittest_static$exeext"
}
if [is-effective-target shared] {
unittester "druntime/shared" "$objdir/../libdruntime/unittest$exeext"
unittester "phobos/shared" "$objdir/../src/unittest$exeext"
}
import core.runtime, core.time : MonoTime;
import core.stdc.stdio;
ModuleInfo* getModuleInfo(string name)
{
foreach (m; ModuleInfo)
if (m.name == name) return m;
assert(0, "module '"~name~"' not found");
}
bool tester()
{
return Runtime.args.length > 1 ? testModules() : printAll();
}
string mode;
bool testModules()
{
bool ret = true;
foreach(name; Runtime.args[1..$])
{
immutable pkg = ".package";
immutable pkgLen = pkg.length;
if (name.length > pkgLen && name[$ - pkgLen .. $] == pkg)
name = name[0 .. $ - pkgLen];
doTest(getModuleInfo(name), ret);
}
return ret;
}
bool printAll()
{
foreach (m; ModuleInfo)
{
if (m.unitTest)
{
string name = m.name;
printf("%.*s\n", cast(int)name.length, name.ptr);
}
}
return true;
}
void doTest(ModuleInfo* moduleInfo, ref bool ret)
{
if (auto fp = moduleInfo.unitTest)
{
auto name = moduleInfo.name;
try
{
immutable t0 = MonoTime.currTime;
fp();
printf("%.3fs PASS %.*s %.*s\n",
(MonoTime.currTime - t0).total!"msecs" / 1000.0,
cast(uint)mode.length, mode.ptr,
cast(uint)name.length, name.ptr);
}
catch (Throwable e)
{
auto msg = e.toString();
printf("****** FAIL %.*s %.*s\n%.*s\n",
cast(uint)mode.length, mode.ptr,
cast(uint)name.length, name.ptr,
cast(uint)msg.length, msg.ptr);
ret = false;
}
}
}
shared static this()
{
version(D_Coverage)
{
import core.runtime : dmd_coverSetMerge;
dmd_coverSetMerge(true);
}
Runtime.moduleUnitTester = &tester;
debug mode = "debug";
else mode = "release";
static if ((void*).sizeof == 4) mode ~= "32";
else static if ((void*).sizeof == 8) mode ~= "64";
else static assert(0, "You must be from the future!");
}
void main()
{
}
...@@ -35,7 +35,8 @@ case ${query} in ...@@ -35,7 +35,8 @@ case ${query} in
GDCPATHS_default="-nostdinc" GDCPATHS_default="-nostdinc"
GDCPATHS_config="-B${BUILD_DIR}/src GDCPATHS_config="-B${BUILD_DIR}/src
-I${BUILD_DIR}/libdruntime -I${BUILD_DIR}/libdruntime
-I${SRC_DIR}/libdruntime" -I${SRC_DIR}/libdruntime
-I${SRC_DIR}/src"
echo ${GDCPATHS_default} ${GDCPATHS_config} echo ${GDCPATHS_default} ${GDCPATHS_config}
;; ;;
--gdcldflags) --gdcldflags)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment