[m-rev.] for review: improve test framework

Simon Taylor stayl at cs.mu.OZ.AU
Thu Aug 15 03:24:03 AEST 2002


Estimated hours taken: 30
Branches: main

Improve the test framework to make it easier to find out which tests
failed and to reduce disk usage (important in debug grades). The
disadvantage is that the tests can no longer be run in parallel.

Allow the tests to be run with `mmc --make' (still some failures).

tests/Mmake.common:
tests/*/Mmakefile:
	Move common code (such as the code to deal with subdirectories)
	to Mmake.common.

	Run the tests using `mmake runtests' rather than using slightly
	different runtests scripts in each directory.

	Add to the output from `mmake runtests' to make it easier to
	identify which tests failed in which grades.

	Move per-module options into Mercury.options files so they
	can be read by `mmc --make'.

	Remove the last of the NU-Prolog support.

	Consistently use the main module name when listing tests.
	Some directories (e.g. invalid) were using the source file
	name.

tests/process_log.awk:
	Collect the parts of the output relating to failing tests.

tests/generate_exp:
tests/handle_options:
tests/subdir_runtests:
tests/startup:
tests/shutdown:
tests/*/runtests:
tests/recompilation/TESTS:
	Removed.

tests/README:
	Updated.

tools/bootcheck:
tools/test_mercury:
	Use `mmake runtests' instead of the `runtests' script.

tools/test_mercury:
tools/run_all_tests_from_cron:
	Use the new framework to summarize test failures.

Index: tests/Mmake.common
===================================================================
RCS file: /home/mercury1/repository/tests/Mmake.common,v
retrieving revision 1.24
diff -u -u -r1.24 Mmake.common
--- tests/Mmake.common	29 Apr 2002 08:22:05 -0000	1.24
+++ tests/Mmake.common	14 Aug 2002 16:08:25 -0000
@@ -1,4 +1,25 @@
 #-----------------------------------------------------------------------------#
+# Mmake.common - shared Mmake variables and rules for the test directories.
+#
+# The including Mmakefile must set the following variables:
+# THIS_DIR - the name of the directory containing tests
+#		(e.g. benchmarks, hard_coded/typeclasses)
+# TESTS_DIR - the directory containing this file.
+# SUBDIRS - the names of any subdirectories containing tests.
+# PROGS - the names of the main modules of the test programs.
+# TESTS- the names of the tests. For each test there must be targets
+#	test.depend, test.runtest and test.realclean, unless the test ends
+#	in `-nodepend', in which case the `-nodepend' suffix will be stripped
+#	off and the test.depend target is not required.
+#
+#-----------------------------------------------------------------------------#
+
+MAIN_TARGET = runtests
+
+-include $(TESTS_DIR)/Mmake.params
+
+# Avoid trying to make this file with `mmc --make' if it doesn't exist.
+$(TESTS_DIR)/Mmake.params: ;
 
 # Set up to test a particular workspace.
 ifdef WORKSPACE
@@ -15,10 +36,6 @@
 # file by setting both GRADEFLAGS-foo.
 #
 
-# Override this with `mmake HAVE_NUPROLOG=yes'
-# if you want to rebuild the `.exp' files.
-HAVE_NUPROLOG=no
-
 DIFF_OPTS=-c
 
 # Override this with `RUN_RECOMPILATION_TESTS=no'
@@ -31,7 +48,7 @@
 
 #-----------------------------------------------------------------------------#
 
-# .PRECIOUS: %.mod %.c %.o %_init.c %.no %.nu %_init.nl %_init.no
+# .PRECIOUS: %.c %.o %_init.c
 
 %_init.c: Entry
 
@@ -82,44 +99,193 @@
 		echo "** $*.out did not match the expected output"; \
 		echo "** (closest match was $$shortest)"; \
 		cp $$shortest $@; \
+		cat $@; \
 		exit 1; }
 
 #-----------------------------------------------------------------------------#
 
-clean_local: clean_out clean_res
+MERCURY_MAIN_MODULES = $(PROGS)
+
+LOG_FILE = runtests.log
+ERROR_FILE = runtests.errs
+
+realclean_local: clean_errors
+clean_local: clean_out clean_res clean_zip
 
 clean_mc: clean_c clean_o clean_out clean_res
 
 clean_out:
 	rm -f *.out
 
-clean_exp:
-	rm -f *.exp
-
 clean_res:
 	rm -f *.res*
 
+clean_errors:
+	rm -f $(ERROR_FILE)
+
+# Remove gzipped executables for tests which have failed.
+clean_zip:
+	for test in $(TESTS); do \
+		rm -f `basename $$test -nodepend`.gz; \
+	done
+
 #
-# The `foo' targets make `foo_local' in the current directory before
-# recursively making `foo' in all subdirectories.  The recursive part
-# is handled in individual Mmakefiles.
+# The `foo' targets make recursively make `foo' in all subdirectories.
+# before making `foo_local' in the current directory 
 # 
 
-.PHONY: check_local dep_local depend_local all_local
-
-.PHONY: check_subdirs dep_subdirs depend_subdirs realclean_subdirs \
-        clean_subdirs all_subdirs
+.PHONY: runtests runtests_local runtests_subdirs
+.PHONY: realclean_subdirs clean_subdirs
 
-check:          check_local check_subdirs
-dep:            dep_local dep_subdirs
-depend:         depend_local depend_subdirs
 realclean:      realclean_subdirs
 clean:          clean_subdirs
-all:            all_local all_subdirs
+all:		runtests
+
+ifndef RUNTESTS_IN_SUBDIR
+    RUNTESTS_IN_SUBDIR=false
+endif
+
+ifeq ($(RUNTESTS_IN_SUBDIR),true)
+    STARTUP_LOG=:
+    REDIRECT_TO_LOG=
+    PROCESS_LOG=:
+    CLEANUP_LOG=:
+    REPORT_SUCCESS=:
+    REPORT_FAILURE=:
+else
+    STARTUP_LOG=rm -f $(LOG_FILE); touch $(LOG_FILE)
+    REDIRECT_TO_LOG= | tee -a $(LOG_FILE)
+    PROCESS_LOG=echo ERRORS; \
+        echo END ERRORS
+    CLEANUP_LOG=rm -f $(LOG_FILE)
+    REPORT_SUCCESS=echo ALL TESTS SUCCEEDED; rm -f $(ERROR_FILE)
+    REPORT_FAILURE= \
+        awk -f $(TESTS_DIR)/process_log.awk < $(LOG_FILE) > $(ERROR_FILE); \
+        echo SOME TESTS FAILED: see $(ERROR_FILE)
+endif
+
+# If the tests in the subdirectories, still run the local tests,
+# but return a status of 1.
+# 
+runtests:
+	@$(STARTUP_LOG)
+	@rm -f subdirs_failed local_failed
+	+@{ mmake runtests_subdirs || touch subdirs_failed; } $(REDIRECT_TO_LOG)
+	+@{ mmake runtests_local || touch local_failed; } $(REDIRECT_TO_LOG)
+	@if [ -f subdirs_failed -o -f local_failed ] ; then \
+		$(REPORT_FAILURE); \
+		$(CLEANUP_LOG); \
+		rm -f subdirs_failed local_failed; \
+		exit 1; \
+	else \
+		$(REPORT_SUCCESS); \
+		$(CLEANUP_LOG); \
+		rm -f subdirs_failed local_failed; \
+	fi
+
+ifeq ($(TESTS),)
+
+runtests_local: ;
+
+else
+
+# Run multiple rm commands at once to speed up
+# `mmake realclean' on slow NFS filesystems.
+RM_JFACTOR=-j10
+
+#
+# Run all tests in the directory one at a time, running
+# `mmake realclean' for the tests which succeed and
+# gzipping the executables for those which don't.
+#
+runtests_local:
+	@echo STARTING tests in $(THIS_DIR) in grade $(GRADE)
+	@echo cleaning up the directory before the tests
+	+ at if ls -lt | head -2 | egrep CLEAN > /dev/null 2>&1; then  \
+		rm -f CLEAN > /dev/null 2>&1; \
+	else \
+		rm -f CLEAN > /dev/null 2>&1; \
+		mmake $(RM_JFACTOR) realclean_local > /dev/null 2>&1; \
+		rm -f *.d *.dep *.int *.int2 *.int3 > /dev/null 2>&1; \
+		rm -f *.date *.date3 *.opt *.optdate > /dev/null 2>&1; \
+		rm -f *.trans_opt *.trans_opt_date > /dev/null 2>&1; \
+	fi
+	+ at failed_targets= ; \
+	for test in $(TESTS); do \
+	    echo RUNNING TEST $(THIS_DIR)/$$test in grade $(GRADE); \
+	    case $$test in \
+	        *-nodepend) \
+			depend_success=true; \
+			test=`basename $$test -nodepend` ;; \
+		*) \
+			if mmake $$test.depend; then \
+			    depend_success=true; \
+			else \
+			    depend_success=false; \
+	    		fi ;; \
+	    esac; \
+	    case $$depend_success in \
+	        true) \
+		    if mmake $$test.runtest; then \
+		        echo FINISHED TEST $(THIS_DIR)/$$test; \
+			rm -f $$test.out* $$test.*res*; \
+		        mmake $$test.realclean > /dev/null 2>&1; \
+		    else \
+		        echo FAILED TEST $(THIS_DIR)/$$test in grade $(GRADE); \
+		        failed_targets="$$failed_targets $(THIS_DIR)/$$test"; \
+		    	if [ -f $$test ]; then \
+				rm -f $$test.gz; gzip $$test; \
+			fi; \
+		    fi ;; \
+		false) \
+		    echo FAILED TEST $(THIS_DIR)/$$test; \
+		    failed_targets="$$failed_targets $(THIS_DIR)/$$test" ;; \
+	    esac; \
+	done; \
+	case "$$failed_targets" in \
+		"") \
+			echo cleaning up the directory after the tests; \
+			mmake $(RM_JFACTOR) realclean_local > /dev/null 2>&1; \
+			rm core > /dev/null 2>&1; \
+			touch CLEAN; \
+			echo \
+		"FINISHED tests in $(THIS_DIR) in grade $(GRADE)" ;; \
+		*) \
+			echo \
+		"FAILED tests in grade $(GRADE): $$failed_targets"; \
+			exit 1 ;; \
+	esac
+
+endif	# TESTS != ""
+
+ifeq ($(SUBDIRS),)
+
+runtests_subdirs realclean_subdirs clean_subdirs : ;
+
+else
+
+runtests_subdirs:
+	succeeded=true; \
+	for dir in $(SUBDIRS); do \
+		(cd $$dir && RUNTESTS_IN_SUBDIR=true mmake runtests) || \
+			succeeded=false; \
+	done; \
+	case $$succeeded in false) exit 1 ;; esac
+
+realclean_subdirs:
+	+succeeded=true; \
+	for dir in $(SUBDIRS); do \
+	    (cd $$dir && mmake realclean) || succeeded=false; \
+	done
+	case $$succeeded in false) exit 1 ;; esac
+
+clean_subdirs:
+	+succeeded=true; \
+	for dir in $(SUBDIRS); do \
+		(cd $$dir && mmake clean) || succeeded=false; \
+	done; \
+	case $$succeeded in false) exit 1 ;; esac
 
-SUBDIR_MMAKE = mmake \
-                GRADE='$(GRADE)' \
-                EXTRA_CFLAGS='$(EXTRA_CFLAGS)' \
-                EXTRA_MCFLAGS='$(EXTRA_MCFLAGS)'
+endif	# SUBDIRS != ""
 
 #-----------------------------------------------------------------------------#
Index: tests/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/Mmakefile,v
retrieving revision 1.5
diff -u -u -r1.5 Mmakefile
--- tests/Mmakefile	2 Sep 2001 10:33:02 -0000	1.5
+++ tests/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -1,37 +1,6 @@
+THIS_DIR=tests
+PROGS=
+TESTS=
 SUBDIRS = benchmarks debugger general hard_coded invalid misc_tests tabling term valid warnings
-NUPROLOG_SUBDIRS = benchmarks general
-
-main_target: check
-
-# Generate the .exp files that are used as a basis of comparison to check
-# the correctness of the code emitted by the Mercury compiler.
-exp:
-	+for dir in $(NUPROLOG_SUBDIRS); do \
-		(cd $$dir && mmake $(MMAKEFLAGS) exp) || exit 1; \
-	done
-
-# run the tests
-check:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && mmake $(MMAKEFLAGS) check) || exit 1; \
-	done
-
-dep:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && mmake $(MMAKEFLAGS) dep) || exit 1; \
-	done
-
-depend:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && mmake $(MMAKEFLAGS) depend) || exit 1; \
-	done
-
-realclean:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && mmake $(MMAKEFLAGS) realclean) || exit 1; \
-	done
-
-clean:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && mmake $(MMAKEFLAGS) clean) || exit 1; \
-	done
+TESTS_DIR=.
+include $(TESTS_DIR)/Mmake.common
Index: tests/README
===================================================================
RCS file: /home/mercury1/repository/tests/README,v
retrieving revision 1.6
diff -u -u -r1.6 README
--- tests/README	27 Jun 2001 05:04:42 -0000	1.6
+++ tests/README	14 Aug 2002 07:30:48 -0000
@@ -1,17 +1,19 @@
 The Mercury test suite is (dis)organized into a directory hierarchy.
-Each subdirectory has a script named "runtests" that runs the tests
-in that subdirectory; these indicate the presence of any errors by
-returning a nonzero exit status. The runtests script in each directory
-invokes the runtests scripts in all subdirectories, and propagates
-any nonzero exit status upwards.
 
-Both the bootcheck script and the nightly script use the main runtests
-script to run all the tests.
+`mmake' will run the tests in the directory it is
+invoked in and all subdirectories of that subdirectory.
+Use `mmake SUBDIRS=' to just run the local tests without
+the subdirectories.
+
+Both the bootcheck script and the nightly script use `mmake'
+to run all the tests.
+
+Unless otherwise stated, the tests in each directory compile
+the test programs and compare their output against hand-coded
+`.exp' (or `.exp2', `.exp3', etc) files.
 
 benchmarks
 	This directory contains Mercury versions of the benchmarks.
-	These tests work by comparing the output of the Mercury and
-	the NU-Prolog versions.
 
 debugger
 	This directory is for testing mdb, the Mercury debugger.
@@ -24,22 +26,27 @@
 	features of mdb.
 
 general
-	This directory is for general test cases.
+hard_coded
+	These directories are for general test cases.
+
 	(It might be a good idea to split this into tests
 	of particular features and regression tests that check
 	for old bugs.  But for the moment, just about everything
 	goes in here.)
-	These tests work by comparing the output of the Mercury and
-	the NU-Prolog versions.
 
-hard_coded
-	This directory is for tests of features that don't work in
-	NU-Prolog.  The expected output of the program has to be
-	hard-coded in a hand-written `.exp' file, rather having the
-	`.exp' file be generated automatically using NU-Prolog.
+	The historical reason for the separate `general' and `hard_coded'
+	directories was that the tests in `general' worked with NU-Prolog
+	and compared the Mercury output with the NU-Prolog output,
+	but the tests in `hard_coded' didn't work with NU-Prolog, so
+	their expected output needed to be hard-coded. We no longer
+	support compilation with NU-Prolog, so everything goes
+	in hard_coded now.
 
 recompilation
 	This directory contains tests of the smart recompilation system.
+	As well as checking for the correct output from the test
+	programs these tests also examine the `.err' files to
+	make sure that all necessary recompilations are performed.
 
 valid
 	This directory is for test cases that are not complete
@@ -47,12 +54,12 @@
 
 invalid
 	This directory is for test cases that are invalid
-	programs. We check that the files do *not* compile.
+	programs. We check that the files do *not* compile,
+	and check that the errors match those in the hand-written
+	`.err_exp' file.
 
 warnings
 	This directory is for tests of compiler warnings. These work by
 	comparing the warnings emitted by the compiler with those given
 	in the hand-written `.exp' file. 
 
-To regenerate the expected output files for the benchmark and general
-directories, execute the "generate_exp" script in this directory.
Index: tests/generate_exp
===================================================================
RCS file: tests/generate_exp
diff -N tests/generate_exp
--- tests/generate_exp	9 Feb 1997 09:10:04 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-#!/bin/sh
-# Generate the .exp files that are used as a basis of comparison to check
-# the correctness of the code emitted by the Mercury compiler.
-
-. ./handle_options
-
-root=`pwd`
-for dir in benchmarks general
-do
-	cd $dir
-	mmake $jfactor realclean
-	mmake $jfactor depend
-	mmake $jfactor HAVE_NUPROLOG=yes exp
-	cd $root
-done
Index: tests/handle_options
===================================================================
RCS file: tests/handle_options
diff -N tests/handle_options
--- tests/handle_options	18 Jul 2002 05:56:57 -0000	1.9
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,102 +0,0 @@
-usage="\
-Usage: $0 [options]
-Options:
-	-f <mcflags>, --flags <mcflags>
-		Pass EXTRA_MCFLAGS=<mcflags> as an option to \`mmake check'.
-	-m <mgnucflags>, --mgnucflags <mgnucflags>
-		Pass EXTRA_MGNUCFLAGS=<mgnucflags> as an option to \`mmake check'.
-	-c <cflags>, --cflags <cflags>
-		Pass EXTRA_CFLAGS=<cflags> as an option to \`mmake check'.
-	-l <mlflags>, --mlflags <mlflags>
-		Pass EXTRA_MLFLAGS=<mlflags> as an option to \`mmake check'.
-	-g <grade>, --grade <grade>
-		Pass GRADE=<grade> as an option to \`mmake check'.
-	-t <target>, --target <target>
-		Pass \`--target <target>' as an option to \`mmake check'.
-	-j <num-jobs>, --jobs <num-jobs>
-		Run using <num-jobs> different parallel processes.
-	-e, --generate-missing-exp-files
-		If any missing \`.exp' or \`.err_exp' files are missing,
-		generate them rather than reporting an error.
-		Currently only works in the recompilation directory.
-"
-
-targetopt=""
-jfactor=""
-
-# Run multiple jobs when doing `mmake realclean' for faster cleanup over NFS.
-rm_jfactor="-j10"
-flagsopt=""
-mgnucflagsopt=""
-cflagsopt=""
-mlflagsopt=""
-gradeopt=""
-fflag=""
-mflag=""
-cflag=""
-lflag=""
-gflag=""
-generate_missing_exp_files=false
-
-while [ $# -gt 0 ]; do
-	case "$1" in
-
-	-f|--flags)
-		fflag="-f '$2'"
-		flagsopt="EXTRA_MCFLAGS='$2'"
-		shift ;;
-
-	-m|--mgnucflags)
-		mflag="-m '$2'"
-		mgnucflagsopt="EXTRA_MGNUCFLAGS='$2'"
-		shift ;;
-
-	-c|--cflags)
-		cflag="-c '$2'"
-		cflagsopt="EXTRA_CFLAGS='$2'"
-		shift ;;
-
-	-l|--mlflags)
-		lflag="-l '$2'"
-		mlflagsopt="EXTRA_MLFLAGS='$2'"
-		shift ;;
-
-	-g|--grade)
-		gflag="-g $2"
-		gradeopt="GRADE=$2"
-		shift ;;
-
-	-j|--jobs)
-		jfactor="-j$2"; shift ;;
-	-j*)
-		jfactor="-j` expr $1 : '-j\(.*\)' `" ;;
-	--jobs*)
-		jfactor="--jobs` expr $1 : '--jobs\(.*\)' `" ;;
-
-	-t|--target)
-		target_opt="--target '$2'"; shift ;;
-
-	-e|--generate-missing-exp-files)
-		generate_missing_exp_files=true ;;
-
-	--)	
-		shift; break ;;
-	-*)
-		echo "$0: unknown option \`$1'" 1>&2
-		echo "$usage" 1>&2
-		exit 1 ;;
-	*)
-		break ;;
-	esac
-	shift
-done
-
-if [ $# -ne 0 ]; then
-	echo "$0: unexpected argument(s) \`$*'" 1>&2
-	echo "$usage" 1>&2
-	exit 1
-fi
-
-mmakeopts="$target_opt $jfactor $flagsopt $mgnucflagsopt $cflagsopt \
-	$mlflagsopt $gradeopt"
-runtestopts="$target_opt $jfactor $mflag $cflag $lflag $fflag $gflag"
Index: tests/process_log.awk
===================================================================
RCS file: tests/process_log.awk
diff -N tests/process_log.awk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/process_log.awk	14 Aug 2002 13:58:40 -0000
@@ -0,0 +1,25 @@
+# process_log.awk
+# 
+# Process the output of `mmake runtests' collecting
+# the mmake output for failing tests. See the
+# `runtests_local' target in Mmake.common for the
+# code which produces the markers used by this script.
+
+BEGIN			{ test_line = -1 }
+
+/^RUNNING TEST/		{ test_line = 0 }
+
+/^FINISHED TEST/	{ test_line = -1 }
+
+test_line != -1		{
+	test_lines[test_line] = $0
+	test_line++
+}
+
+test_line != -1 && /^FAILED TEST/ {
+	for (line = 0; line < test_line; line++) {
+		print test_lines[line]
+	}
+	test_line = -1
+}
+
Index: tests/runtests
===================================================================
RCS file: tests/runtests
diff -N tests/runtests
--- tests/runtests	3 Oct 1999 08:20:41 -0000	1.6
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-# Process command line options.
-. ./handle_options
-
-# Run the tests in each of the subdirectories.
-. ./subdir_runtests
-
-if test "$subdir_failures" = ""
-then
-	echo "all tests have succeeded"
-	echo "mmakeopts=$mmakeopts"
-	exit 0
-else
-	echo "some tests have failed in: $subdir_failures"
-	echo "mmakeopts=$mmakeopts"
-	exit 1
-fi
Index: tests/shutdown
===================================================================
RCS file: tests/shutdown
diff -N tests/shutdown
--- tests/shutdown	18 Jul 2002 05:56:57 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,4 +0,0 @@
-echo cleaning up the directory after the tests
-mmake $gradeopt $rm_jfactor realclean_local > /dev/null 2>&1
-rm core > /dev/null 2>&1
-touch CLEAN
Index: tests/startup
===================================================================
RCS file: tests/startup
diff -N tests/startup
--- tests/startup	18 Jul 2002 05:56:57 -0000	1.6
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
-echo cleaning up the directory before the tests
-if ls -lt | head -2 | egrep CLEAN > /dev/null 2>&1
-then
-	rm -f CLEAN > /dev/null 2>&1
-else
-	rm -f CLEAN > /dev/null 2>&1
-	mmake $gradeopt $rm_jfactor realclean_local > /dev/null 2>&1
-	/bin/rm *.d *.dep *.int *.int2 *.int3 *.date *.date3 > /dev/null 2>&1
-	/bin/rm *.opt *.optdate *.trans_opt *.trans_opt_date > /dev/null 2>&1
-fi
Index: tests/subdir_runtests
===================================================================
RCS file: tests/subdir_runtests
diff -N tests/subdir_runtests
--- tests/subdir_runtests	3 Oct 1999 08:20:42 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,20 +0,0 @@
-# Run the tests in each of the subdirectories.
-
-subdir_failures=""
-for dir in *
-do
-        if test -d $dir -a -x $dir/runtests
-        then
-                cd $dir
-                # we need to use `eval' here to get the quoting right in
-                # the case when $runtestopts contains embedded spaces
-                if eval ./runtests $runtestopts
-                then
-                        true
-                else
-                        subdir_failures="$subdir_failures $dir"
-                fi
-                cd ..
-        fi
-done
-
Index: tests/benchmarks/Mercury.options
===================================================================
RCS file: tests/benchmarks/Mercury.options
diff -N tests/benchmarks/Mercury.options
Index: tests/benchmarks/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/benchmarks/Mmakefile,v
retrieving revision 1.4
diff -u -u -r1.4 Mmakefile
--- tests/benchmarks/Mmakefile	19 Dec 2001 15:08:28 -0000	1.4
+++ tests/benchmarks/Mmakefile	14 Aug 2002 06:49:25 -0000
@@ -1,11 +1,6 @@
 #-----------------------------------------------------------------------------#
 
-main_target: check
-
-include ../Mmake.common
--include ../Mmake.params
-
-#-----------------------------------------------------------------------------#
+THIS_DIR = benchmarks
 
 # uncomment the following line to test the performance
 # of the benchmarks (with I/O suppressed)
@@ -13,13 +8,6 @@
 
 #-----------------------------------------------------------------------------#
 
-ifeq ($(HAVE_NUPROLOG),yes)
-%.exp: %.nu
-	{ [ -f $*.inp ] && cat $*.inp; } | ./$< > $@ 2>&1;
-endif
-
-#-----------------------------------------------------------------------------#
-
 PROGS=	\
 	cqueens \
 	crypt \
@@ -33,40 +21,33 @@
 	query \
 	tak
 
-DEPENDS=$(PROGS:%=%.depend)
-DEPS=	$(PROGS:%=%.dep)
-OUTS=	$(PROGS:%=%.out)
-EXPS=	$(PROGS:%=%.exp)
-RESS=	$(PROGS:%=%.res)
-SS=	$(PROGS:%=%.s)
-CS=	$(PROGS:%=%.c)
-TIMES=	$(PROGS:%=%.time)
+TESTS=$(PROGS)
+SUBDIRS=
+TESTS_DIR=..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
 
-dep:	$(DEPS)
-
-depend:	$(DEPENDS)
-
-exp:	$(EXPS)
+#-----------------------------------------------------------------------------#
 
-check:	$(OUTS) $(RESS)
+%.runtest: %.res ;
 
-outs:	$(OUTS)
+SS=	$(PROGS:%=%.s)
+CS=	$(PROGS:%=%.c)
+TIMES=	$(PROGS:%=%.time)
 
 cs:	$(CS)
 
 ss:	$(SS)
 
-all:	$(PROGS)
-
 times:	$(TIMES)
 
 dir.%:	$(PROGS) $(SS)
 	-mkdir $@
 	cp $(PROGS) $(SS) $@
 	cp BenchEntry $@
-
-clean_exes:	
-	rm -f $(PROGS)
 
 %.time: %
 	{ count=`awk '/$*/ { print $$2; exit; }' < BenchRepeatCounts`; \
Index: tests/benchmarks/runtests
===================================================================
RCS file: tests/benchmarks/runtests
diff -N tests/benchmarks/runtests
--- tests/benchmarks/runtests	31 Jan 2001 11:34:37 -0000	1.8
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
-#!/bin/sh
-# Test whether the code generated by the Mercury compiler is producing 
-# the same output as code generated by the NU-Prolog compiler.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-#
-# The .exp files containing the expected output of each test should be under
-# CVS control. They can be updated by running
-#
-#	mmake realclean
-#	mmake depend
-#	mmake exp
-#
-# on a machine that has NU-Prolog installed.
-
-. ../handle_options
-. ../startup
-
-eval mmake $mmakeopts depend || exit 1
-eval mmake $mmakeopts -k check
-checkstatus=$?
-
-cat *.res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the benchmark directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../shutdown
-	exit 0
-else
-	echo "the tests in the benchmark directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/debugger/Mercury.options
===================================================================
RCS file: tests/debugger/Mercury.options
diff -N tests/debugger/Mercury.options
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/Mercury.options	2 Aug 2002 06:59:42 -0000
@@ -0,0 +1,21 @@
+
+# The completion test requires mdb to use readline, even though
+# the input is not a terminal.
+MLFLAGS-completion = --runtime-flags --force-readline
+
+MCFLAGS-queens_rep = --trace rep
+MCFLAGS-shallow = --trace shallow
+MCFLAGS-tabled_read = --trace-table-io
+MCFLAGS-tabled_read_unitize = --trace-table-io
+MCFLAGS-tabled_read_decl = --trace-table-io-decl
+# By default, we reclaim heap on failure in non-Boehm-gc grades.
+# The extra stack slots required for this reclamation cause spurious
+# differences from the expected output on the nondet_stack test case.
+# The optimization level also affects stack frame sizes.
+MCFLAGS-nondet_stack = -O2 --no-reclaim-heap-on-failure
+
+# We need to use shared libraries for interactive queries to work.
+# The following is necessary for shared libraries to work on Linux.
+GRADEFLAGS-interactive = --pic-reg
+MLFLAGS-interactive = --shared
+
Index: tests/debugger/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/Mmakefile,v
retrieving revision 1.80
diff -u -u -r1.80 Mmakefile
--- tests/debugger/Mmakefile	26 Jul 2002 04:20:13 -0000	1.80
+++ tests/debugger/Mmakefile	14 Aug 2002 06:44:12 -0000
@@ -1,9 +1,6 @@
 #-----------------------------------------------------------------------------#
 
-main_target:	check
-
-include ../Mmake.common
--include ../Mmake.params
+THIS_DIR = debugger
 
 #-----------------------------------------------------------------------------#
 
@@ -51,28 +48,6 @@
 	shallow				\
 	type_desc_test
 
-# The completion test requires mdb to use readline, even though
-# the input is not a terminal.
-MLFLAGS-completion = --runtime-flags --force-readline
-
-MCFLAGS-queens_rep = --trace rep
-MCFLAGS-shallow = --trace shallow
-MCFLAGS-tabled_read = --trace-table-io
-MCFLAGS-tabled_read_unitize = --trace-table-io
-MCFLAGS-tabled_read_decl = --trace-table-io-decl
-# By default, we reclaim heap on failure in non-Boehm-gc grades.
-# The extra stack slots required for this reclamation cause spurious
-# differences from the expected output on the nondet_stack test case.
-# The optimization level also affects stack frame sizes.
-MCFLAGS-nondet_stack = -O2 --no-reclaim-heap-on-failure
-
-MCFLAGS += --trace deep
-MLFLAGS += --trace
-
-# We need to use shared libraries for interactive queries to work.
-# The following is necessary for shared libraries to work on Linux.
-GRADEFLAGS-interactive = --pic-reg
-MLFLAGS-interactive = --shared
 
 # Since the `interactive' test case requires the use of shared libraries,
 # this means it won't work properly if the static libraries are linked
@@ -117,6 +92,20 @@
     endif
 endif
 
+SUBDIRS=declarative
+TESTS=$(PROGS)
+TESTS_DIR=..
+include $(TESTS_DIR)/Mmake.common
+
+MCFLAGS += --trace deep
+MLFLAGS += --trace
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
+
+%.runtest: %.res ;
+
 #-----------------------------------------------------------------------------#
 
 all_solutions.out: all_solutions all_solutions.inp
@@ -309,15 +298,15 @@
 	$(MDB) ./type_desc_test < type_desc_test.inp \
 		> type_desc_test.out 2>&1
 
-# Note that interactive.out.orig depends on $(interactive.ints) because
-# interactive.inp contains interactive queries that require interactive.ints
-# to have been built.
 # When WORKSPACE is set, use $(WORKSPACE)/tools/lmc to compile the query.
 ifneq ($(origin WORKSPACE), undefined)
 export WORKSPACE
 endif
 
-interactive.out.orig: interactive $(interactive.ints)
+# Note that interactive.out.orig depends on $(interactive.ints) because
+# interactive.inp contains interactive queries that require interactive.ints
+# to have been built.
+interactive.out.orig: interactive interactive.ints
 ifneq ($(origin WORKSPACE),undefined)
 	rm -rf lmc
 	mkdir ./lmc
@@ -397,53 +386,3 @@
 		> mdb_command_test.out
 
 #-----------------------------------------------------------------------------#
-
-DEPS=		$(PROGS:%=$(deps_subdir)%.dep)
-DEPENDS=	$(PROGS:%=%.depend)
-OUTS=		$(PROGS:%=%.out)
-RESS=		$(PROGS:%=%.res)
-
-dep_local:	$(DEPS)
-depend_local:	$(DEPENDS)
-check_local:	$(OUTS) $(RESS)
-all_local:	$(PROGS)
-
-realclean_local:
-	rm -f Mercury.options.interactive
-
-#-----------------------------------------------------------------------------#
-
-SUBDIRS = declarative
-
-check_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) check) || exit 1; \
-	done
-
-dep_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) dep) || exit 1; \
-	done
-
-depend_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) depend) || exit 1; \
-	done
-
-realclean_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) realclean) || exit 1; \
-	done
-
-clean_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) clean) || exit 1; \
-	done
-
-all_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) all) || exit 1; \
-	done
-
-#-----------------------------------------------------------------------------#
-
Index: tests/debugger/runtests
===================================================================
RCS file: tests/debugger/runtests
diff -N tests/debugger/runtests
--- tests/debugger/runtests	22 May 2001 04:21:09 -0000	1.11
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,51 +0,0 @@
-#!/bin/sh
-# Test whether the code generated by the Mercury compiler
-# is producing the expected output.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../handle_options
-
-# Avoid picking up parameter settings from $HOME/.mdbrc that could cause
-# spurious differences between the outputs of these test cases and the
-# expected outputs.
-HOME=/nonexistent
-export HOME
-
-# Run the tests in any subdirectories of this one.  If any of these
-# fail, we still perform the tests in this directory but return a
-# status of 1 regardless of the outcome.
-
-. ../subdir_runtests
-
-# Don't let any single test run for more than ten minutes.
-ulimit -t 600
-
-if test "$subdir_failures" = ""
-then
-	subdir_status=0
-else
-	subdir_status=1
-fi
-
-# Now run all the tests in this directory.
-. ../startup
-
-eval mmake $mmakeopts depend_local || exit 1
-eval mmake $mmakeopts -k check_local
-checkstatus=$?
-
-cat *.res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the debugger directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../shutdown
-	exit $subdir_status
-else
-	echo "the tests in the debugger directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/debugger/declarative/Mercury.options
===================================================================
RCS file: tests/debugger/declarative/Mercury.options
diff -N tests/debugger/declarative/Mercury.options
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/Mercury.options	19 Jun 2002 16:53:38 -0000
@@ -0,0 +1,9 @@
+
+MCFLAGS-deep_sub=--trace deep
+MCFLAGS-dependency=--trace rep
+MCFLAGS-dependency2=--trace rep
+MCFLAGS-input_term_dep=--trace rep
+MCFLAGS-output_term_dep=--trace rep
+MCFLAGS-special_term_dep=--trace rep
+MCFLAGS-tabled_read_decl=--trace rep --trace-table-io-decl
+MCFLAGS-untraced_subgoal_sub=--trace minimum
Index: tests/debugger/declarative/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mmakefile,v
retrieving revision 1.37
diff -u -u -r1.37 Mmakefile
--- tests/debugger/declarative/Mmakefile	15 May 2002 11:24:17 -0000	1.37
+++ tests/debugger/declarative/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -1,9 +1,6 @@
 #-----------------------------------------------------------------------------#
 
-main_target:	check
-
-include ../../Mmake.common
--include ../../Mmake.params
+THIS_DIR = debugger/declarative
 
 #-----------------------------------------------------------------------------#
 
@@ -54,18 +51,6 @@
 NONWORKING_DECLARATIVE_PROGS=	\
 	solutions
 
-MCFLAGS += --trace decl
-MLFLAGS += --trace
-
-MCFLAGS-deep_sub=--trace deep
-MCFLAGS-dependency=--trace rep
-MCFLAGS-dependency2=--trace rep
-MCFLAGS-input_term_dep=--trace rep
-MCFLAGS-output_term_dep=--trace rep
-MCFLAGS-special_term_dep=--trace rep
-MCFLAGS-tabled_read_decl=--trace rep --trace-table-io-decl
-MCFLAGS-untraced_subgoal_sub=--trace minimum
-
 ifneq "$(findstring .debug,$(GRADE))" ""
     PROGS_2=$(DECLARATIVE_PROGS)
 else
@@ -104,6 +89,20 @@
     PROGS=
 endif
 
+SUBDIRS=
+TESTS=$(PROGS)
+TESTS_DIR=../..
+include $(TESTS_DIR)/Mmake.common
+
+MCFLAGS += --trace decl
+MLFLAGS += --trace
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
+
+%.runtest: %.res ;
+
 #-----------------------------------------------------------------------------#
 
 aadebug.out: aadebug aadebug.inp
@@ -209,22 +208,5 @@
 untraced_subgoal.out: untraced_subgoal untraced_subgoal.inp
 	$(MDB) ./untraced_subgoal < untraced_subgoal.inp \
 			> untraced_subgoal.out 2>&1
-
-#-----------------------------------------------------------------------------#
-
-DEPS=		$(PROGS:%=$(deps_subdir)%.dep)
-DEPENDS=	$(PROGS:%=%.depend)
-OUTS=		$(PROGS:%=%.out)
-RESS=		$(PROGS:%=%.res)
-
-#-----------------------------------------------------------------------------#
-
-dep:		$(DEPS)
-
-depend:		$(DEPENDS)
-
-check:		$(OUTS) $(RESS)
-
-all:		$(PROGS)
 
 #-----------------------------------------------------------------------------#
Index: tests/debugger/declarative/runtests
===================================================================
RCS file: tests/debugger/declarative/runtests
diff -N tests/debugger/declarative/runtests
--- tests/debugger/declarative/runtests	31 Jan 2001 11:34:27 -0000	1.6
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-#!/bin/sh
-# Test whether the code generated by the Mercury compiler
-# is producing the expected output.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../../handle_options
-. ../../startup
-
-eval mmake $mmakeopts depend || exit 1
-eval mmake $mmakeopts -k check
-checkstatus=$?
-
-cat *.res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the debugger/declarative directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../../shutdown
-	exit 0
-else
-	echo "the tests in the debugger/declarative directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/dppd/Mercury.options
===================================================================
RCS file: tests/dppd/Mercury.options
diff -N tests/dppd/Mercury.options
Index: tests/dppd/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/dppd/Mmakefile,v
retrieving revision 1.2
diff -u -u -r1.2 Mmakefile
--- tests/dppd/Mmakefile	29 Apr 2002 08:22:07 -0000	1.2
+++ tests/dppd/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -1,4 +1,9 @@
-include ../Mmake.common
+TESTS_DIR=..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
 
 MCFLAGS=#--pd --no-inlining -d 35 -D petdr #-d 99
 #GRADE=asm_fast.gc.prof
Index: tests/general/Mercury.options
===================================================================
RCS file: tests/general/Mercury.options
diff -N tests/general/Mercury.options
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/general/Mercury.options	19 Jun 2002 17:00:48 -0000
@@ -0,0 +1,19 @@
+# mode_inf, mode_inf_bug and mode_inference_reorder need to be compiled
+# with `--infer-all'.
+MCFLAGS-mode_inf = --infer-all
+MCFLAGS-mode_inf_bug = --infer-all
+MCFLAGS-mode_inference_reorder = --infer-all
+MCFLAGS-intermod_type = --intermodule-optimization
+MCFLAGS-intermod_type2 = --intermodule-optimization
+
+# In grade `none' with options `-O1 --opt-space' on kryten
+# (a sparc-sun-solaris2.5 system), string_test needs to be linked
+# with `--no-strip', otherwise it gets a seg fault. 
+# The test case ../hard_coded/mode_choice suffers from a similar problem.
+# This is probably a bug in one of the underlying tools (e.g. the Solaris
+# linker) rather than a bug in Mercury, and since it is goes away when you
+# compile with debugging information, it is very difficult to debug.
+# It is much easier to just work around it this way rather than
+# tracking it down.
+MLFLAGS-string_test = --no-strip
+
Index: tests/general/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/general/Mmakefile,v
retrieving revision 1.40
diff -u -u -r1.40 Mmakefile
--- tests/general/Mmakefile	9 Jul 2002 01:30:27 -0000	1.40
+++ tests/general/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -1,16 +1,6 @@
 #-----------------------------------------------------------------------------#
 
-main_target: check
-
-include ../Mmake.common
--include ../Mmake.params
-
-#-----------------------------------------------------------------------------#
-
-ifeq ($(HAVE_NUPROLOG),yes)
-%.exp: %.nu
-	{ [ -f $*.inp ] && cat $*.inp; } | ./$< > $@ 2>&1;
-endif
+THIS_DIR = general
 
 #-----------------------------------------------------------------------------#
 
@@ -87,30 +77,22 @@
 # (i.e. tabling) and tabling is not yet implemented for non-gc grades.
 NOT_WORKING =	dnf
 
+SUBDIRS = accumulator
+TESTS=$(PROGS)
+TESTS_DIR=..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
+
+%.runtest: %.res ;
+
 #-----------------------------------------------------------------------------#
 #
 # Some test cases need special handling.
 #
 
-# mode_inf, mode_inf_bug and mode_inference_reorder need to be compiled
-# with `--infer-all'.
-MCFLAGS-mode_inf = --infer-all
-MCFLAGS-mode_inf_bug = --infer-all
-MCFLAGS-mode_inference_reorder = --infer-all
-MCFLAGS-intermod_type = --intermodule-optimization
-MCFLAGS-intermod_type2 = --intermodule-optimization
-
-# In grade `none' with options `-O1 --opt-space' on kryten
-# (a sparc-sun-solaris2.5 system), string_test needs to be linked
-# with `--no-strip', otherwise it gets a seg fault. 
-# The test case ../hard_coded/mode_choice suffers from a similar problem.
-# This is probably a bug in one of the underlying tools (e.g. the Solaris
-# linker) rather than a bug in Mercury, and since it is goes away when you
-# compile with debugging information, it is very difficult to debug.
-# It is much easier to just work around it this way rather than
-# tracking it down.
-MLFLAGS-string_test = --no-strip
-
 # string_format_test_2 and string__format_test_3 are expected to fail
 # (string__format should call error/1 for these test cases)
 # so we need to ignore the exit status; hence the leading `-'.
@@ -136,52 +118,5 @@
 	# io_foldl `cat's its input to its output.
 io_foldl.out: io_foldl io_foldl.exp
 	./io_foldl < io_foldl.exp > io_foldl.out 2>&1
-
-#-----------------------------------------------------------------------------#
-
-DEPENDS=$(PROGS:%=%.depend)
-OUTS=	$(PROGS:%=%.out)
-EXPS=	$(PROGS:%=%.exp)
-RESS=	$(PROGS:%=%.res)
-
-exp:	$(EXPS)
-
-depend_local:	$(DEPENDS)
-check_local:	$(OUTS) $(RESS)
-all_local:	$(PROGS)
-
-#-----------------------------------------------------------------------------#
-
-SUBDIRS = accumulator
-
-check_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) check) || exit 1; \
-	done
-
-dep_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) dep) || exit 1; \
-	done
-
-depend_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) depend) || exit 1; \
-	done
-
-realclean_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) realclean) || exit 1; \
-	done
-
-clean_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) clean) || exit 1; \
-	done
-
-all_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) all) || exit 1; \
-	done
 
 #-----------------------------------------------------------------------------#
Index: tests/general/runtests
===================================================================
RCS file: tests/general/runtests
diff -N tests/general/runtests
--- tests/general/runtests	31 Jan 2001 11:34:39 -0000	1.9
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,51 +0,0 @@
-#!/bin/sh
-# Test whether the code generated by the Mercury compiler is producing 
-# the same output as code generated by the NU-Prolog compiler.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-#
-# The .exp files containing the expected output of each test should be under
-# CVS control. They can be updated by running
-#
-#	mmake realclean
-#	mmake depend
-#	mmake exp
-#
-# on a machine that has NU-Prolog installed.
-
-. ../handle_options
-
-# Run the tests in any subdirectories of this one.  If any of these
-# fail, we still perform the tests in this directory but return a
-# status of 1 regardless of the outcome.
-
-. ../subdir_runtests
-
-if test "$subdir_failures" = ""
-then
-        subdir_status=0
-else
-        subdir_status=1
-fi
-
-# Now run all the tests in this directory.
-. ../startup
-
-eval mmake $mmakeopts depend_local || exit 1
-eval mmake $mmakeopts -k check_local
-checkstatus=$?
-
-cat *.res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the general directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../shutdown
-	exit $subdir_status
-else
-	echo "the tests in the general directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/general/accumulator/Mercury.options
===================================================================
RCS file: tests/general/accumulator/Mercury.options
diff -N tests/general/accumulator/Mercury.options
Index: tests/general/accumulator/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/general/accumulator/Mmakefile,v
retrieving revision 1.17
diff -u -u -r1.17 Mmakefile
--- tests/general/accumulator/Mmakefile	30 Jan 2002 05:09:07 -0000	1.17
+++ tests/general/accumulator/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -1,16 +1,6 @@
 #-----------------------------------------------------------------------------#
 
-main_target: check
-
-include ../../Mmake.common
--include ../../Mmake.params
-
-#-----------------------------------------------------------------------------#
-
-ifeq ($(HAVE_NUPROLOG),yes)
-%.exp: %.nu
-	{ [ -f $*.inp ] && cat $*.inp; } | ./$< > $@ 2>&1;
-endif
+THIS_DIR = general/accumulator
 
 #-----------------------------------------------------------------------------#
 
@@ -37,6 +27,19 @@
 		split		\
 		swap
 
+SUBDIRS=
+TESTS = $(PROGS)
+TESTS_DIR=../..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
+
+%.runtest: %.res ;
+
+#-----------------------------------------------------------------------------#
+
 ACC_FLAGS = -d accum --introduce-accumulators --optimize-constructor-last-call \
 		--intermodule-optimization
 
@@ -49,26 +52,14 @@
 	# Ensure that the accumulator introduction flags are passed
 	# after EXTRA_MCFLAGS, so that we can override things set in
 	# EXTRA_MCFLAGS.
-ALL_MCGFLAGS+= $(OPT_FLAGS) $(ACC_FLAGS)
+ALL_MCFLAGS += $(OPT_FLAGS) $(ACC_FLAGS)
 
     # programs which aren't working.
 NOT_WORKING =
 
-DEPENDS=$(PROGS:%=%.depend)
-OUTS=	$(PROGS:%=%.out)
 EXPS=	$(PROGS:%=%.exp)
-RESS=	$(PROGS:%=%.res)
-MODS=	$(PROGS:%=%.mod)
-
-depend: $(DEPENDS)
 
 exp:	$(EXPS)
-
-check:	$(OUTS) $(RESS)
-
-mods:	$(MODS)
-
-all:	$(PROGS)
 
 realclean_local: clean_hlds_dump
 
Index: tests/general/accumulator/runtests
===================================================================
RCS file: tests/general/accumulator/runtests
diff -N tests/general/accumulator/runtests
--- tests/general/accumulator/runtests	31 Jan 2001 11:34:31 -0000	1.10
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,52 +0,0 @@
-#!/bin/sh
-# Test whether the code generated by the Mercury compiler is producing 
-# the same output as code generated by the NU-Prolog compiler.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-#
-# The .exp files containing the expected output of each test should be under
-# CVS control. They can be updated by running
-#
-#	mmake realclean
-#	mmake depend
-#	mmake exp
-#
-# on a machine that has NU-Prolog installed.
-
-. ../../handle_options
-. ../../startup
-
-eval mmake $mmakeopts depend || exit 1
-eval mmake $mmakeopts -k check
-checkstatus=$?
-
-cat *.res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-    grep -h "% mode.*AccFrom" *hlds*acc* | \
-   	 sed -e 's/number//' -e 's/ of predicate//' -e 's/ of function//' \
-	 -e 's,__[0-9]*__[0-9]*/,/,' > I.$$
-    diff -u INTRODUCED I.$$ > INTRODUCED.diff
-    rm -f I.$$
-
-    if [ -s INTRODUCED.diff ]; then
-        echo "** the tests in the general/accumulator directory failed"
-        echo "** as some predicates didn't have accumulators introduced"
-        echo "mmakeopts=$mmakeopts"
-	    echo "the predicates are:"
-        cat INTRODUCED.diff
-        exit 1
-    fi
-
-	echo "the tests in the general/accumulator directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres INTRODUCED.diff
-	. ../../shutdown
-	exit 0
-else
-	echo "** the tests in the general/accumulator directory failed"
-	echo "** as some test cases didn't produce the correct output"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/general/structure_reuse/Mercury.options
===================================================================
RCS file: tests/general/structure_reuse/Mercury.options
diff -N tests/general/structure_reuse/Mercury.options
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/general/structure_reuse/Mercury.options	21 Jun 2002 11:38:13 -0000
@@ -0,0 +1 @@
+MCFLAGS-interpret=--cell-cache
Index: tests/general/structure_reuse/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/general/structure_reuse/Mmakefile,v
retrieving revision 1.2
diff -u -u -r1.2 Mmakefile
--- tests/general/structure_reuse/Mmakefile	30 Mar 2001 13:57:51 -0000	1.2
+++ tests/general/structure_reuse/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -1,18 +1,6 @@
 #-----------------------------------------------------------------------------#
 
-main_target: check
-
-include ../../Mmake.common
--include ../../Mmake.params
-
-#-----------------------------------------------------------------------------#
-
-ifeq ($(HAVE_NUPROLOG),yes)
-%.exp: %.nu
-	{ [ -f $*.inp ] && cat $*.inp; } | ./$< > $@ 2>&1;
-endif
-
-#-----------------------------------------------------------------------------#
+THIS_DIR = general/structure_reuse
 
 # Any program added here should also be added to the `.cvsignore' file.
 
@@ -20,7 +8,17 @@
 	internal_alias		\
 	interpret
 
-MCFLAGS-interpret=--cell-cache
+TESTS=$(PROGS)
+TESTS_DIR=../..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
+
+%.runtest: %.res ;
+
+#-----------------------------------------------------------------------------#
 
 ACC_FLAGS = --infer-structure-reuse -d structure_reuse -D sr
 
@@ -36,22 +34,6 @@
 
     # programs which aren't working.
 NOT_WORKING =
-
-DEPENDS=$(PROGS:%=%.depend)
-OUTS=	$(PROGS:%=%.out)
-EXPS=	$(PROGS:%=%.exp)
-RESS=	$(PROGS:%=%.res)
-MODS=	$(PROGS:%=%.mod)
-
-depend: $(DEPENDS)
-
-exp:	$(EXPS)
-
-check:	$(OUTS) $(RESS)
-
-mods:	$(MODS)
-
-all:	$(PROGS)
 
 realclean_local: clean_hlds_dump
 
Index: tests/hard_coded/Mercury.options
===================================================================
RCS file: tests/hard_coded/Mercury.options
diff -N tests/hard_coded/Mercury.options
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/Mercury.options	8 Aug 2002 09:29:12 -0000
@@ -0,0 +1,65 @@
+MCFLAGS-checked_nondet_tailcall	=	--checked-nondet-tailcalls
+MCFLAGS-bigtest		=	--intermodule-optimization -O3
+MCFLAGS-constraint	=	--constraint-propagation --enable-termination
+MCFLAGS-constraint_order =	--constraint-propagation --enable-termination
+MCFLAGS-deforest_cc_bug =	--deforestation
+MCFLAGS-lp		=	--intermodule-optimization -O3
+MCFLAGS-boyer		=	--infer-all
+MCFLAGS-func_test	=	--infer-all
+MCFLAGS-ho_order	=	--optimize-higher-order
+MCFLAGS-ho_order2	=	--optimize-higher-order
+MCFLAGS-no_fully_strict	=	--no-fully-strict
+MCFLAGS-impure_foreign	=	--optimize-duplicate-calls
+MCFLAGS-intermod_c_code =	--intermodule-optimization
+MCFLAGS-intermod_c_code2 =	--intermodule-optimization
+MCFLAGS-intermod_foreign_type = --intermodule-optimization
+MCFLAGS-intermod_foreign_type2 = --intermodule-optimization
+MCFLAGS-intermod_pragma_clause = --intermodule-optimization
+MCFLAGS-intermod_pragma_clause_sub = --intermodule-optimization
+MCFLAGS-intermod_type_qual =	--intermodule-optimization
+MCFLAGS-intermod_type_qual2 =	--intermodule-optimization
+MCFLAGS-intermod_multimode =	--intermodule-optimization
+MCFLAGS-intermod_multimode_main = --intermodule-optimization
+MCFLAGS-no_warn_singleton =	--halt-at-warn
+MCFLAGS-nondet_copy_out =	--no-inlining --nondet-copy-out
+MCFLAGS-redoip_clobber	=	--no-inlining
+MCFLAGS-rnd		=	-O6
+MCFLAGS-split_c_files	=	--trace deep
+MCFLAGS-type_qual	= 	--infer-all
+MCFLAGS-type_spec	=	--user-guided-type-specialization
+MCFLAGS-existential_types_test = --infer-all
+MCFLAGS-existential_float = --infer-all
+MCFLAGS-user_defined_equality	= --infer-all
+MCFLAGS-parse		=	--trace deep
+MCFLAGS-unused_float_box_test =	--infer-all
+
+MCFLAGS-target_mlobjs	= 	--pre-link-command "mmake target_mlobjs_c.o"
+MLOBJS-target_mlobjs	=	target_mlobjs_c.o
+
+# In grade `none' with options `-O1 --opt-space' on kryten
+# (a sparc-sun-solaris2.5 system), mode_choice needs to be linked
+# with `--no-strip', otherwise it gets a seg fault. 
+# The test case ../hard_coded/string_test suffers from a similar problem.
+# This is probably a bug in one of the underlying tools (e.g. the Solaris
+# linker) rather than a bug in Mercury, and since it is goes away when you
+# compile with debugging information, it is very difficult to debug.
+# It is much easier to just work around it this way rather than
+# tracking it down.
+MLFLAGS-mode_choice = --no-strip
+
+MLFLAGS-parse		=	--trace --static
+
+MLFLAGS-split-c-files	=	--trace
+
+MLFLAGS-needs_init	= 	--include-initialization-code --extra-inits
+
+# These tests run out of memory in non-GC grades
+# unless we increase the heap size from the default 4M.
+# The sizes specified here (70 Mb and 20 Mb respectively)
+# are sufficient for running these tests on 64-bit systems.
+# The setting of `--mdb-out' tests the quoting of runtime
+# options containing special characters.
+
+MLFLAGS-integer_test = \
+		--runtime-flags "--heap-size 70000 --mdb-out \"mdb\\mdb out\""
+MLFLAGS-rational_test = --runtime-flags "--heap-size 20000"
Index: tests/hard_coded/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.162
diff -u -u -r1.162 Mmakefile
--- tests/hard_coded/Mmakefile	6 Aug 2002 15:27:13 -0000	1.162
+++ tests/hard_coded/Mmakefile	14 Aug 2002 09:54:45 -0000
@@ -1,9 +1,6 @@
 #-----------------------------------------------------------------------------#
 
-main_target: check
-
-include ../Mmake.common
--include ../Mmake.params
+THIS_DIR = hard_coded
 
 #-----------------------------------------------------------------------------#
 
@@ -237,9 +234,9 @@
 
 # --split-c-files does not work in the hl* grades (e.g. hlc.gc),
 # because it hasn't yet been implemented yet.
-# The same is true for deep profiling grades.
+# The same is true for deep profiling grades and `mmc --make'.
 # The modules in SPLIT_PROGS should also be in ORDINARY_PROGS above.
-ifeq "$(findstring hl,$(GRADE))$(findstring profdeep,$(GRADE))" ""
+ifeq "$(findstring yes,$(MMAKE_USE_MMC_MAKE))$(findstring hl,$(GRADE))$(findstring profdeep,$(GRADE))" ""
 	SPLIT_PROGS = mapped_module split_c_files
 else
 	SPLIT_PROGS =
@@ -247,71 +244,23 @@
 
 #-----------------------------------------------------------------------------#
 
-# some tests need to be compiled with particular options
+TESTS = $(PROGS) $(SPLIT_PROGS:%=%.split)
+SUBDIRS = typeclasses sub-modules exceptions purity
+TESTS_DIR=..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
 
-MCFLAGS-checked_nondet_tailcall	=	--checked-nondet-tailcalls
-MCFLAGS-bigtest		=	--intermodule-optimization -O3
-MCFLAGS-constraint	=	--constraint-propagation --enable-termination
-MCFLAGS-constraint_order =	--constraint-propagation --enable-termination
-MCFLAGS-deforest_cc_bug =	--deforestation
-MCFLAGS-lp		=	--intermodule-optimization -O3
-MCFLAGS-boyer		=	--infer-all
-MCFLAGS-func_test	=	--infer-all
-MCFLAGS-ho_order	=	--optimize-higher-order
-MCFLAGS-ho_order2	=	--optimize-higher-order
-MCFLAGS-no_fully_strict	=	--no-fully-strict
-MCFLAGS-impure_foreign	=	--optimize-duplicate-calls
-MCFLAGS-intermod_c_code =	--intermodule-optimization
-MCFLAGS-intermod_c_code2 =	--intermodule-optimization
-MCFLAGS-intermod_foreign_type = --intermodule-optimization
-MCFLAGS-intermod_foreign_type2 = --intermodule-optimization
-MCFLAGS-intermod_pragma_clause = --intermodule-optimization
-MCFLAGS-intermod_type_qual =	--intermodule-optimization
-MCFLAGS-intermod_type_qual2 =	--intermodule-optimization
-MCFLAGS-intermod_multimode =	--intermodule-optimization
-MCFLAGS-intermod_multimode_main = --intermodule-optimization
-MCFLAGS-no_warn_singleton =	--halt-at-warn
-MCFLAGS-nondet_copy_out =	--no-inlining --nondet-copy-out
-MCFLAGS-redoip_clobber	=	--no-inlining
-MCFLAGS-rnd		=	-O6
-MCFLAGS-split_c_files	=	--trace deep
-MCFLAGS-type_qual	= 	--infer-all
-MCFLAGS-type_spec	=	--user-guided-type-specialization
-MCFLAGS-existential_types_test = --infer-all
-MCFLAGS-existential_float = --infer-all
-MCFLAGS-user_defined_equality	= --infer-all
-MCFLAGS-parse		=	--trace deep
-MCFLAGS-unused_float_box_test =	--infer-all
-
-MLOBJS-target_mlobjs	=	target_mlobjs_c.o
-
-# In grade `none' with options `-O1 --opt-space' on kryten
-# (a sparc-sun-solaris2.5 system), mode_choice needs to be linked
-# with `--no-strip', otherwise it gets a seg fault. 
-# The test case ../hard_coded/string_test suffers from a similar problem.
-# This is probably a bug in one of the underlying tools (e.g. the Solaris
-# linker) rather than a bug in Mercury, and since it is goes away when you
-# compile with debugging information, it is very difficult to debug.
-# It is much easier to just work around it this way rather than
-# tracking it down.
-MLFLAGS-mode_choice = --no-strip
-
-MLFLAGS-parse			=	--trace --static
-
-MLFLAGS-split-c-files		=	--trace
-
-MLFLAGS-needs_init		= 	--include-initialization-code --extra-inits
-
-# These tests run out of memory in non-GC grades
-# unless we increase the heap size from the default 4M.
-# The sizes specified here (70 Mb and 20 Mb respectively)
-# are sufficient for running these tests on 64-bit systems.
-# The setting of `--mdb-out' tests the quoting of runtime
-# options containing special characters.
-
-MLFLAGS-integer_test = \
-		--runtime-flags "--heap-size 70000 --mdb-out \"mdb\\mdb out\""
-MLFLAGS-rational_test = --runtime-flags "--heap-size 20000"
+%.runtest: %.res ;
+
+$(SPLIT_PROGS:%=%.split.depend): %.split.depend: %.depend ;
+$(SPLIT_PROGS:%=%.split.realclean): %.split.realclean: %.realclean ;
+
+mapped_module.depend: Mercury.modules
+
+#-----------------------------------------------------------------------------#
 
 # no_fully_strict is expected to fail (it calls error/1).
 # We also need to pipe the output through sed to avoid hard-coding
@@ -329,16 +278,6 @@
 
 #-----------------------------------------------------------------------------#
 
-DEPS=	$(PROGS:%=%.dep)
-DEPENDS=$(PROGS:%=%.depend)
-OUTS=	$(PROGS:%=%.out) $(SPLIT_PROGS:%=%.split.out)
-RESS=	$(PROGS:%=%.res) $(SPLIT_PROGS:%=%.split.res)
-
-dep_local:	$(DEPS)
-depend_local:	Mercury.modules $(DEPENDS)
-check_local:	$(OUTS) $(RESS)
-all_local:	$(PROGS) $(SPLIT_PROGS:%=%.split)
-
 clean_local:
 	rm -f target_mlobjs_c.o		
 
@@ -347,40 +286,8 @@
 
 #-----------------------------------------------------------------------------#
 
-SUBDIRS = typeclasses sub-modules exceptions purity
-
 .PHONY: Mercury.modules
 Mercury.modules:
 	$(MC) -f $(ALL_MCFLAGS) source_file_map.m
-
-dep_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) dep) || exit 1; \
-	done
-
-depend_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) depend) || exit 1; \
-	done
-
-check_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) check) || exit 1; \
-	done
-
-all_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) all) || exit 1; \
-	done
-
-clean_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) clean) || exit 1; \
-	done
-
-realclean_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) realclean) || exit 1; \
-	done
 
 #-----------------------------------------------------------------------------#
Index: tests/hard_coded/runtests
===================================================================
RCS file: tests/hard_coded/runtests
diff -N tests/hard_coded/runtests
--- tests/hard_coded/runtests	31 Jan 2001 11:34:40 -0000	1.9
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,42 +0,0 @@
-#!/bin/sh
-# Test whether the code generated by the Mercury compiler
-# is producing the expected output.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../handle_options
-
-# Run the tests in any subdirectories of this one.  If any of these
-# fail, we still perform the tests in this directory but return a
-# status of 1 regardless of the outcome.
-
-. ../subdir_runtests
-
-if test "$subdir_failures" = ""
-then
-        subdir_status=0
-else
-        subdir_status=1
-fi
-
-# Now run all the tests in this directory.
-. ../startup
-
-eval mmake $mmakeopts depend_local || exit 1
-eval mmake $mmakeopts -k check_local
-checkstatus=$?
-
-cat *.res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the hard_coded directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../shutdown
-	exit $subdir_status
-else
-	echo "the tests in the hard_coded directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/hard_coded/exceptions/Mercury.options
===================================================================
RCS file: tests/hard_coded/exceptions/Mercury.options
diff -N tests/hard_coded/exceptions/Mercury.options
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/exceptions/Mercury.options	19 Jun 2002 17:09:04 -0000
@@ -0,0 +1,2 @@
+
+MCFLAGS-looptest = --infer-all
Index: tests/hard_coded/exceptions/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/exceptions/Mmakefile,v
retrieving revision 1.9
diff -u -u -r1.9 Mmakefile
--- tests/hard_coded/exceptions/Mmakefile	1 Feb 2002 22:09:14 -0000	1.9
+++ tests/hard_coded/exceptions/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -7,17 +7,16 @@
 # These rules define the main targets: depend, all, check.
 #
 
-MAIN_TARGET = check
+THIS_DIR = hard_coded/exceptions
 
-include ../../Mmake.common
--include ../../Mmake.params
+#-----------------------------------------------------------------------------#
 
 EXCEPTION_PROGS = \
-	test_exceptions.m \
-	test_exceptions_func.m \
-	test_try_all.m \
-	test_uncaught_exception.m \
-	tricky_try_store.m
+	test_exceptions \
+	test_exceptions_func \
+	test_try_all \
+	test_uncaught_exception \
+	tricky_try_store
 
 #
 # XXX the following tests are not enabled because we do not pass them yet:
@@ -43,13 +42,18 @@
 	PROGS=$(EXCEPTION_PROGS)
 endif
 
-depend: $(PROGS:.m=.depend)
-all: $(PROGS:.m=)
-check: $(PROGS:.m=.res)
+TESTS = $(PROGS)
+SUBDIRS=
+TESTS_DIR=../..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
 
-#-----------------------------------------------------------------------------#
+%.runtest: %.res ;
 
-MCFLAGS-looptest = --infer-all
+#-----------------------------------------------------------------------------#
 
 # test_uncaught_exception is *supposed* to return an error exit status.
 # We also need to pipe the output through sed to avoid hard-coding
Index: tests/hard_coded/exceptions/runtests
===================================================================
RCS file: tests/hard_coded/exceptions/runtests
diff -N tests/hard_coded/exceptions/runtests
--- tests/hard_coded/exceptions/runtests	31 Jan 2001 11:34:34 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-#!/bin/sh
-# Test whether the code generated by the Mercury compiler
-# is producing the expected output.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../../handle_options
-. ../../startup
-
-eval mmake $mmakeopts depend || exit 1
-eval mmake $mmakeopts -k check
-checkstatus=$?
-
-cat *.res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the hard_coded/exceptions directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../../shutdown
-	exit 0
-else
-	echo "the tests in the hard_coded/exceptions directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/hard_coded/purity/Mercury.options
===================================================================
RCS file: tests/hard_coded/purity/Mercury.options
diff -N tests/hard_coded/purity/Mercury.options
Index: tests/hard_coded/purity/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/purity/Mmakefile,v
retrieving revision 1.1
diff -u -u -r1.1 Mmakefile
--- tests/hard_coded/purity/Mmakefile	22 Apr 2000 07:12:34 -0000	1.1
+++ tests/hard_coded/purity/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -1,8 +1,6 @@
 #-----------------------------------------------------------------------------#
 
-main_target: check
-
-include ../../Mmake.common
+THIS_DIR = hard_coded/purity
 
 #-----------------------------------------------------------------------------#
 
@@ -11,21 +9,15 @@
 	impure_func_t1 \
 	impure_func_t6 
 
-#-----------------------------------------------------------------------------#
-
-DEPS=	$(PROGS:%=%.dep)
-DEPENDS=$(PROGS:%=%.depend)
-OUTS=	$(PROGS:%=%.out)
-RESS=	$(PROGS:%=%.res)
-
-#-----------------------------------------------------------------------------#
-
-dep:	$(DEPS)
-
-depend:	$(DEPENDS)
-
-check:	$(OUTS) $(RESS)
+TESTS = $(PROGS)
+SUBDIRS=
+TESTS_DIR=../..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
 
-all:	$(PROGS)
+%.runtest: %.res ;
 
 #-----------------------------------------------------------------------------#
Index: tests/hard_coded/purity/runtests
===================================================================
RCS file: tests/hard_coded/purity/runtests
diff -N tests/hard_coded/purity/runtests
--- tests/hard_coded/purity/runtests	31 Jan 2001 11:34:35 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-#!/bin/sh
-# Test whether the code generated by the Mercury compiler
-# is producing the expected output.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../../handle_options
-. ../../startup
-
-eval mmake $mmakeopts depend || exit 1
-eval mmake $mmakeopts -k check
-checkstatus=$?
-
-cat *.res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the hard_coded/purity directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../../shutdown
-	exit 0
-else
-	echo "the tests in the hard_coded/purity directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/hard_coded/sub-modules/Mercury.options
===================================================================
RCS file: tests/hard_coded/sub-modules/Mercury.options
diff -N tests/hard_coded/sub-modules/Mercury.options
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/sub-modules/Mercury.options	19 Jun 2002 17:09:44 -0000
@@ -0,0 +1,4 @@
+
+MCFLAGS-nested_intermod	=	--intermodule-optimization
+MCFLAGS-nested_intermod_main =	--intermodule-optimization
+
Index: tests/hard_coded/sub-modules/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/sub-modules/Mmakefile,v
retrieving revision 1.6
diff -u -u -r1.6 Mmakefile
--- tests/hard_coded/sub-modules/Mmakefile	5 Mar 2002 20:25:39 -0000	1.6
+++ tests/hard_coded/sub-modules/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -5,10 +5,7 @@
 #
 #-----------------------------------------------------------------------------#
 
-main_target: check
-
-include ../../Mmake.common
--include ../../Mmake.params
+THIS_DIR = hard_coded/sub-modules
 
 #-----------------------------------------------------------------------------#
 
@@ -29,24 +26,15 @@
 	class \
 	nested_intermod_main
 
-MCFLAGS-nested_intermod	=	--intermodule-optimization
-MCFLAGS-nested_intermod_main =	--intermodule-optimization
-
-#-----------------------------------------------------------------------------#
-
-DEPS=	$(PROGS:%=%.dep)
-DEPENDS=$(PROGS:%=%.depend)
-OUTS=	$(PROGS:%=%.out)
-RESS=	$(PROGS:%=%.res)
-
-#-----------------------------------------------------------------------------#
-
-dep:	$(DEPS)
-
-depend:	$(DEPENDS)
-
-check:	$(OUTS) $(RESS)
+TESTS = $(PROGS)
+TESTS_DIR=../..
+SUBDIRS=
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
 
-all:	$(PROGS)
+%.runtest: %.res ;
 
 #-----------------------------------------------------------------------------#
Index: tests/hard_coded/sub-modules/runtests
===================================================================
RCS file: tests/hard_coded/sub-modules/runtests
diff -N tests/hard_coded/sub-modules/runtests
--- tests/hard_coded/sub-modules/runtests	31 Jan 2001 11:34:36 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-#!/bin/sh
-# Test whether the code generated by the Mercury compiler
-# is producing the expected output.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../../handle_options
-. ../../startup
-
-# XXX we need to disable parallel make, because parallel make is currently
-# not supported when using nested modules.
-jfactor=-j1
-
-eval mmake $mmakeopts $jfactor depend || exit 1
-eval mmake $mmakeopts -k $jfactor check
-checkstatus=$?
-
-cat *.res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the hard_coded/sub-modules directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../../shutdown
-	exit 0
-else
-	echo "the tests in the hard_coded/sub-modules directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/hard_coded/typeclasses/Mercury.options
===================================================================
RCS file: tests/hard_coded/typeclasses/Mercury.options
diff -N tests/hard_coded/typeclasses/Mercury.options
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/typeclasses/Mercury.options	19 Jun 2002 17:10:09 -0000
@@ -0,0 +1,21 @@
+
+MCFLAGS-abstract_instance = --infer-all
+MCFLAGS-existential_type_classes = --infer-all
+MCFLAGS-extra_typeinfo = --optimize-higher-order --no-type-specialization \
+				--body-typeinfo-liveness
+MCFLAGS-inference_test = --infer-all
+MCFLAGS-inference_test_2 = --infer-all
+MCFLAGS-intermod_typeclass_bug = --intermodule-optimization
+MCFLAGS-intermod_typeclass_bug2 = --intermodule-optimization
+MCFLAGS-lambda_multi_constraint_same_tvar = --infer-all
+
+	# Check that the exported specialized versions are still created.
+MCFLAGS-type_spec_2 = --no-user-guided-type-specialization
+MCFLAGS-unbound_tvar = --no-user-guided-type-specialisation
+MCFLAGS-unqualified_method = --intermodule-optimization
+MCFLAGS-unqualified_method2 = --intermodule-optimization
+MCFLAGS-unqualified_method3 = --intermodule-optimization
+MCFLAGS-module_test_m1 = --infer-all
+MCFLAGS-module_test_m2 = --infer-all
+MCFLAGS-module_test = --infer-all
+
Index: tests/hard_coded/typeclasses/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/typeclasses/Mmakefile,v
retrieving revision 1.46
diff -u -u -r1.46 Mmakefile
--- tests/hard_coded/typeclasses/Mmakefile	29 Jul 2002 06:04:19 -0000	1.46
+++ tests/hard_coded/typeclasses/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -1,9 +1,6 @@
 #-----------------------------------------------------------------------------#
 
-main_target: check
-
-include ../../Mmake.common
--include ../../Mmake.params
+THIS_DIR = hard_coded/typeclasses
 
 #-----------------------------------------------------------------------------#
 
@@ -69,41 +66,15 @@
 #	complicated_constraint --
 #		because we don't support that feature yet
 
-MCFLAGS-abstract_instance = --infer-all
-MCFLAGS-existential_type_classes = --infer-all
-MCFLAGS-extra_typeinfo = --optimize-higher-order --no-type-specialization \
-				--body-typeinfo-liveness
-MCFLAGS-inference_test = --infer-all
-MCFLAGS-inference_test_2 = --infer-all
-MCFLAGS-intermod_typeclass_bug = --intermodule-optimization
-MCFLAGS-intermod_typeclass_bug2 = --intermodule-optimization
-MCFLAGS-lambda_multi_constraint_same_tvar = --infer-all
-
-	# Check that the exported specialized versions are still created.
-MCFLAGS-type_spec_2 = --no-user-guided-type-specialization
-MCFLAGS-unbound_tvar = --no-user-guided-type-specialisation
-MCFLAGS-unqualified_method = --intermodule-optimization
-MCFLAGS-unqualified_method2 = --intermodule-optimization
-MCFLAGS-unqualified_method3 = --intermodule-optimization
-MCFLAGS-module_test_m1 = --infer-all
-MCFLAGS-module_test_m2 = --infer-all
-MCFLAGS-module_test = --infer-all
-
-#-----------------------------------------------------------------------------#
-
-DEPS=	$(PROGS:%=%.dep)
-DEPENDS=$(PROGS:%=%.depend)
-OUTS=	$(PROGS:%=%.out)
-RESS=	$(PROGS:%=%.res)
-
-#-----------------------------------------------------------------------------#
-
-dep:	$(DEPS)
-
-depend:	$(DEPENDS)
-
-check:	$(OUTS) $(RESS)
+TESTS = $(PROGS)
+SUBDIRS=
+TESTS_DIR=../..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
 
-all:	$(PROGS)
+%.runtest: %.res ;
 
 #-----------------------------------------------------------------------------#
Index: tests/hard_coded/typeclasses/runtests
===================================================================
RCS file: tests/hard_coded/typeclasses/runtests
diff -N tests/hard_coded/typeclasses/runtests
--- tests/hard_coded/typeclasses/runtests	31 Jan 2001 11:34:36 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-#!/bin/sh
-# Test whether the code generated by the Mercury compiler
-# is producing the expected output.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../../handle_options
-. ../../startup
-
-eval mmake $mmakeopts depend || exit 1
-eval mmake $mmakeopts -k check
-checkstatus=$?
-
-cat *.res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the hard_coded/typeclasses directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../../shutdown
-	exit 0
-else
-	echo "the tests in the hard_coded/typeclasses directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/invalid/Mercury.options
===================================================================
RCS file: tests/invalid/Mercury.options
diff -N tests/invalid/Mercury.options
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/invalid/Mercury.options	11 Aug 2002 13:50:00 -0000
@@ -0,0 +1,45 @@
+# Inter-module optimization changes the diagnostics for some
+# tests (in most cases reporting diagnostics when writing the `.opt'
+# file). For those tests, we just disable inter-module optimization.
+
+MCFLAGS-aditi_errors =		--aditi --no-intermodule-optimization
+MCFLAGS-aditi_state_errors =	--aditi --no-intermodule-optimization
+MCFLAGS-aditi_update_derived_relation =	--aditi --no-intermodule-optimization
+MCFLAGS-aditi_update_errors =	--aditi --no-intermodule-optimization
+MCFLAGS-aditi_update_mode_errors = --aditi --no-intermodule-optimization
+MCFLAGS-any_mode	=	--infer-types
+
+# XXX This test should work with --intermodule-optimization, but
+# the compiler doesn't know whether items imported from `.opt' files
+# were imported in the interface or the implementation. The error
+# is reported correctly when building the `.opt' file.
+MCFLAGS-assert_in_interface =	--no-intermodule-optimization
+
+MCFLAGS-children =		--no-intermodule-optimization
+MCFLAGS-duplicate_modes	=	--verbose-error-messages
+MCFLAGS-exported_mode =		--infer-all --no-intermodule-optimization
+MCFLAGS-foreign_decl_line_number = --no-errorcheck-only --line-numbers --compile-only
+MCFLAGS-foreign_singleton =	--halt-at-warn
+MCFLAGS-foreign_type =		--compile-only
+MCFLAGS-foreign_type_2 =	--no-intermodule-optimization
+MCFLAGS-foreign_type_visibility = --no-intermodule-optimization
+MCFLAGS-imported_mode =		--infer-all --no-intermodule-optimization
+MCFLAGS-missing_det_decls =	--no-infer-det
+MCFLAGS-missing_interface_import = --make-interface
+MCFLAGS-missing_parent_import = --no-intermodule-optimization
+MCFLAGS-multisoln_func	=	--infer-types
+MCFLAGS-mode_inf	=	--infer-all
+MCFLAGS-no_exports = 		--halt-at-warn
+MCFLAGS-nonexistent_import =    --no-verbose-make --make nonexistent_import
+MCFLAGS-overloading = 		--no-intermodule-optimization
+MCFLAGS-sub_c = 	--verbose-error-messages --no-intermodule-optimization
+MCFLAGS-record_syntax_errors =	--verbose-error-messages
+MCFLAGS-test_nested =		--no-intermodule-optimization
+MCFLAGS-transitive_import = --no-intermodule-optimization
+MCFLAGS-transitive_import2 = --no-intermodule-optimization
+MCFLAGS-transitive_import_class = --no-intermodule-optimization
+MCFLAGS-transitive_import_class2 = --no-intermodule-optimization
+MCFLAGS-transitive_import_class3 = --no-intermodule-optimization
+MCFLAGS-typeclass_mode =	--infer-all
+MCFLAGS-undef_mod_qual = 	--no-intermodule-optimization
+MCFLAGS-undef_symbol = 		--no-intermodule-optimization
Index: tests/invalid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/Mmakefile,v
retrieving revision 1.119
diff -u -u -r1.119 Mmakefile
--- tests/invalid/Mmakefile	5 Aug 2002 21:46:22 -0000	1.119
+++ tests/invalid/Mmakefile	14 Aug 2002 16:41:44 -0000
@@ -1,11 +1,6 @@
 #-----------------------------------------------------------------------------#
 
-main_target: check
-
-include ../Mmake.common
--include ../Mmake.params
-
-#-----------------------------------------------------------------------------#
+THIS_DIR = invalid
 
 # Note: multi-module tests (including tests of nested modules)
 # need to be listed separately from single-module tests, since
@@ -14,207 +9,166 @@
 # building the dependencies (e.g. duplicate_module_test.m) should 
 # not be included in this list; we handle those specially (see below).
 
-MULTIMODULE_SOURCES= \
-	aditi_errors.m \
-	aditi_state_errors.m \
-	aditi_update_derived_relation.m \
-	aditi_update_errors.m \
-	aditi_update_mode_errors.m \
-	duplicate_instance_2.m \
-	ho_default_func_2.sub.m \
-	imported_mode.m \
-	missing_parent_import.m \
-	partial_implied_mode.m \
-	sub_c.m \
-	test_nested.m \
-	transitive_import.m \
-	transitive_import_class.m \
-	undef_mod_qual.m
-
-SINGLEMODULE_SOURCES= \
-	any_mode.m \
-	assert_in_interface.m \
-	bigtest.m \
-	bind_var_errors.m \
-	builtin_int.m \
-	builtin_proc.m \
-	circ_type.m \
-	constrained_poly_insts.m \
-	constructor_warning.m \
-	det_errors.m \
-	duplicate_modes.m \
-	duplicate_module_test.m \
-	errors.m \
-	errors1.m \
-	errors2.m \
-	external.m \
-	ext_type.m \
-	ext_type_bug.m \
-	exported_mode.m \
-	field_syntax_error.m \
-	foreign_decl_line_number.m \
-	foreign_singleton.m \
-	foreign_type_2.m \
-	foreign_type_visibility.m \
-	func_errors.m \
-	funcs_as_preds.m \
-	ho_default_func_1.m \
-	ho_default_func_3.m \
-	ho_type_mode_bug.m \
-	ho_unique_error.m \
-	impure_method_impl.m \
-	inline_conflict.m \
-	inst_list_dup.m \
-	invalid_main.m \
-	invalid_typeclass.m \
-	io_in_ite_cond.m \
-	lambda_syntax_error.m \
-	merge_ground_any.m \
-	method_impl.m \
-	missing_det_decls.m \
-	missing_interface_import.m \
-	mode_inf.m \
-	modes_erroneous.m \
-	mostly_uniq1.m \
-	mostly_uniq2.m \
-	multimode_missing_impure.m \
-	multimode_dcg.m \
-	multimode_syntax.m \
-	multisoln_func.m \
-	nested_impl_in_int.m \
-	no_exports.m \
-	nonexistent_import.m \
-	not_a_switch.m \
-	nullary_ho_func_error.m \
-	occurs.m \
-	overloading.m \
-	polymorphic_unification.m \
-	pragma_c_code_dup_var.m \
-	pragma_c_code_no_det.m \
-	predmode.m \
-	prog_io_erroneous.m \
-	qual_basic_test2.m \
-	qualified_cons_id2.m \
-	record_syntax_errors.m \
-	some.m \
-	spurious_mode_error.m \
-	state_vars_test1.m \
-	state_vars_test2.m \
-	state_vars_test3.m \
-	state_vars_test4.m \
-	tc_err1.m \
-	tc_err2.m \
-	tricky_assert1.m \
-	type_inf_loop.m \
-	type_loop.m \
-	type_mismatch.m \
-	type_vars.m \
-	typeclass_bogus_method.m \
-	typeclass_constraint_extra_var.m \
-	typeclass_constraint_no_var.m \
-	typeclass_mode.m \
-	typeclass_missing_det.m \
-	typeclass_missing_det_2.m \
-	typeclass_missing_det_3.m \
-	typeclass_missing_mode.m \
-	typeclass_missing_mode_2.m \
-	typeclass_test_1.m \
-	typeclass_test_2.m \
-	typeclass_test_3.m \
-	typeclass_test_4.m \
-	typeclass_test_5.m \
-	typeclass_test_7.m \
-	typeclass_test_9.m \
-	types.m	\
-	type_spec.m \
-	unbound_type_vars.m \
-	undef_lambda_mode.m \
-	undef_mode.m \
-	undef_mode_and_no_clauses.m \
-	undef_symbol.m \
-	undef_type.m \
-	undef_type_mod_qual.m \
-	unify_mode_error.m \
-	uniq_modes.m \
-	uniq_neg.m \
-	uu_type.m \
-	vars_in_wrong_places.m \
-	with_type.m
-
-SOURCES= $(SINGLEMODULE_SOURCES) $(MULTIMODULE_SOURCES)
+MULTIMODULE_PROGS= \
+	aditi_errors \
+	aditi_state_errors \
+	aditi_update_derived_relation \
+	aditi_update_errors \
+	aditi_update_mode_errors \
+	duplicate_instance_2 \
+	ho_default_func_2.sub \
+	imported_mode \
+	missing_parent_import \
+	partial_implied_mode \
+	sub_c \
+	test_nested \
+	transitive_import \
+	transitive_import_class \
+	undef_mod_qual
+
+SINGLEMODULE_PROGS= \
+	any_mode \
+	assert_in_interface \
+	bigtest \
+	bind_var_errors \
+	builtin_int \
+	builtin_proc \
+	circ_type \
+	constrained_poly_insts \
+	constructor_warning \
+	det_errors \
+	duplicate_modes \
+	duplicate_module_test \
+	errors \
+	errors1 \
+	errors2 \
+	external \
+	ext_type \
+	ext_type_bug \
+	exported_mode \
+	field_syntax_error \
+	foreign_decl_line_number \
+	foreign_singleton \
+	foreign_type_2 \
+	foreign_type_visibility \
+	func_errors \
+	funcs_as_preds \
+	ho_default_func_1 \
+	ho_default_func_3 \
+	ho_type_mode_bug \
+	ho_unique_error \
+	impure_method_impl \
+	inline_conflict \
+	inst_list_dup \
+	invalid_main \
+	invalid_typeclass \
+	io_in_ite_cond \
+	lambda_syntax_error \
+	merge_ground_any \
+	method_impl \
+	missing_det_decls \
+	missing_interface_import \
+	mode_inf \
+	modes_erroneous \
+	mostly_uniq1 \
+	mostly_uniq2 \
+	multimode_missing_impure \
+	multimode_dcg \
+	multimode_syntax \
+	multisoln_func \
+	nested_impl_in_int \
+	no_exports \
+	nonexistent_import \
+	not_a_switch \
+	nullary_ho_func_error \
+	occurs \
+	overloading \
+	polymorphic_unification \
+	pragma_c_code_dup_var \
+	pragma_c_code_no_det \
+	predmode \
+	prog_io_erroneous \
+	qual_basic_test2 \
+	qualified_cons_id2 \
+	record_syntax_errors \
+	some \
+	spurious_mode_error \
+	state_vars_test1 \
+	state_vars_test2 \
+	state_vars_test3 \
+	state_vars_test4 \
+	tc_err1 \
+	tc_err2 \
+	tricky_assert1 \
+	type_inf_loop \
+	type_loop \
+	type_mismatch \
+	type_vars \
+	typeclass_bogus_method \
+	typeclass_constraint_extra_var \
+	typeclass_constraint_no_var \
+	typeclass_mode \
+	typeclass_missing_det \
+	typeclass_missing_det_2 \
+	typeclass_missing_det_3 \
+	typeclass_missing_mode \
+	typeclass_missing_mode_2 \
+	typeclass_test_1 \
+	typeclass_test_2 \
+	typeclass_test_3 \
+	typeclass_test_4 \
+	typeclass_test_5 \
+	typeclass_test_7 \
+	typeclass_test_9 \
+	types	\
+	type_spec \
+	unbound_type_vars \
+	undef_lambda_mode \
+	undef_mode \
+	undef_mode_and_no_clauses \
+	undef_symbol \
+	undef_type \
+	undef_type_mod_qual \
+	unify_mode_error \
+	uniq_modes \
+	uniq_neg \
+	uu_type \
+	vars_in_wrong_places \
+	with_type
 
 # we do not yet pass the following tests:
 #	duplicate_instance_3 (the error is only detected when doing
 #		normal static linking; the error goes undetected
 #		when doing dynamic linking, or when the library
 #		was built with `--split-c-files')
-#	parent.undeclared_child.m (just not yet implemented)
-#	freefree.m 	(need bromage's aliasing stuff)
-#	typeclass_test_8.m (minor formatting error in the output --
+#	parent.undeclared_child (just not yet implemented)
+#	freefree 	(need bromage's aliasing stuff)
+#	typeclass_test_8 (minor formatting error in the output --
 #			the type class name should be in quotes)
-#	typeclass_mode_{2,3,4}.m (compiler calls error/1)
-#	cyclic_typeclass.m (compiler goes into an infinite loop)
-#	ho_default_func_4.m (due to a bug in the mode-checker ---
+#	typeclass_mode_{2,3,4} (compiler calls error/1)
+#	cyclic_typeclass (compiler goes into an infinite loop)
+#	ho_default_func_4 (due to a bug in the mode-checker ---
 #			see XXX comment in inst_match:inst_matches_final_3)
-#	inst_matches_final_bug.m (due to same bug as ho_default_func_4.m)
+#	inst_matches_final_bug (due to same bug as ho_default_func_4)
 #	foreign_type (the error is only detected when trying to compile 
 #		the generated C code).
 
-# Inter-module optimization changes the diagnostics for some
-# tests (in most cases reporting diagnostics when writing the `.opt'
-# file). For those tests, we just disable inter-module optimization.
-
-MCFLAGS-aditi_errors =		--aditi --no-intermodule-optimization
-MCFLAGS-aditi_state_errors =	--aditi --no-intermodule-optimization
-MCFLAGS-aditi_update_derived_relation =	--aditi --no-intermodule-optimization
-MCFLAGS-aditi_update_errors =	--aditi --no-intermodule-optimization
-MCFLAGS-aditi_update_mode_errors = --aditi --no-intermodule-optimization
-MCFLAGS-any_mode	=	--infer-types
-
-# XXX This test should work with --intermodule-optimization, but
-# the compiler doesn't know whether items imported from `.opt' files
-# were imported in the interface or the implementation. The error
-# is reported correctly when building the `.opt' file.
-MCFLAGS-assert_in_interface =	--no-intermodule-optimization
-
-MCFLAGS-children =		--no-intermodule-optimization
-MCFLAGS-duplicate_modes	=	--verbose-error-messages
-MCFLAGS-exported_mode =		--infer-all --no-intermodule-optimization
-MCFLAGS-foreign_decl_line_number = --no-errorcheck-only --line-numbers --compile-only
-MCFLAGS-foreign_type =		--compile-only
-MCFLAGS-foreign_singleton =	--halt-at-warn
-MCFLAGS-foreign_type_2 =	--no-intermodule-optimization
-MCFLAGS-foreign_type_visibility  = --no-intermodule-optimization
-MCFLAGS-imported_mode =		--infer-all --no-intermodule-optimization
-MCFLAGS-missing_det_decls =	--no-infer-det
-MCFLAGS-missing_interface_import = --make-interface
-MCFLAGS-missing_parent_import = --no-intermodule-optimization
-MCFLAGS-multisoln_func	=	--infer-types
-MCFLAGS-mode_inf	=	--infer-all
-MCFLAGS-no_exports = 		--halt-at-warn
-MCFLAGS-nonexistent_import =	--no-verbose-make --make nonexistent_import
-MCFLAGS-overloading = 		--no-intermodule-optimization
-MCFLAGS-sub_c = 	--verbose-error-messages --no-intermodule-optimization
-MCFLAGS-record_syntax_errors =	--verbose-error-messages
-MCFLAGS-test_nested =		--no-intermodule-optimization
-MCFLAGS-transitive_import = --no-intermodule-optimization
-MCFLAGS-transitive_import2 = --no-intermodule-optimization
-MCFLAGS-transitive_import_class = --no-intermodule-optimization
-MCFLAGS-transitive_import_class2 = --no-intermodule-optimization
-MCFLAGS-transitive_import_class3 = --no-intermodule-optimization
-MCFLAGS-typeclass_mode =	--infer-all
-MCFLAGS-undef_mod_qual = 	--no-intermodule-optimization
-MCFLAGS-undef_symbol = 		--no-intermodule-optimization
+#-----------------------------------------------------------------------------#
 
-# For these test cases, the bug is caught when generating dependencies,
-# so it is easiest just to do that step.
-MCFLAGS-nested_impl_in_int =	--generate-dependencies
-MCFLAGS-duplicate_module_test =	--generate-dependencies
+PROGS= $(SINGLEMODULE_PROGS) $(MULTIMODULE_PROGS)
 
-MULTIMODULE_DEPENDS=	$(MULTIMODULE_SOURCES:%.m=%.depend)
+TESTS = $(MULTIMODULE_PROGS) $(SINGLEMODULE_PROGS:%=%-nodepend)
+SUBDIRS = purity
+TESTS_DIR=..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
+
+%.runtest: %.err_res ;
 
-ERRS=		$(SOURCES:%.m=%.err)
-ERR_RESS=	$(SOURCES:%.m=%.err_res)
+#-----------------------------------------------------------------------------#
 
 %.err: %.m
 	if $(MC) --errorcheck-only $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) $* \
@@ -226,74 +180,36 @@
 # The exact error message varies a lot from system to system,
 # so we don't check the error output, we just check the command
 # return status.
-duplicate_instance_2.err: duplicate_instance_1.m duplicate_instance_2.m \
-		$(ints_subdir)duplicate_instance_1.int
-	if $(MC) $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) \
-		--link-flags "$(ALL_MLFLAGS)" \
-		duplicate_instance_1.m duplicate_instance_2.m \
-		> $*.err 2>&1; \
+duplicate_instance_2.err: duplicate_instance_1.m duplicate_instance_2.m
+	if $(MCM) duplicate_instance_2 > /dev/null 2>&1; \
 	then	false; \
 	else	echo "Error was successfully detected" > $*.err; \
 	fi
 
+# For these test cases, the bug is caught when generating dependencies,
+# so it is easiest just to do that step.
+nested_impl_in_int.err duplicate_module_test.err: %.err: %.m
+	if $(MC) --generate-dependencies $* > $*.err 2>&1; \
+	then false; \
+	else true; \
+	fi
+
 $(dates_subdir)undef_mod_qual.date: $(int0s_subdir)undef_mod_qual.int0
 
 # Some tests have more than one possible valid output, so
 # we allow the test to pass if it matches any of the .err_exp* files.
-DIFF_OPTS=-c
 %.err_res: %.err %.err_exp
-	-rm -f $@
-	diff $(DIFF_OPTS) $*.err_exp $*.err > $@ || \
+	@-rm -f $@
+	@diff $(DIFF_OPTS) $*.err_exp $*.err > $@ || \
 		{ [ -f $*.err_exp2 ] && \
 		  diff $(DIFF_OPTS) $*.err_exp2 $*.err > $@; } || \
 		{ [ -f $*.err_exp3 ] && \
 		  diff $(DIFF_OPTS) $*.err_exp3 $*.err > $@; } || \
 		{ [ -f $*.err_exp4 ] && \
-		  diff $(DIFF_OPTS) $*.err_exp4 $*.err > $@; }
-
-all:	check
-
-check:	$(ERRS) $(ERR_RESS)
-
-errs:	$(ERRS)
-
-depend:	$(MULTIMODULE_DEPENDS)
+		  diff $(DIFF_OPTS) $*.err_exp4 $*.err > $@; } || \
+		{ cat $*.err && exit 1; }
 
 clean_local:
 	rm -f *.err *.err_res
-
-#-----------------------------------------------------------------------------#
-
-SUBDIRS = purity
-
-dep_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) dep) || exit 1; \
-	done
-
-depend_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) depend) || exit 1; \
-	done
-
-check_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) check) || exit 1; \
-	done
-
-all_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) all) || exit 1; \
-	done
-
-clean_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) clean) || exit 1; \
-	done
-
-realclean_subdirs:
-	+for dir in $(SUBDIRS); do \
-		(cd $$dir && $(SUBDIR_MMAKE) realclean) || exit 1; \
-	done
 
 #-----------------------------------------------------------------------------#
Index: tests/invalid/runtests
===================================================================
RCS file: tests/invalid/runtests
diff -N tests/invalid/runtests
--- tests/invalid/runtests	31 Jan 2001 11:34:41 -0000	1.8
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,26 +0,0 @@
-#!/bin/sh
-# Test whether the compiler is producing the right errors.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../handle_options
-. ../startup
-
-eval mmake $mmakeopts depend || exit 1
-eval mmake $mmakeopts -k check
-checkstatus=$?
-
-cat *.err_res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the invalid directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../shutdown
-	exit 0
-else
-	echo "the tests in the invalid directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/invalid/purity/Mercury.options
===================================================================
RCS file: tests/invalid/purity/Mercury.options
diff -N tests/invalid/purity/Mercury.options
Index: tests/invalid/purity/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/purity/Mmakefile,v
retrieving revision 1.2
diff -u -u -r1.2 Mmakefile
--- tests/invalid/purity/Mmakefile	13 Jul 2001 17:35:10 -0000	1.2
+++ tests/invalid/purity/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -1,31 +1,43 @@
 #-----------------------------------------------------------------------------#
 
-main_target: check
+THIS_DIR = invalid/purity
 
-include ../../Mmake.common
+PROGS= \
+	impure_func_t2 \
+	impure_func_t3 \
+	impure_func_t4 \
+	impure_func_t5 \
+	impure_func_t7 \
+	impure_pred_t1 \
+	impure_pred_t2 \
+	purity \
+	purity_nonsense \
+	purity_type_error
+
+TESTS=$(PROGS)
+SUBDIRS=
+TESTS_DIR=../..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
 
-#-----------------------------------------------------------------------------#
+%.runtest: %.err_res ;
 
-SOURCES= \
-	impure_func_t2.m \
-	impure_func_t3.m \
-	impure_func_t4.m \
-	impure_func_t5.m \
-	impure_func_t7.m \
-	impure_pred_t1.m \
-	impure_pred_t2.m \
-	purity.m \
-	purity_nonsense.m \
-	purity_type_error.m
-
-DEPS=		$(SOURCES:%.m=%.dep)
-DEPENDS=	$(SOURCES:%.m=%.depend)
-ERRS=		$(SOURCES:%.m=%.err)
-ERR_RESS=	$(SOURCES:%.m=%.err_res)
+#-----------------------------------------------------------------------------#
 
+# With `mmc --make', errors should go only to the `.err' file,
+# not stderr.
+ifeq ($(MMAKE_USE_MMC_MAKE),yes)
+%.err: %.m
+	if $(MCM) $*.err > /dev/null 2>&1 ; then false; else true; fi
+else
 %.err: %.m
-	if $(MC) $(ALL_MCFLAGS) --errorcheck-only $* > $*.err 2>&1; \
+	if $(MC) $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) --errorcheck-only $* \
+		> $*.err 2>&1; \
 	then false; else true; fi
+endif
 
 # Some tests have more than one possible valid output, so
 # we allow the test to pass if it matches *either* the .err_exp
@@ -33,13 +45,8 @@
 %.err_res: %.err %.err_exp
 	-rm -f $@
 	diff -c $*.err_exp $*.err > $@ || \
-		{ [ -f $*.err_exp2 ] && diff -c $*.err_exp2 $*.err > $@; }
-
-all:	check
-
-check:	$(ERRS) $(ERR_RESS)
-
-errs:	$(ERRS)
+		{ [ -f $*.err_exp2 ] && diff -c $*.err_exp2 $*.err > $@; } || \
+		{ cat $@ && exit 1; }
 
 clean_local:
 	rm -f *.err *.err_res
Index: tests/invalid/purity/runtests
===================================================================
RCS file: tests/invalid/purity/runtests
diff -N tests/invalid/purity/runtests
--- tests/invalid/purity/runtests	31 Jan 2001 11:34:37 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-#!/bin/sh
-# Test whether the code generated by the Mercury compiler
-# is producing the expected output.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../../handle_options
-. ../../startup
-
-eval mmake $mmakeopts depend || exit 1
-eval mmake $mmakeopts -k check
-checkstatus=$?
-
-cat *.err_res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the invalid/purity directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../../shutdown
-	exit 0
-else
-	echo "the tests in the invalid/purity directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/misc_tests/Mercury.options
===================================================================
RCS file: tests/misc_tests/Mercury.options
diff -N tests/misc_tests/Mercury.options
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/misc_tests/Mercury.options	19 Jun 2002 17:12:02 -0000
@@ -0,0 +1 @@
+MCFLAGS-pretty_print_test = --no-line-numbers
Index: tests/misc_tests/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/misc_tests/Mmakefile,v
retrieving revision 1.13
diff -u -u -r1.13 Mmakefile
--- tests/misc_tests/Mmakefile	5 Apr 2000 06:11:34 -0000	1.13
+++ tests/misc_tests/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -1,11 +1,18 @@
 #-----------------------------------------------------------------------------#
 
-main_target: check
+THIS_DIR = misc_tests
 
-include ../Mmake.common
--include ../Mmake.params
+SUBDIRS = 
+PROGS =
+TESTS = mdemangle_test-nodepend pretty_print_test-nodepend
+TESTS_DIR=..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
 
-MCFLAGS-pretty_print_test = --no-line-numbers
+%.runtest: %.res ;
 
 #-----------------------------------------------------------------------------#
 
@@ -17,30 +24,13 @@
 
 #-----------------------------------------------------------------------------#
 
-PROGS =
-
-OTHER_TESTS = mdemangle_test pretty_print_test
-
-#-----------------------------------------------------------------------------#
-
-DEPS=	$(PROGS:%=%.dep)
-DEPENDS=$(PROGS:%=%.depend)
-OUTS=	$(PROGS:%=%.out) $(OTHER_TESTS:%=%.out)
-RESS=	$(PROGS:%=%.res) $(OTHER_TESTS:%=%.res)
-
-#-----------------------------------------------------------------------------#
-
-dep:	$(DEPS)
-
-depend:	$(DEPENDS)
-
-check:	$(OUTS) $(RESS)
-
-all:	$(PROGS)
+mdemangle_test.realclean:
+	rm -f mdemangle_test.out mdemangle_test.res
 
-clean_local:	clean_ugly
+pretty_print_test.realclean:
+	rm -f pretty_print_test.ugly pretty_print_test.out
+	rm -f pretty_print_test.res
 
-clean_ugly:
-	rm -fr *.ugly
+clean_local:	mdemangle_test.realclean pretty_print_test.realclean
 
 #-----------------------------------------------------------------------------#
Index: tests/misc_tests/runtests
===================================================================
RCS file: tests/misc_tests/runtests
diff -N tests/misc_tests/runtests
--- tests/misc_tests/runtests	31 Jan 2001 11:34:41 -0000	1.7
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-#!/bin/sh
-# Test whether the code generated by the Mercury compiler
-# is producing the expected output.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../handle_options
-. ../startup
-
-eval mmake $mmakeopts depend || exit 1
-eval mmake $mmakeopts -k check
-checkstatus=$?
-
-cat *.res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the misc_tests directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../shutdown
-	exit 0
-else
-	echo "the tests in the misc_tests directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/recompilation/Mercury.options
===================================================================
RCS file: tests/recompilation/Mercury.options
diff -N tests/recompilation/Mercury.options
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/recompilation/Mercury.options	19 Jun 2002 17:12:46 -0000
@@ -0,0 +1,7 @@
+	# typeclass_method_pragma_r calls a predicate with a
+	# `:- pragma obsolete' declaration.
+MCFLAGS-typeclass_method_pragma_r = --no-halt-at-warn
+
+# This module tests recompilation of a module which depends on a module
+# for which no version numbers have been computed.
+MCFLAGS-no_version_numbers_r_2 = --no-smart-recompilation
Index: tests/recompilation/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/recompilation/Mmakefile,v
retrieving revision 1.8
diff -u -u -r1.8 Mmakefile
--- tests/recompilation/Mmakefile	23 Feb 2002 07:30:58 -0000	1.8
+++ tests/recompilation/Mmakefile	14 Aug 2002 15:02:32 -0000
@@ -1,37 +1,90 @@
 #-----------------------------------------------------------------------------#
 
-main_target: check
+THIS_DIR = recompilation
 
-include ../Mmake.common
--include ../Mmake.params
+TESTS_SHOULD_SUCCEED = \
+	add_constructor_nr \
+	add_constructor_r \
+	add_instance_r \
+	add_instance_2_r \
+	add_type_nr \
+	change_class_r \
+	change_func_r \
+	change_instance_r \
+	change_mode_r \
+	change_type_nr \
+	combined_type_mode_nr \
+	field_r \
+	func_overloading_nr \
+	func_overloading_r \
+	lambda_mode_r \
+	no_version_numbers_r \
+	pragma_type_spec_r \
+	pred_ctor_ambiguity_r \
+	pred_overloading_r \
+	typeclass_method_pragma_r \
+	type_spec_rename_var_r \
+	type_spec_unname_var_r \
+	unchanged_pred_nr \
+	unchanged_with_type_nr
+
+# Parallel mmake with nested sub-modules is broken.
+# The commands to create `.c' files from the `.m' file containing the
+# nested sub-module are run twice, resulting in incorrect output in
+# the `.err' file.
+NO_PARALLEL_MAKE_TESTS = \
+	nested_module_r \
+	nested_module_2_r
+
+TESTS_SHOULD_FAIL = \
+	add_type_re \
+	remove_type_re \
+	type_qual_re \
+	with_type_re
+
+PROGS= $(TESTS_SHOULD_SUCCEED) $(NO_PARALLEL_MAKE_TESTS) $(TESTS_SHOULD_FAIL)
+TESTS= $(PROGS:%=%-nodepend)
+SUBDIRS=
+TESTS_DIR=..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
+
+%.runtest:
+	@m -f $*.res
+	@touch $*.res
+	+ at case $* in \
+		*_re) \
+			test_should_fail=true ;; \
+		*) \
+			test_should_fail=false ;; \
+	esac; \
+	if ./two_module_test $$test_should_fail $* $*_2; then \
+		rm -f failing_make_output; \
+	else \
+		cat $*.res; \
+		exit 1; \
+	fi
 
 #-----------------------------------------------------------------------------#
-#-----------------------------------------------------------------------------#
 
 clean_local:
 
 realclean_local:
-	. ./TESTS; \
-	for module in $$ALL_TESTS; do \
+	for module in $$PROGS; do \
 		rm -rf $$module.m $${module}_2.m ;\
 	done
 
 should_run_recompilation_tests:
 	@echo $(RUN_RECOMPILATION_TESTS)
 
-	# typeclass_method_pragma_r calls a predicate with a
-	# `:- pragma obsolete' declaration.
-MCFLAGS-typeclass_method_pragma_r = --no-halt-at-warn
-
 # Smart recompilation doesn't yet work with --intermodule-optimization.
 # The `override' is needed because otherwise make ignores the assignment if
 # EXTRA_MCFLAGS is set on the command line, as it is for the nightly tests.
 override EXTRA_MCFLAGS += --no-intermodule-optimization --smart-recompilation \
 			--find-all-recompilation-reasons
-
-# This module tests recompilation of a module which depends on a module
-# for which no version numbers have been computed.
-MCFLAGS-no_version_numbers_r_2 = --no-smart-recompilation
 
 $(dates_subdir)nested_module_2_r_2.date: \
 				$(int0s_subdir)nested_module_2_r_2.int0
Index: tests/recompilation/TESTS
===================================================================
RCS file: tests/recompilation/TESTS
diff -N tests/recompilation/TESTS
--- tests/recompilation/TESTS	15 Mar 2002 07:32:25 -0000	1.10
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,45 +0,0 @@
-# This is a shell script fragment to define variables containing
-# the names of the tests. This is sourced by runtests and by the
-# commands for the realclean target in the Mmakefile. 
-
-TESTS_SHOULD_SUCCEED="\
-	add_constructor_nr \
-	add_constructor_r \
-	add_instance_r \
-	add_instance_2_r \
-	add_type_nr \
-	change_class_r \
-	change_func_r \
-	change_instance_r \
-	change_mode_r \
-	change_type_nr \
-	combined_type_mode_nr \
-	field_r \
-	func_overloading_nr \
-	func_overloading_r \
-	lambda_mode_r \
-	no_version_numbers_r \
-	pragma_type_spec_r \
-	pred_ctor_ambiguity_r \
-	pred_overloading_r \
-	typeclass_method_pragma_r \
-	type_spec_rename_var_r \
-	type_spec_unname_var_r \
-	unchanged_pred_nr \
-	unchanged_with_type_nr"
-
-# Parallel mmake with nested sub-modules is broken.
-# The commands to create `.c' files from the `.m' file containing the
-# nested sub-module are run twice, resulting in incorrect output in
-# the `.err' file.
-NO_PARALLEL_MAKE_TESTS="\
-	nested_module_r \
-	nested_module_2_r"
-
-TESTS_SHOULD_FAIL="\
-	add_type_re \
-	remove_type_re \
-	type_qual_re \
-	with_type_re"
-
-ALL_TESTS="$TESTS_SHOULD_SUCCEED $NO_PARALLEL_MAKE_TESTS $TESTS_SHOULD_FAIL"
Index: tests/recompilation/runtests
===================================================================
RCS file: tests/recompilation/runtests
diff -N tests/recompilation/runtests
--- tests/recompilation/runtests	3 Aug 2001 16:22:45 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,76 +0,0 @@
-#!/bin/sh
-# Test whether smart recompilation works and is producing the
-# expected output.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../handle_options
-
-case "`eval mmake $mmakeopts should_run_recompilation_tests`" in
-	no)	
-		exit 0
-		;;
-esac
-
-. ../startup
-
-. ./TESTS
-
-failing_tests=""
-cleanup=true
-
-# If the compilation is supposed to fail then the mmake
-# output should be suppressed to avoid making it harder
-# to find genuine failures in the nightly test logs.
-failing_make_output=failing_make_output
-
-export mmakeopts generate_missing_exp_files cleanup failing_make_output
-
-run_all_tests () {
-	test_should_fail=$1
-	shift
-
-	for test in "$@"
-	do
-		rm -f $test.res
-		touch $test.res
-		if ./two_module_test $test_should_fail $test ${test}_2
-		then
-			:
-		else
-			failing_tests="$failing_tests $test"
-		fi
-	done
-}
-
-run_all_tests false $TESTS_SHOULD_SUCCEED
-run_all_tests true $TESTS_SHOULD_FAIL
-
-# Parallel mmake does not work with nested sub-modules,
-# so disable it for tests which contain nested sub-modules.
-oldmmakeopts="$mmakeopts"
-mmakeopts="$mmakeopts -j1"
-export mmakeopts
-run_all_tests false $NO_PARALLEL_MAKE_TESTS
-
-mmakeopts=$oldmmakeopts
-export mmakeopts
-
-cat *.res > .allres
-if [ "$failing_tests" = "" -a ! -s .allres ]
-then
-	echo "the tests in the recompilation directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	case $cleanup in true)
-		rm -f $failing_make_output
-		. ../shutdown ;;
-	esac
-	exit 0
-else
-	echo "the tests in the recompilation directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the tests that failed are: $failing_tests"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/recompilation/test_functions
===================================================================
RCS file: /home/mercury1/repository/tests/recompilation/test_functions,v
retrieving revision 1.5
diff -u -u -r1.5 test_functions
--- tests/recompilation/test_functions	31 Jul 2001 16:59:48 -0000	1.5
+++ tests/recompilation/test_functions	14 Aug 2002 07:10:39 -0000
@@ -71,7 +71,7 @@
 }
 
 mmake_depend () {
-	eval mmake $mmakeopts $main_module.depend || exit 1
+	eval mmake $main_module.depend || exit 1
 }
 
 #
@@ -114,6 +114,10 @@
 
 #
 # Build the test, then run it and compare the output.
+# The tests are built using `mmake -j1' to avoid
+# spurious differences in the `.err' files due to the
+# commands to compile a module being run twice with
+# parallel make.
 #
 mmake_test () {
 	if [ $# != 2 ]
@@ -134,10 +138,10 @@
 		# The `-k' option to mmake avoids differences in the output
 		# when using parallel mmakes.
 		#
-		eval mmake $mmakeopts -k $main_module > $failing_make_output 2>&1
+		eval mmake -j1 -k $main_module > failing_make_output 2>&1
 		;;
 	    false)
-		eval mmake $mmakeopts $main_module
+		eval mmake -j1 $main_module
 		;;
 	esac
 
@@ -146,7 +150,7 @@
 		case $mmake_should_fail in
 		    true)
 			echo \
-	"** Error: mmake $mmakeopts $main_module succeeded where it should fail"
+	"** Error: mmake $main_module succeeded where it should fail"
 			exit 1
 			;;
 		esac
@@ -158,7 +162,7 @@
 	    *)
 		case $mmake_should_fail in
 		    false)
-			echo "** Error: mmake $mmakeopts $main_module failed"
+			echo "** Error: mmake $main_module failed"
 			exit 1
 			;;
 		esac
@@ -190,7 +194,7 @@
 cleanup_test () {
 	case $cleanup in
 	true)
-		eval mmake $mmakeopts $main_module.realclean
+		eval mmake $main_module.realclean
 
 		for module in $modules
 		do
Index: tests/tabling/Mercury.options
===================================================================
RCS file: tests/tabling/Mercury.options
diff -N tests/tabling/Mercury.options
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/tabling/Mercury.options	19 Jun 2002 17:13:30 -0000
@@ -0,0 +1,4 @@
+# With the Mercury system as of 17 September 1998,
+# tc_minimal works on some machines even in the presence of a known bug
+# if inlining is turned on, so we turn inlining off to make the test tougher.
+MCFLAGS-tc_minimal	=	--no-inlining
Index: tests/tabling/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/tabling/Mmakefile,v
retrieving revision 1.16
diff -u -u -r1.16 Mmakefile
--- tests/tabling/Mmakefile	18 Mar 2001 23:10:16 -0000	1.16
+++ tests/tabling/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -1,9 +1,6 @@
 #-----------------------------------------------------------------------------#
 
-main_target: check
-
-include ../Mmake.common
--include ../Mmake.params
+THIS_DIR = tabling
 
 #-----------------------------------------------------------------------------#
 
@@ -53,12 +50,18 @@
 	PROGS=
 endif
 
-#-----------------------------------------------------------------------------#
+TESTS = $(PROGS)
+SUBDIRS=
+TESTS_DIR=..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
 
-# With the Mercury system as of 17 September 1998,
-# tc_minimal works on some machines even in the presence of a known bug
-# if inlining is turned on, so we turn inlining off to make the test tougher.
-MCFLAGS-tc_minimal	=	--no-inlining
+%.runtest: %.res ;
+
+#-----------------------------------------------------------------------------#
 
 # Some test cases are expected to abort.
 # We also need to pipe the output for these test cases through sed to avoid
@@ -86,28 +89,5 @@
 			< $@.tmp > $@; \
 		rm -f $@.tmp; \
 	fi
-
-#-----------------------------------------------------------------------------#
-
-DEPS=	$(PROGS:%=%.dep)
-DEPENDS=$(PROGS:%=%.depend)
-OUTS=	$(PROGS:%=%.out)
-RESS=	$(PROGS:%=%.res)
-
-#-----------------------------------------------------------------------------#
-
-MMAKEFLAGS =
-
-dep:	$(DEPS)
-
-depend:	$(DEPENDS)
-
-check:	$(OUTS) $(RESS)
-
-all:	$(PROGS)
-
-clean_local:
-
-realclean_local:
 
 #-----------------------------------------------------------------------------#
Index: tests/tabling/runtests
===================================================================
RCS file: tests/tabling/runtests
diff -N tests/tabling/runtests
--- tests/tabling/runtests	31 Jan 2001 11:34:42 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-#!/bin/sh
-# Test whether the code generated by the Mercury compiler
-# is producing the expected output.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../handle_options
-. ../startup
-
-eval mmake $mmakeopts depend || exit 1
-eval mmake $mmakeopts -k check
-checkstatus=$?
-
-cat *.res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the tabling directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../shutdown
-	exit 0
-else
-	echo "the tests in the tabling directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/term/Mercury.options
===================================================================
RCS file: tests/term/Mercury.options
diff -N tests/term/Mercury.options
Index: tests/term/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/term/Mmakefile,v
retrieving revision 1.16
diff -u -u -r1.16 Mmakefile
--- tests/term/Mmakefile	5 Apr 2000 06:11:36 -0000	1.16
+++ tests/term/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -1,12 +1,13 @@
 #-----------------------------------------------------------------------------#
 
-main_target: check
-
-include ../Mmake.common
--include ../Mmake.params
+THIS_DIR = term
 
 #-----------------------------------------------------------------------------#
 
+ifeq ($(MMAKE_USE_MMC_MAKE),yes)
+# `mmc --make' doesn't know how to create `.trans_opt' files.
+PROGS=
+else
 PROGS=	\
 	ack \
 	append \
@@ -62,10 +63,18 @@
 	subset \
 	sum \
 	vangelder
+endif	# $(MMAKE_USE_MMC_MAKE) == no
+
+TESTS=$(PROGS)
+SUBDIRS=
+TESTS_DIR=..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
 
-DEPENDS = $(PROGS:%=%.depend)
-TRANS_OPTS = $(PROGS:%=$(trans_opts_subdir)%.trans_opt)
-TRANS_OPT_RESS = $(PROGS:%=%.trans_opt_res)
+%.runtest: %.trans_opt_res ;
 
 #-----------------------------------------------------------------------------#
 
@@ -85,12 +94,6 @@
 	diff -c $*.trans_opt_exp $(trans_opts_subdir)$*.trans_opt > $@
 
 #-----------------------------------------------------------------------------#
-
-depend: $(DEPENDS)
-
-trans_opts: $(TRANS_OPTS)
-
-check: $(TRANS_OPT_RESS)
 
 clean_local:
 	rm -f *.trans_opt_err
Index: tests/term/runtests
===================================================================
RCS file: tests/term/runtests
diff -N tests/term/runtests
--- tests/term/runtests	31 Jan 2001 11:34:42 -0000	1.7
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-#!/bin/sh
-# Test whether the termination analysis algorithm of the Mercury compiler
-# is working right.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../handle_options
-. ../startup
-
-eval mmake $mmakeopts depend || exit 1
-eval mmake $mmakeopts -k check
-checkstatus=$?
-
-cat *.trans_opt_res > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the term directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../shutdown
-	exit 0
-else
-	echo "the tests in the term directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tests/valid/Mercury.options
===================================================================
RCS file: tests/valid/Mercury.options
diff -N tests/valid/Mercury.options
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/valid/Mercury.options	14 Aug 2002 16:58:11 -0000
@@ -0,0 +1,85 @@
+# some regression tests only failed with particular options enabled
+# (please keep these lists sorted)
+
+# When compiling using the installed libraries, setting GRADEFLAGS may
+# may cause mgnuc to look for the `.mih' files for a non-installed grade.
+# test_mercury runs the tests using the installed libraries, so GRADEFLAGS
+# won't be set, but test_mercury runs the tests in at least one `.tr' grade
+# on all machines, so it isn't a problem.
+GRADEFLAGS-complex_failure	= $(GRADEFLAGS_TRAIL)
+GRADEFLAGS-semi_fail_in_non_ite	= $(GRADEFLAGS_TRAIL)
+
+# The `agc*' tests currently aren't run in grades for which `.mih'
+# files are created, and no header files are generated in `il' grades,
+# so it's OK to set GRADEFLAGS for these tests.
+GRADEFLAGS-agc_graph		= --gc accurate
+GRADEFLAGS-agc_ho_pred		= --gc accurate
+GRADEFLAGS-agc_ite		= --gc accurate
+GRADEFLAGS-agc_unbound_typevars	= --gc accurate
+GRADEFLAGS-agc_unbound_typevars2 = --gc accurate
+GRADEFLAGS-agc_unused_in	= --gc accurate
+GRADEFLAGS-foreign_type_spec	= --grade il
+GRADEFLAGS-foreign_type_spec.foreign	= --grade il
+
+MCFLAGS-aditi_error_bug		= --aditi
+MCFLAGS-aditi_error_bug2	= --aditi
+MCFLAGS-aditi_error_bug3	= --aditi
+MCFLAGS-aditi_query		= --aditi-only
+MCFLAGS-aditi_update		= --aditi
+MCFLAGS-base_relation		= --aditi
+MCFLAGS-base_relation2		= --aditi
+MCFLAGS-compl_unify_bug		= -O3
+MCFLAGS-context_anc		= --aditi
+MCFLAGS-deforest_bug		= -O3
+MCFLAGS-deforest_loop		= -O3 --intermodule-optimization
+MCFLAGS-deforest_rerun_det	= -O3 --check-termination
+MCFLAGS-double_vn		= -O4
+MCFLAGS-explicit_quant		= --halt-at-warn
+MCFLAGS-foreign_underscore_var	= --halt-at-warn
+MCFLAGS-higher_order_implied_mode = -O-1
+MCFLAGS-inhibit_warn_test       = --inhibit-warnings --halt-at-warn
+MCFLAGS-intermod_dcg_bug	= --intermodule-optimization
+MCFLAGS-intermod_dcg_bug2	= --intermodule-optimization
+MCFLAGS-intermod_impure		= --intermodule-optimization
+MCFLAGS-intermod_impure2	= --intermodule-optimization
+MCFLAGS-intermod_lambda		= --intermodule-optimization
+MCFLAGS-intermod_lambda2	= --intermodule-optimization
+MCFLAGS-intermod_nested_module	= --intermodule-optimization
+MCFLAGS-intermod_nested_module2	= --intermodule-optimization
+MCFLAGS-intermod_nested_module_bug = --intermodule-optimization
+MCFLAGS-intermod_nested_module_bug2 = --intermodule-optimization
+MCFLAGS-intermod_nested_uniq	= --intermodule-optimization
+MCFLAGS-intermod_nested_uniq2	= --intermodule-optimization
+MCFLAGS-intermod_pragma_import	= --intermodule-optimization
+MCFLAGS-intermod_pragma_import2	= --intermodule-optimization
+MCFLAGS-intermod_quote		= --intermodule-optimization
+MCFLAGS-intermod_quote2		= --intermodule-optimization
+MCFLAGS-intermod_record		= --intermodule-optimization
+MCFLAGS-intermod_record2	= --intermodule-optimization
+MCFLAGS-intermod_test		= --intermodule-optimization
+MCFLAGS-intermod_test2		= --intermodule-optimization
+MCFLAGS-intermod_typeclass	= --intermodule-optimization
+MCFLAGS-intermod_typeclass2	= --intermodule-optimization
+MCFLAGS-intermod_type_spec	= --intermodule-optimization
+MCFLAGS-intermod_type_spec2	= --intermodule-optimization
+MCFLAGS-intermod_user_equality	= --intermodule-optimization
+MCFLAGS-intermod_user_equality2	= --intermodule-optimization
+MCFLAGS-intermod_user_equality_nested	= --intermodule-optimization
+MCFLAGS-intermod_user_equality_nested2	= --intermodule-optimization
+MCFLAGS-ite_to_disj		= --aditi
+MCFLAGS-livevals_seq		= -O5 --opt-space
+MCFLAGS-middle_rec_labels	= --middle-rec --no-follow-vars 
+MCFLAGS-mostly_uniq_mode_inf	= --infer-all
+MCFLAGS-pred_with_no_modes	= --infer-all
+MCFLAGS-quantifier_warning	= --halt-at-warn
+MCFLAGS-simplify_bug		= -O-1
+MCFLAGS-simplify_bug2		= -O3
+MCFLAGS-spurious_purity_warning	= --halt-at-warn
+MCFLAGS-tuple_eqv               = --smart-recompilation
+MCFLAGS-two_way_unif		= -O-1
+MCFLAGS-type_inf_ambig_test	= --infer-all
+MCFLAGS-typeclass_det_warning	= --halt-at-warn
+MCFLAGS-unify_typeinfo_bug	= -O3 --no-special-preds
+MCFLAGS-uniq_mode_inf_bug	= --infer-all
+MCFLAGS-vn_float		= -O5
+MCFLAGS-zero_arity		= --infer-modes
Index: tests/valid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/valid/Mmakefile,v
retrieving revision 1.110
diff -u -u -r1.110 Mmakefile
--- tests/valid/Mmakefile	29 Jul 2002 16:28:31 -0000	1.110
+++ tests/valid/Mmakefile	14 Aug 2002 06:51:31 -0000
@@ -1,250 +1,259 @@
 #-----------------------------------------------------------------------------#
 
-main_target: all
-
-include ../Mmake.common
--include ../Mmake.params
+THIS_DIR = valid
 
 #-----------------------------------------------------------------------------#
 
 # please keep these lists sorted
-AGC_SOURCES= \
-	agc_graph.m \
-	agc_ho_pred.m \
-	agc_ite.m \
-	agc_unbound_typevars.m \
-	agc_unbound_typevars2.m \
-	agc_unused_in.m 
-
-TRAIL_SOURCES= \
-	complex_failure.m \
-	semi_fail_in_non_ite.m
-
-TYPECLASS_SOURCES= \
-	abstract_typeclass.m \
-	constraint_proof_bug.m \
-	func_method.m \
-	instance_superclass.m \
-	instance_unconstrained_tvar.m \
-	repeated_class_constraint.m \
-	typeclass_det_warning.m
-
-ADITI_SOURCES= \
-	aditi_error_bug.m \
-	aditi_update.m \
-	base_relation.m \
-	base_relation2.m \
-	context_anc.m \
-	ite_to_disj.m
+AGC_PROGS= \
+	agc_graph \
+	agc_ho_pred \
+	agc_ite \
+	agc_unbound_typevars \
+	agc_unbound_typevars2 \
+	agc_unused_in 
+
+TRAIL_PROGS= \
+	complex_failure \
+	semi_fail_in_non_ite
+
+TYPECLASS_PROGS= \
+	abstract_typeclass \
+	constraint_proof_bug \
+	func_method \
+	instance_superclass \
+	instance_unconstrained_tvar \
+	repeated_class_constraint \
+	typeclass_det_warning
+
+ADITI_PROGS= \
+	aditi_error_bug \
+	aditi_update \
+	base_relation \
+	base_relation2 \
+	context_anc \
+	ite_to_disj
 
 	# This test is compiled with --no-special-preds,
 	# which doesn't work in jump.* and fast.* grades.
-NO_SPECIAL_PREDS_SOURCES= \
-	unify_typeinfo_bug.m
+NO_SPECIAL_PREDS_PROGS= \
+	unify_typeinfo_bug
 
 	# This test does not produce a `.c' file.
-RLO_SOURCES= \
-	aditi_query.m
+RLO_PROGS= \
+	aditi_query
 
 	# Tests for which we should only produce a `.il' file.
-IL_SOURCES = \
-	foreign_type_spec.m
+IL_PROGS = \
+	foreign_type_spec
 
-OTHER_SOURCES= \
-	any_inst_merge.m \
-	common_struct_bug.m \
-	compl_unify_bug.m \
-	complicated_unify.m \
-	constrained_poly_insts.m \
-	constructor_arg_names.m \
-	dcg_test.m \
-	deforest_bug.m \
-	deforest_loop.m \
-	deforest_rerun_det.m \
-	det_condition.m \
-	det_inference.m \
-	det_switch.m \
-	double_vn.m \
-	easy_nondet_test.m \
-	easy_nondet_test_2.m \
-	empty_bound_inst_list.m \
-	empty_switch.m \
-	error.m \
-	existential_cons.m \
-	explicit_quant.m \
-	fail_ite.m \
-	followcode_det_problem.m \
-	foreign_underscore_var.m \
-	func_int_bug_main.m \
-	func_default_modes.m \
-	headvar_not_found.m \
-	higher_order.m \
-	higher_order2.m \
-	higher_order3.m \
-	higher_order_implied_mode.m \
-	ho_func_call.m \
-	ho_inst.m \
-	ho_unify.m \
-	implied_mode.m \
-	indexing.m \
-	inhibit_warn_test.m \
-	inlining_bug.m \
-	inst_perf_bug_1.m \
-	int64.m \
-	intermod_dcg_bug.m \
-	intermod_impure.m \
-	intermod_lambda.m \
-	intermod_nested_module.m \
-	intermod_nested_module_bug.m \
-	intermod_nested_uniq.m \
-	intermod_pragma_import.m \
-	intermod_quote.m \
-	intermod_record.m \
-	intermod_test.m \
-	intermod_typeclass.m \
-	intermod_type_spec.m \
-	intermod_user_equality.m \
-	intermod_user_equality_nested.m \
-	lambda_inference.m\
-	lambda_instmap_bug.m \
-	lambda_output.m \
-	lambda_quant.m \
-	lambda_quant_bug.m \
-	lambda_recompute.m \
-	lambda_struct_bug.m \
-	lambda_switch.m \
-	lambda_type.m \
-	lazy_list.m \
-	liveness_nonlocals.m \
-	livevals_seq.m \
-	loop.m \
-	loop_in_disj.m \
-	merge_ground_any.m \
-	middle_rec_labels.m \
-	modes_bug.m \
-	mode_syntax.m \
-	module_a.m \
-	module_b.m \
-	module_c.m \
-	module_d.m \
-	module_e.m \
-	mostly_uniq_bug.m \
-	mostly_uniq_neg.m \
-	mostly_uniq_mode_inf.m \
-	multidet_prune1.m \
-	multidet_test.m \
-	nasty_func_test.m \
-	nested_mod_type_bug.m \
-	nondet_live.m \
-	parsing_bug_main.m \
-	pred_with_no_modes.m \
-	qualified_cons_id.m \
-	quantifier_warning.m \
-	record_syntax_bug.m \
-	record_syntax_bug_2.m \
-	record_syntax_bug_3.m \
-	record_syntax_bug_4.m \
-	record_syntax_bug_5.m \
-	recursive_no_tag_type.m \
-	same_length_2.m \
-	semidet_disj.m \
-	shape_type.m \
-	simplify_bug.m \
-	simplify_bug2.m \
-	soln_context.m \
-	some_switch.m \
-	spurious_purity_warning.m \
-	stack_alloc.m \
-	static.m \
-	subtype_switch.m \
-	switch_detection_bug.m \
-	switch_detection_bug2.m \
-	switches.m \
-	tabled_io.m \
-	tabled_for_io.m \
-	transitive_instance.m \
-	tricky_assert2.m \
-	tricky_ite.m \
-	tuple_eqv.m \
-	two_pragma_c_codes.m \
-	two_way_unif.m \
-	typeclass_inlining_bug.m \
-	type_inf_ambig_test.m \
-	unbound_inst_var.m \
-	unbound_tvar_in_lambda.m \
-	undead_proc.m \
-	uniq_unify.m \
-	uniq_mode_inf_bug.m \
-	unreachable_code.m \
-	unused_args_test2.m \
-	vn_float.m \
-	zero_arity.m
+OTHER_PROGS= \
+	any_inst_merge \
+	common_struct_bug \
+	compl_unify_bug \
+	complicated_unify \
+	constrained_poly_insts \
+	constructor_arg_names \
+	dcg_test \
+	deforest_bug \
+	deforest_loop \
+	deforest_rerun_det \
+	det_condition \
+	det_inference \
+	det_switch \
+	double_vn \
+	easy_nondet_test \
+	easy_nondet_test_2 \
+	empty_bound_inst_list \
+	empty_switch \
+	error \
+	existential_cons \
+	explicit_quant \
+	fail_ite \
+	followcode_det_problem \
+	foreign_underscore_var \
+	func_int_bug_main \
+	func_default_modes \
+	headvar_not_found \
+	higher_order \
+	higher_order2 \
+	higher_order3 \
+	higher_order_implied_mode \
+	ho_func_call \
+	ho_inst \
+	ho_unify \
+	implied_mode \
+	indexing \
+	inhibit_warn_test \
+	inlining_bug \
+	inst_perf_bug_1 \
+	int64 \
+	intermod_dcg_bug \
+	intermod_impure \
+	intermod_lambda \
+	intermod_nested_module \
+	intermod_nested_module_bug \
+	intermod_nested_uniq \
+	intermod_pragma_import \
+	intermod_quote \
+	intermod_record \
+	intermod_test \
+	intermod_typeclass \
+	intermod_type_spec \
+	intermod_user_equality \
+	intermod_user_equality_nested \
+	lambda_inference\
+	lambda_instmap_bug \
+	lambda_output \
+	lambda_quant \
+	lambda_quant_bug \
+	lambda_recompute \
+	lambda_struct_bug \
+	lambda_switch \
+	lambda_type \
+	lazy_list \
+	liveness_nonlocals \
+	livevals_seq \
+	loop \
+	loop_in_disj \
+	merge_ground_any \
+	middle_rec_labels \
+	modes_bug \
+	mode_syntax \
+	module_a \
+	module_b \
+	module_c \
+	module_d \
+	module_e \
+	mostly_uniq_bug \
+	mostly_uniq_neg \
+	mostly_uniq_mode_inf \
+	multidet_prune1 \
+	multidet_test \
+	nasty_func_test \
+	nested_mod_type_bug \
+	nondet_live \
+	parsing_bug_main \
+	pred_with_no_modes \
+	qualified_cons_id \
+	quantifier_warning \
+	record_syntax_bug \
+	record_syntax_bug_2 \
+	record_syntax_bug_3 \
+	record_syntax_bug_4 \
+	record_syntax_bug_5 \
+	recursive_no_tag_type \
+	same_length_2 \
+	semidet_disj \
+	shape_type \
+	simplify_bug \
+	simplify_bug2 \
+	soln_context \
+	some_switch \
+	spurious_purity_warning \
+	stack_alloc \
+	static \
+	subtype_switch \
+	switch_detection_bug \
+	switch_detection_bug2 \
+	switches \
+	tabled_io \
+	tabled_for_io \
+	transitive_instance \
+	tricky_assert2 \
+	tricky_ite \
+	tuple_eqv \
+	two_pragma_c_codes \
+	two_way_unif \
+	typeclass_inlining_bug \
+	type_inf_ambig_test \
+	unbound_inst_var \
+	unbound_tvar_in_lambda \
+	undead_proc \
+	uniq_unify \
+	uniq_mode_inf_bug \
+	unreachable_code \
+	unused_args_test2 \
+	vn_float \
+	zero_arity
 
 # XXX The mode system can't handle the following test cases yet:
-#	assoc_list_bug.m
-#	determinism.m
-#	mode_merge_insts.m
-#	inst_perf_bug_2.m
+#	assoc_list_bug
+#	determinism
+#	mode_merge_insts
+#	inst_perf_bug_2
 #
 # XXX We also don't pass this one (see the comments in it for details):
-#	mode_selection.m
+#	mode_selection
 
 # The agc.* tests don't yet work in --high-level-code grades.
 ifneq "$(findstring hl,$(GRADE))" ""
-	SOURCES0 = $(TYPECLASS_SOURCES) $(OTHER_SOURCES)
+	PROGS0 = $(TYPECLASS_PROGS) $(OTHER_PROGS)
 else
-	SOURCES0 = $(AGC_SOURCES) $(TYPECLASS_SOURCES) $(OTHER_SOURCES)
+	PROGS0 = $(AGC_PROGS) $(TYPECLASS_PROGS) $(OTHER_PROGS)
 endif
 
 # Base grades `jump' and `fast'
 # cannot be used with `--no-special-preds'
 
 ifneq "$(findstring asm_,$(GRADE))" ""
-    SOURCES1=$(NO_SPECIAL_PREDS_SOURCES) $(SOURCES0)
+    PROGS1=$(NO_SPECIAL_PREDS_PROGS) $(PROGS0)
 else
     ifneq "$(findstring jump,$(GRADE))" ""
-        SOURCES1=$(SOURCES0)
+        PROGS1=$(PROGS0)
     else
         ifneq "$(findstring fast,$(GRADE))" ""
-            SOURCES1=$(SOURCES0)
+            PROGS1=$(PROGS0)
         else
-	    SOURCES1=$(NO_SPECIAL_PREDS_SOURCES) $(SOURCES0)
+	    PROGS1=$(NO_SPECIAL_PREDS_PROGS) $(PROGS0)
         endif
     endif
 endif
 
 ifneq "$(findstring .mm,$(GRADE))" ""
-    SOURCES2=$(SOURCES1)
+    PROGS2=$(PROGS1)
 else
-    SOURCES2=$(SOURCES1) $(TRAIL_SOURCES)
+    PROGS2=$(PROGS1) $(TRAIL_PROGS)
 endif
 
 # Aditi is not yet implemented for the MLDS back-end
 # (i.e. grades hl*).
 # It will never be implemented for deep profiling grades.
 ifneq "$(findstring hl,$(GRADE))$(findstring profdeep,$(GRADE))" ""
-    SOURCES=$(SOURCES2)
+    OBJ_PROGS=$(PROGS2)
 else
-    SOURCES=$(SOURCES2) $(ADITI_SOURCES)
+    OBJ_PROGS=$(PROGS2) $(ADITI_PROGS)
 endif
 
 ifneq "$(findstring profdeep,$(GRADE))" ""
-	ALL_RLO_SOURCES =
+	ALL_RLO_PROGS =
 else
-	ALL_RLO_SOURCES = $(RLO_SOURCES)
+	ALL_RLO_PROGS = $(RLO_PROGS)
 endif
 
-ALL_SOURCES = $(SOURCES) $(ALL_RLO_SOURCES) $(IL_SOURCES)
-DEPS =	$(ALL_SOURCES:%.m=%.depend)
-OBJS =	$(SOURCES:%.m=$(os_subdir)%.$O) \
-		$(ALL_RLO_SOURCES:%.m=$(rlos_subdir)%.rlo) \
-		$(IL_SOURCES:%.m=$(ils_subdir)%.il)
-PROGS =	$(SOURCES:%.m=%)
+PROGS = $(OBJ_PROGS) $(ALL_RLO_PROGS) $(IL_PROGS)
 
-all:	objs
+# `mmc --make' doesn't expect subdirectories to appear in targets.
+ifeq ($(MMAKE_USE_MMC_MAKE),yes)
+OS_SUBDIR=
+RLOS_SUBDIR=
+ILS_SUBDIR=
+else
+OS_SUBDIR=$(os_subdir)
+RLOS_SUBDIR=$(rlos_subdir)
+ILS_SUBDIR=$(ils_subdir)
+endif
 
-# some regression tests only failed with particular options enabled
-# (please keep these lists sorted)
+OBJS =	$(OBJ_PROGS:%=$(OS_SUBDIR)%.$O) \
+		$(ALL_RLO_PROGS:%=$(RLOS_SUBDIR)%.rlo) \
+		$(IL_PROGS:%=$(ILS_SUBDIR)%.il)
+
+#-----------------------------------------------------------------------------#
+
+TESTS = $(PROGS)
+SUBDIRS=
+TESTS_DIR=..
+include $(TESTS_DIR)/Mmake.common
 
 # When compiling using the installed libraries, setting GRADEFLAGS may
 # may cause mgnuc to look for the `.mih' files for a non-installed grade.
@@ -252,84 +261,24 @@
 # won't be set, but test_mercury runs the tests in at least one `.tr' grade
 # on all machines, so it isn't a problem.
 ifneq ($(origin WORKSPACE),undefined)
-GRADEFLAGS-complex_failure	= --use-trail
-GRADEFLAGS-semi_fail_in_non_ite	= --use-trail
+GRADEFLAGS_TRAIL = --use-trail
+else
+GRADEFLAGS_TRAIL =
 endif
+# Make sure GRADEFLAGS_TRAIL is passed to `mmc --make'.
+export GRADEFLAGS_TRAIL
 
-# The `agc*' tests currently aren't run in grades for which `.mih'
-# files are created, and no header files are generated in `il' grades,
-# so it's OK to set GRADEFLAGS for these tests.
-GRADEFLAGS-agc_graph		= --gc accurate
-GRADEFLAGS-agc_ho_pred		= --gc accurate
-GRADEFLAGS-agc_ite		= --gc accurate
-GRADEFLAGS-agc_unbound_typevars	= --gc accurate
-GRADEFLAGS-agc_unbound_typevars2 = --gc accurate
-GRADEFLAGS-agc_unused_in	= --gc accurate
-GRADEFLAGS-foreign_type_spec	= --grade il
-GRADEFLAGS-foreign_type_spec.foreign	= --grade il
-
-MCFLAGS-aditi_error_bug		= --aditi
-MCFLAGS-aditi_error_bug2	= --aditi
-MCFLAGS-aditi_error_bug3	= --aditi
-MCFLAGS-aditi_query		= --aditi-only
-MCFLAGS-aditi_update		= --aditi
-MCFLAGS-base_relation		= --aditi
-MCFLAGS-base_relation2		= --aditi
-MCFLAGS-compl_unify_bug		= -O3
-MCFLAGS-context_anc		= --aditi
-MCFLAGS-deforest_bug		= -O3
-MCFLAGS-deforest_loop		= -O3 --intermodule-optimization
-MCFLAGS-deforest_rerun_det	= -O3 --check-termination
-MCFLAGS-double_vn		= -O4
-MCFLAGS-explicit_quant		= --halt-at-warn
-MCFLAGS-foreign_underscore_var	= --halt-at-warn
-MCFLAGS-higher_order_implied_mode = -O-1
-MCFLAGS-inhibit_warn_test       = --inhibit-warnings --halt-at-warn
-MCFLAGS-intermod_dcg_bug	= --intermodule-optimization
-MCFLAGS-intermod_dcg_bug2	= --intermodule-optimization
-MCFLAGS-intermod_impure		= --intermodule-optimization
-MCFLAGS-intermod_impure2	= --intermodule-optimization
-MCFLAGS-intermod_lambda		= --intermodule-optimization
-MCFLAGS-intermod_lambda2	= --intermodule-optimization
-MCFLAGS-intermod_nested_module	= --intermodule-optimization
-MCFLAGS-intermod_nested_module2	= --intermodule-optimization
-MCFLAGS-intermod_nested_module_bug = --intermodule-optimization
-MCFLAGS-intermod_nested_module_bug2 = --intermodule-optimization
-MCFLAGS-intermod_nested_uniq	= --intermodule-optimization
-MCFLAGS-intermod_nested_uniq2	= --intermodule-optimization
-MCFLAGS-intermod_pragma_import	= --intermodule-optimization
-MCFLAGS-intermod_pragma_import2	= --intermodule-optimization
-MCFLAGS-intermod_quote		= --intermodule-optimization
-MCFLAGS-intermod_quote2		= --intermodule-optimization
-MCFLAGS-intermod_record		= --intermodule-optimization
-MCFLAGS-intermod_record2	= --intermodule-optimization
-MCFLAGS-intermod_test		= --intermodule-optimization
-MCFLAGS-intermod_test2		= --intermodule-optimization
-MCFLAGS-intermod_typeclass	= --intermodule-optimization
-MCFLAGS-intermod_typeclass2	= --intermodule-optimization
-MCFLAGS-intermod_type_spec	= --intermodule-optimization
-MCFLAGS-intermod_type_spec2	= --intermodule-optimization
-MCFLAGS-intermod_user_equality	= --intermodule-optimization
-MCFLAGS-intermod_user_equality2	= --intermodule-optimization
-MCFLAGS-intermod_user_equality_nested	= --intermodule-optimization
-MCFLAGS-intermod_user_equality_nested2	= --intermodule-optimization
-MCFLAGS-ite_to_disj		= --aditi
-MCFLAGS-livevals_seq		= -O5 --opt-space
-MCFLAGS-middle_rec_labels	= --middle-rec --no-follow-vars 
-MCFLAGS-mostly_uniq_mode_inf	= --infer-all
-MCFLAGS-pred_with_no_modes	= --infer-all
-MCFLAGS-quantifier_warning	= --halt-at-warn
-MCFLAGS-simplify_bug		= -O-1
-MCFLAGS-simplify_bug2		= -O3
-MCFLAGS-spurious_purity_warning	= --halt-at-warn
-MCFLAGS-tuple_eqv		= --smart-recompilation
-MCFLAGS-two_way_unif		= -O-1
-MCFLAGS-type_inf_ambig_test	= --infer-all
-MCFLAGS-typeclass_det_warning	= --halt-at-warn
-MCFLAGS-unify_typeinfo_bug	= -O3 --no-special-preds
-MCFLAGS-uniq_mode_inf_bug	= --infer-all
-MCFLAGS-vn_float		= -O5
-MCFLAGS-zero_arity		= --infer-modes
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
+
+$(OBJ_PROGS:%=%.runtest): %.runtest: %.$O ;
+
+$(ALL_RLO_PROGS:%=%.runtest): %.runtest: %.rlo ;
+
+$(IL_PROGS:%=%.runtest): %.runtest: %.il ;
+
+#-----------------------------------------------------------------------------#
 
 # XXX mmake should automatically handle these two dependencies.
 $(dates_subdir)intermod_nested_module2.date: \
@@ -337,11 +286,7 @@
 $(dates_subdir)intermod_user_equality_nested2.date: \
 	$(date0s_subdir)intermod_user_equality_nested2.date0
 
-check:	objs
-
 objs:	$(OBJS)
-
-depend: $(DEPS)
 
 printtests:
 	@echo $(PROGS)
Index: tests/valid/runtests
===================================================================
RCS file: tests/valid/runtests
diff -N tests/valid/runtests
--- tests/valid/runtests	31 Jan 2001 11:34:43 -0000	1.10
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,32 +0,0 @@
-#!/bin/sh
-# Test whether the compiler succeeds in generating code for each test.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../handle_options
-. ../startup
-
-eval mmake $mmakeopts depend || exit 1
-eval mmake $mmakeopts -k check
-checkstatus=$?
-
-objs=`eval mmake $mmakeopts printobjs`
-failed=""
-for obj in $objs
-do
-	if test ! -f "$obj"
-	then
-		failed="$failed $obj"
-	fi
-done
-
-if test "$failed" = "" -a "$checkstatus" = 0
-then
-	echo "the tests in the valid directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	. ../shutdown
-	exit 0
-else
-	echo "some tests in the valid directory failed: $failed"
-	echo "mmakeopts=$mmakeopts"
-	exit 1
-fi
Index: tests/warnings/Mercury.options
===================================================================
RCS file: tests/warnings/Mercury.options
diff -N tests/warnings/Mercury.options
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/warnings/Mercury.options	2 Aug 2002 07:10:39 -0000
@@ -0,0 +1,23 @@
+	# XXX The warnings for this module are reported twice when
+	# compiling with --intermodule-optimization due to a
+	# performance bug in the handling of assertions
+	# which causes typechecking to be run twice.
+MCFLAGS-ambiguous_overloading	= --no-intermodule-optimization
+
+	# We need to explicitly enable these optimizations because
+	# the arg_order_rearrangement warning doesn't show up at
+	# lower optimization levels.
+MCFLAGS-arg_order_rearrangment	= --introduce-accumulators \
+					--excess-assign --common-struct \
+					--trace-optimized
+
+MCFLAGS-duplicate_call		= --warn-duplicate-calls
+MCFLAGS-unused_args_test	= --warn-unused-args
+MCFLAGS-unused_import		= --warn-interface-imports
+MCFLAGS-inference_test		= --infer-all
+
+	# We need to explicitly enable these optimizations because
+	# some of the infinite recursion warnings don't show up at
+	# lower optimization levels.
+MCFLAGS-infinite_recursion	= --excess-assign --common-struct
+
Index: tests/warnings/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/warnings/Mmakefile,v
retrieving revision 1.21
diff -u -u -r1.21 Mmakefile
--- tests/warnings/Mmakefile	1 Aug 2002 00:41:40 -0000	1.21
+++ tests/warnings/Mmakefile	14 Aug 2002 05:36:39 -0000
@@ -1,9 +1,6 @@
 #-----------------------------------------------------------------------------#
 
-include ../Mmake.common
--include ../Mmake.params
-
-main_target: check
+THIS_DIR = warnings
 
 #-----------------------------------------------------------------------------#
 
@@ -26,67 +23,45 @@
 	unused_args_test \
 	unused_import
 
-#-----------------------------------------------------------------------------#
+PROGS=$(COMPILE_PROGS) $(ERRORCHECK_PROGS)
+
+TESTS = $(PROGS)
+SUBDIRS=
+TESTS_DIR=..
+include $(TESTS_DIR)/Mmake.common
+
+# Module-specific options should go in Mercury.options so they
+# can be found by `mmc --make'.
+include Mercury.options
+
+# With `mmc --make', the errors should only go to the 
+# `.err' files, not stderr.
+MCFLAGS += --output-compile-error-lines 0
 
-# some files need to be compiled with special options
+$(COMPILE_PROGS:%=%.runtest): %.runtest: %.res_compile ;
 
-	# XXX The warnings for this module are reported twice when
-	# compiling with --intermodule-optimization due to a
-	# performance bug in the handling of assertions
-	# which causes typechecking to be run twice.
-MCFLAGS-ambiguous_overloading	= --no-intermodule-optimization
-
-	# We need to explicitly enable these optimizations because
-	# the arg_order_rearrangement warning doesn't show up at
-	# lower optimization levels.
-MCFLAGS-arg_order_rearrangment	= --introduce-accumulators \
-					--excess-assign --common-struct \
-					--trace-optimized
-
-MCFLAGS-duplicate_call		= --warn-duplicate-calls
-MCFLAGS-unused_args_test	= --warn-unused-args
-MCFLAGS-unused_import		= --warn-interface-imports
-MCFLAGS-inference_test		= --infer-all
-
-	# We need to explicitly enable these optimizations because
-	# some of the infinite recursion warnings don't show up at
-	# lower optimization levels.
-MCFLAGS-infinite_recursion	= --excess-assign --common-struct
+$(ERRORCHECK_PROGS:%=%.runtest): %.runtest: %.res_error ;
 
 #-----------------------------------------------------------------------------#
 
 %.res_error:	%.exp %.err
 	-rm -f $@
-	diff -c $*.exp $*.err > $@
+	diff -c $*.exp $*.err > $@ || { cat $@ && exit 1; }
 
-%.res_compile:	%.exp $(cs_subdir)%.c
+%.res_compile:	%.exp %.c
 	-rm -f $@
-	diff -c $*.exp $*.err > $@
+	diff -c $*.exp $*.err > $@ || { cat $@ && exit 1; }
 
-#-----------------------------------------------------------------------------#
-
-PROGS=$(COMPILE_PROGS) $(ERRORCHECK_PROGS)
-DEPENDS=$(PROGS:%=%.depend)
-
-RES_ERRORS=	$(ERRORCHECK_PROGS:%=%.res_error)
-RES_COMPILES=	$(COMPILE_PROGS:%=%.res_compile)
+ifeq ($(MMAKE_USE_MMC_MAKE),yes)
+%.c: %.m
+	$(MCM) $@
+endif
 
 #-----------------------------------------------------------------------------#
 
-depend:	$(DEPENDS)
-
-check:	$(RES_COMPILES) $(RES_ERRORS)
-
-all:	$(PROGS)
-
 clean_local:	clean_err clean_res
 
-clean_mc: clean_c clean_o clean_err clean_res
-
 clean_err:
 	rm -f *.err
-
-clean_res:
-	rm -f *.res_compile *.res_error
 
 #-----------------------------------------------------------------------------#
Index: tests/warnings/runtests
===================================================================
RCS file: tests/warnings/runtests
diff -N tests/warnings/runtests
--- tests/warnings/runtests	31 Jan 2001 11:34:44 -0000	1.10
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,26 +0,0 @@
-#!/bin/sh
-# Test whether the compiler is producing the right warnings.
-# Return a status of 0 (true) if everything is all right, and 1 otherwise.
-
-. ../handle_options
-. ../startup
-
-eval mmake $mmakeopts depend || exit 1
-eval mmake $mmakeopts -k check
-checkstatus=$?
-
-cat *.res_compile *.res_error > .allres
-if test ! -s .allres -a "$checkstatus" = 0
-then
-	echo "the tests in the warnings directory succeeded"
-	echo "mmakeopts=$mmakeopts"
-	rm -f .allres
-	. ../shutdown
-	exit 0
-else
-	echo "the tests in the warnings directory failed"
-	echo "mmakeopts=$mmakeopts"
-	echo "the differences are:"
-	cat .allres
-	exit 1
-fi
Index: tools/bootcheck
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/bootcheck,v
retrieving revision 1.133
diff -u -u -r1.133 bootcheck
--- tools/bootcheck	9 Aug 2002 07:00:47 -0000	1.133
+++ tools/bootcheck	14 Aug 2002 16:46:56 -0000
@@ -967,7 +967,7 @@
 
 	if test "$test_grade" != ""
 	then
-		test_grade_opt="-g $test_grade"
+		test_grade_opt="GRADE=$test_grade"
 	else
 		test_grade_opt=""
 	fi
@@ -998,12 +998,13 @@
 		if test "$testdirs" = ""
 		then
 			cd ${tests_prefix}tests
-			./runtests $target_opt $jfactor $test_grade_opt
+			mmake $target_opt $jfactor $test_grade_opt runtests
 		else
 			for testdir in $testdirs
 			do
 				cd $root/${tests_prefix}tests/$testdir
-				./runtests $target_opt $jfactor $test_grade_opt
+				mmake $target_opt $jfactor \
+					$test_grade_opt runtests
 			done
 		fi
 		test_status=$?
Index: tools/run_all_tests_from_cron
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/run_all_tests_from_cron,v
retrieving revision 1.48
diff -u -u -r1.48 run_all_tests_from_cron
--- tools/run_all_tests_from_cron	30 Apr 2002 06:06:46 -0000	1.48
+++ tools/run_all_tests_from_cron	14 Aug 2002 10:04:49 -0000
@@ -137,8 +137,10 @@
 
 mv -f $tm_dir/logs/old/$logname $tm_dir/logs/old2 2>/dev/null
 mv -f $tm_dir/logs/old/$logname.errs $tm_dir/logs/old2 2>/dev/null
+mv -f $tm_dir/logs/old/$logname.test_errs $tm_dir/logs/old2 2>/dev/null
 mv -f $tm_dir/logs/$logname $tm_dir/logs/old 2>/dev/null
 mv -f $tm_dir/logs/$logname.errs $tm_dir/logs/old 2>/dev/null
+mv -f $tm_dir/logs/$logname.test_errs $tm_dir/logs/old 2>/dev/null
 logfile="$tm_dir/logs/$logname"
 
 if nice -5 sh $tmpscript $HOST $ARCH $FULLARCH $BRANCH $C_COMPILER \
@@ -153,6 +155,12 @@
 		rm -f $logfile.errs
 		echo "test passed"
 	fi
+	if [ ! -s $logfile.test_errs ]; then
+		test_status="FAILED"
+		echo "Error: test passed but $logfile.test_errs not empty"
+	else
+		rm -f $logfile.test_errs
+	fi
 	echo
 	case $HOST in
 		hg) base=/home/hg ;;
@@ -173,12 +181,22 @@
 	echo test FAILED
 	echo log file in $logfile
 	echo log file summary in $logfile.errs
+	echo test failure summary in $logfile.test_errs
 fi
 
-if [ -s $logfile.errs ]; then
-	echo
-	echo first 100 lines of log file summary:
-	head -100 $logfile.errs
+if [ -f $logfile.errs -o -f $logfile.test_errs ]; then
+	if [ ! -f $logfile.errs ]; then
+		# Failures building the compiler or library should
+		# occur early in the log summary.
+		echo first 10 lines of log file summary:
+		head -10 $logfile.errs
+		echo
+		echo
+	fi
+	if [ ! -f $logfile.test_errs ]; then
+		echo first 100 test failures:
+		grep "FAILED TEST" $logfile.test_errs | head - 100
+	fi
 elif [ $test_status = "FAILED" ]; then
 	echo
 	echo last 20 lines of log file:
Index: tools/test_mercury
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/test_mercury,v
retrieving revision 1.183
diff -u -u -r1.183 test_mercury
--- tools/test_mercury	13 Aug 2002 10:04:46 -0000	1.183
+++ tools/test_mercury	14 Aug 2002 10:24:49 -0000
@@ -853,12 +853,23 @@
 # 	*) ;;
 # esac
 
+case "$C_COMPILER" in
+        gcc)    test_error_file="test-$BRANCH-$HOST.test_errs" ;;
+        *)      test_error_file="test-$BRANCH-$HOST-$C_COMPILER.test_errs" ;;
+esac
+rm -f $test_error_file
 for grade in $GRADES
 do
 	echo "test_mercury starting tests for grade $grade at `date`" 1>&2
-	./runtests -f "$TEST_MCFLAGS" -c "$TEST_CFLAGS" -g "$grade" \
-		-m "$TEST_MGNUCFLAGS" -l "$TEST_MLFLAGS" \
-		$PARALLEL || status=1
+	mmake GRADE="$grade" \
+		EXTRA_MCFLAGS="$TEST_MCFLAGS" \
+		EXTRA_CFLAGS="$TEST_CFLAGS" \
+		EXTRA_MGNUCFLAGS="$TEST_MGNUCFLAGS" \
+		EXTRA_MLFLAGS="$TEST_MLFLAGS" \
+		$PARALLEL runtests || status=1
+	if [ -f runtests.errs ]; then
+		cat runtest.errs >> $test_error_file
+	fi
 	case $grade in
 		*.memprof*)
 			# we need to set LD_BIND_NOW=1
@@ -900,11 +911,18 @@
 	# XXX Note that some of these tests are currently expected to fail
 	# with `--target asm' (in particular the tests of tabling and
 	# nested modules), so we don't set status=1 if these tests fail.
-	./runtests --target asm -f "$TEST_MCFLAGS" -c "$TEST_CFLAGS" \
-		-g hlc.gc -m "$TEST_MGNUCFLAGS" -l "$TEST_MLFLAGS" \
-		$PARALLEL
+	mmake --target asm GRADE=hlc.gc \
+		EXTRA_MCFLAGS="$TEST_MCFLAGS" \
+		EXTRA_CFLAGS="$TEST_CFLAGS" \
+		EXTRA_MGNUCFLAGS="$TEST_MGNUCFLAGS" \
+		EXTRA_MLFLAGS="$TEST_MLFLAGS" \
+		$PARALLEL runtests
+	if [ -f runtests.errs ]; then
+		cat runtest.errs >> $test_error_file
+	fi
 	;;
 esac
+
 cd ..
 
 #-----------------------------------------------------------------------------#
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list