[m-rev.] diff: workaround test cases failure in tests/term

Julien Fischer juliensf at cs.mu.OZ.AU
Tue Aug 2 19:01:53 AEST 2005


Estimated hours taken: 1
Branches: main

Workaround the failure of some of the test cases in the term directory
in the .debug and .decldebug grades.  The test cases were not failing
as such, it was just that the argument size information produced by the
termination2 analysis in the debug grades looks a little different.

tests/term/Mmakefile:
	Allow the test cases in the term directory to have multiple
	expected outputs by allowing for .trans_opt_exp2 files.

tests/term/select.trans_opt_exp2:
tests/term/occur.trans_opt_exp2:
tests/term/pl4_01.trans_opt_exp2:
	The argument size information produced by the termination2
	analysis for these test cases in debug grades contains redundant
	constraints.  The redundant constraints are slipping by some of
	redundancy checks because the order of the constraints differs
	in the debug grades (due to differences in the HLDS between grades).
	While removing these redundant constraints is certainly
	possible, doing so is a relatively low priority task.

Julien.

Workspace:/home/swordfish/juliensf/ws-debug
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/term/Mmakefile,v
retrieving revision 1.27
diff -u -r1.27 Mmakefile
--- Mmakefile	3 Jun 2005 15:59:40 -0000	1.27
+++ Mmakefile	2 Aug 2005 07:47:02 -0000
@@ -109,8 +109,24 @@
 ALL_MCTOIFLAGS+=$(MCTRANSOPTFLAGS)

 %.trans_opt_res: %.trans_opt_exp $(trans_opts_subdir)%.trans_opt
-	diff $(DIFF_OPTS) $*.trans_opt_exp $(trans_opts_subdir)$*.trans_opt \
-		> $@
+	@echo "Comparing $(trans_opts_subdir)$*.trans_opt with $*.trans_opt_exp2,"
+	@echo " results in $@"
+	@-rm -f $@ $*.trans_opt_res[1-2]
+	@{ diff $(DIFF_OPTS) $*.trans_opt_exp $(trans_opts_subdir)$*.trans_opt \
+			> $*.trans_opt_res1 && \
+		echo "Matches $*.trans_opt_exp" && \
+		cp $*.trans_opt_res1 $@; } || \
+	{ diff $(DIFF_OPTS) $*.trans_opt_exp2 $(trans_opts_subdir)$*.trans_opt \
+			> $*.trans_opt_res2 && \
+		echo "Matches $*.trans_opt_exp2" && \
+		cp $*.trans_opt_res2 $@; } || \
+	{ shortest=`wc -l $*.trans_opt_res[1-2] | grep -v total | sort -n | \
+		head -1 | awk '{ print $$2; }' `; \
+		echo "** $*.err did not match the expected error output"; \
+		echo "** (closest match was $$shortest)"; \
+		cp $$shortest $@; \
+		cat $@; \
+		exit 1; }

 #-----------------------------------------------------------------------------#

@@ -120,4 +136,3 @@
 realclean_local:
 	rm -f *.trans_opt_res

-#-----------------------------------------------------------------------------#
Index: occur.trans_opt_exp2
===================================================================
RCS file: occur.trans_opt_exp2
diff -N occur.trans_opt_exp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ occur.trans_opt_exp2	2 Aug 2005 06:55:05 -0000
@@ -0,0 +1,3 @@
+:- module occur.
+:- pragma termination_info(occur.occurall((builtin.in), (builtin.in), (builtin.out)), infinite, cannot_loop).
+:- pragma termination2_info(occur.occurall((builtin.in), (builtin.in), (builtin.out)), constraints([eq([term(0, r(1, 1)), term(2, r(-1, 3))], r(0, 1))]), not_set, cannot_loop).
Index: pl4_01.trans_opt_exp2
===================================================================
RCS file: pl4_01.trans_opt_exp2
diff -N pl4_01.trans_opt_exp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pl4_01.trans_opt_exp2	2 Aug 2005 06:55:25 -0000
@@ -0,0 +1,5 @@
+:- module pl4_01.
+:- pragma termination_info(pl4_01.append3((builtin.in), (builtin.in), (builtin.in), (builtin.out)), finite(0, [no, yes, yes, yes, no]), cannot_loop).
+:- pragma termination_info(pl4_01.append3((builtin.out), (builtin.out), (builtin.out), (builtin.in)), finite(0, [no, no, no, no, yes]), cannot_loop).
+:- pragma termination2_info(pl4_01.append3((builtin.in), (builtin.in), (builtin.in), (builtin.out)), constraints([eq([term(1, r(1, 1)), term(2, r(1, 1)), term(3, r(1, 1)), term(4, r(-1, 1))], r(0, 1))]), not_set, cannot_loop).
+:- pragma termination2_info(pl4_01.append3((builtin.out), (builtin.out), (builtin.out), (builtin.in)), constraints([le([term(3, r(1, 1)), term(4, r(-1, 1))], r(0, 1)), eq([term(1, r(1, 1)), term(2, r(1, 1)), term(3, r(1, 1)), term(4, r(-1, 1))], r(0, 1))]), not_set, cannot_loop).
Index: select.trans_opt_exp2
===================================================================
RCS file: select.trans_opt_exp2
diff -N select.trans_opt_exp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ select.trans_opt_exp2	2 Aug 2005 07:58:20 -0000
@@ -0,0 +1,3 @@
+:- module select.
+:- pragma termination_info(select.select((builtin.out), (builtin.in), (builtin.out)), finite(-1, [no, no, yes, no]), cannot_loop).
+:- pragma termination2_info(select.select((builtin.out), (builtin.in), (builtin.out)), constraints([le([term(2, r(-1, 1))], r(-2, 1)), eq([term(1, r(1, 1)), term(2, r(-1, 1)), term(3, r(1, 1))], r(-2, 1))]), not_set, cannot_loop).


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