[m-dev.] diff: fix bug in tools/test_mercury

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Apr 19 15:43:33 AEST 2000


Estimated hours taken: 1

tools/test_mercury:
	Fix a bug: use different options for building and
	installing the compiler and libraries than we use
	for running the tests.  We want to specify `--pic-reg'
	for building the tests, so that they can use shared libraries,
	but we can't use that when building the library,
	because that would break the static versions of the
	library.

	Simplify the code a little, by putting the options
	for building the extras in a file extras/Mmake.params.

	Change the work-around that we use for profiling on
	alphas: use the LD_BIND_NOW environment variable
	rather than using static linking.
	(Using static linking could conflict with the options
	specified for building the tests.)

extras/clpr/Mmakefile:
extras/trailed_update/Mmakefile:
	Include extras/Mmake.params.

Workspace: /home/pgrad/fjh/ws/hg
Index: extras/clpr/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/clpr/Mmakefile,v
retrieving revision 1.18
diff -u -d -r1.18 Mmakefile
--- extras/clpr/Mmakefile	2000/02/07 03:41:55	1.18
+++ extras/clpr/Mmakefile	2000/04/16 08:43:31
@@ -109,3 +109,8 @@
 	cd samples && $(SUBDIR_MMAKE) realclean
 
 #-----------------------------------------------------------------------------#
+
+# The Mmake.params file can be used to override definitions in this file
+-include ../Mmake.params
+
+#-----------------------------------------------------------------------------#
Index: extras/trailed_update/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/trailed_update/Mmakefile,v
retrieving revision 1.8
diff -u -d -r1.8 Mmakefile
--- extras/trailed_update/Mmakefile	1998/06/06 11:18:24	1.8
+++ extras/trailed_update/Mmakefile	2000/04/19 05:38:37
@@ -33,3 +33,8 @@
 	cd tests && mmake $(MMAKEFLAGS) realclean
 
 #-----------------------------------------------------------------------------#
+
+# The Mmake.params file can be used to override definitions in this file
+-include ../Mmake.params
+
+#-----------------------------------------------------------------------------#
Index: tools/test_mercury
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/test_mercury,v
retrieving revision 1.108
diff -u -d -r1.108 test_mercury
--- tools/test_mercury	2000/04/10 08:29:52	1.108
+++ tools/test_mercury	2000/04/19 05:33:14
@@ -71,8 +71,17 @@
 	*)		LN="ln"; LN_S="ln -s" ;;
 esac
 
+# flags for building the compiler
+INSTALL_MCFLAGS="$OPTIMIZE --opt-space"
+INSTALL_MGNUCFLAGS=""
+INSTALL_CFLAGS=""
+INSTALL_MLFLAGS=""
+
+# flags for running the tests
 TEST_MCFLAGS="$OPTIMIZE --opt-space"
+TEST_MGNUCFLAGS=""
 TEST_CFLAGS=""
+TEST_MLFLAGS=""
 
 case $FULLARCH in
 	i?86-*-linux*)
@@ -80,13 +89,11 @@
 		# shared libraries (and we need to use shared libraries to
 		# avoid running out of disk space...)
 		TEST_MCFLAGS="$TEST_MCFLAGS --pic-reg"
-		TEST_MGNUCFLAGS=--pic-reg
-		TEST_MLFLAGS=--shared
+		TEST_MGNUCFLAGS="$TEST_MGNUCFLAGS --pic-reg"
+		TEST_MLFLAGS="$TEST_MLFLAGS --shared"
 		;;
 	*)
 		# On other platforms shared libraries is the default
-		TEST_MGNUCFLAGS=""
-		TEST_MLFLAGS=""
 		;;
 esac
 
@@ -256,8 +263,10 @@
 # 	tools/expand_params `tools/cur_param tools $HOST` > Mmake.params
 # else
 	echo "MC = ../scripts/mmc" > Mmake.params
-	echo "EXTRA_MCFLAGS = $TEST_MCFLAGS" >> Mmake.params
-	echo "EXTRA_CFLAGS = $TEST_CFLAGS" >> Mmake.params
+	echo "EXTRA_MCFLAGS = $INSTALL_MCFLAGS" >> Mmake.params
+	echo "EXTRA_MGNUCFLAGS = $INSTALL_MGNUCFLAGS" >> Mmake.params
+	echo "EXTRA_CFLAGS = $INSTALL_CFLAGS" >> Mmake.params
+	echo "EXTRA_MLFLAGS = $INSTALL_MLFLAGS" >> Mmake.params
 # fi
 
 autoconf || { false; exit 1; }
@@ -314,7 +323,7 @@
 		\
 		PATH=../scripts:../util:$PATH \
 		MMAKE_VPATH=. MMAKE_DIR=../scripts \
-		../scripts/mmake EXTRA_CFLAGS="$TEST_CFLAGS -O1" \
+		../scripts/mmake EXTRA_CFLAGS="$INSTALL_CFLAGS -O1" \
 		int.dir/*.o && \
 		\
 		PATH=../scripts:../util:$PATH \
@@ -369,42 +378,28 @@
 do
 	if [ "$grade" != kludge_for_broken_shells ]; then
 		echo "test clpr stuff for grade $grade" 1>&2
+		{
+			echo "GRADE = $grade"
+			echo "EXTRA_MCFLAGS = $INSTALL_MCFLAGS"
+			echo "EXTRA_MGNUCFLAGS = $INSTALL_MGNUCFLAGS"
+			echo "EXTRA_CFLAGS = $INSTALL_CFLAGS"
+			echo "EXTRA_MLFLAGS = $INSTALL_MLFLAGS"
+		} > mercury/extras/Mmake.params &&
 		(cd mercury/extras/clpr &&
-			 mmake realclean $PARALLEL MMAKEFLAGS=$PARALLEL &&
-			 mmake depend	 $PARALLEL MMAKEFLAGS=$PARALLEL \
-				GRADE=$grade \
-				EXTRA_MCFLAGS="$TEST_MCFLAGS" \
-				EXTRA_CFLAGS="$TEST_CFLAGS" &&
-			 mmake 		 $PARALLEL MMAKEFLAGS=$PARALLEL \
-				GRADE=$grade \
-				EXTRA_MCFLAGS="$TEST_MCFLAGS" \
-				EXTRA_CFLAGS="$TEST_CFLAGS" &&
-			 mmake check	 $PARALLEL MMAKEFLAGS=$PARALLEL \
-				GRADE=$grade \
-				EXTRA_MCFLAGS="$TEST_MCFLAGS" \
-				EXTRA_CFLAGS="$TEST_CFLAGS" &&
-			 mmake install	 $PARALLEL MMAKEFLAGS=$PARALLEL \
-				GRADE=$grade \
-				EXTRA_MCFLAGS="$TEST_MCFLAGS" \
-				EXTRA_CFLAGS="$TEST_CFLAGS" &&
-			 mmake realclean $PARALLEL MMAKEFLAGS=$PARALLEL) ||
+			mmake realclean $PARALLEL MMAKEFLAGS=$PARALLEL &&
+			mmake depend	 $PARALLEL MMAKEFLAGS=$PARALLEL &&
+			mmake 		 $PARALLEL MMAKEFLAGS=$PARALLEL &&
+			mmake check	 $PARALLEL MMAKEFLAGS=$PARALLEL &&
+			mmake install	 $PARALLEL MMAKEFLAGS=$PARALLEL &&
+			mmake realclean $PARALLEL MMAKEFLAGS=$PARALLEL) ||
 				status=1
 		echo "test trailed_update stuff for grade $grade" 1>&2
 		(cd mercury/extras/trailed_update &&
-			 mmake realclean $PARALLEL MMAKEFLAGS=$PARALLEL &&
-			 mmake depend	 $PARALLEL MMAKEFLAGS=$PARALLEL \
-				GRADE=$grade \
-				EXTRA_MCFLAGS="$TEST_MCFLAGS" \
-				EXTRA_CFLAGS="$TEST_CFLAGS" &&
-			 mmake 		 $PARALLEL MMAKEFLAGS=$PARALLEL \
-				GRADE=$grade \
-				EXTRA_MCFLAGS="$TEST_MCFLAGS" \
-				EXTRA_CFLAGS="$TEST_CFLAGS" &&
-			 mmake check	 $PARALLEL MMAKEFLAGS=$PARALLEL \
-				GRADE=$grade \
-				EXTRA_MCFLAGS="$TEST_MCFLAGS" \
-				EXTRA_CFLAGS="$TEST_CFLAGS" &&
-			 mmake realclean $PARALLEL MMAKEFLAGS=$PARALLEL) ||
+			mmake realclean $PARALLEL MMAKEFLAGS=$PARALLEL &&
+			mmake depend	 $PARALLEL MMAKEFLAGS=$PARALLEL &&
+			mmake 		 $PARALLEL MMAKEFLAGS=$PARALLEL &&
+			mmake check	 $PARALLEL MMAKEFLAGS=$PARALLEL &&
+			mmake realclean $PARALLEL MMAKEFLAGS=$PARALLEL) ||
 				status=1
 	fi
 done
@@ -516,16 +511,17 @@
 		$PARALLEL || status=1
 	case $grade in
 		*.memprof*)
-			# we need to link statically for profiling on DEC Alpha
+			# we need to set LD_BIND_NOW=1 for profiling on DEC Alpha
 			(cd benchmarks &&
 			touch poly.m &&
 			mmake poly.depend &&
 			mmake poly \
 				GRADE="$grade" \
 				EXTRA_MCFLAGS="$TEST_MCFLAGS" \
+				EXTRA_MGNUCFLAGS="$TEST_MGNUCFLAGS" \
 				EXTRA_CFLAGS="$TEST_CFLAGS" \
-				EXTRA_MLFLAGS="-static" &&
-			./poly > poly.$grade.out &&
+				EXTRA_MLFLAGS="$TEST_MLFLAGS" &&
+			LD_BIND_NOW=1 ./poly > poly.$grade.out &&
 			mprof -v -m -c > poly.$grade.mprof 2>&1  &&
 			{ diff -u poly.mprof-exp poly.$grade.mprof || true; } &&
 			cp Prof.CallPair poly.$grade.CallPair &&

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- 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