8210669: Some launcher tests assume a pre-JDK 9 run-time image layout
authormr
Wed, 09 Jan 2019 08:52:47 -0800
changeset 53229 76a4b08fdf59
parent 53228 e7738fd1c974
child 53230 b5f085197234
8210669: Some launcher tests assume a pre-JDK 9 run-time image layout Reviewed-by: mchung
test/jdk/tools/launcher/ExecutionEnvironment.java
test/jdk/tools/launcher/Test7029048.java
test/jdk/tools/launcher/TestHelper.java
--- a/test/jdk/tools/launcher/ExecutionEnvironment.java	Wed Jan 09 08:49:26 2019 -0800
+++ b/test/jdk/tools/launcher/ExecutionEnvironment.java	Wed Jan 09 08:52:47 2019 -0800
@@ -241,17 +241,26 @@
      */
     @Test
     void testVmSelection() {
+        boolean haveSomeVM = false;
         if (haveClientVM) {
-            TestResult tr = doExec(javaCmd, "-client", "-version");
-            if (!tr.matches(".*Client VM.*")) {
-                flagError(tr, "the expected vm -client did not launch");
-            }
+            tryVmOption("-client", ".*Client VM.*");
+            haveSomeVM = true;
         }
         if (haveServerVM) {
-            TestResult tr = doExec(javaCmd, "-server", "-version");
-            if (!tr.matches(".*Server VM.*")) {
-                flagError(tr, "the expected vm -server did not launch");
-            }
+            tryVmOption("-server", ".*Server VM.*");
+            haveSomeVM = true;
+        }
+        if (!haveSomeVM) {
+            String msg = "Don't have a known VM";
+            System.err.println(msg);
+            throw new RuntimeException(msg);
+        }
+    }
+
+    private void tryVmOption(String opt, String expected) {
+        TestResult tr = doExec(javaCmd, opt, "-version");
+        if (!tr.matches(expected)) {
+            flagError(tr, "the expected vm " + opt + " did not launch");
         }
     }
 
--- a/test/jdk/tools/launcher/Test7029048.java	Wed Jan 09 08:49:26 2019 -0800
+++ b/test/jdk/tools/launcher/Test7029048.java	Wed Jan 09 08:52:47 2019 -0800
@@ -59,13 +59,10 @@
     private static final File srcLibjvmSo = new File(srcServerDir, LIBJVM);
 
     private static final File dstLibDir = new File("lib");
-    private static final File dstLibArchDir =
-            new File(dstLibDir, getJreArch());
-
-    private static final File dstServerDir = new File(dstLibArchDir, "server");
+    private static final File dstServerDir = new File(dstLibDir, "server");
     private static final File dstServerLibjvm = new File(dstServerDir, LIBJVM);
 
-    private static final File dstClientDir = new File(dstLibArchDir, "client");
+    private static final File dstClientDir = new File(dstLibDir, "client");
     private static final File dstClientLibjvm = new File(dstClientDir, LIBJVM);
 
     private static final Map<String, String> env = new HashMap<>();
--- a/test/jdk/tools/launcher/TestHelper.java	Wed Jan 09 08:49:26 2019 -0800
+++ b/test/jdk/tools/launcher/TestHelper.java	Wed Jan 09 08:52:47 2019 -0800
@@ -184,8 +184,7 @@
             return jvmFile.exists();
         } else {
             File vmDir = new File(JAVA_LIB, type);
-            File vmArchDir = new File(vmDir, getJreArch());
-            File jvmFile = new File(vmArchDir, LIBJVM);
+            File jvmFile = new File(vmDir, LIBJVM);
             return jvmFile.exists();
         }
     }