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

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Jan 10 21:24:32 AEDT 2003


On 10-Jan-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 10-Jan-2003, Michael Wybrow <mjwybrow at cs.mu.OZ.AU> wrote:
> > 
> > I do have a couple of questions:
> > Why are some entire directories in the test suite disabled? (i.e. Why is
> > the recompilation directory not listed in `tests/Mmakefile'.)
> > If this is intentional where is it documented?
> 
> Good questions.  The "dppd" is also not included.
...
> Pete, what about the "dppd" directory?
> Any objections to my re-enabling the tests in that directory?

That is, any objections to the following diff?

----------

Estimated hours taken: 2
Branches: main

Clean up tests/dppd so that it uses the new test suite framework properly,
all the tests are enabled, and all tests pass.

tests/dppd/Mmakefile:
	- Don't set MLFLAGS = --static.
	- Add "%.runtest: %.res", as required by tests/Mmake.common.
	- Likewise set THIS_DIR, TESTS, and SUBDIRS, as required by
	  tests/Mmake.common.  TESTS is set to just the single test "run",
	  which is actually a Mercury test harness which invokes all the tests.
	- Delete the rule "default_target: run", since the default target
	  is handled by tests/Mmake.common.

tests/dppd/grammar.m:
tests/dppd/grammar_impl.m:
	Fix various type, mode, and determinism errors.
	(Apparently this test had not yet been fully converted to Mercury.)
	
tests/dppd/run.m:
	- Enable the "grammar", "ssuply", and "maxlength" tests.
	- Don't define the inst "pair/2", since that is defined in std_util.m.
	- Use "garbage_collect" from the standard library "gc" module,
	  rather than defining our own version of "collect" here, since it is
	  now defined in the standard library, and the definition here was
	  broken for grades that don't use conservative GC.

tests/dppd/map_reduce.m:
	Work around a Mercury compiler bug, due to the lack of support for
	partially instantiated data structures.

tests/dppd/bug.m:
	Add some XXX comments.

Workspace: /home/ceres/fjh/mercury
Index: tests/dppd/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/dppd/Mmakefile,v
retrieving revision 1.3
diff -u -d -r1.3 Mmakefile
--- tests/dppd/Mmakefile	17 Aug 2002 13:52:04 -0000	1.3
+++ tests/dppd/Mmakefile	10 Jan 2003 09:56:08 -0000
@@ -1,16 +1,23 @@
-TESTS_DIR=..
+THIS_DIR = dppd
+TESTS_DIR = ..
+SUBDIRS =
+# For this directory, rather than having a separate main
+# for each test, there is a single Mercury test harness which
+# invokes all of the different tests.
+TESTS = run
 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=#--pd --no-inlining -d 35 -D petdr #-d 99
 #GRADE=asm_fast.gc.prof
-MLFLAGS=--static
-
-default_target:	run
+#MLFLAGS=--static
 
 clean:	run.clean
 realclean:	run.realclean
 depend:	run.depend
+
Index: tests/dppd/bug.m
===================================================================
RCS file: /home/mercury1/repository/tests/dppd/bug.m,v
retrieving revision 1.1
diff -u -d -r1.1 bug.m
--- tests/dppd/bug.m	20 Feb 1999 11:34:16 -0000	1.1
+++ tests/dppd/bug.m	10 Jan 2003 10:00:02 -0000
@@ -1,3 +1,10 @@
+% XXX The Mercury compiler reports a spurious mode error for this code,
+%     due to the lack of support for partially instantiated data
+%     structures.
+%
+% XXX This test, which is extracted from tests/dppd/map_reduce.m,
+%     should go in tests/valid.
+
 :- module bug.
 
 :- interface.
Index: tests/dppd/grammar.m
===================================================================
RCS file: /home/mercury1/repository/tests/dppd/grammar.m,v
retrieving revision 1.1
diff -u -d -r1.1 grammar.m
--- tests/dppd/grammar.m	20 Feb 1999 11:34:21 -0000	1.1
+++ tests/dppd/grammar.m	10 Jan 2003 09:29:25 -0000
@@ -23,7 +23,7 @@
 :- import_module grammar_impl, list.
 
 grammar :-
- 	expression_query( n, [], ['(','(','(','(',n,')',')',')',')'], [] ).
+ 	expression_query( ['(','(','(','(',n,')',')',')',')'] ).
 
 /*
   The benchmark program (in ordinary clause format)
Index: tests/dppd/grammar_impl.m
===================================================================
RCS file: /home/mercury1/repository/tests/dppd/grammar_impl.m,v
retrieving revision 1.1
diff -u -d -r1.1 grammar_impl.m
--- tests/dppd/grammar_impl.m	20 Feb 1999 11:34:21 -0000	1.1
+++ tests/dppd/grammar_impl.m	10 Jan 2003 09:47:30 -0000
@@ -20,7 +20,12 @@
 	;	that
 	;	suchthat
 	;	(is)
-	;	subscripted(variable, variable).
+	;	subscripted(variable, variable)
+	;	(where)
+	;	(when)
+	;	'(' ; ')' ; '[' ; ']' ; '{' ; '}'
+	;	(',') ; (':') ; (';') ; ('..') ; ('=')
+	.
 
 :- pred expression_query(list(variable)::in) is semidet.
  
@@ -43,7 +48,7 @@
 	expression(n, none, String, []).	
 
 :- pred expression(expression::in, qualifier::in, 
-		list(variable)::in, list(variable)::out) is det.
+		list(variable)::in, list(variable)::out) is nondet.
 
 :- implementation.
 
@@ -52,7 +57,7 @@
 expression( Term, none ) -->
     value( Term ).
 
-:- pred value(variable::in, list(variable)::in, list(variable)::out) is det.
+:- pred value(variable::in, list(variable)::in, list(variable)::out) is nondet.
 value( Term ) --> identifier( Term ).
 value( Term ) --> numeric( Term ).
 value( Term ) --> built_in( Term ).
@@ -63,7 +68,7 @@
 
 
 :- pred qualification(qualifier::in, list(variable)::in,
-		list(variable)::out) is det.
+		list(variable)::out) is nondet.
 qualification( merge_qualifiers( Qualifier, Qualifiers ) ) -->
     qualifier( Qualifier ),
     qualification( Qualifiers ).
@@ -71,12 +76,12 @@
     qualifier( Qualifier ).
 
 :- pred qualifier(qualifier::in, list(variable)::in,
-		list(variable)::out) is det.
+		list(variable)::out) is nondet.
 qualifier( such_that( Left, Right ) ) -->
     such_that, value( Left ), equals, value( Right ).
 qualifier( for_all( Term ) ) --> for_all, subrange( Term ).
-qualifier( 'when'( Term ) )    --> when, value( Term ).
-qualifier( 'where'( Term ) )   --> where, is_a( Term ).
+qualifier( 'when'( Term ) )    --> (when), value( Term ).
+qualifier( 'where'( Term ) )   --> (where), is_a( Term ).
 
 :- pred leftparen(list(variable)::in, list(variable)::out) is semidet.
 leftparen --> ['('].
@@ -118,22 +123,22 @@
 such_that --> [suchthat].
 such_that --> [such], [that].
 
-:- pred for_all(list(variable)::in, list(variable)::out) is nondet.
+:- pred for_all(list(variable)::in, list(variable)::out) is semidet.
 for_all --> [forall].
 for_all --> [for], [all].
 
-:- pred start_subscript(list(variable)::in, list(variable)::out) is nondet.
+:- pred start_subscript(list(variable)::in, list(variable)::out) is semidet.
 start_subscript --> ['{'].
 
-:- pred end_subscript(list(variable)::in, list(variable)::out) is nondet.
+:- pred end_subscript(list(variable)::in, list(variable)::out) is semidet.
 end_subscript --> ['}'].
 
-:- pred identifier(variable::out, list(variable)::in, list(variable)::out) is nondet.
+:- pred identifier(variable::in, list(variable)::in, list(variable)::out) is semidet.
 identifier( Identifier ) --> common_function( Identifier ).
 identifier( Identifier ) --> common_variable( Identifier ).
 
 :- pred common_variable(variable::in, 
-		list(variable)::in, list(variable)::out) is nondet.
+		list(variable)::in, list(variable)::out) is semidet.
 
 common_variable( a ) --> [a].
 common_variable( n ) --> [n].
@@ -147,14 +152,21 @@
 
 :- pred numeric(variable::in, list(variable)::in, 
 		list(variable)::out) is failure.
-numeric( _, _, _ ) --> fail.
+numeric( _) --> fail.
 :- pred built_in(variable::in, list(variable)::in, 
 		list(variable)::out) is failure.
-built_in( _, _, _ ) --> fail.
+built_in( _) --> fail.
 :- pred bracketted(variable::in, list(variable)::in, 
 		list(variable)::out) is failure.
-bracketted( _, _, _ ) --> fail.
+bracketted( _) --> fail.
 :- pred common_function(variable::in, list(variable)::in, 
 		list(variable)::out) is failure.
-common_function( _, _, _ ) --> fail.
+common_function( _) --> fail.
+:- pred is_a(variable::in, list(variable)::in, list(variable)::out) is failure.
+is_a(_) --> fail.
+:- pred subrange(variable::in, list(variable)::in, list(variable)::out) is failure.
+subrange(_) --> fail.
+
+:- pred fail(T::in, T::out) is failure.
+fail --> { fail }.
 
Index: tests/dppd/map_reduce.m
===================================================================
RCS file: /home/mercury1/repository/tests/dppd/map_reduce.m,v
retrieving revision 1.1
diff -u -d -r1.1 map_reduce.m
--- tests/dppd/map_reduce.m	20 Feb 1999 11:34:26 -0000	1.1
+++ tests/dppd/map_reduce.m	10 Jan 2003 10:22:08 -0000
@@ -25,7 +25,13 @@
 :- import_module list, run, map_impl.
 
 map_reduce :-
-	map_reduce_add([[1,2],[1,2,3]],[_L1,_L2]),
+	% XXX the commented-out line below results in a mode error,
+	%     due to the Mercury compiler's lack of support for partially
+	%     instantiated data structures.  Therefore it has been
+	%     replaced with the line below it.  (The commented-out code here
+	%     is also reproduced in a separate test case in tests/dppd/bug.m.)
+	/* map_reduce_add([[1,2],[1,2,3]],[_L1,_L2]), */
+	map_reduce_add([[1,2],[1,2,3]],Res0), Res0 = [_L1,_L2],
 	map_reduce_add([[],[1,2],[5,6,7],[8,9,10]],Res1),
 	use(Res1),
 	map_reduce_add([[],[1,2],[5,6,7],[],[8,9,10],[11,12],
Index: tests/dppd/run.m
===================================================================
RCS file: /home/mercury1/repository/tests/dppd/run.m,v
retrieving revision 1.1
diff -u -d -r1.1 run.m
--- tests/dppd/run.m	20 Feb 1999 11:34:38 -0000	1.1
+++ tests/dppd/run.m	10 Jan 2003 09:51:44 -0000
@@ -10,7 +10,7 @@
 
 :- implementation.
 
-:- import_module benchmarking, list, string, int, std_util.
+:- import_module benchmarking, gc, list, string, int, std_util.
 
 	% The imports which are modules to be benchmarked.
 :- import_module 
@@ -18,7 +18,7 @@
 	applast,
 	doubleapp,
 	flip,
-	% grammar,
+	grammar,
 	imperative_solve_power,
 	map_reduce,
 	map_rev,
@@ -33,7 +33,7 @@
 	relative,
 	remove,
 	remove2,
-	% ssuply,
+	ssuply,
 	transpose,
 	upto_sum1,
 	upto_sum2,
@@ -83,14 +83,7 @@
 	io__write_int(Time),
 	io__nl,
 	io__flush_output,
-	collect.
-
-:- pred collect(io__state::di, io__state::uo) is det.
-:- pragma c_code(collect(IO0::di, IO::uo),
-"{
-	IO = IO0;
-	GC_gcollect();
-}").
+	garbage_collect.
 
 :- func benchmark_list = list(benchmark).
 :- mode benchmark_list = list_skel_out(benchmark).
@@ -98,9 +91,6 @@
 :- type benchmark == pair(string, pred).
 :- inst benchmark = pair(ground, (pred) is semidet).
 
-:- inst pair(T, U)
-	--->	'-'(T, U).
-
 use(_) :- semidet_succeed.
 
 benchmark_list = [
@@ -110,14 +100,14 @@
 		"contains_lam" - contains_lam,
 		"doubleapp" - doubleapp,
 		"flip" - flip, 
-		% "grammar" - grammar,
+		"grammar" - grammar,
 		"imperative_solve_power" - imperative_solve_power,
 		"map_reduce" - map_reduce,
 		"map_rev" - map_rev,
 		"match_kmp" - match_kmp,
 		"match" - match,
 		"match_append" - match_append,
-		% "maxlength" - maxlength,
+		"maxlength" - maxlength,
 		"missionaries" - missionaries,
 		"regexp_r1" - regexp_r1,
 		"regexp_r2" - regexp_r2,
@@ -126,7 +116,7 @@
 		"remove" - remove,
 		"remove2" - remove2,
 		"rotateprune" - rotateprune,
-		% "ssuply" - ssuply,
+		"ssuply" - ssuply,
 		"transpose" - transpose,
 		"upto_sum1" - upto_sum1,
 		"upto_sum2" - upto_sum2

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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