aboutsummaryrefslogtreecommitdiff
path: root/libphobos/testsuite/Makefile.am
blob: c3a91a6362c9f3f903b6d09b21085f037b072fe6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
## Makefile for the testsuite subdirectory of the D Standard library.
## Copyright (C) 2016-2020 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*