[m-rev.] diff: fix duplicate_instance_2 test case

Fergus Henderson fjh at cs.mu.OZ.AU
Tue May 29 19:51:33 AEST 2001


Estimated hours taken: 0.25
Branches: main

tests/invalid/Mmakefile:
tests/invalid/duplicate_instance_2.err_exp:
tests/invalid/duplicate_instance_2.err_exp2:
tests/invalid/duplicate_instance_2.err_exp3:
tests/invalid/duplicate_instance_2.err_exp4:
	Don't try to check the exact output of the error message for this
	test case, since it varies too much from system to system.
	Instead, just check that an error was detected, i.e. that
	mmc returns a non-zero exit status.

Workspace: /mnt/mars/home/mars/fjh/ws1/mercury
Index: tests/invalid/duplicate_instance_2.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/duplicate_instance_2.err_exp,v
retrieving revision 1.1
diff -u -d -r1.1 duplicate_instance_2.err_exp
--- tests/invalid/duplicate_instance_2.err_exp	2001/05/16 16:36:15	1.1
+++ tests/invalid/duplicate_instance_2.err_exp	2001/05/29 09:45:36
@@ -1,5 +1 @@
-duplicate_instance_2.o(.data+0x0): multiple definition of `<instance declaration for duplicate_instance_1:foo(int/0)>'
-duplicate_instance_1.o(.data+0x0): first defined here
-collect2: ld returned 1 exit status
-Error: system command returned non-zero exit status.
-Error: link failed.
+Error was successfully detected
Index: tests/invalid/duplicate_instance_2.err_exp2
===================================================================
RCS file: duplicate_instance_2.err_exp2
diff -N duplicate_instance_2.err_exp2
--- /tmp/cvsyZgEVf	Tue May 29 19:50:53 2001
+++ /dev/null	Thu Mar 30 14:06:13 2000
@@ -1,5 +0,0 @@
-duplicate_instance_2.o(.rodata+0x0): multiple definition of `base_typeclass_info_duplicate_instance_1__foo__arity1__int__arity0__'
-duplicate_instance_1.o(.rodata+0x0): first defined here
-collect2: ld returned 1 exit status
-Error: system command returned non-zero exit status.
-Error: link failed.
Index: tests/invalid/duplicate_instance_2.err_exp3
===================================================================
RCS file: duplicate_instance_2.err_exp3
diff -N duplicate_instance_2.err_exp3
--- /tmp/cvsx06Pji	Tue May 29 19:50:53 2001
+++ /dev/null	Thu Mar 30 14:06:13 2000
@@ -1,4 +0,0 @@
-duplicate_instance_1.opt:003: Error: multiply defined (or overlapping) instance
-duplicate_instance_1.opt:003: declarations for class `duplicate_instance_1:foo/1'.
-duplicate_instance_2.m:010: Previous instance declaration was here.
-For more information, try recompiling with `-E'.
Index: tests/invalid/duplicate_instance_2.err_exp4
===================================================================
RCS file: duplicate_instance_2.err_exp4
diff -N duplicate_instance_2.err_exp4
--- /tmp/cvsKklrYm	Tue May 29 19:50:53 2001
+++ /dev/null	Thu Mar 30 14:06:13 2000
@@ -1,10 +0,0 @@
-lcc.orig: -lc ignored
-lcc.orig: -lgcc ignored
-lcc.orig: -lc ignored
-lcc.orig: -lgcc ignored
-lcc.orig: -lc ignored
-lcc.orig: -lgcc ignored
-duplicate_instance_2.o(.data+0x0): multiple definition of `<instance declaration for duplicate_instance_1:foo(int/0)>'
-duplicate_instance_1.o(.data+0x0): first defined here
-Error: system command returned non-zero exit status.
-Error: link failed.
Index: tests/invalid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/Mmakefile,v
retrieving revision 1.88
diff -u -d -r1.88 Mmakefile
--- tests/invalid/Mmakefile	2001/05/21 03:53:12	1.88
+++ tests/invalid/Mmakefile	2001/05/29 09:45:20
@@ -173,13 +173,18 @@
 
 # For duplicate_instance_{1,2}, the error is only caught at link time.
 # So we need to use a different rule for that.
+# 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 \
 		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; \
-	then false; else true; fi
+	then	false; \
+	else	echo "Error was successfully detected" > $*.err; \
+	fi
 
 # 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.
-- 
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-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