8208655: use JTreg skipped status in hotspot tests
authoriignatyev
Thu, 02 Aug 2018 14:40:55 -0700
changeset 51287 7b1ddbafa134
parent 51286 744f731e9e8c
child 51288 8e2f5dad68a0
8208655: use JTreg skipped status in hotspot tests Reviewed-by: kvn, hseigel, iklam
test/hotspot/jtreg/TEST.ROOT
test/hotspot/jtreg/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java
test/hotspot/jtreg/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java
test/hotspot/jtreg/compiler/tiered/ConstantGettersTransitionsTest.java
test/hotspot/jtreg/compiler/tiered/LevelTransitionTest.java
test/hotspot/jtreg/compiler/tiered/NonTieredLevelsTest.java
test/hotspot/jtreg/compiler/tiered/TieredLevelsTest.java
test/hotspot/jtreg/gc/arguments/TestAggressiveHeap.java
test/hotspot/jtreg/gc/g1/TestHumongousShrinkHeap.java
test/hotspot/jtreg/gc/g1/TestLargePageUseForAuxMemory.java
test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData.java
test/hotspot/jtreg/runtime/6819213/TestBootNativeLibraryPath.java
test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java
test/hotspot/jtreg/runtime/CompressedOops/CompressedKlassPointerAndOops.java
test/hotspot/jtreg/runtime/ErrorHandling/TestOnError.java
test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java
test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java
test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java
test/hotspot/jtreg/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java
test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java
test/hotspot/jtreg/runtime/os/AvailableProcessors.java
test/hotspot/jtreg/runtime/signal/SigTestDriver.java
test/hotspot/jtreg/serviceability/jvmti/GetObjectSizeOverflow.java
test/hotspot/jtreg/serviceability/jvmti/NotifyFramePop/NotifyFramePopTest.java
test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java
test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java
test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java
test/hotspot/jtreg/serviceability/sa/ClhsdbJdis.java
test/hotspot/jtreg/serviceability/sa/ClhsdbLongConstant.java
test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAs.java
test/hotspot/jtreg/serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java
test/hotspot/jtreg/serviceability/sa/ClhsdbScanOops.java
test/hotspot/jtreg/serviceability/sa/DeadlockDetectionTest.java
test/hotspot/jtreg/serviceability/sa/TestJmapCore.java
test/hotspot/jtreg/vmTestbase/gc/g1/unloading/UnloadingTest.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/TestDriver.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace001.java
test/lib/jtreg/SkippedException.java
--- a/test/hotspot/jtreg/TEST.ROOT	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/TEST.ROOT	Thu Aug 02 14:40:55 2018 -0700
@@ -65,7 +65,7 @@
     docker.support
 
 # Minimum jtreg version
-requiredVersion=4.2 b12
+requiredVersion=4.2 b13
 
 # Path to libraries in the topmost test directory. This is needed so @library
 # does not need ../../../ notation to reach them
--- a/test/hotspot/jtreg/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,7 @@
 import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.Utils;
+import jtreg.SkippedException;
 
 import java.io.IOException;
 import java.lang.reflect.Executable;
@@ -119,12 +120,11 @@
     }
 
     public static void main(String args[]) {
+        if (!DtraceRunner.dtraceAvailable()) {
+            throw new SkippedException("There is no dtrace avaiable.");
+        }
         int iterations
                 = Integer.getInteger("jdk.test.lib.iterations", 1);
-        if (!DtraceRunner.dtraceAvailable()) {
-            System.out.println("INFO: There is no dtrace avaiable. Skipping.");
-            return;
-        }
         int[] availableLevels = CompilerUtils.getAvailableCompilationLevels();
         // adding one more entry(zero) for interpeter
         availableLevels
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -96,6 +96,7 @@
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotStackFrameReference;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jtreg.SkippedException;
 import sun.hotspot.WhiteBox;
 
 import java.lang.reflect.Method;
@@ -143,11 +144,10 @@
         int levels[] = CompilerUtils.getAvailableCompilationLevels();
         // we need compilation level 4 to use EscapeAnalysis
         if (levels.length < 1 || levels[levels.length - 1] != 4) {
-            System.out.println("INFO: Test needs compilation level 4 to"
-                    + " be available. Skipping.");
-        } else {
-            new MaterializeVirtualObjectTest().test();
+            throw new SkippedException("Test needs compilation level 4");
         }
+
+        new MaterializeVirtualObjectTest().test();
     }
 
     private static String getName() {
--- a/test/hotspot/jtreg/compiler/tiered/ConstantGettersTransitionsTest.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/compiler/tiered/ConstantGettersTransitionsTest.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,9 @@
 
 public class ConstantGettersTransitionsTest extends LevelTransitionTest {
     public static void main(String[] args) {
-        assert (!CompilerWhiteBoxTest.skipOnTieredCompilation(false));
+        if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) {
+            throw new SkippedException("Test isn't applicable for non-tiered mode");
+        }
 
         // run test cases
         for (TestCase testCase : ConstantGettersTestCase.values()) {
--- a/test/hotspot/jtreg/compiler/tiered/LevelTransitionTest.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/compiler/tiered/LevelTransitionTest.java	Thu Aug 02 14:40:55 2018 -0700
@@ -43,6 +43,7 @@
 
 import compiler.whitebox.CompilerWhiteBoxTest;
 import compiler.whitebox.SimpleTestCase;
+import jtreg.SkippedException;
 
 import java.lang.reflect.Executable;
 import java.lang.reflect.Method;
@@ -57,7 +58,9 @@
     private int transitionCount;
 
     public static void main(String[] args) throws Throwable {
-        assert (!CompilerWhiteBoxTest.skipOnTieredCompilation(false));
+        if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) {
+            throw new SkippedException("Test isn't applicable for non-tiered mode");
+        }
 
         CompilerWhiteBoxTest.main(LevelTransitionTest::new, args);
         // run extended test cases
--- a/test/hotspot/jtreg/compiler/tiered/NonTieredLevelsTest.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/compiler/tiered/NonTieredLevelsTest.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,7 @@
 import java.util.function.IntPredicate;
 import compiler.whitebox.CompilerWhiteBoxTest;
 import jdk.test.lib.Platform;
+import jtreg.SkippedException;
 
 public class NonTieredLevelsTest extends CompLevelsTest {
     private static final int AVAILABLE_COMP_LEVEL;
@@ -60,7 +61,7 @@
     }
     public static void main(String[] args) throws Exception {
         if (CompilerWhiteBoxTest.skipOnTieredCompilation(true)) {
-            return;
+            throw new SkippedException("Test isn't applicable for tiered mode");
         }
         CompilerWhiteBoxTest.main(NonTieredLevelsTest::new, args);
     }
--- a/test/hotspot/jtreg/compiler/tiered/TieredLevelsTest.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/compiler/tiered/TieredLevelsTest.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,11 +40,12 @@
 package compiler.tiered;
 
 import compiler.whitebox.CompilerWhiteBoxTest;
+import jtreg.SkippedException;
 
 public class TieredLevelsTest extends CompLevelsTest {
     public static void main(String[] args) throws Throwable {
         if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) {
-            return;
+            throw new SkippedException("Test isn't applicable for non-tiered mode");
         }
         CompilerWhiteBoxTest.main(TieredLevelsTest::new, args);
     }
--- a/test/hotspot/jtreg/gc/arguments/TestAggressiveHeap.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/gc/arguments/TestAggressiveHeap.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
+import jtreg.SkippedException;
 
 public class TestAggressiveHeap {
 
@@ -88,9 +89,7 @@
 
     private static boolean canUseAggressiveHeapOption() throws Exception {
         if (!haveRequiredMemory()) {
-            System.out.println(
-                "Skipping test of " + option + " : insufficient memory");
-            return false;
+            throw new SkippedException("Skipping test of " + option + " : insufficient memory");
         }
         return true;
     }
--- a/test/hotspot/jtreg/gc/g1/TestHumongousShrinkHeap.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/gc/g1/TestHumongousShrinkHeap.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
 import java.text.NumberFormat;
 import gc.testlibrary.Helpers;
 import static jdk.test.lib.Asserts.*;
+import jtreg.SkippedException;
 
 public class TestHumongousShrinkHeap {
 
@@ -61,13 +62,11 @@
 
     public static void main(String[] args) {
         if (HUMON_COUNT == 0) {
-            System.out.println("Skipped. Heap is too small");
-            return;
+            throw new SkippedException("Heap is too small");
         }
 
         if (TOTAL_MEMORY + REGION_SIZE * HUMON_COUNT > MAX_MEMORY) {
-            System.out.println("Skipped. Initial heap size is to close to max heap size.");
-            return;
+            throw new SkippedException("Initial heap size is to close to max heap size.");
         }
 
         System.out.format("Running with %s initial heap size of %s maximum heap size. "
--- a/test/hotspot/jtreg/gc/g1/TestLargePageUseForAuxMemory.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/gc/g1/TestLargePageUseForAuxMemory.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Platform;
+import jtreg.SkippedException;
 import sun.hotspot.WhiteBox;
 
 public class TestLargePageUseForAuxMemory {
@@ -134,13 +135,11 @@
         final long heapAlignment = lcm(cardSize * smallPageSize, largePageSize);
 
         if (largePageSize == 0) {
-            System.out.println("Skip tests because large page support does not seem to be available on this platform.");
-            return;
+            throw new SkippedException("Large page support does not seem to be available on this platform.");
         }
         if (largePageSize == smallPageSize) {
-            System.out.println("Skip tests because large page support does not seem to be available on this platform." +
-                               "Small and large page size are the same.");
-            return;
+            throw new SkippedException("Large page support does not seem to be available on this platform."
+                    + "Small and large page size are the same.");
         }
 
         // To get large pages for the card table etc. we need at least a 1G heap (with 4k page size).
--- a/test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.Utils;
+import jtreg.SkippedException;
+
 import java.io.IOException;
 import java.lang.management.ManagementFactory;
 import java.lang.management.MemoryUsage;
@@ -69,10 +71,9 @@
 
         int maxCacheSize = Math.max(0, Math.min(31, getMaxCacheSize()));
         if (maxCacheSize < hotCardTableSize) {
-            System.out.format("Skiping test for %d cache size due max cache size %d",
-                    hotCardTableSize, maxCacheSize
-            );
-            return;
+            throw new SkippedException(String.format(
+                    "Skiping test for %d cache size due max cache size %d",
+                    hotCardTableSize, maxCacheSize));
         }
 
         printTestInfo(maxCacheSize);
--- a/test/hotspot/jtreg/runtime/6819213/TestBootNativeLibraryPath.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/runtime/6819213/TestBootNativeLibraryPath.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,12 +24,14 @@
 /*
  * @test TestBootNativeLibraryPath.java
  * @bug 6819213
+ * @summary verify sun.boot.native.library.path is expandable on 32 bit systems
+ * @author ksrini
  * @modules java.compiler
+ * @library /test/lib
+ * @requiers vm.bits == 32
  * @compile -XDignore.symbol.file TestBootNativeLibraryPath.java
- * @summary verify sun.boot.native.library.path is expandable on 32 bit systems
  * @run main TestBootNativeLibraryPath
- * @author ksrini
-*/
+ */
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -108,10 +110,6 @@
 
     public static void main(String[] args) {
         try {
-            if (!System.getProperty("sun.arch.data.model").equals("32")) {
-                System.out.println("Warning: test skipped for 64-bit systems\n");
-                return;
-            }
             String osname = System.getProperty("os.name");
             if (osname.startsWith("Windows")) {
                 osname = "Windows";
--- a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java	Thu Aug 02 14:40:55 2018 -0700
@@ -26,14 +26,17 @@
  * @bug 8024927
  * @summary Testing address of compressed class pointer space as best as possible.
  * @requires vm.opt.final.UseCompressedOops
+ * @requires vm.bits == 64
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
+ * @run main CompressedClassPointers
  */
 
 import jdk.test.lib.Platform;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
+import jtreg.SkippedException;
 
 public class CompressedClassPointers {
 
@@ -139,17 +142,10 @@
     }
 
     public static void main(String[] args) throws Exception {
-        if (!Platform.is64bit()) {
-            // Can't test this on 32 bit, just pass
-            System.out.println("Skipping test on 32bit");
-            return;
-        }
-        // Solaris 10 can't mmap compressed oops space without a base
         if (Platform.isSolaris()) {
              String name = System.getProperty("os.version");
              if (name.equals("5.10")) {
-                 System.out.println("Skipping test on Solaris 10");
-                 return;
+                throw new SkippedException("Solaris 10 can't mmap compressed oops space without a base");
              }
         }
         smallHeapTest();
--- a/test/hotspot/jtreg/runtime/CompressedOops/CompressedKlassPointerAndOops.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/runtime/CompressedOops/CompressedKlassPointerAndOops.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
+ * @requiers vm.bits == 64
+ * @run main CompressedKlassPointerAndOops
  */
 
 import jdk.test.lib.Platform;
@@ -38,13 +40,6 @@
 public class CompressedKlassPointerAndOops {
 
     public static void main(String[] args) throws Exception {
-
-        if (!Platform.is64bit()) {
-            // Can't test this on 32 bit, just pass
-            System.out.println("Skipping test on 32bit");
-            return;
-        }
-
         runWithAlignment(16);
         runWithAlignment(32);
         runWithAlignment(64);
--- a/test/hotspot/jtreg/runtime/ErrorHandling/TestOnError.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestOnError.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,12 @@
 
 /*
  * @test TestOnError
+ * @bug 8078470
  * @summary Test using -XX:OnError=<cmd>
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
+ * @requires vm.debug
  * @run main TestOnError
- * @bug 8078470
  */
 
 import jdk.test.lib.process.ProcessTools;
@@ -37,11 +38,6 @@
 public class TestOnError {
 
     public static void main(String[] args) throws Exception {
-        if (!Platform.isDebugBuild()) {
-            System.out.println("Test requires a non-product build - skipping");
-            return;
-        }
-
         String msg = "Test Succeeded";
 
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java	Thu Aug 02 14:40:55 2018 -0700
@@ -29,10 +29,12 @@
  *          is different from object alignment for creating a CDS file
  *          should fail when loading.
  * @requires vm.cds
+ * @requires vm.bits == 64
  * @library /test/lib
  * @bug 8025642
  * @modules java.base/jdk.internal.misc
  *          java.management
+ * @run main CdsDifferentObjectAlignment
  */
 
 import jdk.test.lib.cds.CDSTestUtils;
@@ -40,20 +42,12 @@
 import jdk.test.lib.Platform;
 
 public class CdsDifferentObjectAlignment {
+
     public static void main(String[] args) throws Exception {
-        String nativeWordSize = System.getProperty("sun.arch.data.model");
-        if (!Platform.is64bit()) {
-            System.out.println("ObjectAlignmentInBytes for CDS is only " +
-                "supported on 64bit platforms; this plaform is " +
-                nativeWordSize);
-            System.out.println("Skipping the test");
-        } else {
-            createAndLoadSharedArchive(16, 64);
-            createAndLoadSharedArchive(64, 32);
-        }
+        createAndLoadSharedArchive(16, 64);
+        createAndLoadSharedArchive(64, 32);
     }
 
-
     // Parameters are object alignment expressed in bytes
     private static void
     createAndLoadSharedArchive(int createAlignment, int loadAlignment)
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java	Thu Aug 02 14:40:55 2018 -0700
@@ -26,29 +26,24 @@
  * @summary Testing CDS (class data sharing) using varying object alignment.
  *          Using same object alignment for each dump/load pair
  * @requires vm.cds
+ * @requires vm.bits == 64
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
+ * @run main CdsSameObjectAlignment
  */
 
 import jdk.test.lib.Platform;
 import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
+import jtreg.SkippedException;
 
 public class CdsSameObjectAlignment {
     public static void main(String[] args) throws Exception {
-        String nativeWordSize = System.getProperty("sun.arch.data.model");
-        if (!Platform.is64bit()) {
-            System.out.println("ObjectAlignmentInBytes for CDS is only " +
-                "supported on 64bit platforms; this plaform is " +
-                nativeWordSize);
-            System.out.println("Skipping the test");
-        } else {
-            dumpAndLoadSharedArchive(8);
-            dumpAndLoadSharedArchive(16);
-            dumpAndLoadSharedArchive(32);
-            dumpAndLoadSharedArchive(64);
-        }
+        dumpAndLoadSharedArchive(8);
+        dumpAndLoadSharedArchive(16);
+        dumpAndLoadSharedArchive(32);
+        dumpAndLoadSharedArchive(64);
     }
 
     private static void
--- a/test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
+ * @requires vm.family == "solaris" | vm.family == "linux" | vm.family == "mac"
  * @run main XCheckJSig
  */
 
@@ -36,15 +37,12 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.Platform;
+import jtreg.SkippedException;
 
 public class XCheckJSig {
     public static void main(String args[]) throws Throwable {
 
         System.out.println("Regression test for bugs 7051189 and 8023393");
-        if (!Platform.isSolaris() && !Platform.isLinux() && !Platform.isOSX()) {
-            System.out.println("Test only applicable on Solaris, Linux, and Mac OSX, skipping");
-            return;
-        }
 
         String jdk_path = System.getProperty("test.jdk");
         String os_arch = Platform.getOsArch();
@@ -69,8 +67,7 @@
 
         // Make sure the libjsig file exists.
         if (!(new File(libjsig).exists())) {
-            System.out.println("File " + libjsig + " not found, skipping");
-            return;
+            throw new jtreg.SkippedException("File " + libjsig + " not found");
         }
 
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcheck:jni", "-version");
--- a/test/hotspot/jtreg/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
  * questions.
  */
 
-
 /*
  * @test Testlibadimalloc.java
  * @bug 8141445
@@ -37,6 +36,7 @@
 import java.nio.file.*;
 import java.util.*;
 import jdk.test.lib.process.ProcessTools;
+import jtreg.SkippedException;
 
 public class Testlibadimalloc {
 
@@ -50,8 +50,7 @@
 
         // If the libadimalloc.so file does not exist, pass the test
         if (!(Files.isRegularFile(path) || Files.isSymbolicLink(path))) {
-            System.out.println("Test skipped; libadimalloc.so does not exist");
-            return;
+            throw new SkippedException("libadimalloc.so does not exist");
         }
 
         // Get the JDK, library and class path properties
--- a/test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /* @test TestLargePagesFlags
  * @summary Tests how large pages are choosen depending on the given large pages flag combinations.
  * @requires vm.gc != "Z"
+ * @requires vm.family == "linux"
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
@@ -33,16 +34,12 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.Platform;
 import jdk.test.lib.process.ProcessTools;
+
 import java.util.ArrayList;
 
 public class TestLargePagesFlags {
 
   public static void main(String [] args) throws Exception {
-    if (!Platform.isLinux()) {
-      System.out.println("Skipping. TestLargePagesFlags has only been implemented for Linux.");
-      return;
-    }
-
     testUseTransparentHugePages();
     testUseHugeTLBFS();
     testUseSHM();
--- a/test/hotspot/jtreg/runtime/os/AvailableProcessors.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/runtime/os/AvailableProcessors.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -20,10 +20,6 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-import java.io.File;
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.process.OutputAnalyzer;
-import java.util.ArrayList;
 
 /*
  * @test
@@ -34,6 +30,14 @@
  * @library /test/lib
  * @run driver AvailableProcessors
  */
+
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jtreg.SkippedException;
+
+import java.util.ArrayList;
+import java.io.File;
+
 public class AvailableProcessors {
 
     static final String SUCCESS_STRING = "Found expected processors: ";
@@ -47,20 +51,18 @@
             String taskset;
             final String taskset1 = "/bin/taskset";
             final String taskset2 = "/usr/bin/taskset";
-            if (new File(taskset1).exists())
+            if (new File(taskset1).exists()) {
                 taskset = taskset1;
-            else if (new File(taskset2).exists())
+            } else if (new File(taskset2).exists()) {
                 taskset = taskset2;
-            else {
-                System.out.println("Skipping test: could not find taskset command");
-                return;
+            } else {
+                throw new SkippedException("Could not find taskset command");
             }
 
             int available = Runtime.getRuntime().availableProcessors();
 
             if (available == 1) {
-                System.out.println("Skipping test: only one processor available");
-                return;
+                throw new SkippedException("only one processor available");
             }
 
             // Get the java command we want to execute
--- a/test/hotspot/jtreg/runtime/signal/SigTestDriver.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/SigTestDriver.java	Thu Aug 02 14:40:55 2018 -0700
@@ -25,6 +25,7 @@
 import jdk.test.lib.Utils;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
+import jtreg.SkippedException;
 
 import java.io.File;
 import java.nio.file.Path;
@@ -40,8 +41,7 @@
     public static void main(String[] args) {
         // No signal tests on Windows yet; so setting to no-op
         if (Platform.isWindows()) {
-            System.out.println("SKIPPED: no signal tests on Windows, ignore.");
-            return;
+            throw new SkippedException("no signal tests on Windows");
         }
 
         // At least one argument should be specified
@@ -54,16 +54,13 @@
             case "SIGWAITING":
             case "SIGKILL":
             case "SIGSTOP": {
-                System.out.println("SKIPPED: signals SIGWAITING, SIGKILL and SIGSTOP can't be tested, ignore.");
-                return;
+                throw new SkippedException("signals SIGWAITING, SIGKILL and SIGSTOP can't be tested");
             }
             case "SIGUSR2": {
                 if (Platform.isLinux()) {
-                    System.out.println("SKIPPED: SIGUSR2 can't be tested on Linux, ignore.");
-                    return;
+                    throw new SkippedException("SIGUSR2 can't be tested on Linux");
                 } else if (Platform.isOSX()) {
-                    System.out.println("SKIPPED: SIGUSR2 can't be tested on OS X, ignore.");
-                    return;
+                    throw new SkippedException("SIGUSR2 can't be tested on OS X");
                 }
             }
         }
--- a/test/hotspot/jtreg/serviceability/jvmti/GetObjectSizeOverflow.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/jvmti/GetObjectSizeOverflow.java	Thu Aug 02 14:40:55 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -20,11 +20,6 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-import java.io.PrintWriter;
-import jdk.test.lib.JDKToolFinder;
-import jdk.test.lib.Platform;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.process.ProcessTools;
 
 /*
  * Test to verify GetObjectSize does not overflow on a 600M element int[]
@@ -37,18 +32,23 @@
  *          java.instrument
  *          java.management
  *          jdk.internal.jvmstat/sun.jvmstat.monitor
+ * @requires vm.bits == 64
  * @build GetObjectSizeOverflowAgent
  * @run driver ClassFileInstaller GetObjectSizeOverflowAgent
  * @run main GetObjectSizeOverflow
  */
+
+import java.io.PrintWriter;
+
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.Platform;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jtreg.SkippedException;
+
 public class GetObjectSizeOverflow {
     public static void main(String[] args) throws Exception  {
 
-        if (!Platform.is64bit()) {
-            System.out.println("Test needs a 4GB heap and can only be run as a 64bit process, skipping.");
-            return;
-        }
-
         PrintWriter pw = new PrintWriter("MANIFEST.MF");
         pw.println("Premain-Class: GetObjectSizeOverflowAgent");
         pw.close();
@@ -63,8 +63,7 @@
         if (output.getStdout().contains("Could not reserve enough space") || output.getStderr().contains("java.lang.OutOfMemoryError")) {
             System.out.println("stdout: " + output.getStdout());
             System.out.println("stderr: " + output.getStderr());
-            System.out.println("Test could not reserve or allocate enough space, skipping");
-            return;
+            throw new SkippedException("Test could not reserve or allocate enough space");
         }
 
         output.stdoutShouldContain("GetObjectSizeOverflow passed");
--- a/test/hotspot/jtreg/serviceability/jvmti/NotifyFramePop/NotifyFramePopTest.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/jvmti/NotifyFramePop/NotifyFramePopTest.java	Thu Aug 02 14:40:55 2018 -0700
@@ -24,10 +24,13 @@
 /**
  * @test
  * @summary Verifies NotifyFramePop request is cleared if JVMTI_EVENT_FRAME_POP is disabled
+ * @library /test/lib
  * @compile NotifyFramePopTest.java
  * @run main/othervm/native -agentlib:NotifyFramePopTest NotifyFramePopTest
  */
 
+import jtreg.SkippedException;
+
 public class NotifyFramePopTest {
     static {
         try {
@@ -42,8 +45,7 @@
 
     public static void main(String args[]) {
         if (!canGenerateFramePopEvents()) {
-            log("FramePop event is not supported - skipping the test");
-            return;
+            throw new SkippedException("FramePop event is not supported");
         }
 
         // Sanity testing that FRAME_POP works.
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java	Thu Aug 02 14:40:55 2018 -0700
@@ -54,6 +54,7 @@
 import java.util.regex.Matcher;
 import jdk.internal.misc.Unsafe;
 import java.util.Scanner;
+import jtreg.SkippedException;
 
 class CrashApp {
     public static void main(String[] args) {
@@ -121,7 +122,7 @@
                                 "Core files might not be generated. Please reset /proc/sys/kernel/core_pattern\n" +
                                 "to enable core generation. Skipping this test.");
                             cleanup();
-                            return;
+                            throw new SkippedException("This system uses a crash report tool");
                         }
                     }
                 }
@@ -144,16 +145,14 @@
 
             if (useSharedSpacesOutput == null) {
                 // Output could be null due to attach permission issues.
-                System.out.println("Could not determine the UseSharedSpaces value - test skipped.");
                 cleanup();
-                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.");
                 cleanup();
-                return;
+                throw new SkippedException("The CDS archive is not mapped");
             }
 
             cmds = List.of("printmdo -a", "printall");
@@ -183,6 +182,8 @@
                 "Failure occurred at bci",
                 "No suitable match for type of address"));
             test.runOnCore(TEST_CDS_CORE_FILE_NAME, cmds, expStrMap, unExpStrMap);
+        } catch (SkippedException e) {
+            throw e;
         } catch (Exception ex) {
             throw new RuntimeException("Test ERROR " + ex, ex);
         }
--- 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 {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java	Thu Aug 02 14:40:55 2018 -0700
@@ -21,12 +21,6 @@
  * questions.
  */
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.ArrayList;
-import jdk.test.lib.apps.LingeredApp;
-
 /**
  * @test
  * @bug 8192985
@@ -36,6 +30,13 @@
  * @run main/othervm ClhsdbInspect
  */
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ArrayList;
+import jdk.test.lib.apps.LingeredApp;
+import jtreg.SkippedException;
+
 public class ClhsdbInspect {
 
     public static void main(String[] args) throws Exception {
@@ -60,7 +61,7 @@
                 // Output could be null due to attach permission issues
                 // and if we are skipping this.
                 LingeredApp.stopApp(theApp);
-                return;
+                throw new SkippedException("attach permission issues");
             }
 
             Map<String, String> tokensMap = new HashMap<>();
@@ -100,6 +101,8 @@
                 expStrMap.put(cmd, List.of(tokensMap.get(key)));
                 test.run(theApp.getPid(), cmds, expStrMap, null);
             }
+        } catch (SkippedException e) {
+            throw e;
         } catch (Exception ex) {
             throw new RuntimeException("Test ERROR " + ex, ex);
         } finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbJdis.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbJdis.java	Thu Aug 02 14:40:55 2018 -0700
@@ -21,13 +21,6 @@
  * questions.
  */
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.ArrayList;
-
-import jdk.test.lib.apps.LingeredApp;
-
 /**
  * @test
  * @bug 8193124
@@ -37,6 +30,14 @@
  * @run main/othervm ClhsdbJdis
  */
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ArrayList;
+
+import jdk.test.lib.apps.LingeredApp;
+import jtreg.SkippedException;
+
 public class ClhsdbJdis {
 
     public static void main(String[] args) throws Exception {
@@ -58,33 +59,36 @@
 
             // Output could be null if the test was skipped due to
             // attach permission issues.
-            if (output != null) {
-                String cmdStr = null;
-                String[] parts = output.split("LingeredApp.main");
-                String[] tokens = parts[1].split(" ");
-                for (String token : tokens) {
-                    if (token.contains("Method")) {
-                        String[] address = token.split("=");
-                        // address[1] represents the address of the Method
-                        cmdStr = "jdis " + address[1];
-                        cmds.add(cmdStr);
-                        break;
-                    }
+            if (output == null) {
+                throw new SkippedException("attach permission issues");
+            }
+            String cmdStr = null;
+            String[] parts = output.split("LingeredApp.main");
+            String[] tokens = parts[1].split(" ");
+            for (String token : tokens) {
+                if (token.contains("Method")) {
+                    String[] address = token.split("=");
+                    // address[1] represents the address of the Method
+                    cmdStr = "jdis " + address[1];
+                    cmds.add(cmdStr);
+                    break;
                 }
+            }
 
-                Map<String, List<String>> expStrMap = new HashMap<>();
-                expStrMap.put(cmdStr, List.of(
-                        "public static void main(java.lang.String[])",
-                        "Holder Class",
-                        "public class jdk.test.lib.apps.LingeredApp @",
-                        "Bytecode",
-                        "line bci   bytecode",
-                        "Exception Table",
-                        "start bci end bci handler bci catch type",
-                        "Constant Pool of [public class jdk.test.lib.apps.LingeredApp @"));
+            Map<String, List<String>> expStrMap = new HashMap<>();
+            expStrMap.put(cmdStr, List.of(
+                    "public static void main(java.lang.String[])",
+                    "Holder Class",
+                    "public class jdk.test.lib.apps.LingeredApp @",
+                    "Bytecode",
+                    "line bci   bytecode",
+                    "Exception Table",
+                    "start bci end bci handler bci catch type",
+                    "Constant Pool of [public class jdk.test.lib.apps.LingeredApp @"));
 
-                test.run(theApp.getPid(), cmds, expStrMap, null);
-            }
+            test.run(theApp.getPid(), cmds, expStrMap, null);
+        } catch (SkippedException e) {
+            throw e;
         } catch (Exception ex) {
             throw new RuntimeException("Test ERROR " + ex, ex);
         } finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbLongConstant.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbLongConstant.java	Thu Aug 02 14:40:55 2018 -0700
@@ -21,13 +21,6 @@
  * questions.
  */
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import jdk.test.lib.apps.LingeredApp;
-import jdk.test.lib.Platform;
-
 /**
  * @test
  * @bug 8190198
@@ -37,6 +30,14 @@
  * @run main/othervm ClhsdbLongConstant
  */
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import jdk.test.lib.apps.LingeredApp;
+import jdk.test.lib.Platform;
+import jtreg.SkippedException;
+
 public class ClhsdbLongConstant {
 
     public static void main(String[] args) throws Exception {
@@ -75,11 +76,11 @@
             String longConstantOutput = test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);
 
             if (longConstantOutput == null) {
-                // Output could be null due to attach permission issues
-                // and if we are skipping this.
-                return;
+                throw new SkippedException("attach permission issues");
             }
             checkForTruncation(longConstantOutput);
+        } catch (SkippedException e) {
+            throw e;
         } catch (Exception ex) {
             throw new RuntimeException("Test ERROR " + ex, ex);
         } finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAs.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAs.java	Thu Aug 02 14:40:55 2018 -0700
@@ -21,12 +21,6 @@
  * questions.
  */
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.ArrayList;
-import jdk.test.lib.apps.LingeredApp;
-
 /**
  * @test
  * @bug 8192985
@@ -36,6 +30,13 @@
  * @run main/othervm ClhsdbPrintAs
  */
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ArrayList;
+import jdk.test.lib.apps.LingeredApp;
+import jtreg.SkippedException;
+
 public class ClhsdbPrintAs {
 
     public static void main(String[] args) throws Exception {
@@ -55,10 +56,8 @@
             String jstackOutput = test.run(theApp.getPid(), cmds, null, null);
 
             if (jstackOutput == null) {
-                // Output could be null due to attach permission issues
-                // and if we are skipping this.
                 LingeredApp.stopApp(theApp);
-                return;
+                throw new SkippedException("attach permission issues");
             }
 
             String[] snippets = jstackOutput.split("LingeredApp.main");
@@ -118,6 +117,8 @@
             expStrMap.put(cmd, List.of
                 ("ConstantPoolCache", "_pool_holder", "InstanceKlass*"));
             test.run(theApp.getPid(), cmds, expStrMap, null);
+        } catch (SkippedException e) {
+            throw e;
         } catch (Exception ex) {
             throw new RuntimeException("Test ERROR " + ex, ex);
         } finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java	Thu Aug 02 14:40:55 2018 -0700
@@ -21,12 +21,6 @@
  * questions.
  */
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import jdk.test.lib.apps.LingeredApp;
-
 /**
  * @test
  * @bug 8175312
@@ -36,6 +30,13 @@
  * @run main/othervm/timeout=2400 ClhsdbRegionDetailsScanOopsForG1
  */
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import jdk.test.lib.apps.LingeredApp;
+import jtreg.SkippedException;
+
 public class ClhsdbRegionDetailsScanOopsForG1 {
 
     public static void main(String[] args) throws Exception {
@@ -70,10 +71,8 @@
             String regionDetailsOutput = test.run(theApp.getPid(), cmds,
                                                   expStrMap, unExpStrMap);
             if (regionDetailsOutput == null) {
-                // Output could be null due to attach permission issues
-                // and if we are skipping this.
                 LingeredApp.stopApp(theApp);
-                return;
+                throw new SkippedException("attach permission issues");
             }
 
             // Test the output of 'scanoops' -- get the start and end addresses
@@ -87,6 +86,8 @@
             expStrMap = new HashMap<>();
             expStrMap.put(cmd, List.of("[Ljava/lang/String"));
             test.run(theApp.getPid(), List.of(cmd), expStrMap, null);
+        } catch (SkippedException e) {
+            throw e;
         } catch (Exception ex) {
             throw new RuntimeException("Test ERROR " + ex, ex);
         } finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbScanOops.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbScanOops.java	Thu Aug 02 14:40:55 2018 -0700
@@ -21,13 +21,6 @@
  * questions.
  */
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.ArrayList;
-import jdk.test.lib.Utils;
-import jdk.test.lib.apps.LingeredApp;
-
 /**
  * @test
  * @bug 8192985
@@ -37,6 +30,14 @@
  * @run main/othervm/timeout=1200 ClhsdbScanOops
  */
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ArrayList;
+import jdk.test.lib.Utils;
+import jdk.test.lib.apps.LingeredApp;
+import jtreg.SkippedException;
+
 public class ClhsdbScanOops {
 
     private static void testWithGcType(String gc) throws Exception {
@@ -58,10 +59,8 @@
             String universeOutput = test.run(theApp.getPid(), cmds, null, null);
 
             if (universeOutput == null) {
-                // Output could be null due to attach permission issues
-                // and if we are skipping this.
                 LingeredApp.stopApp(theApp);
-                return;
+                throw new SkippedException("attach permission issues");
             }
 
             cmds = new ArrayList<String>();
@@ -97,6 +96,8 @@
             unExpStrMap.put(cmd, List.of("java/lang/Thread"));
 
             test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);
+        } catch (SkippedException e) {
+            throw e;
         } catch (Exception ex) {
             throw new RuntimeException("Test ERROR " + ex, ex);
         } finally {
@@ -106,12 +107,8 @@
 
     public static void main(String[] args) throws Exception {
         System.out.println("Starting the ClhsdbScanOops test");
-        try {
-            testWithGcType("-XX:+UseParallelGC");
-            testWithGcType("-XX:+UseSerialGC");
-        } catch (Exception e) {
-            throw new Error("Test failed with " + e);
-        }
+        testWithGcType("-XX:+UseParallelGC");
+        testWithGcType("-XX:+UseSerialGC");
         System.out.println("Test PASSED");
     }
 }
--- a/test/hotspot/jtreg/serviceability/sa/DeadlockDetectionTest.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/sa/DeadlockDetectionTest.java	Thu Aug 02 14:40:55 2018 -0700
@@ -21,11 +21,21 @@
  * questions.
  */
 
+/**
+ * @test
+ * @summary Test deadlock detection
+ * @requires vm.hasSAandCanAttach
+ * @requires os.family != "mac"
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @modules java.management
+ * @run main DeadlockDetectionTest
+ */
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
-
 import jdk.test.lib.apps.LingeredApp;
 import jdk.test.lib.apps.LingeredAppWithDeadlock;
 
@@ -35,15 +45,7 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
-/**
- * @test
- * @summary Test deadlock detection
- * @requires vm.hasSAandCanAttach
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management
- * @run main DeadlockDetectionTest
- */
+import jtreg.SkippedException;
 
 public class DeadlockDetectionTest {
 
@@ -70,13 +72,6 @@
     public static void main(String[] args) throws Exception {
         System.out.println("Starting DeadlockDetectionTest");
 
-        if (Platform.isOSX()) {
-            // Coredump stackwalking is not implemented for Darwin
-            System.out.println("This test is not expected to work on OS X. Skipping");
-            return;
-        }
-
-
         if (!LingeredApp.isLastModifiedWorking()) {
             // Exact behaviour of the test depends on operating system and the test nature,
             // so just print the warning and continue
@@ -94,9 +89,8 @@
             System.out.println(output.getOutput());
 
             if (output.getExitValue() == 3) {
-                System.out.println("Test can't run for some reason. Skipping");
-            }
-            else {
+                throw new SkippedException("Test can't run for some reason");
+            } else {
                 output.shouldHaveExitValue(0);
                 output.shouldContain("Found a total of 1 deadlock.");
             }
--- a/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java	Thu Aug 02 14:40:55 2018 -0700
@@ -37,6 +37,7 @@
 import jdk.test.lib.hprof.HprofParser;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
+import jtreg.SkippedException;
 
 import java.io.File;
 
@@ -103,8 +104,7 @@
             String pid = output.firstMatch("^(\\d+)" + pidSeparator, 1);
             core = new File("cores/core." + pid);
             if (!core.exists()) {
-                System.out.println("Has not been able to find coredump. Test skipped.");
-                return;
+                throw new SkippedException("Has not been able to find coredump");
             }
         } else {
             Asserts.assertTrue(cores.length == 1,
--- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/UnloadingTest.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/UnloadingTest.java	Thu Aug 02 14:40:55 2018 -0700
@@ -20,6 +20,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package gc.g1.unloading;
 
 import java.lang.Thread.UncaughtExceptionHandler;
@@ -33,12 +34,13 @@
 import gc.g1.unloading.check.AssertionContainer;
 import gc.g1.unloading.check.ClassAssertion;
 import gc.g1.unloading.configuration.*;
+import gc.g1.unloading.loading.*;
 import nsk.share.gc.GCTestBase;
 import nsk.share.test.ExecutionController;
 import nsk.share.test.Stresser;
 import nsk.share.test.Tests;
 
-import gc.g1.unloading.loading.*;
+import jtreg.SkippedException;
 
 /**
  * This class contains main method. It's entry point for all configurations.
@@ -165,8 +167,7 @@
     private void checkIfG1Used() {
         for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) {
             if (!bean.getName().contains("G1")) {
-                System.err.println("This test was created to cover G1 class unloading feature. It should be ran with -XX:+UseG1GC. Skipping silently.");
-                System.exit(0);
+                throw new SkippedException("This test was created to cover G1 class unloading feature. It should be ran with -XX:+UseG1GC");
             }
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/TestDriver.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/AttachingConnector/attach/attach004/TestDriver.java	Thu Aug 02 14:40:55 2018 -0700
@@ -25,6 +25,7 @@
 
 import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.Utils;
+import jtreg.SkippedException;
 import nsk.share.jdi.ArgumentHandler;
 
 import java.io.BufferedReader;
@@ -63,23 +64,23 @@
                 "-arch=" + arch
         };
 
-        if (isTransportSupported(jdiArgs)) {
-            System.out.println("Transport is supported on this platform, execute test");
-            String suspend = args[2];
-            Process debuggee = startDebuggee(jdiArgs, transport, suspend);
-            Process debugger = startDebugger(jdiArgs, Arrays.copyOfRange(args, 3, args.length), debuggee.pid());
+        if (!isTransportSupported(jdiArgs)) {
+            throw new SkippedException("Transport isn't supported on this platform");
+        }
+
+        System.out.println("Transport is supported on this platform, execute test");
+        String suspend = args[2];
+        Process debuggee = startDebuggee(jdiArgs, transport, suspend);
+        Process debugger = startDebugger(jdiArgs, Arrays.copyOfRange(args, 3, args.length), debuggee.pid());
 
-            int debuggerExit = debugger.waitFor();
-            if (debuggerExit != 95) {
-                throw new Error("debugger exit code is " + debuggerExit);
-            }
+        int debuggerExit = debugger.waitFor();
+        if (debuggerExit != 95) {
+            throw new Error("debugger exit code is " + debuggerExit);
+        }
 
-            int debuggeeExit = debuggee.waitFor();
-            if (debuggeeExit != 95) {
-                throw new Error("debuggee exit code is " + debuggeeExit);
-            }
-        } else {
-            System.out.println("SKIPPED: Transport isn't supported on this platform, treat test as passed");
+        int debuggeeExit = debuggee.waitFor();
+        if (debuggeeExit != 95) {
+            throw new Error("debuggee exit code is " + debuggeeExit);
         }
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace001.java	Thu Aug 02 09:27:40 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace001.java	Thu Aug 02 14:40:55 2018 -0700
@@ -106,8 +106,9 @@
                         printStackTrace(snapshot);
                         testFailed = true;
                     }
-                } else
+                } else {
                     log.display("Thread " + j + " is dead, skipping it.");
+                }
             }
 
             // Let all threads to complete their job
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jtreg/SkippedException.java	Thu Aug 02 14:40:55 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jtreg;
+
+/**
+ * {@code SkippedException} is an exception treaded by jtreg as an indication
+ * of skipped status.
+ */
+public final class SkippedException extends RuntimeException {
+    public SkippedException(String s, Throwable t) {
+        super(s, t);
+    }
+
+    public SkippedException(String s) {
+        super(s);
+    }
+}