[m-rev.] for review: Add two bootcheck options.

Peter Wang novalazy at gmail.com
Tue Jul 16 14:50:27 AEST 2024


Add options to the bootcheck script to help with testing of grades
in which the stage 2 compiler would be very slow, i.e. java and csharp.

tools/bootcheck:
    Add --skip-stage-3, which skips building the stage 3 directory.

    Add --test-with-stage-1-compiler, which causes the stage 1 compiler
    to be used when executing the test suite, instead of the stage 2
    compiler.

(The diff is created with -b.)

diff --git a/tools/bootcheck b/tools/bootcheck
index a2503483e..c5135ba56 100755
--- a/tools/bootcheck
+++ b/tools/bootcheck
@@ -2,7 +2,7 @@
 # vim: ts=4 sw=4 et ft=sh
 #---------------------------------------------------------------------------#
 # Copyright (C) 1995-2008, 2010-2011 The University of Melbourne.
-# Copyright (C) 2013-2022 The Mercury team.
+# Copyright (C) 2013-2024 The Mercury team.
 # This file may only be copied under the terms of the GNU General
 # Public License - see the file COPYING in the Mercury distribution.
 #---------------------------------------------------------------------------#
@@ -88,11 +88,14 @@ Options:
         Don't build the check_namespace targets in the runtime,
         trace, browser, ssdb, mdbcomp and library directories.
     -t-, --no-test-suite
-        By default, bootcheck will also run the test quite.
+        By default, bootcheck will also run the test suite.
         This option prevents that.
     --skip-stage-2
         Take the existing stage 2 directory as given; do not run mmake
         in it.
+    --skip-stage-3
+        Skip building the stage 3 directory, and the comparison to the
+        stage 2 directory.
     -2, --keep-stage-2
         Don't rebuild the stage 2 directory from scratch after
         building stage 1. Instead use the existing stage 2 directory
@@ -104,6 +107,9 @@ Options:
     --no-test-params
         When executing the test suite, do not use the stage 2 Mmake.params
         file.
+    --test-with-stage-1-compiler
+        Use the stage 1 compiler when executing the test suite.
+        By default, the stage 2 compiler is used.
     --keep-success-log-files
         Keep every test case's .log file, renamed as a .kept_log file,
         even if the test passes. It can be useful to compare these files
@@ -199,11 +205,13 @@ use_gradedir=false
 target=c
 test_grade=
 test_params=true
+test_with_stage_1_compiler=false
 copy_runtime=false
 copy_boehm_gc=false
 copy_slice=true
 copy_profilers=true
 mmake_stage_2=true
+mmake_stage_3=true
 keep_stage_2=false
 keep_stage_3=false
 stop_after_stage_2=false
@@ -401,6 +409,11 @@ do
             mmake_stage_2=false
             ;;
 
+        --skip-stage-3)
+            keep_stage_3=true
+            mmake_stage_3=false
+            ;;
+
         -2|--keep-stage-2)
             keep_stage_2=true
             ;;
@@ -417,6 +430,10 @@ do
             test_params=false
             ;;
 
+        --test-with-stage-1-compiler)
+            test_with_stage_1_compiler=true
+            ;;
+
         --keep-success-log-files)
             KEEP_SUCCESS_LOG_FILES=keep_success_log_files
             export KEEP_SUCCESS_LOG_FILES
@@ -799,7 +816,7 @@ then
     test -d ${stage2dir} || mkdir ${stage2dir}
     if ${keep_stage_2}
     then
-        echo keeping existing stage2
+        echo keeping existing stage 2
     else
         /bin/rm -fr "${root:?}/${stage2dir}" < /dev/null
         mkdir "${root}/${stage2dir}"
@@ -1476,12 +1493,14 @@ EOF
     test -d ${stage3dir} || mkdir ${stage3dir}
     if ${keep_stage_3}
     then
-        echo keeping existing stage3
+        echo keeping existing stage 3
     else
         /bin/rm -fr "${root:?}/${stage3dir}" < /dev/null
         mkdir "${root}/${stage3dir}"
     fi
 
+    if ${mmake_stage_3}
+    then
         echo linking stage 3... 1>&2
         set +x
 
@@ -2036,6 +2055,10 @@ EOF
         fi
 
         echo "finishing stage 3 at $(date)"
+    else
+        diff_status=0
+        echo "building of stage 3 skipped"
+    fi
 else
     MMAKE_USE_SUBDIRS=${use_subdirs}
     export MMAKE_USE_SUBDIRS
@@ -2060,7 +2083,12 @@ then
     # 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.
 
+    if test "${test_with_stage_1_compiler}" = true
+    then
+        MERCURY_COMPILER=${root}/compiler/mercury_compile
+    else
         MERCURY_COMPILER=${root}/${stage2dir}/compiler/mercury_compile
+    fi
     export MERCURY_COMPILER
 
     # now in FLAGS files
-- 
2.44.0



More information about the reviews mailing list