diff --git a/Mmakefile b/Mmakefile index a66838b82..0dcfa8bfd 100644 --- a/Mmakefile +++ b/Mmakefile @@ -53,7 +53,7 @@ SUBDIRS = \ MMAKEFLAGS = -# We include ../../mfilterjavac in this path because $SUBDIR_MMAKE is used +# We include ../../mfilterjavac in this path because $(SUBDIR_MMAKE) is used # from the grade install directories, and we need mfilterjavac in our path # when executing in install_grade_dir.java/library and others. SUBDIR_MMAKE = \ @@ -612,7 +612,7 @@ tar2: $(GENERATED_DOCS) chmod -R a+r * # Our invoker should have passed to us in ${SRCDIST_NAME} # the name of the current directory in its parent directory. - # This name should have the form mercury-srcdist-$VERSION, + # This name should have the form mercury-srcdist-$(VERSION), # which matters, because it will also be the name of the directory # that the tar file we are creating here will unpack into. # @@ -929,7 +929,7 @@ bindist: WORK_IN_PROGRESS TODO #-----------------------------------------------------------------------------# -clean: clean_tests clean_subdirs +clean: clean_tests clean_subdirs clean_extras .PHONY: clean_subdirs clean_subdirs: @@ -941,14 +941,20 @@ clean_subdirs: .PHONY: clean_tests clean_tests: +if test -d tests; then \ - (cd tests; $(SUBDIR_MMAKE) clean) \ + (cd tests; $(MMAKE) $(MMAKEFLAGS) clean) \ fi realclean: realclean_tests realclean_subdirs realclean_local +cd scripts; $(SUBDIR_MMAKE) realclean +.PHONY: clean_extras +clean_extras: + +if test -d extras; then \ + (cd extras; $(MMAKE) $(MMAKEFLAGS) clean) \ + fi + .PHONY: realclean_local -realclean_local: realclean_config realclean_docs +realclean_local: realclean_config realclean_docs realclean_extras .PHONY: realclean_subdirs realclean_subdirs: clean_subdirs @@ -970,7 +976,13 @@ realclean_config: .PHONY: realclean_tests realclean_tests: +if test -d tests; then \ - (cd tests; $(SUBDIR_MMAKE) realclean) \ + (cd tests; $(MMAKE) $(MMAKEFLAGS) realclean) \ + fi + +.PHONY: realclean_extras +realclean_extras: + +if test -d extras; then \ + (cd extras; $(MMAKE) $(MMAKEFLAGS) realclean) \ fi #-----------------------------------------------------------------------------# diff --git a/configure.ac b/configure.ac index 40f7b6e4b..dc9551305 100644 --- a/configure.ac +++ b/configure.ac @@ -5677,17 +5677,6 @@ AC_SUBST(CSHPATH) #-----------------------------------------------------------------------------# -# When running the debugger tests we want to use the local mdbrc file, -# not the installed one, so that we can test changes to this file -# without having to install first. We therefore create a copy of the mdbrc.in -# for use with the test suite. - -test_mdbrc=tests/mdbrc - -cat "`pwd`"/scripts/mdbrc.in | sed \ - -e 's/DEFAULT_MERCURY_DEBUGGER_INIT_DIR/TESTS_MDB_INIT_DIR/g' \ - -e 's/DEFAULT_MERCURY_DEBUGGER_DOC/TESTS_MDB_DOC/g' > $test_mdbrc.in - TESTS_MDB_INIT_DIR="`pwd`"/scripts TESTS_MDB_DOC="`pwd`"/doc/mdb_doc AC_SUBST(TESTS_MDB_INIT_DIR) @@ -5774,7 +5763,6 @@ output_files="$nonexecutable_output_files $executable_output_files" # scripts/mercury_config.in. AC_OUTPUT($output_files -"$test_mdbrc" , [ # Only do this when compiling the source, not when reconfiguring diff --git a/scripts/Mmakefile b/scripts/Mmakefile index 13d17d11c..e46e9899f 100644 --- a/scripts/Mmakefile +++ b/scripts/Mmakefile @@ -48,22 +48,23 @@ CONF_FILES = \ Mmake.vars \ parse_ml_options.sh-subr -CONF_DEBUG_SCRIPTS = \ +CONF_DEBUG_SCRIPTS = \ mdbrc -DEBUGGER_SCRIPTS = $(CONF_DEBUG_SCRIPTS) \ - xul_tree.xsl \ - mdb_open \ - mdb_grep \ - mdb_track \ - mdb_term_browser.js \ - mdb_term_browser.css \ - jquery.slim.js \ - jstree.js \ - jstree.style.css \ - 32px.png \ - 40px.png \ - throbber.gif +DEBUGGER_SCRIPTS = \ + $(CONF_DEBUG_SCRIPTS) \ + xul_tree.xsl \ + mdb_open \ + mdb_grep \ + mdb_track \ + mdb_term_browser.js \ + mdb_term_browser.css \ + jquery.slim.js \ + jstree.js \ + jstree.style.css \ + 32px.png \ + 40px.png \ + throbber.gif EMACS_SCRIPTS = gud.el @@ -78,7 +79,7 @@ CSHARP_WRAPPER_SCRIPTS = \ # .SUFFIXES: .in -# we test membership of CONF_SCRIPTS and CONF_FILES, because testing $(@D) +# We test membership of CONF_SCRIPTS and CONF_FILES, because testing $(@D) # (the directory part of $*) does the wrong thing for Mercury.config. # Not testing anything would make this rule apply even to ../Mmake.common. # The grep is there to ensure that there were no mispelt autoconf variable @@ -105,10 +106,30 @@ CSHARP_WRAPPER_SCRIPTS = \ fi \ done +# To allow a change to the debugger and/or to its documentation to be +# matched by changes in the expected output files in the debugger and +# declarative_debugger test directories, we must give the tests in those +# directories access to mdb_doc and mdbrc files in the current workspace, +# *not* in the installed system. +test_mdbrc: mdbrc.in mdbrc + ABS_MERCURY_DIR=`(cd $(MERCURY_DIR); /bin/pwd)` ; \ + sed \ + -e "s:@DEFAULT_MERCURY_DEBUGGER_DOC@:$${ABS_MERCURY_DIR}/doc/mdb_doc:" \ + -e "s:@DEFAULT_MERCURY_DEBUGGER_INIT_DIR@:$${ABS_MERCURY_DIR}/scripts:" \ + -e '/^xml_/d' \ + -e '/^web_/d' \ + < mdbrc.in > test_mdbrc + egrep '^xml_' < mdbrc >> test_mdbrc + egrep '^web_' < mdbrc >> test_mdbrc + @if grep '@' test_mdbrc; then \ + echo "unhandled configuration variable in test_mdbrc"; \ + exit 1; \ + fi + #-----------------------------------------------------------------------------# .PHONY: all -all: $(CONF_FILES) $(SCRIPTS) $(DEBUGGER_SCRIPTS) $(EMACS_SCRIPTS) +all: $(CONF_FILES) $(SCRIPTS) $(DEBUGGER_SCRIPTS) $(EMACS_SCRIPTS) test_mdbrc #-----------------------------------------------------------------------------# @@ -171,11 +192,9 @@ install_config: Mercury.config install_dirs .PHONY: install_debugger_scripts install_debugger_scripts: $(DEBUGGER_SCRIPTS) install_dirs - # Reportedly old versions of Mercury - # used to install mdbrc as read-only. - # If that is the case, then we need to make sure - # that it gets made writable before we install the - # new version. + # Reportedly old versions of Mercury used to install mdbrc + # as read-only. If that is the case, then we need to make sure + # that it gets made writable before we install the new version. -chmod u+w $(INSTALL_LIBDIR)/mdb/* cp $(DEBUGGER_SCRIPTS) $(INSTALL_LIBDIR)/mdb diff --git a/tests/Mmake.common b/tests/Mmake.common index 83b04d8f7..e66466172 100644 --- a/tests/Mmake.common +++ b/tests/Mmake.common @@ -82,7 +82,7 @@ JAVA=java # the source of irrelevant difference between the actual and expected outputs. MDB = HOME=/nonexistent MERCURY_SUPPRESS_MDB_BANNER=yes \ - MERCURY_DEBUGGER_INIT=$(TESTS_DIR)/mdbrc mdb + MERCURY_DEBUGGER_INIT=$(WORKSPACE)/scripts/test_mdbrc mdb MDB_NOINIT = HOME=/nonexistent MERCURY_SUPPRESS_MDB_BANNER=yes \ MERCURY_DEBUGGER_INIT="" mdb @@ -274,6 +274,10 @@ realclean_local: clean_logs clean_errors clean_mdbrc clean_local: clean_out clean_res clean_trace_counts clean_mdbrc_in +# XXX As of 2020 oct 4, mdbrc and mdbrc.in are no longer created +# in this directory. After a few weeks, after all workspaces can be +# expected to be cleaned up, we should delete these two now-redundant +# targets, and the references to them. clean_mdbrc: -rm -f mdbrc diff --git a/tests/Mmakefile b/tests/Mmakefile index 18c76bd40..c337900dc 100644 --- a/tests/Mmakefile +++ b/tests/Mmakefile @@ -91,6 +91,10 @@ $(RUNTESTS_IN_SUBDIRS): runtests_in_%: echo Could not run tests in directory $* >> NOMAKE_DIRS ; \ fi +#-----------------------------------------------------------------------------# + +realclean: realclean_subdirs + realclean_subdirs: +succeeded=true; \ for dir in $(SUBDIRS); do \ @@ -102,6 +106,8 @@ realclean_subdirs: ;; \ esac +clean: clean_subdirs + clean_subdirs: +succeeded=true; \ for dir in $(SUBDIRS); do \ @@ -112,3 +118,5 @@ clean_subdirs: exit 1 \ ;; \ esac + +#-----------------------------------------------------------------------------# diff --git a/tools/bootcheck b/tools/bootcheck index 33239044f..4566dbdca 100755 --- a/tools/bootcheck +++ b/tools/bootcheck @@ -1912,30 +1912,14 @@ if ${runtests} then echo "starting the test suite at `date`" - # We need to give tests/debugger access to the mdbrc and mdb_doc - # files in the doc and scripts directories, without hardcoding their - # pathnames. We must also compensate for scripts/mdbrc having hardcoded - # within it the *installed* pathname of mdb_doc and not its current - # pathname. - cat ${root}/doc/mdb_doc > ${root}/scripts/test_mdbrc - sed -e '/^source/d' ${root}/scripts/mdbrc >> ${root}/scripts/test_mdbrc + # If the workspace has been moved since ${root}/scripts/test_mdbrc + # was last built, that file will refer to the OLD location of + # the workspace, which may not exist anymore. We therefore rebuild + # the file. + (cd =${root}/scripts; /bin/rm test_mdbrc; mmake test_mdbrc) MERCURY_DEBUGGER_INIT=${root}/scripts/test_mdbrc export MERCURY_DEBUGGER_INIT - # If the workspace has been copied or moved since ${root}/tests/mdbrc - # has been created by an invocation of ${root}/configure, the - # ${root}/tests/mdbrc file will refer to the mdb_doc file in the OLD - # location of the workspace, which may not exist anymore. - # Override the settings in tests/mdbrc that refer to the current - # directory; keep the xml settings, which do not do so. - sed \ - -e "s:@TESTS_MDB_DOC@:${root}/doc/mdb_doc:" \ - -e "s:@TESTS_MDB_INIT_DIR@:${root}/scripts:" \ - -e "/^xml_/d" \ - < "${root}/tests/mdbrc.in" > "${root}/tests/mdbrc.tmp" - grep '^xml_' < "${root}/tests/mdbrc" >> "${root}/tests/mdbrc.tmp" - mv "${root}/tests/mdbrc.tmp" "${root}/tests/mdbrc" - MERCURY_SUPPRESS_STACK_TRACE=yes export MERCURY_SUPPRESS_STACK_TRACE