test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java
changeset 51287 7b1ddbafa134
parent 50791 b1e90a8a876c
child 53635 247e5ca412f5
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java	Thu Aug 02 14:40:55 2018 -0700
@@ -37,6 +37,7 @@
 import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.cds.CDSOptions;
 import jdk.test.lib.apps.LingeredApp;
+import jtreg.SkippedException;
 
 public class ClhsdbCDSJstackPrintAll {
 
@@ -64,17 +65,15 @@
                                                     null, null);
 
             if (useSharedSpacesOutput == null) {
+                LingeredApp.stopApp(theApp);
                 // Attach permission issues.
-                System.out.println("Could not determine the UseSharedSpaces value - test skipped.");
-                LingeredApp.stopApp(theApp);
-                return;
+                throw new SkippedException("Could not determine the UseSharedSpaces value");
             }
 
             if (!useSharedSpacesOutput.contains("true")) {
                 // CDS archive is not mapped. Skip the rest of the test.
-                System.out.println("The CDS archive is not mapped - test skipped.");
                 LingeredApp.stopApp(theApp);
-                return;
+                throw new SkippedException("The CDS archive is not mapped");
             }
 
             cmds = List.of("jstack -v", "printall", "where -a");
@@ -113,6 +112,8 @@
                 "illegal code",
                 "Failure occurred at bci"));
             test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);
+        } catch (SkippedException e) {
+            throw e;
         } catch (Exception ex) {
             throw new RuntimeException("Test ERROR " + ex, ex);
         } finally {