[m-dev.] diff: fix line numbers for exception test cases

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Jan 7 14:05:00 AEDT 2001


Estimated hours taken: 1

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/throw.exp2:
tests/hard_coded/exceptions/Mmakefile:
tests/hard_coded/exceptions/test_uncaught_exception.exp2:
tests/hard_coded/Mmakefile:
tests/hard_coded/no_fully_strict.exp2:
tests/tabling/Mmakefile:
tests/tabling/loopcheck.exp2:
	Pipe the output of these test cases through sed to avoid
	hard-coding dependencies on line numbers in the standard
	library.  These test cases were all failing because the
	line numbers were changed by trd's recent change to add
	code for the .NET back-end to the standard library.

Workspace: /home/pgrad/fjh/ws/hg
Index: tests/debugger/declarative/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mmakefile,v
retrieving revision 1.23
diff -u -d -r1.23 Mmakefile
--- tests/debugger/declarative/Mmakefile	2000/11/10 01:01:00	1.23
+++ tests/debugger/declarative/Mmakefile	2001/01/07 02:30:22
@@ -156,9 +156,12 @@
 solutions.out: solutions solutions.inp
 	$(MDB) ./solutions < solutions.inp > solutions.out 2>&1
 
+# We need to pipe the output through sed to avoid hard-coding dependencies on
+# particular line numbers in the standard library source code.
 throw.out: throw throw.inp
-	$(MDB) ./throw < throw.inp 2>&1 | sed -e '/EXCP/s/).*/)/' \
-		> throw.out 2>&1
+	$(MDB) ./throw < throw.inp 2>&1 | \
+		sed -e 's/exception.m:[0-9]*/exception.m:NNNN/g' | \
+		sed -e '/EXCP/s/).*/)/' > throw.out 2>&1
 
 untraced_subgoal.out: untraced_subgoal untraced_subgoal.inp
 	$(MDB) ./untraced_subgoal < untraced_subgoal.inp \
Index: tests/debugger/declarative/throw.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/throw.exp2,v
retrieving revision 1.4
diff -u -d -r1.4 throw.exp2
--- tests/debugger/declarative/throw.exp2	2000/11/01 04:26:32	1.4
+++ tests/debugger/declarative/throw.exp2	2001/01/07 02:30:34
@@ -7,7 +7,7 @@
 mdb> break q
  1: + stop  interface pred throw:q/1-0 (semidet)
 mdb> continue
-       3:      3  3 CALL pred throw:p/1-0 (cc_nondet) throw.m:20 (exception.m:320)
+       3:      3  3 CALL pred throw:p/1-0 (cc_nondet) throw.m:20 (exception.m:NNNN)
 mdb> finish
       34:      3  3 EXCP pred throw:p/1-0 (cc_nondet)
 mdb> dd
@@ -26,7 +26,7 @@
       34:      3  3 EXCP pred throw:p/1-0 (cc_nondet)
 mdb> continue
 exception(univ("Too big" : string))
-      41:     11  3 CALL pred throw:q/1-0 (semidet) throw.m:48 (exception.m:320)
+      41:     11  3 CALL pred throw:q/1-0 (semidet) throw.m:48 (exception.m:NNNN)
 mdb> finish
       76:     11  3 EXCP pred throw:q/1-0 (semidet)
 mdb> dd
Index: tests/hard_coded/exceptions/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/exceptions/Mmakefile,v
retrieving revision 1.4
diff -u -d -r1.4 Mmakefile
--- tests/hard_coded/exceptions/Mmakefile	2000/06/19 07:19:08	1.4
+++ tests/hard_coded/exceptions/Mmakefile	2001/01/07 02:43:49
@@ -25,8 +25,17 @@
 
 #-----------------------------------------------------------------------------#
 
-# test_uncaught_exception is *supposed* to return an error exit status
+# test_uncaught_exception is *supposed* to return an error exit status.
+# We also need to pipe the output through sed to avoid hard-coding
+# dependencies on particular line numbers in the standard library source code.
 test_uncaught_exception.out: test_uncaught_exception
-	if ./$< > $@ 2>&1; then false; else true; fi
+	if ./$< > $@.tmp 2>&1; then \
+		grep . $@.tmp; \
+		exit 1; \
+	else \
+		sed -e 's/exception.m:[0-9]*/exception.m:NNNN/g' \
+			< $@.tmp > $@ ; \
+		rm -f $@.tmp; \
+	fi
 
 #-----------------------------------------------------------------------------#
Index: tests/hard_coded/exceptions/test_uncaught_exception.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/exceptions/test_uncaught_exception.exp2,v
retrieving revision 1.3
diff -u -d -r1.3 test_uncaught_exception.exp2
--- tests/hard_coded/exceptions/test_uncaught_exception.exp2	2000/03/13 06:45:15	1.3
+++ tests/hard_coded/exceptions/test_uncaught_exception.exp2	2001/01/07 02:36:35
@@ -1,5 +1,5 @@
 Uncaught exception:
 "<exception thrown from main>"
 Stack dump follows:
-   0       pred exception:throw/1-0 (erroneous) (exception.m:292)
+   0       pred exception:throw/1-0 (erroneous) (exception.m:NNNN)
    1       pred test_uncaught_exception:main/2-0 (cc_multi) (test_uncaught_exception.m:25)
Index: tests/hard_coded/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.106.2.2
diff -u -d -r1.106.2.2 Mmakefile
--- tests/hard_coded/Mmakefile	2000/12/26 02:04:32	1.106.2.2
+++ tests/hard_coded/Mmakefile	2001/01/07 02:42:07
@@ -209,10 +209,19 @@
 C2INITFLAGS-split-c-files	= 	--trace
 MLFLAGS-split-c-files		=	--trace
 
-# no_fully_strict is expected to fail (it calls error/1)
-# so we need to ignore the exit status (hence the leading `-')
+# no_fully_strict is expected to fail (it calls error/1).
+# We also need to pipe the output through sed to avoid hard-coding
+# dependencies on particular line numbers in the standard library source code.
 no_fully_strict.out: no_fully_strict
-	-./no_fully_strict > no_fully_strict.out 2>&1;
+	if ./no_fully_strict > $@.tmp 2>&1; then \
+		grep . $@.tmp; \
+		exit 1; \
+	else \
+                sed	-e 's/exception.m:[0-9]*/exception.m:NNNN/g' \
+			-e 's/require.m:[0-9]*/require.m:NNNN/g' \
+			< $@.tmp > $@; \
+		rm -f $@.tmp; \
+	fi
 
 #-----------------------------------------------------------------------------#
 
Index: tests/hard_coded/no_fully_strict.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/no_fully_strict.exp2,v
retrieving revision 1.6
diff -u -d -r1.6 no_fully_strict.exp2
--- tests/hard_coded/no_fully_strict.exp2	2000/03/13 06:43:02	1.6
+++ tests/hard_coded/no_fully_strict.exp2	2001/01/07 02:38:15
@@ -1,6 +1,6 @@
 Uncaught exception:
 Software Error: oops
 Stack dump follows:
-   0       pred exception:throw/1-0 (erroneous) (exception.m:292)
-   1       pred require:error/1-0 (erroneous) (require.m:90)
+   0       pred exception:throw/1-0 (erroneous) (exception.m:NNNN)
+   1       pred require:error/1-0 (erroneous) (require.m:NNNN)
    2       pred no_fully_strict:main/2-0 (det) (no_fully_strict.m:12)
Index: tests/tabling/loopcheck.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/tabling/loopcheck.exp2,v
retrieving revision 1.3
diff -u -d -r1.3 loopcheck.exp2
--- tests/tabling/loopcheck.exp2	2000/03/13 06:43:08	1.3
+++ tests/tabling/loopcheck.exp2	2001/01/07 02:58:16
@@ -1,7 +1,7 @@
 Uncaught exception:
 Software Error: detected infinite recursion in pred loopcheck:loop/1
 Stack dump follows:
-   0       pred exception:throw/1-0 (erroneous) (exception.m:292)
-   1       pred require:error/1-0 (erroneous) (require.m:90)
+   0       pred exception:throw/1-0 (erroneous) (exception.m:NNNN)
+   1       pred require:error/1-0 (erroneous) (require.m:NNNN
    2    2* pred loopcheck:loop/1-0 (erroneous) (loopcheck.m:17)
    4       pred loopcheck:main/2-0 (det) (loopcheck.m:13)
Index: tests/tabling/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/tabling/Mmakefile,v
retrieving revision 1.13
diff -u -d -r1.13 Mmakefile
--- tests/tabling/Mmakefile	2000/09/18 11:53:16	1.13
+++ tests/tabling/Mmakefile	2001/01/07 03:00:31
@@ -55,12 +55,32 @@
 # if inlining is turned on, so we turn inlining off to make the test tougher.
 MCFLAGS-tc_minimal	=	--no-inlining
 
-# Some test cases are expected to abort, so we need to ignore the exit status
-# (hence the leading `-')
+# Some test cases are expected to abort.
+# We also need to pipe the output for these test cases through sed to avoid
+# hard-coding dependencies on particular line numbers in the standard library
+# source code.
+
 tc_loop.out: tc_loop
-	-./tc_loop > tc_loop.out 2>&1;
+	if ./no_fully_strict > $@.tmp 2>&1; then \
+		grep . $@.tmp; \
+		exit 1; \
+	else \
+		sed	-e 's/exception.m:[0-9]*/exception.m:NNNN/g' \
+			-e 's/require.m:[0-9]*/require.m:NNNN/g' \
+			< $@.tmp > $@; \
+		rm -f $@.tmp; \
+	fi
+
 loopcheck.out: loopcheck
-	-./loopcheck > loopcheck.out 2>&1;
+	if ./no_fully_strict > $@.tmp 2>&1; then \
+		grep . $@.tmp; \
+		exit 1; \
+	else \
+		sed	-e 's/exception.m:[0-9]*/exception.m:NNNN/g' \
+			-e 's/require.m:[0-9]*/require.m:NNNN/g' \
+			< $@.tmp > $@; \
+		rm -f $@.tmp; \
+	fi
 
 #-----------------------------------------------------------------------------#
 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list