Home | History | Annotate | Line # | Download | only in testsuite
      1      1.1  christos ## See sim/Makefile.am.
      2      1.1  christos ##
      3  1.1.1.2  christos ## Copyright (C) 1997-2024 Free Software Foundation, Inc.
      4      1.1  christos ##
      5      1.1  christos ## This program is free software; you can redistribute it and/or modify
      6      1.1  christos ## it under the terms of the GNU General Public License as published by
      7      1.1  christos ## the Free Software Foundation; either version 3 of the License, or
      8      1.1  christos ## (at your option) any later version.
      9      1.1  christos ##
     10      1.1  christos ## This program is distributed in the hope that it will be useful,
     11      1.1  christos ## but WITHOUT ANY WARRANTY; without even the implied warranty of
     12      1.1  christos ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13      1.1  christos ## GNU General Public License for more details.
     14      1.1  christos ##
     15      1.1  christos ## You should have received a copy of the GNU General Public License
     16      1.1  christos ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
     17      1.1  christos 
     18      1.1  christos ## Tweak the site.exp so it works with plain `runtest` from user.
     19      1.1  christos EXTRA_DEJAGNU_SITE_CONFIG = site-sim-config.exp
     20      1.1  christos 
     21      1.1  christos # Custom verbose test variables that automake doesn't provide (yet?).
     22      1.1  christos AM_V_RUNTEST = $(AM_V_RUNTEST_@AM_V@)
     23      1.1  christos AM_V_RUNTEST_ = $(AM_V_RUNTEST_@AM_DEFAULT_V@)
     24      1.1  christos AM_V_RUNTEST_0 =  @echo "  RUNTEST  $(RUNTESTFLAGS) $*";
     25      1.1  christos AM_V_RUNTEST_1 =
     26      1.1  christos 
     27      1.1  christos site-sim-config.exp: Makefile
     28      1.1  christos 	$(AM_V_GEN)( \
     29      1.1  christos 	echo "set SIM_PRIMARY_TARGET \"$(SIM_PRIMARY_TARGET)\""; \
     30      1.1  christos 	echo "set builddir \"$(builddir)\""; \
     31      1.1  christos 	echo "set srcdir \"$(srcdir)/testsuite\""; \
     32      1.1  christos 	$(foreach V,$(SIM_TOOLCHAIN_VARS),echo "set $(V) \"$($(V))\"";) \
     33      1.1  christos 	) > $@
     34      1.1  christos 
     35      1.1  christos DO_RUNTEST = \
     36      1.1  christos 	LC_ALL=C; export LC_ALL; \
     37      1.1  christos 	EXPECT=${EXPECT} ; export EXPECT ; \
     38      1.1  christos 	runtest=$(RUNTEST); \
     39      1.1  christos 	$$runtest $(RUNTESTFLAGS)
     40      1.1  christos 
     41      1.1  christos # Ignore dirs that only contain configuration settings.
     42      1.1  christos check/./config/%.exp: ; @true
     43      1.1  christos check/config/%.exp: ; @true
     44      1.1  christos check/./lib/%.exp: ; @true
     45      1.1  christos check/lib/%.exp: ; @true
     46      1.1  christos 
     47      1.1  christos check/%.exp:
     48      1.1  christos 	$(AM_V_at)mkdir -p testsuite/$*
     49      1.1  christos 	$(AM_V_RUNTEST)$(DO_RUNTEST) --objdir testsuite/$* --outdir testsuite/$* $*.exp
     50      1.1  christos 
     51      1.1  christos check-DEJAGNU-parallel:
     52      1.1  christos 	$(AM_V_at)( \
     53      1.1  christos 	set -- `cd $(srcdir)/testsuite && find . -name '*.exp' -printf '%P\n' | sed 's:[.]exp$$::'`; \
     54      1.1  christos 	$(MAKE) -k `printf 'check/%s.exp ' $$@`; \
     55      1.1  christos 	ret=$$?; \
     56      1.1  christos 	set -- `printf 'testsuite/%s/ ' $$@`; \
     57      1.1  christos 	$(SHELL) $(srcroot)/contrib/dg-extract-results.sh \
     58      1.1  christos 	  `find $$@ -maxdepth 1 -name testrun.sum 2>/dev/null | sort` > testrun.sum; \
     59      1.1  christos 	$(SHELL) $(srcroot)/contrib/dg-extract-results.sh -L \
     60      1.1  christos 	  `find $$@ -maxdepth 1 -name testrun.log 2>/dev/null | sort` > testrun.log; \
     61      1.1  christos 	echo; \
     62      1.1  christos 	$(SED) -n '/^.*===.*Summary.*===/,$$p' testrun.sum; \
     63      1.1  christos 	exit $$ret)
     64      1.1  christos 
     65      1.1  christos check-DEJAGNU-single:
     66      1.1  christos 	$(AM_V_RUNTEST)$(DO_RUNTEST)
     67      1.1  christos 
     68      1.1  christos # If running a single job, invoking runtest once is faster & has nicer output.
     69      1.1  christos check-DEJAGNU: site.exp
     70      1.1  christos 	$(AM_V_at)(set -e; \
     71      1.1  christos 	EXPECT=${EXPECT} ; export EXPECT ; \
     72      1.1  christos 	runtest=$(RUNTEST); \
     73      1.1  christos 	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
     74      1.1  christos 	  case "$(MAKEFLAGS)" in \
     75      1.1  christos 	  *-j*) $(MAKE) check-DEJAGNU-parallel;; \
     76      1.1  christos 	  *)    $(MAKE) check-DEJAGNU-single;; \
     77      1.1  christos 	  esac; \
     78      1.1  christos 	else \
     79      1.1  christos 	  echo "WARNING: could not find \`runtest'" 1>&2; :;\
     80      1.1  christos 	fi)
     81      1.1  christos 
     82      1.1  christos MOSTLYCLEANFILES += \
     83      1.1  christos 	site-sim-config.exp testrun.log testrun.sum
     84      1.1  christos 
     85      1.1  christos include %D%/common/local.mk
     86