changeset 51992:266a89a5d1af

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
author ccheung
date Tue, 02 Oct 2018 20:52:40 -0700
parents ad00713a0562
children c0d05cf1d19d
files test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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++;
             }
         }