for review: bootchecks in non-default grades

Zoltan Somogyi zs at cs.mu.OZ.AU
Thu Apr 15 20:37:26 AEST 1999


Estimated hours taken: 1

Make it much more convenient to do a full bootcheck, including all the tests,
in a grade other than the default one.

By passing a grade explicitly to the tests, instead of just grade component
flags, we allow the conditionals in tests/*/Mmakefiles to work in a lot
more cases than previously.

*** IMPORTANT **
If you do not use any grade other than the default one, then this change
does not affect you; if you do, it affects what you can put in Mmake.params
and Mmake.stage.params files. This change requires that there should be
no grade flags (e.g. --use-trail) specified in the file that becomes
stage2/Mmake.params, which is Mmake.stage.params in the top directory
if it exists, and Mmake.params in that directory otherwise.

tools/bootcheck:
	Add two new options, --grade (abbreviated -G) and --test-grade,
	which each take an argument specifying a grade. The purpose of the
	--grade option is to allow you to specify what grade stages 2 and 3
	should be compiled in. The purpose of the -test-grade option is
	to allow you to say that the tests should be done in the same
	grade as stage 1, not stage 2 or 3, although this is not checked.

	If you specify neither, then stages 2 and 3 will be built in the
	default grade, and the tests will be done in the default grade as well.
	The tests will use everything (compiler, library, runtime etc) from
	the stage2 directory.

	If you specify only --grade, then stages 2 and 3 will be built in the
	given grade, and the tests will be done in the given grade as well.
	The tests will use everything (compiler, library, runtime etc) from
	the stage2 directory.

	If you specify both --grade and --testgrade, then stages 2 and 3 will
	be built in the grade given to --grade, while the tests will be done
	in the grade given to --test-grade. The tests will use only the
	compiler from stage2; everything else (library, runtime etc) will be
	from stage 1 directory, since it is assumed that the test grade
	is the same as the grade of stage 1.

	If you specify only --testgrade, then stages 2 and 3 will be built
	in the default grade, while the tests will be done in the given grade.
	The tests will use only the compiler from stage2; everything else
	(library, runtime etc) will be from stage 1 directory, since it is
	assumed that the test grade is the same as the grade of stage 1.

	The runtime and boehm_gc directories of stage2 will be copied instead
	of linked from stage 1 if either of the new options is given, since
	there is no reason to give either option unless the stage 1 grade
	differs from the stage 2 grade, and such grade differences may require
	this copying.

	The old --copy-runtime and --copy-boehm-gc options, which were each
	intended to accomplish one half of this, are deleted by this change.

Zoltan.

cvs diff: Diffing .
Index: bootcheck
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/bootcheck,v
retrieving revision 1.73
diff -u -b -u -r1.73 bootcheck
--- bootcheck	1999/03/31 08:03:37	1.73
+++ bootcheck	1999/04/15 10:36:25
@@ -20,14 +20,16 @@
 		Pass <mmake-args> as options to \`mmake'.
 	-o <filename>, --output-file <filename>
 		Output results to <filename>.
-	-r, --copy-runtime
-		Copy the runtime directory instead of linking it.
-		This is necessary if one wants to bootcheck a grade
-		that is not compatible with the standard one.
-	-g, --copy-boehm-gc
-		Copy the bohem_gc directory instead of linking it.
-		This is necessary if one wants to bootcheck a grade
-		that is not compatible with the standard one.
+	-G <grade>, --grade <grade>
+		Specify the grade to use in creating stages 2 and 3.
+		The tests will also be executed in this grade, unless
+		the --test-grade option says otherwise.
+	--test-grade <grade>
+		Specify the grade to use in executing the tests.
+		If this is the same as the grade of stages 2 and 3, then
+		we use the stage 2 runtime, library etc for the tests.
+		Otherwise, we use the stage 1 runtime, library etc,
+		and trust that these are compatible with the given grade.
 	-p, --copy-profiler
 		Copy the profiler directory instead of linking it.
 		This is sometimes necessary for bootstrapping
@@ -57,8 +59,8 @@
 outfile=""
 runtests=true
 do_bootcheck=true
-copy_runtime=false
-copy_boehm_gc=false
+grade=
+test_grade=
 copy_profiler=false
 keep_stage_2=false
 keep_stage_3=false
@@ -106,14 +108,16 @@
 	-o*)
 		outfile="` expr $1 : '-o\(.*\)' `"; ;;
 
-	-p|--copy-profiler)
-		copy_profiler=true ;;
+	-G|--grade)
+		grade="$2"; shift ;;
+	-G*)
+		grade="` expr $1 : '-G\(.*\)' `"; ;;
 
-	-r|--copy-runtime)
-		copy_runtime=true ;;
+	--test-grade)
+		test_grade="$2"; shift ;;
 
-	-g|--copy-boehm-gc)
-		copy_boehm_gc=true ;;
+	-p|--copy-profiler)
+		copy_profiler=true ;;
 
 	-t|--no-test-suite)
 		runtests=false ;;
@@ -150,6 +154,11 @@
 	exit 1
 fi
 
+if test "$grade" != "" -a "$test_grade" = ""
+then
+	test_grade="$grade"
+fi
+
 case $use_subdirs in
 	yes)	cs_subdir=Mercury/cs/
 		;;
@@ -267,7 +276,7 @@
 	cp $root/browser/Mmake* .
 	ln -s $root/browser/$BROWSER_LIB_NAME.init .
 	cd $root/stage2
-	if "$copy_runtime"
+	if test "$grade" != "" -o "test_grade" != ""
 	then
 		# Remove symbolic link to the stage 1 runtime if it's present,
 		# which it can be with the -2 option.
@@ -287,12 +296,10 @@
 		ln -s $root/trace/*.c .
 		cp $root/trace/Mmake* .
 		cd $root/stage2
-	else
-		ln -s $root/runtime .
-		ln -s $root/trace .
-	fi
-	if "$copy_boehm_gc"
-	then
+
+		# Remove symbolic link to the stage 1 gc if it's present,
+		# which it can be with the -2 option.
+		rm boehm_gc
 		mkdir boehm_gc
 		cd boehm_gc
 		ln -s $root/boehm_gc/*.h .
@@ -304,6 +311,8 @@
 		ln -s $root/boehm_gc/machdeps .
 		cd $root/stage2
 	else
+		ln -s $root/runtime .
+		ln -s $root/trace .
 		ln -s $root/boehm_gc .
 	fi
 	ln -s $root/doc .
@@ -330,6 +339,10 @@
 		/bin/rm -f Mmake.params
 		cp $root/Mmake.stage.params Mmake.params
 	fi
+	if test "$grade" != ""
+	then
+		echo "GRADE = $grade" >> Mmake.params
+	fi
 	cd $root
 
 	set -x
@@ -471,12 +484,7 @@
 	ln -s $root/VERSION .
 	ln -s $root/.*.in .
 	rm -f config*.log
-	cp $root/Mmake* .
-	if test -f $root/Mmake.stage.params
-	then
-		/bin/rm -f Mmake.params
-		ln -s $root/Mmake.stage.params Mmake.params
-	fi
+	cp $root/stage2/Mmake* .
 	cd $root
 	set -x
 
@@ -573,85 +581,51 @@
 
 if $runtests
 then
-	# Use everything from stage 2, unless we copied the runtime.
-	# In that case, the grades of stage 1 & 2 may be different,
-	# which means we have a choice between
-	#
-	# (a) using the stage 2 runtime and library, and the stage 2 flags, or
-	# (b) using the stage 1 runtime and library, and the default flags
-	#
-	# Some tests/ directories have several dozen executables. Compiling
-	# all these with debugging on yields far too many large (14 Mb +)
-	# executables. Since stage 2 is much more likely to have flags
-	# that turn on debugging, we prefer alternative (b).
+	# Use everything from stage 2, the options say that the tests
+	# should be done in grade different from the grade of stage 2,
+	# in which case use everything from stage 1, trusting the user
+	# that the grade of the tests and the grade of stage 1 are compatible.
 
 	MERCURY_COMPILER=$root/stage2/compiler/mercury_compile
 	export MERCURY_COMPILER
 
-	if $copy_runtime
+	if test "$test_grade" != "$grade"
 	then
-		MERCURY_INT_DIR=$root/library
-		export MERCURY_INT_DIR
-
-		MERCURY_LIBS="
-			$root/trace/lib$TRACE_LIB_NAME.a
-			$root/browser/lib$BROWSER_LIB_NAME.a
-			$root/library/lib$STD_LIB_NAME.a
-			$root/runtime/lib$RT_LIB_NAME.a
-			$root/boehm_gc/libgc.a
-			-lm"
-		export MERCURY_LIBS
-
-		MERCURY_ALL_C_INCL_DIRS="-I$root/trace
-			-I$root/runtime
-			-I$root/boehm_gc
-			-I$root/boehm_gc/include"
-		export MERCURY_ALL_C_INCL_DIRS
-
-		MMAKE_DIR="$root/scripts"
-		export MMAKE_DIR
-
-		MERCURY_MOD_LIB_MODS="
-			$root/browser/$BROWSER_LIB_NAME.init
-			$root/library/$STD_LIB_NAME.init
-			$root/runtime/$RT_LIB_NAME.init"
-		export MERCURY_MOD_LIB_MODS
-
-			# for mkinit, mmc, mgnuc, ml etc
-		PATH=$root/util:$root/scripts:$PATH
-		export PATH
+		stage2_insert="stage2/"
 	else
-		MERCURY_INT_DIR=$root/stage2/library
+		stage2_insert=""
+	fi
+
+	MERCURY_INT_DIR=$root/${stage2_insert}library
 		export MERCURY_INT_DIR
 
 		MERCURY_LIBS="
-			$root/stage2/trace/lib$TRACE_LIB_NAME.a
-			$root/stage2/browser/lib$BROWSER_LIB_NAME.a
-			$root/stage2/library/lib$STD_LIB_NAME.a
-			$root/stage2/runtime/lib$RT_LIB_NAME.a
-			$root/stage2/boehm_gc/libgc.a
+		$root/${stage2_insert}trace/lib$TRACE_LIB_NAME.a
+		$root/${stage2_insert}browser/lib$BROWSER_LIB_NAME.a
+		$root/${stage2_insert}library/lib$STD_LIB_NAME.a
+		$root/${stage2_insert}runtime/lib$RT_LIB_NAME.a
+		$root/${stage2_insert}boehm_gc/libgc.a
 			-lm"
 		export MERCURY_LIBS
 
-		MERCURY_ALL_C_INCL_DIRS="-I$root/stage2/trace
-			-I$root/stage2/runtime
-			-I$root/stage2/boehm_gc
-			-I$root/stage2/boehm_gc/include"
+	MERCURY_ALL_C_INCL_DIRS="-I$root/${stage2_insert}trace
+		-I$root/${stage2_insert}runtime
+		-I$root/${stage2_insert}boehm_gc
+		-I$root/${stage2_insert}boehm_gc/include"
 		export MERCURY_ALL_C_INCL_DIRS
 
-		MMAKE_DIR="$root/stage2/scripts"
+	MMAKE_DIR="$root/${stage2_insert}scripts"
 		export MMAKE_DIR
 
 		MERCURY_MOD_LIB_MODS="
-			$root/stage2/browser/$BROWSER_LIB_NAME.init
-			$root/stage2/library/$STD_LIB_NAME.init
-			$root/stage2/runtime/$RT_LIB_NAME.init"
+		$root/${stage2_insert}browser/$BROWSER_LIB_NAME.init
+		$root/${stage2_insert}library/$STD_LIB_NAME.init
+		$root/${stage2_insert}runtime/$RT_LIB_NAME.init"
 		export MERCURY_MOD_LIB_MODS
 
 			# for mkinit, mmc, mgnuc, ml etc
-		PATH=$root/stage2/util:$root/stage2/scripts:$PATH
+	PATH=$root/${stage2_insert}util:$root/${stage2_insert}scripts:$PATH
 		export PATH
-	fi
 
 	# We need to give tests/debugger access to the mdbrc and mdb_doc
 	# files in the doc and scripts directories, without hardcoding their
@@ -663,16 +637,23 @@
 	MERCURY_DEBUGGER_INIT=$root/scripts/test_mdbrc
 	export MERCURY_DEBUGGER_INIT
 
+	if test "$test_grade" != ""
+	then
+		test_grade_opt="-g $test_grade"
+	else
+		test_grade_opt=""
+	fi
+
 	if test -d ../tests
 	then
 		cp $root/doc/mdb_command_test.inp ../tests/debugger
 		if test "$testdir" = ""
 		then
 			cd ../tests
-			./runtests $jfactor
+			./runtests $jfactor $test_grade_opt
 		else
 			cd ../tests/$testdir
-			./runtests $jfactor
+			./runtests $jfactor $test_grade_opt
 		fi
 		test_status=$?
 		cd $root
@@ -682,10 +663,10 @@
 		if test "$testdir" = ""
 		then
 			cd tests
-			./runtests $jfactor
+			./runtests $jfactor $test_grade_opt
 		else
 			cd tests/$testdir
-			./runtests $jfactor
+			./runtests $jfactor $test_grade_opt
 		fi
 		test_status=$?
 		cd $root



More information about the developers mailing list