[m-rev.] for review: grade java testing

Michael Wybrow mjwybrow at students.cs.mu.oz.au
Sat Feb 23 02:12:47 AEDT 2002


For review by Fergus.

NOTE:  Even if there are no problems with this diff, I will still need to
	address the problem with building the java directory links (that
	Simon discovered last night) before I can commit this change.
       I have tested the `runtests' code but not the changes to
	test_mercury. It looked to me that if I ran test_mercury and
	there was a problem I could wrongly tag the rotd unstable, etc.
	Is there a safe way to test this script? 

Michael.

===================================================================

Estimated hours taken: 8
Branches: main

Add some Java testing to the nightly tests.

mercury/tools/test_mercury:
	Set-up the required CLASSPATH variable.
	Add the testing grade `java' to earth.

tests/Mmake.common:
	Added a rule to build `.out' files when the grade is java.

tests/benchmarks/Mmakefile:
	Enable the working java test cases for the benchmark directory.  

tests/debugger/Mmakefile:
tests/debugger/declarative/Mmakefile:
tests/general/Mmakefile:
tests/general/accumulator/Mmakefile:
tests/general/structure_reuse/Mmakefile:
tests/hard_coded/Mmakefile:
tests/hard_coded/exceptions/Mmakefile:
tests/hard_coded/purity/Mmakefile:
tests/hard_coded/sub-modules/Mmakefile:
tests/hard_coded/typeclasses/Mmakefile:
tests/invalid/Mmakefile:
tests/invalid/purity/Mmakefile:
tests/term/Mmakefile:
tests/valid/Mmakefile:
	Disable test cases for grade java.

tests/general/accumulator/runtests:
	Workaround for a bug caused when we don't run any test cases in the
	general/accumulator directory.

tests/recompilation/runtests:
	Disable recompilation testing for grade java.

tests/recompilation/test_functions:
	Add framework needed to do recompilation testing for the java grade.

Index: mercury/tools/test_mercury
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/test_mercury,v
retrieving revision 1.176
diff -u -r1.176 test_mercury
--- mercury/tools/test_mercury	21 Dec 2001 04:42:27 -0000	1.176
+++ mercury/tools/test_mercury	22 Feb 2002 07:54:34 -0000
@@ -195,6 +195,10 @@
 HOSTDIR=$TESTDIR/test_dirs/$HOST
 DIR=$HOSTDIR/build.$BRANCH.$C_COMPILER
 
+# Set-up the class path needed for java testing.
+CLASSPATH=$DIR/mercury/java:.
+export CLASSPATH
+
 case $HOST in
 	hg|ender|roy|venus|earth|mars|ceres) 	
 		INSTALL_DIR=/home/$HOST/public/$INSTALL_DIR_NAME/$FULLARCH ;;
@@ -770,7 +774,7 @@
 	earth)	GRADES="asm_fast.gc asm_fast
 			asm_fast.gc.prof asm_fast.prof
 			asm_fast.gc.memprof asm_fast.gc.tr asm_fast.gc.tr.debug
-			hlc.gc hlc.par.gc"
+			hlc.gc hlc.par.gc java"
 		;;
 
 	mars)	GRADES="asm_fast.gc asm_fast
Index: tests/Mmake.common
===================================================================
RCS file: /home/mercury1/repository/tests/Mmake.common,v
retrieving revision 1.22
diff -u -r1.22 Mmake.common
--- tests/Mmake.common	29 Jun 2001 08:10:42 -0000	1.22
+++ tests/Mmake.common	22 Feb 2002 13:42:13 -0000
@@ -34,9 +34,19 @@
 # to print out the contents, because that precedes each line of output with
 # the filename, which is helpful when running a parallel make.
 #
+ifneq "$(findstring java,$(GRADE))" ""
+
+%.out: %.class
+	{ [ -f $*.inp ] && cat $*.inp; } | java `basename $< .class` > $@ 2>&1 \
+		|| { grep . $@ /dev/null; exit 1; }
+
+else
+
 %.out: %
 	{ [ -f $*.inp ] && cat $*.inp; } | ./$< > $@ 2>&1 || \
 		{ grep . $@ /dev/null; exit 1; }
+
+endif
 
 #
 # For some test cases, there is more than one valid output.
Index: tests/benchmarks/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/benchmarks/Mmakefile,v
retrieving revision 1.4
diff -u -r1.4 Mmakefile
--- tests/benchmarks/Mmakefile	19 Dec 2001 15:08:28 -0000	1.4
+++ tests/benchmarks/Mmakefile	22 Feb 2002 12:00:32 -0000
@@ -20,18 +20,29 @@
 
 #-----------------------------------------------------------------------------#
 
-PROGS=	\
+JAVA_PROGS= \
 	cqueens \
 	crypt \
 	deriv \
 	deriv2 \
 	nrev \
-	poly \
 	primes \
 	qsort \
 	queens \
 	query \
 	tak
+
+# XXX These test cases don't work in Java yet
+NONJAVA_PROGS= \
+	poly
+
+ifeq "$(findstring java,$(GRADE))" "java"
+	PROGS=$(JAVA_PROGS)
+else
+	PROGS=$(JAVA_PROGS) $(NONJAVA_PROGS)
+endif
+
+#-----------------------------------------------------------------------------#
 
 DEPENDS=$(PROGS:%=%.depend)
 DEPS=	$(PROGS:%=%.dep)
Index: tests/debugger/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/Mmakefile,v
retrieving revision 1.62
diff -u -r1.62 Mmakefile
--- tests/debugger/Mmakefile	20 Feb 2002 03:14:44 -0000	1.62
+++ tests/debugger/Mmakefile	22 Feb 2002 13:31:46 -0000
@@ -73,8 +73,9 @@
 # doesn't and will not work in deep profiling grades (profdeep).
 # Also base grades `jump' and `fast' cannot be used with
 # stack layouts (which are required for tracing).
+# We currently don't do any testing in grade java on this directory.
 
-ifneq "$(findstring hl,$(GRADE))" ""
+ifneq "$(findstring hl,$(GRADE))$(findstring java,$(GRADE))" ""
     PROGS=
 else
     ifneq "$(findstring profdeep,$(GRADE))" ""
Index: tests/debugger/declarative/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mmakefile,v
retrieving revision 1.32
diff -u -r1.32 Mmakefile
--- tests/debugger/declarative/Mmakefile	19 Dec 2001 15:08:29 -0000	1.32
+++ tests/debugger/declarative/Mmakefile	22 Feb 2002 13:33:07 -0000
@@ -70,8 +70,9 @@
 # stack layouts (which are required for tracing).
 # Currently, declarative debugging does not work in `rt' grades.
 # Also, declarative debugging only works in `.gc' grades.
+# We currently don't do any testing in grade java on this directory.
 
-ifeq "$(findstring hl,$(GRADE))$(findstring profdeep,$(GRADE))" ""
+ifeq "$(findstring hl,$(GRADE))$(findstring profdeep,$(GRADE))$(findstring java,$(GRADE))" ""
     ifneq "$(findstring .gc,$(GRADE))" ""
         ifneq "$(findstring rt,$(GRADE))" ""
 	    PROGS=
Index: tests/general/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/general/Mmakefile,v
retrieving revision 1.38
diff -u -r1.38 Mmakefile
--- tests/general/Mmakefile	12 Feb 2002 15:47:57 -0000	1.38
+++ tests/general/Mmakefile	22 Feb 2002 11:58:30 -0000
@@ -16,7 +16,7 @@
 
 # Any program added here should also be added to the `.cvsignore' file.
 
-PROGS=		\
+GENERAL_PROGS=	\
 		arithmetic \
 		array_test \
 		commit_bug \
@@ -72,6 +72,13 @@
 		unreachable \
 		unsafe_uniqueness \
 		unused_arg_determinism
+
+# We currently don't do any testing in grade java on this directory.
+ifeq "$(findstring java,$(GRADE))" "java"
+	PROGS=
+else
+	PROGS=$(GENERAL_PROGS)
+endif
 
 # dnf.m does not work in non-gc grades, because it uses `pragma memo'
 # (i.e. tabling) and tabling is not yet implemented for non-gc grades.
Index: tests/general/accumulator/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/general/accumulator/Mmakefile,v
retrieving revision 1.17
diff -u -r1.17 Mmakefile
--- tests/general/accumulator/Mmakefile	30 Jan 2002 05:09:07 -0000	1.17
+++ tests/general/accumulator/Mmakefile	22 Feb 2002 11:58:50 -0000
@@ -16,7 +16,8 @@
 
 # Any program added here should also be added to the `.cvsignore' file.
 
-PROGS=		base		\
+ACCUMULATOR_PROGS= \
+		base		\
 		call_in_base	\
 		chain		\
 		commutative	\
@@ -36,6 +37,14 @@
 		simple		\
 		split		\
 		swap
+
+# We currently don't do any testing in grade java on this directory.
+ifeq "$(findstring java,$(GRADE))" "java"
+	PROGS=
+else
+	PROGS=$(ACCUMULATOR_PROGS)
+endif
+
 
 ACC_FLAGS = -d accum --introduce-accumulators --optimize-constructor-last-call \
 		--intermodule-optimization
Index: tests/general/accumulator/runtests
===================================================================
RCS file: /home/mercury1/repository/tests/general/accumulator/runtests,v
retrieving revision 1.10
diff -u -r1.10 runtests
--- tests/general/accumulator/runtests	31 Jan 2001 11:34:31 -0000	1.10
+++ tests/general/accumulator/runtests	21 Feb 2002 06:18:06 -0000
@@ -19,7 +19,17 @@
 eval mmake $mmakeopts -k check
 checkstatus=$?
 
-cat *.res > .allres
+# we can't just use `cat *.res > .allres' since there might not be
+# any files that match *.res
+res_files=*.res
+case $res_files in
+    "*.res")  
+              echo "the tests in the general/accumulator directory were disabled"
+              echo "mmakeopts=$mmakeopts"
+              . ../../shutdown;
+              exit 0 ;;
+    *)        cat *.res > .allres ;;
+esac
 if test ! -s .allres -a "$checkstatus" = 0
 then
     grep -h "% mode.*AccFrom" *hlds*acc* | \
Index: tests/general/structure_reuse/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/general/structure_reuse/Mmakefile,v
retrieving revision 1.2
diff -u -r1.2 Mmakefile
--- tests/general/structure_reuse/Mmakefile	30 Mar 2001 13:57:51 -0000	1.2
+++ tests/general/structure_reuse/Mmakefile	22 Feb 2002 11:59:09 -0000
@@ -16,9 +16,18 @@
 
 # Any program added here should also be added to the `.cvsignore' file.
 
-PROGS=	if_then_else		\
+STRUCTURE_REUSE_PROGS=	\
+	if_then_else		\
 	internal_alias		\
 	interpret
+
+# We currently don't do any testing in grade java on this directory.
+ifeq "$(findstring java,$(GRADE))" "java"
+	PROGS=
+else
+	PROGS=$(STRUCTURE_REUSE_PROGS)
+endif
+
 
 MCFLAGS-interpret=--cell-cache
 
Index: tests/hard_coded/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.143
diff -u -r1.143 Mmakefile
--- tests/hard_coded/Mmakefile	30 Jan 2002 05:09:08 -0000	1.143
+++ tests/hard_coded/Mmakefile	22 Feb 2002 11:50:17 -0000
@@ -207,12 +207,19 @@
 	endif
 endif
 
-PROGS = $(ORDINARY_PROGS) $(EXCEPTION_PROGS) $(BACKEND_PROGS) $(NONDET_C_PROGS)
+# We currently don't do any testing in grade java on this directory.
+ifeq "$(findstring java,$(GRADE))" "java"
+	PROGS=
+else
+	PROGS = $(ORDINARY_PROGS) $(EXCEPTION_PROGS) \
+		$(BACKEND_PROGS) $(NONDET_C_PROGS)
+endif
 
 # --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.
-ifeq "$(findstring hl,$(GRADE))$(findstring profdeep,$(GRADE))" ""
+# We currently don't test this in grade java either.
+ifeq "$(findstring hl,$(GRADE))$(findstring profdeep,$(GRADE))$(findstring java,$(GRADE))" ""
 	SPLIT_PROGS = split_c_files
 else
 	SPLIT_PROGS =
Index: tests/hard_coded/exceptions/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/exceptions/Mmakefile,v
retrieving revision 1.9
diff -u -r1.9 Mmakefile
--- tests/hard_coded/exceptions/Mmakefile	1 Feb 2002 22:09:14 -0000	1.9
+++ tests/hard_coded/exceptions/Mmakefile	22 Feb 2002 11:55:59 -0000
@@ -36,8 +36,9 @@
 
 # Deep profiling grades cannot yet handle catching exceptions, either
 # explicitly or implicitly by the runtime system.
+# We currently don't do any testing in grade java on this directory.
 
-ifneq "$(findstring profdeep,$(GRADE))" ""
+ifneq "$(findstring profdeep,$(GRADE))$(findstring java,$(GRADE))" ""
 	PROGS=
 else
 	PROGS=$(EXCEPTION_PROGS)
Index: tests/hard_coded/purity/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/purity/Mmakefile,v
retrieving revision 1.1
diff -u -r1.1 Mmakefile
--- tests/hard_coded/purity/Mmakefile	22 Apr 2000 07:12:34 -0000	1.1
+++ tests/hard_coded/purity/Mmakefile	22 Feb 2002 11:55:37 -0000
@@ -6,10 +6,19 @@
 
 #-----------------------------------------------------------------------------#
 
-PROGS=	\
+PURITY_PROGS= \
 	purity \
 	impure_func_t1 \
 	impure_func_t6 
+
+
+# We currently don't do any testing in grade java on this directory.
+
+ifeq "$(findstring java,$(GRADE))" "java"
+	PROGS=
+else
+	PROGS=$(PURITY_PROGS)
+endif
 
 #-----------------------------------------------------------------------------#
 
Index: tests/hard_coded/sub-modules/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/sub-modules/Mmakefile,v
retrieving revision 1.4
diff -u -r1.4 Mmakefile
--- tests/hard_coded/sub-modules/Mmakefile	15 Nov 2001 15:01:30 -0000	1.4
+++ tests/hard_coded/sub-modules/Mmakefile	22 Feb 2002 11:56:35 -0000
@@ -17,7 +17,7 @@
 # if you use parallel make.
 #
 
-PROGS=	\
+SUB_MODULE_PROGS= \
 	use_submodule \
 	parent \
 	parent2 \
@@ -29,6 +29,14 @@
 
 MCFLAGS-nested_intermod	=	--intermodule-optimization
 MCFLAGS-nested_intermod_main =	--intermodule-optimization
+
+# We currently don't do any testing in grade java on this directory.
+
+ifeq "$(findstring java,$(GRADE))" "java"
+	PROGS=
+else
+	PROGS=$(SUB_MODULE_PROGS)
+endif
 
 #-----------------------------------------------------------------------------#
 
Index: tests/hard_coded/typeclasses/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/typeclasses/Mmakefile,v
retrieving revision 1.44
diff -u -r1.44 Mmakefile
--- tests/hard_coded/typeclasses/Mmakefile	12 Feb 2001 05:14:57 -0000	1.44
+++ tests/hard_coded/typeclasses/Mmakefile	22 Feb 2002 11:56:58 -0000
@@ -7,7 +7,7 @@
 
 #-----------------------------------------------------------------------------#
 
-PROGS=	\
+TYPECLASSES_PROGS= \
 	constrained_lambda \
 	extract_typeinfo \
 	exist_disjunction \
@@ -83,6 +83,14 @@
 MCFLAGS-module_test_m1 = --infer-all
 MCFLAGS-module_test_m2 = --infer-all
 MCFLAGS-module_test = --infer-all
+
+# We currently don't do any testing in grade java on this directory.
+
+ifeq "$(findstring java,$(GRADE))" "java"
+	PROGS=
+else
+	PROGS=$(TYPECLASSES_PROGS)
+endif
 
 #-----------------------------------------------------------------------------#
 
Index: tests/invalid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/Mmakefile,v
retrieving revision 1.102
diff -u -r1.102 Mmakefile
--- tests/invalid/Mmakefile	11 Feb 2002 10:29:08 -0000	1.102
+++ tests/invalid/Mmakefile	22 Feb 2002 12:18:24 -0000
@@ -128,7 +128,14 @@
 	uu_type.m \
 	vars_in_wrong_places.m
 
-SOURCES= $(SINGLEMODULE_SOURCES) $(MULTIMODULE_SOURCES)
+
+# We currently don't do any testing in grade java on this directory.
+
+ifeq "$(findstring java,$(GRADE))" "java"
+	SOURCES=
+else
+	SOURCES= $(SINGLEMODULE_SOURCES) $(MULTIMODULE_SOURCES)
+endif
 
 # we do not yet pass the following tests:
 #	duplicate_instance_3 (the error is only detected when doing
Index: tests/invalid/purity/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/purity/Mmakefile,v
retrieving revision 1.2
diff -u -r1.2 Mmakefile
--- tests/invalid/purity/Mmakefile	13 Jul 2001 17:35:10 -0000	1.2
+++ tests/invalid/purity/Mmakefile	22 Feb 2002 12:20:07 -0000
@@ -6,7 +6,7 @@
 
 #-----------------------------------------------------------------------------#
 
-SOURCES= \
+PURITY_SOURCES= \
 	impure_func_t2.m \
 	impure_func_t3.m \
 	impure_func_t4.m \
@@ -17,6 +17,16 @@
 	purity.m \
 	purity_nonsense.m \
 	purity_type_error.m
+
+
+# We currently don't do any testing in grade java on this directory.
+
+ifeq "$(findstring java,$(GRADE))" "java"
+	SOURCES=
+else
+	SOURCES= $(PURITY_SOURCES)
+endif
+
 
 DEPS=		$(SOURCES:%.m=%.dep)
 DEPENDS=	$(SOURCES:%.m=%.depend)
Index: tests/recompilation/runtests
===================================================================
RCS file: /home/mercury1/repository/tests/recompilation/runtests,v
retrieving revision 1.4
diff -u -r1.4 runtests
--- tests/recompilation/runtests	3 Aug 2001 16:22:45 -0000	1.4
+++ tests/recompilation/runtests	22 Feb 2002 13:48:37 -0000
@@ -11,6 +11,13 @@
 		;;
 esac
 
+case "$mmakeopts" in
+	*java*)	
+    echo "the tests in the recompilation directory were disabled"
+		exit 0
+		;;
+esac
+
 . ../startup
 
 . ./TESTS
Index: tests/recompilation/test_functions
===================================================================
RCS file: /home/mercury1/repository/tests/recompilation/test_functions,v
retrieving revision 1.5
diff -u -r1.5 test_functions
--- tests/recompilation/test_functions	31 Jul 2001 16:59:48 -0000	1.5
+++ tests/recompilation/test_functions	21 Feb 2002 06:40:57 -0000
@@ -125,6 +125,17 @@
 	output_file_version=$1
 	mmake_should_fail=$2
 
+	# XXX This is a hacky way of testing for Java grades
+	echo "mmakeopts=$mmakeopts"
+	case $mmakeopts in
+		*java*)	target=$main_module.classes
+			run_target="java $main_module"
+			;;
+		*)	target=$main_module
+			run_target="./$main_module"
+			;;
+	esac
+
 	case $mmake_should_fail in
 	    true)	
 		#
@@ -134,10 +145,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 $mmakeopts -k $target > $failing_make_output 2>&1
 		;;
 	    false)
-		eval mmake $mmakeopts $main_module
+		eval mmake $mmakeopts $target
 		;;
 	esac
 
@@ -146,19 +157,19 @@
 		case $mmake_should_fail in
 		    true)
 			echo \
-	"** Error: mmake $mmakeopts $main_module succeeded where it should fail"
+	"** Error: mmake $mmakeopts $target succeeded where it should fail"
 			exit 1
 			;;
 		esac
 
-		./$main_module > $main_module.out
+		$run_target > $main_module.out
 		compare_files $main_module.exp.$output_file_version \
 				$main_module.out 
 		;;
 	    *)
 		case $mmake_should_fail in
 		    false)
-			echo "** Error: mmake $mmakeopts $main_module failed"
+			echo "** Error: mmake $mmakeopts $target failed"
 			exit 1
 			;;
 		esac
Index: tests/term/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/term/Mmakefile,v
retrieving revision 1.16
diff -u -r1.16 Mmakefile
--- tests/term/Mmakefile	5 Apr 2000 06:11:36 -0000	1.16
+++ tests/term/Mmakefile	22 Feb 2002 12:13:01 -0000
@@ -7,7 +7,7 @@
 
 #-----------------------------------------------------------------------------#
 
-PROGS=	\
+TERM_PROGS= \
 	ack \
 	append \
 	arit_exp \
@@ -62,6 +62,16 @@
 	subset \
 	sum \
 	vangelder
+
+
+# We currently don't do any testing in grade java on this directory.
+
+ifeq "$(findstring java,$(GRADE))" "java"
+	PROGS=
+else
+	PROGS=$(TERM_PROGS)
+endif
+
 
 DEPENDS = $(PROGS:%=%.depend)
 TRANS_OPTS = $(PROGS:%=$(trans_opts_subdir)%.trans_opt)
Index: tests/valid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/valid/Mmakefile,v
retrieving revision 1.95
diff -u -r1.95 Mmakefile
--- tests/valid/Mmakefile	4 Jan 2002 05:56:40 -0000	1.95
+++ tests/valid/Mmakefile	22 Feb 2002 12:12:00 -0000
@@ -212,12 +212,20 @@
 # (i.e. grades hl*).
 # It will never be implemented for deep profiling grades.
 ifneq "$(findstring hl,$(GRADE))$(findstring profdeep,$(GRADE))" ""
-    SOURCES=$(SOURCES2)
+    SOURCES3=$(SOURCES2)
 else
-    SOURCES=$(SOURCES2) $(ADITI_SOURCES)
+    SOURCES3=$(SOURCES2) $(ADITI_SOURCES)
 endif
 
-ifneq "$(findstring profdeep,$(GRADE))" ""
+# We currently don't do any testing in grade java on this directory.
+ifeq "$(findstring java,$(GRADE))$" "java"
+    SOURCES=
+else
+    SOURCES=$(SOURCES3)
+endif
+
+
+ifneq "$(findstring profdeep,$(GRADE))$(findstring java,$(GRADE))" ""
 	ALL_RLO_SOURCES =
 else
 	ALL_RLO_SOURCES = $(RLO_SOURCES)

--------------------------------------------------------------------------
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