[m-rev.] diff: fix running the tests in a java grade bootcheck

Julien Fischer jfischer at opturion.com
Tue Nov 7 20:45:55 AEDT 2017


Fix running the tests in a java grade bootcheck.

When bootchecking the test suite is run using the stage 2 compiler, but the
launcher scripts we generate for executables set the CLASSPATH based on the
install path of the compiler.  Add a new environment variable,
MERCURY_STAGE2_LAUNCHER_BASE, that causes the launcher script to be set the
CLASSPATH based on the stage 2 location and directory structure.

Set the new environment variable when bootchecking in the java grade.

compiler/module_cmds.m:
     Handle the new environment variable.

     Add a note about the environment variable not yet being handled on MSYS.
     (I'll fix this separately.)

tools/bootcheck.m:
     Set the new environment variable to the stage 2 directory if bootchecking
     in the java grade.

Julien.

diff --git a/compiler/module_cmds.m b/compiler/module_cmds.m
index 1a002ae..c8e2b33 100644
--- a/compiler/module_cmds.m
+++ b/compiler/module_cmds.m
@@ -812,7 +812,18 @@ create_java_shell_script(Globals, MainModuleName, Succeeded, !IO) :-
      file_name::in, io.text_output_stream::in, io::di, io::uo) is det.

  write_java_shell_script(Globals, MainModuleName, JarFileName, Stream, !IO) :-
-    get_mercury_std_libs_for_java(Globals, MercuryStdLibs),
+    io.get_environment_var("MERCURY_STAGE2_LAUNCHER_BASE", MaybeStage2Base,
+        !IO),
+    (
+        MaybeStage2Base = no,
+        get_mercury_std_libs_for_java(Globals, MercuryStdLibs)
+    ;
+        MaybeStage2Base = yes(Stage2Base),
+        MercuryStdLibs = [
+            Stage2Base / "library/mer_rt.jar",
+            Stage2Base / "library/mer_std.jar"
+        ]
+    ),
      globals.lookup_accumulating_option(Globals, java_classpath,
          UserClasspath),
      % We prepend the .class files' directory and the current CLASSPATH.
@@ -852,6 +863,8 @@ write_java_shell_script(Globals, MainModuleName, JarFileName, Stream, !IO) :-
      % 4. The path of the Java interpreter must be a Unix style path as it will
      % be invoked directly from the MSYS shell.
      %
+    % XXX TODO: handle MERCURY_STAGE2_LAUNCHER_BASE for this case.
+    %
  :- pred write_java_msys_shell_script(globals::in, module_name::in,
      file_name::in, io.text_output_stream::in, io::di, io::uo) is det.

diff --git a/tools/bootcheck b/tools/bootcheck
index 73563af..5d31345 100755
--- a/tools/bootcheck
+++ b/tools/bootcheck
@@ -1707,6 +1707,12 @@ then
          WORKSPACE_FLAGS=yes
          export WORKSPACE_FLAGS

+        if test "$grade" = "java"
+        then
+            MERCURY_STAGE2_LAUNCHER_BASE=$root/$stage2dir
+            export MERCURY_STAGE2_LAUNCHER_BASE
+        fi
+
          case $error_file_only in
              true)
                  if test ! -f ${tests_prefix}tests/runtests.errs


More information about the reviews mailing list