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
--- 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++;
}
}