[m-rev.] for review: test case for --lib-linkage option

Peter Wang wangp at students.cs.mu.OZ.AU
Wed Jan 11 15:42:14 AEDT 2006


Estimated hours taken: 2
Branches: main

tests/mmc_make/Mercury.options:
tests/mmc_make/Mmakefile:
tests/mmc_make/linkage_test.exp:
tests/mmc_make/linkage_test.m:
tests/mmc_make/lib/linkage_test2.m:
	Add a test case for the new `--lib-linkage' option to `mmc --make'.

	Fix an existing test case (complex_test) in the same directory.  It was
	looking for the file `../TESTS_FLAGS' while in the directory
	`tests/mmc_make/lib', which doesn't exist.  The workaround used is to
	symlink or copy `tests/TESTS_FLAGS' into `tests/mmc_make/TESTS_FLAGS'
	as necessary.

Index: tests/mmc_make/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/mmc_make/Mercury.options,v
retrieving revision 1.1
diff -u -r1.1 Mercury.options
--- tests/mmc_make/Mercury.options	23 Jan 2003 00:24:17 -0000	1.1
+++ tests/mmc_make/Mercury.options	11 Jan 2006 04:26:12 -0000
@@ -1,4 +1,6 @@
 LIB_DIRS = install/lib/mercury
-LIBRARIES-complex_test = complex_numbers
 
+LIBRARIES-complex_test = complex_numbers
 MCFLAGS-complex_test = --linkage shared
+
+LIBRARIES-linkage_test = linkage_test2
Index: tests/mmc_make/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/mmc_make/Mmakefile,v
retrieving revision 1.3
diff -u -r1.3 Mmakefile
--- tests/mmc_make/Mmakefile	23 Sep 2003 02:33:12 -0000	1.3
+++ tests/mmc_make/Mmakefile	11 Jan 2006 04:31:52 -0000
@@ -11,6 +11,7 @@
 PROGS =	\
 		complex_test \
 		hello \
+		linkage_test \
 		rebuild
 
 # These tests only work if the workspace was compiled with `--use-subdirs'.
@@ -29,6 +30,8 @@
 
 complex_test.log: install_libs
 
+linkage_test.log: install_libs_linkage_test2
+
 # Just test that the executable is rebuilt.
 rebuild.runtest:
 	$(MCM) --rebuild rebuild
@@ -39,10 +42,23 @@
 build_object.runtest: build_object.o
 
 .PHONY: install_libs
-install_libs: start_runtests_local
-	cd lib; \
+install_libs: TESTS_FLAGS start_runtests_local
+	( cd lib; \
+	$(MCM) --no-libgrade --install-prefix $(shell pwd)/install \
+			libcomplex_numbers.install ) \
+	|| touch complex_test.failed
+
+.PHONY: install_libs_linkage_test2
+install_libs_linkage_test2: TESTS_FLAGS start_runtests_local
+	( cd lib; \
 	$(MCM) --no-libgrade --install-prefix $(shell pwd)/install \
-			libcomplex_numbers.install
+			liblinkage_test2.install --lib-linkage static ) \
+	|| touch linkage_test.failed
+
+# Copy/symlink TESTS_FLAGS into the current directory for when
+# we change into the `lib' subdirectory.
+TESTS_FLAGS: ../TESTS_FLAGS
+	ln -s $< $@ || cp $< $@
 
 realclean_local:
 	rm -rf install rebuild.err2
Index: tests/mmc_make/linkage_test.exp
===================================================================
RCS file: tests/mmc_make/linkage_test.exp
diff -N tests/mmc_make/linkage_test.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/mmc_make/linkage_test.exp	11 Jan 2006 04:07:03 -0000
@@ -0,0 +1 @@
+1
Index: tests/mmc_make/linkage_test.m
===================================================================
RCS file: tests/mmc_make/linkage_test.m
diff -N tests/mmc_make/linkage_test.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/mmc_make/linkage_test.m	11 Jan 2006 04:25:46 -0000
@@ -0,0 +1,12 @@
+:- module linkage_test.
+
+:- interface.
+:- import_module io.
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+:- import_module linkage_test2.
+
+main(!IO) :-
+    io.print(f : int, !IO),
+    io.nl(!IO).
Index: tests/mmc_make/lib/linkage_test2.m
===================================================================
RCS file: tests/mmc_make/lib/linkage_test2.m
diff -N tests/mmc_make/lib/linkage_test2.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/mmc_make/lib/linkage_test2.m	11 Jan 2006 04:24:02 -0000
@@ -0,0 +1,8 @@
+:- module linkage_test2.
+
+:- interface.
+:- func f = int.
+
+:- implementation.
+
+f = 1.
--------------------------------------------------------------------------
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