8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address."
authorccheung
Tue, 02 Oct 2018 20:52:40 -0700
changeset 51992 266a89a5d1af
parent 51991 ad00713a0562
child 51993 c0d05cf1d19d
8211287: ClassPathTests.java fails due to "Unable to map MiscData shared space at required address." Summary: catch the InvocationTargetException and rethrow exception based on the cause Reviewed-by: jiangli, iklam
test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java	Tue Oct 02 15:01:25 2018 -0700
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java	Tue Oct 02 20:52:40 2018 -0700
@@ -52,6 +52,7 @@
  * same name and package.
  */
 
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -62,6 +63,8 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 
+import jtreg.SkippedException;
+
 
 public class ClassPathTests {
     private static final String TEST_SRC = System.getProperty("test.src");
@@ -83,7 +86,7 @@
     private static String testArchiveName;
 
 
-    public static void main(String[] args) throws Exception {
+    public static void main(String[] args) throws Throwable {
         ClassPathTests tests = new ClassPathTests();
         tests.dumpArchive();
 
@@ -92,7 +95,16 @@
         for (Method m : methods) {
             if (m.getName().startsWith("test")) {
                 System.out.println("About to run test method: " + m.getName());
-                m.invoke(tests);
+                try {
+                    m.invoke(tests);
+                } catch (InvocationTargetException ite) {
+                    Throwable throwable = ite.getCause();
+                    if (throwable instanceof SkippedException) {
+                        throw throwable;
+                    } else {
+                        throw ite;
+                    }
+                }
                 numOfTestMethodsRun++;
             }
         }