test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java
branchJDK-8200758-branch
changeset 58464 d82489644b15
parent 58416 f09bf58c1f17
child 58648 3bf53ffa9ae7
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java	Fri Oct 04 14:53:39 2019 -0400
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java	Fri Oct 04 14:56:02 2019 -0400
@@ -70,6 +70,7 @@
 
         TestInstance test = new TestInstance(testBody);
         ThrowingRunnable.toRunnable(() -> runTests(List.of(test))).run();
+        test.rethrowIfSkipped();
         if (!test.passed()) {
             throw new RuntimeException();
         }
@@ -366,6 +367,16 @@
         throw new IllegalStateException("Unknown platform");
     }
 
+    public static RuntimeException throwSkippedException(String reason) {
+        trace("Skip the test: " + reason);
+        RuntimeException ex = ThrowingSupplier.toSupplier(
+                () -> (RuntimeException) Class.forName("jtreg.SkippedException").getConstructor(
+                        String.class).newInstance(reason)).get();
+
+        currentTest.notifySkipped(ex);
+        throw ex;
+    }
+
     static void waitForFileCreated(Path fileToWaitFor,
             long timeoutSeconds) throws IOException {