gcc/libphobos/testsuite/Makefile.am
2021-01-04 10:26:59 +01:00

137 lines
5.5 KiB
Makefile

## Makefile for the testsuite subdirectory of the D Standard library.
## Copyright (C) 2016-2021 Free Software Foundation, Inc.
##
## GCC 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, or (at your option)
## any later version.
##
## GCC 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/>.
# Process this file with automake to produce Makefile.in.
AUTOMAKE_OPTIONS = foreign
# Setup the testing framework, if you have one
EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
echo $(top_builddir)/../expect/expect; else echo expect; fi)
_RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
PWD_COMMAND = $${PWDCMD-pwd}
check_p_subno=$(word 2,$(subst _, ,$*))
check_p_numbers0:=1 2 3 4 5 6 7 8 9
check_p_numbers1:=0 $(check_p_numbers0)
check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1)))
check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2)
check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3)))
check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
check_p_subdirs=$(wordlist 1,$(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),10),$(check_p_numbers))
check_DEJAGNU_libphobos_targets = $(addprefix check-DEJAGNUlibphobos,$(check_p_subdirs))
$(check_DEJAGNU_libphobos_targets): check-DEJAGNUlibphobos%: libphobos%/site.exp
site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
@echo 'Making a new site.exp file ...'
@echo '## these variables are automatically generated by make ##' >site.tmp
@echo '# Do not edit here. If you wish to override these values' >>site.tmp
@echo '# edit the last section' >>site.tmp
@echo 'set srcdir "$(srcdir)"' >>site.tmp
@echo "set objdir `pwd`" >>site.tmp
@echo 'set build_alias "$(build_alias)"' >>site.tmp
@echo 'set build_triplet $(build_triplet)' >>site.tmp
@echo 'set host_alias "$(host_alias)"' >>site.tmp
@echo 'set host_triplet $(host_triplet)' >>site.tmp
@echo 'set target_alias "$(target_alias)"' >>site.tmp
@echo 'set target_triplet $(target_triplet)' >>site.tmp
@list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
echo "## Begin content included from file $$f. Do not modify. ##" \
&& cat `test -f "$$f" || echo '$(srcdir)/'`$$f \
&& echo "## End content included from file $$f. ##" \
|| exit 1; \
done >> site.tmp
@echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp
@if test -f site.exp; then \
sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \
fi
@-rm -f site.bak
@test ! -f site.exp || mv site.exp site.bak
@mv site.tmp site.exp
%/site.exp: site.exp
-@test -d $* || mkdir $*
@srcdir=`cd $(srcdir); ${PWD_COMMAND}`;
@objdir=`${PWD_COMMAND}`/$*; \
sed -e "s|^set srcdir .*$$|set srcdir $$srcdir|" \
-e "s|^set objdir .*$$|set objdir $$objdir|" \
site.exp > $*/site.exp.tmp
@-rm -f $*/site.bak
@test ! -f $*/site.exp || mv $*/site.exp $*/site.bak
@mv $*/site.exp.tmp $*/site.exp
# Run the testsuite in normal mode.
check-DEJAGNU $(check_DEJAGNU_libphobos_targets): check-DEJAGNU%: site.exp
$(if $*,@)AR="$(AR)"; export AR; \
RANLIB="$(RANLIB)"; export RANLIB; \
if [ -z "$*" ] && [ -n "$(filter -j%, $(MFLAGS))" ]; then \
rm -rf libphobos-parallel || true; \
mkdir libphobos-parallel; \
$(MAKE) $(AM_MAKEFLAGS) $(check_DEJAGNU_libphobos_targets); \
rm -rf libphobos-parallel || true; \
for idx in $(check_p_subdirs); do \
if [ -d libphobos$$idx ]; then \
mv -f libphobos$$idx/libphobos.sum libphobos$$idx/libphobos.sum.sep; \
mv -f libphobos$$idx/libphobos.log libphobos$$idx/libphobos.log.sep; \
fi; \
done; \
$(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
libphobos[0-9]*/libphobos.sum.sep > libphobos.sum; \
$(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
libphobos[0-9]*/libphobos.log.sep > libphobos.log; \
exit 0; \
fi; \
srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
EXPECT=$(EXPECT); export EXPECT; \
runtest=$(_RUNTEST); \
if [ -z "$$runtest" ]; then runtest=runtest; fi; \
tool=libphobos; \
if [ -n "$*" ]; then \
if [ -f libphobos-parallel/finished ]; then rm -rf "$*"; exit 0; fi; \
GCC_RUNTEST_PARALLELIZE_DIR=`${PWD_COMMAND}`/libphobos-parallel; \
export GCC_RUNTEST_PARALLELIZE_DIR; \
cd "$*"; \
fi; \
if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
$$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
$(RUNTESTFLAGS); \
if [ -n "$*" ]; then \
touch $$GCC_RUNTEST_PARALLELIZE_DIR/finished; \
fi; \
else \
echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi
check-am:
$(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
.PHONY: check-DEJAGNU
AM_MAKEFLAGS = "EXEEXT=$(EXEEXT)"
CLEANFILES = *.exe *.log *.o *.sum site.exp
# To remove runtest-parallel directories.
clean-local:
rm -rf libphobos*