From 6c57b87fc41c368cfa339ad8a879899ba3058e44 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 17 Jan 2021 11:13:37 -0500 Subject: [PATCH] sim: testsuite: merge into toplevel automake This allows us to delete most of our custom test logic, and avoids a recursive make for minor speed up. --- sim/ChangeLog | 7 ++ sim/Makefile.am | 4 +- sim/Makefile.in | 102 +++++++++++++++---- sim/common/ChangeLog | 4 + sim/common/Make-common.in | 1 - sim/configure | 3 +- sim/configure.ac | 2 +- sim/testsuite/ChangeLog | 6 ++ sim/testsuite/Makefile.in | 178 --------------------------------- sim/testsuite/lib/sim-defs.exp | 2 +- sim/testsuite/local.mk | 34 +++++++ 11 files changed, 142 insertions(+), 201 deletions(-) delete mode 100644 sim/testsuite/Makefile.in create mode 100644 sim/testsuite/local.mk diff --git a/sim/ChangeLog b/sim/ChangeLog index f31c165ea64..6b27cb46a8f 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,10 @@ +2021-03-07 Mike Frysinger + + * configure.ac (AC_CONFIG_FILES): Delete testsuite/Makefile. + * Makefile.am: Include testsuite/local.mk. + (AUTOMAKE_OPTIONS): Add dejagnu. + * configure, Makefile.in: Regenerated. + 2021-03-07 Mike Frysinger * Makefile.am: New file. diff --git a/sim/Makefile.am b/sim/Makefile.am index bcca70623e9..c6e2d04f33a 100644 --- a/sim/Makefile.am +++ b/sim/Makefile.am @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -AUTOMAKE_OPTIONS = foreign no-dist subdir-objects +AUTOMAKE_OPTIONS = dejagnu foreign no-dist subdir-objects ACLOCAL_AMFLAGS = -I.. -I../config srcroot = $(srcdir)/.. @@ -34,3 +34,5 @@ MOSTLYCLEANFILES = core nltvals: $(abs_srcdir)/common/gennltvals.py --cpp "$(CPP)" --output nltvals.def --srcroot $(srcroot) $(SHELL) $(srcroot)/move-if-change nltvals.def $(abs_srcdir)/common/nltvals.def + +include testsuite/local.mk diff --git a/sim/Makefile.in b/sim/Makefile.in index cda770d349c..390a8575a75 100644 --- a/sim/Makefile.in +++ b/sim/Makefile.in @@ -29,6 +29,22 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . + +# +# Copyright (C) 1997-2021 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 this program. If not, see . VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ @@ -116,7 +132,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -CONFIG_CLEAN_FILES = testsuite/Makefile +CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -172,6 +188,10 @@ am__define_uniq_tagged_files = \ ETAGS = etags CTAGS = ctags CSCOPE = cscope +DEJATOOL = $(PACKAGE) +RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir +EXPECT = expect +RUNTEST = runtest DIST_SUBDIRS = $(SUBDIRS) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -275,17 +295,20 @@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = foreign no-dist subdir-objects +AUTOMAKE_OPTIONS = dejagnu foreign no-dist subdir-objects ACLOCAL_AMFLAGS = -I.. -I../config srcroot = $(srcdir)/.. SUBDIRS = @subdirs@ -MOSTLYCLEANFILES = core +MOSTLYCLEANFILES = core site-srcdir.exp testrun.log testrun.sum + +# Tweak the site.exp so it works with plain `runtest` from user. +EXTRA_DEJAGNU_SITE_CONFIG = site-srcdir.exp all: all-recursive .SUFFIXES: am--refresh: Makefile @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/testsuite/local.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -307,6 +330,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; +$(srcdir)/testsuite/local.mk $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck @@ -316,8 +340,6 @@ $(top_srcdir)/configure: $(am__configure_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): -testsuite/Makefile: $(top_builddir)/config.status $(top_srcdir)/testsuite/Makefile.in - cd $(top_builddir) && $(SHELL) ./config.status $@ # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. @@ -424,7 +446,40 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files +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 + +distclean-DEJAGNU: + -rm -f site.exp site.bak + -l='$(DEJATOOL)'; for tool in $$l; do \ + rm -f $$tool.sum $$tool.log; \ + done check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU check: check-recursive all-am: Makefile installdirs: installdirs-recursive @@ -467,7 +522,8 @@ clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags +distclean-am: clean-am distclean-DEJAGNU distclean-generic \ + distclean-tags dvi: dvi-recursive @@ -529,18 +585,18 @@ ps-am: uninstall-am: -.MAKE: $(am__recursive_targets) install-am install-strip +.MAKE: $(am__recursive_targets) check-am install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ - am--refresh check check-am clean clean-cscope clean-generic \ - cscope cscopelist-am ctags ctags-am distclean \ - distclean-generic distclean-tags dvi dvi-am html html-am info \ - info-am install install-am install-data install-data-am \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ + am--refresh check check-DEJAGNU check-am clean clean-cscope \ + clean-generic cscope cscopelist-am ctags ctags-am distclean \ + distclean-DEJAGNU distclean-generic distclean-tags dvi dvi-am \ + html html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-am uninstall uninstall-am @@ -558,6 +614,18 @@ nltvals: $(abs_srcdir)/common/gennltvals.py --cpp "$(CPP)" --output nltvals.def --srcroot $(srcroot) $(SHELL) $(srcroot)/move-if-change nltvals.def $(abs_srcdir)/common/nltvals.def +site-srcdir.exp: Makefile + echo "set srcdir \"$(srcdir)/testsuite\"" > $@ + +check-DEJAGNU: site.exp + LC_ALL=C; export LC_ALL; \ + EXPECT=${EXPECT} ; export EXPECT ; \ + runtest=$(RUNTEST); \ + if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ + $$runtest $(RUNTESTFLAGS); \ + else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + fi + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 35c10a550dd..6b6df9282b0 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,7 @@ +2021-03-07 Mike Frysinger + + * Make-common.in (check): Delete body. + 2021-02-28 Mike Frysinger * Make-common.in (SIM_EXTRA_LIBDEPS): Delete. diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index 3f16dc476ef..cf92e94993c 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -471,7 +471,6 @@ installdirs: $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(libdir) check: - cd ../testsuite && $(MAKE) check RUNTESTFLAGS="$(RUNTESTFLAGS)" info: clean-info: diff --git a/sim/configure b/sim/configure index b0179bb0cc9..54a52541ea3 100755 --- a/sim/configure +++ b/sim/configure @@ -4953,7 +4953,7 @@ subdirs="$subdirs aarch64" fi fi -ac_config_files="$ac_config_files Makefile testsuite/Makefile" +ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -5703,7 +5703,6 @@ do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/sim/configure.ac b/sim/configure.ac index de5779642c5..23478521e94 100644 --- a/sim/configure.ac +++ b/sim/configure.ac @@ -152,5 +152,5 @@ if test "${enable_sim}" != no; then fi fi -AC_CONFIG_FILES([Makefile testsuite/Makefile]) +AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/sim/testsuite/ChangeLog b/sim/testsuite/ChangeLog index 9eadd5fc400..a88c9950843 100644 --- a/sim/testsuite/ChangeLog +++ b/sim/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2021-03-07 Mike Frysinger + + * Makefile.in: Removed. + * lib/sim-defs.exp (sim): Update default path. + * local.mk: New file based on Makefile.in. + 2021-02-13 Mike Frysinger * Makefile.in (arch): Delete. diff --git a/sim/testsuite/Makefile.in b/sim/testsuite/Makefile.in deleted file mode 100644 index 8db77d2d46f..00000000000 --- a/sim/testsuite/Makefile.in +++ /dev/null @@ -1,178 +0,0 @@ -# Makefile for regression testing the GNU debugger. -# Copyright (C) 1997-2021 Free Software Foundation, Inc. - -# This file is part of GDB. - -# 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 this program. If not, see . - -VPATH = @srcdir@ -srcdir = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -build_canonical = @build@ -build_alias = @build_alias@ -host_canonical = @host@ -host_alias = @host_alias@ -target_canonical = @target@ -target_alias = @target_alias@ -program_transform_name = @program_transform_name@ - -SHELL = /bin/sh -SUBDIRS = @subdirs@ -RPATH_ENVVAR = @RPATH_ENVVAR@ - -EXPECT = `if [ -f $${rootme}/../../expect/expect ] ; then \ - echo $${rootme}/../../expect/expect ; \ - else echo expect ; fi` - -RUNTEST = `if [ -f $${srcdir}/../../dejagnu/runtest ] ; then \ - echo $${srcdir}/../../dejagnu/runtest ; else echo runtest; \ - fi` - -RUNTESTFLAGS = - -#### host, target, and site specific Makefile frags come in here. - -# The use of $$(x_FOR_TARGET) reduces the command line length by not -# duplicating the lengthy definition. - -TARGET_FLAGS_TO_PASS = \ - "prefix=$(prefix)" \ - "exec_prefix=$(exec_prefix)" \ - "against=$(against)" \ - 'CC=$$(CC_FOR_TARGET)' \ - "CC_FOR_TARGET=$(CC_FOR_TARGET)" \ - "CFLAGS=$(TESTSUITE_CFLAGS)" \ - "CHILLFLAGS=$(CHILLFLAGS)" \ - 'CHILL=$$(CHILL_FOR_TARGET)' \ - "CHILL_FOR_TARGET=$(CHILL_FOR_TARGET)" \ - "CHILL_LIB=$(CHILL_LIB)" \ - 'CXX=$$(CXX_FOR_TARGET)' \ - "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \ - "CXXFLAGS=$(CXXFLAGS)" \ - "MAKEINFO=$(MAKEINFO)" \ - "INSTALL=$(INSTALL)" \ - "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ - "INSTALL_DATA=$(INSTALL_DATA)" \ - "RUNTESTFLAGS=$(RUNTESTFLAGS)" - -# "RUNTEST=$(RUNTEST)" \ - -all: - @echo "Nothing to be done for all..." - -.NOEXPORT: -info: -install-info: -dvi: - -install: -install-strip: - -uninstall: force - -installcheck: - -check: check-DEJAGNU check-recursive - -#test1: -check-recursive: - @for i in . ${SUBDIRS}; do \ - if [ $$i = . ] ; then continue ; fi ; \ - if [ -d ./$$i ] ; then \ - if (rootme=`pwd`/ ; export rootme ; \ - rootsrc=`cd $(srcdir); pwd`/ ; export rootsrc ; \ - echo "check recursively into $$i directory..."; \ - cd ./$$i; \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) check) ; then true ; \ - else exit 1 ; fi ; \ - else true ; fi ; \ - done - -#test2: -check-DEJAGNU: site.exp - echo "Dejagnu-checking in `pwd` directory ..." - rootme=`pwd`; export rootme; echo rootme = $$rootme; \ - srcdir=`cd ${srcdir}; pwd`; export srcdir ; echo srcdir = $$srcdir; \ - EXPECT=${EXPECT} ; export EXPECT ; echo EXPECT = $$EXPECT; \ - if [ -f $$rootme/../../expect/expect ]; then \ - TCL_LIBRARY=`cd $$srcdir/../../tcl/library && pwd`; \ - export TCL_LIBRARY; \ - fi; \ - echo TCL_LIBRARY = $$TCL_LIBRARY; \ - runtest=$(RUNTEST); echo runtest = $$runtest; \ - if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ - $$runtest $(RUNTESTFLAGS); \ - else echo "WARNING: could not find \`runtest'" 1>&2; :;\ - fi - - -site.exp: Makefile - @echo 'Making a new site.exp file...' - -@rm -f site.bak - @echo '## these variables are automatically generated by make ##' > $@-t - @echo '# Do not edit here. If you wish to override these values' >> $@-t - @echo '# edit the last section' >> $@-t - @echo 'set srcdir $(srcdir)' >> $@-t - @echo 'set objdir' `pwd` >> $@-t - @echo 'set build_alias $(build_alias)' >> $@-t - @echo 'set build_triplet $(build_canonical)' >> $@-t - @echo 'set host_alias $(host_alias)' >> $@-t - @echo 'set host_triplet $(host_canonical)' >> $@-t - @echo 'set target_alias $(target_alias)' >> $@-t - @echo 'set target_triplet $(target_canonical)' >> $@-t - @echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t - -@sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t - -@mv site.exp site.bak - @mv $@-t site.exp - -force:; - -clean mostlyclean: - -rm -f *~ core *.o a.out xgdb *.x *.grt - -rm -f *.rum *.c *.dif *.*out - if [ x"${SUBDIRS}" != x ] ; then \ - for dir in ${SUBDIRS}; \ - do \ - echo "$$dir:"; \ - if [ -d $$dir ]; then \ - (cd $$dir; $(MAKE) clean); \ - fi; \ - done ; \ - else true; fi - -distclean maintainer-clean realclean: clean - -rm -f *~ core - -rm -f Makefile config.status *-init.exp - -rm -fr *.log summary detail *.plog *.sum *.psum site.* - if [ x"${SUBDIRS}" != x ] ; then \ - for dir in ${SUBDIRS}; \ - do \ - echo "$$dir:"; \ - if [ -d $$dir ]; then \ - (cd $$dir; $(MAKE) distclean); \ - fi; \ - done ; \ - else true; fi - -Makefile : Makefile.in ../config.status - $(SHELL) ../config.status - -config.status: $(srcdir)/../configure - $(SHELL) ../config.status --recheck -# FIXME: Requires --enable-maintainer-mode, which one could add, but -# it's provided by automake. Maybe switch to automake someday. -#$(srcdir)/configure: @MAINT@ $(srcdir)/configure.in -# cd $(srcdir) && autoconf diff --git a/sim/testsuite/lib/sim-defs.exp b/sim/testsuite/lib/sim-defs.exp index 43a07050f50..0157f9bb283 100644 --- a/sim/testsuite/lib/sim-defs.exp +++ b/sim/testsuite/lib/sim-defs.exp @@ -106,7 +106,7 @@ proc sim_run { prog sim_opts prog_opts redir options } { # These global variables come from generated site.exp. global objdir global arch - set sim "$objdir/../$arch/run" + set sim "$objdir/$arch/run" } if [is_remote host] { diff --git a/sim/testsuite/local.mk b/sim/testsuite/local.mk new file mode 100644 index 00000000000..bd8a2069643 --- /dev/null +++ b/sim/testsuite/local.mk @@ -0,0 +1,34 @@ +## See sim/Makefile.am. +# +# Copyright (C) 1997-2021 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 this program. If not, see . + +# Tweak the site.exp so it works with plain `runtest` from user. +EXTRA_DEJAGNU_SITE_CONFIG = site-srcdir.exp + +site-srcdir.exp: Makefile + echo "set srcdir \"$(srcdir)/testsuite\"" > $@ + +check-DEJAGNU: site.exp + LC_ALL=C; export LC_ALL; \ + EXPECT=${EXPECT} ; export EXPECT ; \ + runtest=$(RUNTEST); \ + if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ + $$runtest $(RUNTESTFLAGS); \ + else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + fi + +MOSTLYCLEANFILES += \ + site-srcdir.exp testrun.log testrun.sum -- 2.30.2