8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
authorgoetz
Mon, 25 Jun 2018 23:04:21 +0200
changeset 50791 b1e90a8a876c
parent 50790 5dfedce8ce62
child 50792 59306e5a6cc7
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach Reviewed-by: jgeorge, cjplummer
test/hotspot/jtreg/TEST.ROOT
test/hotspot/jtreg/compiler/ciReplay/SABase.java
test/hotspot/jtreg/compiler/ciReplay/TestSAClient.java
test/hotspot/jtreg/compiler/ciReplay/TestSAServer.java
test/hotspot/jtreg/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java
test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTest.java
test/hotspot/jtreg/serviceability/sa/ClhsdbAttach.java
test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java
test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java
test/hotspot/jtreg/serviceability/sa/ClhsdbField.java
test/hotspot/jtreg/serviceability/sa/ClhsdbFindPC.java
test/hotspot/jtreg/serviceability/sa/ClhsdbFlags.java
test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java
test/hotspot/jtreg/serviceability/sa/ClhsdbJdis.java
test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java
test/hotspot/jtreg/serviceability/sa/ClhsdbJstack.java
test/hotspot/jtreg/serviceability/sa/ClhsdbLongConstant.java
test/hotspot/jtreg/serviceability/sa/ClhsdbPmap.java
test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAll.java
test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAs.java
test/hotspot/jtreg/serviceability/sa/ClhsdbPrintStatics.java
test/hotspot/jtreg/serviceability/sa/ClhsdbPstack.java
test/hotspot/jtreg/serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java
test/hotspot/jtreg/serviceability/sa/ClhsdbScanOops.java
test/hotspot/jtreg/serviceability/sa/ClhsdbSource.java
test/hotspot/jtreg/serviceability/sa/ClhsdbSymbol.java
test/hotspot/jtreg/serviceability/sa/ClhsdbSymbolTable.java
test/hotspot/jtreg/serviceability/sa/ClhsdbThread.java
test/hotspot/jtreg/serviceability/sa/ClhsdbVmStructsDump.java
test/hotspot/jtreg/serviceability/sa/ClhsdbWhere.java
test/hotspot/jtreg/serviceability/sa/DeadlockDetectionTest.java
test/hotspot/jtreg/serviceability/sa/JhsdbThreadInfoTest.java
test/hotspot/jtreg/serviceability/sa/TestClassDump.java
test/hotspot/jtreg/serviceability/sa/TestClhsdbJstackLock.java
test/hotspot/jtreg/serviceability/sa/TestCpoolForInvokeDynamic.java
test/hotspot/jtreg/serviceability/sa/TestDefaultMethods.java
test/hotspot/jtreg/serviceability/sa/TestG1HeapRegion.java
test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java
test/hotspot/jtreg/serviceability/sa/TestHeapDumpForLargeArray.java
test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSize.java
test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSizeForInterface.java
test/hotspot/jtreg/serviceability/sa/TestIntConstant.java
test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackLock.java
test/hotspot/jtreg/serviceability/sa/TestJmapCore.java
test/hotspot/jtreg/serviceability/sa/TestJmapCoreMetaspace.java
test/hotspot/jtreg/serviceability/sa/TestPrintMdo.java
test/hotspot/jtreg/serviceability/sa/TestRevPtrsForInvokeDynamic.java
test/hotspot/jtreg/serviceability/sa/TestType.java
test/hotspot/jtreg/serviceability/sa/TestUniverse.java
test/hotspot/jtreg/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java
test/hotspot/jtreg/serviceability/sa/sadebugd/SADebugDTest.java
test/hotspot/jtreg/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java
test/jdk/TEST.ROOT
test/jdk/sun/tools/jhsdb/AlternateHashingTest.java
test/jdk/sun/tools/jhsdb/BasicLauncherTest.java
test/jdk/sun/tools/jhsdb/HeapDumpTest.java
test/jdk/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java
test/jdk/sun/tools/jstack/DeadlockDetectionTest.java
test/jtreg-ext/requires/VMProps.java
test/lib/jdk/test/lib/Platform.java
--- a/test/hotspot/jtreg/TEST.ROOT	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/TEST.ROOT	Mon Jun 25 23:04:21 2018 +0200
@@ -40,6 +40,7 @@
 requires.properties= \
     sun.arch.data.model \
     vm.simpleArch \
+    vm.bits \
     vm.flightRecorder \
     vm.gc.G1 \
     vm.gc.Serial \
@@ -51,6 +52,8 @@
     vm.emulatedClient \
     vm.cpu.features \
     vm.debug \
+    vm.hasSA \
+    vm.hasSAandCanAttach \
     vm.rtm.cpu \
     vm.rtm.os \
     vm.aot \
--- a/test/hotspot/jtreg/compiler/ciReplay/SABase.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/compiler/ciReplay/SABase.java	Mon Jun 25 23:04:21 2018 +0200
@@ -40,11 +40,6 @@
     private static final String REPLAY_FILE_COPY = "replay_vm.txt";
 
     public static void main(String args[]) throws Exception {
-        if (!Platform.shouldSAAttach()) {
-            System.out.println("SA attach not expected to work - test skipped.");
-            return;
-        }
-
         checkSetLimits();
         new SABase(args).runTest(/* needCoreDump = */ true, args);
     }
--- a/test/hotspot/jtreg/compiler/ciReplay/TestSAClient.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/compiler/ciReplay/TestSAClient.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -26,7 +26,7 @@
  * @bug 8011675
  * @library / /test/lib
  * @summary testing of ciReplay with using generated by SA replay.txt
- * @requires vm.flightRecorder != true & vm.compMode != "Xint" & vm.debug == true & vm.flavor == "client"
+ * @requires vm.hasSAandCanAttach & vm.flightRecorder != true & vm.compMode != "Xint" & vm.debug == true & vm.flavor == "client"
  * @modules java.base/jdk.internal.misc
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
--- a/test/hotspot/jtreg/compiler/ciReplay/TestSAServer.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/compiler/ciReplay/TestSAServer.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -26,7 +26,7 @@
  * @bug 8011675
  * @library / /test/lib
  * @summary testing of ciReplay with using generated by SA replay.txt
- * @requires vm.flightRecorder != true & vm.compMode != "Xint" & vm.debug == true & vm.flavor == "server"
+ * @requires vm.hasSAandCanAttach & vm.flightRecorder != true & vm.compMode != "Xint" & vm.debug == true & vm.flavor == "server"
  * @modules java.base/jdk.internal.misc
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
--- a/test/hotspot/jtreg/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -21,11 +21,11 @@
  * questions.
  */
 
-/*
+/**
  * @test CompressedClassSpaceSizeInJmapHeap
  * @bug 8004924
  * @summary Checks that jmap -heap contains the flag CompressedClassSpaceSize
- * @requires vm.opt.final.UseCompressedOops
+ * @requires vm.hasSAandCanAttach & vm.opt.final.UseCompressedOops
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
@@ -48,10 +48,6 @@
             // Compressed Class Space is only available on 64-bit JVMs
             return;
         }
-        if (!Platform.shouldSAAttach()) {
-            System.out.println("SA attach not expected to work - test skipped.");
-            return;
-        }
 
         String pid = Long.toString(ProcessTools.getProcessId());
 
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTest.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTest.java	Mon Jun 25 23:04:21 2018 +0200
@@ -24,7 +24,7 @@
 /**
  * @test SASymbolTableTest
  * @summary Walk symbol table using SA, with and without CDS.
- * @requires vm.cds
+ * @requires vm.cds & vm.hasSAandCanAttach
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          jdk.hotspot.agent/sun.jvm.hotspot.oops
@@ -59,11 +59,6 @@
 
 
     public static void main(String[] args) throws Exception {
-        if (!Platform.shouldSAAttach()) {
-            System.out.println("SA attach not expected to work - test skipped.");
-            return;
-        }
-
         CDSTestUtils.createArchiveAndCheck();
         run(true);
         run(false);
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbAttach.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbAttach.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -27,10 +27,11 @@
 
 import jdk.test.lib.apps.LingeredApp;
 
-/*
+/**
  * @test
  * @bug 8191658
  * @summary Test clhsdb attach, detach, reattach commands
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbAttach
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java	Mon Jun 25 23:04:21 2018 +0200
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/*
+/**
  * @test
  * @bug 8174994
  * @summary Test the clhsdb commands 'printmdo', 'printall' on a CDS enabled corefile.
  * @requires vm.cds
+ * @requires vm.hasSA
  * @requires os.family != "windows"
  * @requires vm.flavor == "server"
  * @library /test/lib
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java	Mon Jun 25 23:04:21 2018 +0200
@@ -21,11 +21,11 @@
  * questions.
  */
 
-/*
+/**
  * @test
  * @bug 8174994
  * @summary Test the clhsdb commands 'jstack', 'printall', 'where' with CDS enabled
- * @requires vm.cds
+ * @requires vm.hasSA & vm.cds
  * @library /test/lib
  * @run main/othervm/timeout=2400 -Xmx1g ClhsdbCDSJstackPrintAll
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbField.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbField.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -26,10 +26,11 @@
 import java.util.Map;
 import jdk.test.lib.apps.LingeredApp;
 
-/*
+/**
  * @test
  * @bug 8191538
  * @summary Test clhsdb 'field' command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbField
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbFindPC.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbFindPC.java	Mon Jun 25 23:04:21 2018 +0200
@@ -28,10 +28,11 @@
 
 import jdk.test.lib.apps.LingeredApp;
 
-/*
+/**
  * @test
  * @bug 8193124
  * @summary Test the clhsdb 'findpc' command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbFindPC
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbFlags.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbFlags.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -30,10 +30,11 @@
 import jdk.test.lib.Platform;
 import jdk.test.lib.Utils;
 
-/*
+/**
  * @test
  * @bug 8190198
  * @summary Test clhsdb flags command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbFlags
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java	Mon Jun 25 23:04:21 2018 +0200
@@ -27,10 +27,11 @@
 import java.util.ArrayList;
 import jdk.test.lib.apps.LingeredApp;
 
-/*
+/**
  * @test
  * @bug 8192985
  * @summary Test the clhsdb 'inspect' command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbInspect
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbJdis.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbJdis.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -28,10 +28,11 @@
 
 import jdk.test.lib.apps.LingeredApp;
 
-/*
+/**
  * @test
  * @bug 8193124
  * @summary Test the clhsdb 'jdis' command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbJdis
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -29,10 +29,11 @@
 import jdk.test.lib.apps.LingeredApp;
 import jdk.test.lib.Utils;
 
-/*
+/**
  * @test
  * @bug 8191658
  * @summary Test clhsdb jhisto command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbJhisto
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbJstack.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbJstack.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -28,10 +28,11 @@
 import jdk.test.lib.apps.LingeredApp;
 import jdk.test.lib.Platform;
 
-/*
+/**
  * @test
  * @bug 8190198
  * @summary Test clhsdb Jstack command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbJstack
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbLongConstant.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbLongConstant.java	Mon Jun 25 23:04:21 2018 +0200
@@ -28,10 +28,11 @@
 import jdk.test.lib.apps.LingeredApp;
 import jdk.test.lib.Platform;
 
-/*
+/**
  * @test
  * @bug 8190198
  * @summary Test clhsdb longConstant command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbLongConstant
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbPmap.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbPmap.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -28,10 +28,11 @@
 import jdk.test.lib.apps.LingeredApp;
 import jdk.test.lib.Platform;
 
-/*
+/**
  * @test
  * @bug 8190198
  * @summary Test clhsdb pmap command
+ * @requires vm.hasSA
  * @library /test/lib
  * @requires os.family != "mac"
  * @run main/othervm ClhsdbPmap
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAll.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAll.java	Mon Jun 25 23:04:21 2018 +0200
@@ -26,10 +26,11 @@
 import java.util.Map;
 import jdk.test.lib.apps.LingeredApp;
 
-/*
+/**
  * @test
  * @bug 8175384
  * @summary Test clhsdb 'printall' command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm/timeout=2400 -Xmx1g ClhsdbPrintAll
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAs.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAs.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -27,10 +27,11 @@
 import java.util.ArrayList;
 import jdk.test.lib.apps.LingeredApp;
 
-/*
+/**
  * @test
  * @bug 8192985
  * @summary Test the clhsdb 'printas' command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbPrintAs
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintStatics.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintStatics.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -28,10 +28,11 @@
 import jdk.test.lib.apps.LingeredApp;
 import jdk.test.lib.Platform;
 
-/*
+/**
  * @test
  * @bug 8190198
  * @summary Test clhsdb printstatics command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbPrintStatics
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbPstack.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbPstack.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -28,12 +28,12 @@
 import jdk.test.lib.apps.LingeredApp;
 import jdk.test.lib.Platform;
 
-/*
+/**
  * @test
  * @bug 8190198
  * @summary Test clhsdb pstack command
+ * @requires vm.hasSA & os.family != "mac"
  * @library /test/lib
- * @requires os.family != "mac"
  * @run main/othervm ClhsdbPstack
  */
 
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java	Mon Jun 25 23:04:21 2018 +0200
@@ -27,12 +27,12 @@
 import java.util.Map;
 import jdk.test.lib.apps.LingeredApp;
 
-/*
+/**
  * @test
  * @bug 8175312
  * @summary Test clhsdb 'g1regiondetails' and 'scanoops' commands for G1GC
+ * @requires vm.hasSA & (vm.bits == "64" & os.maxMemory > 8g)
  * @library /test/lib
- * @requires (vm.bits == "64" & os.maxMemory > 8g)
  * @run main/othervm/timeout=2400 ClhsdbRegionDetailsScanOopsForG1
  */
 
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbScanOops.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbScanOops.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -28,10 +28,11 @@
 import jdk.test.lib.Utils;
 import jdk.test.lib.apps.LingeredApp;
 
-/*
+/**
  * @test
  * @bug 8192985
  * @summary Test the clhsdb 'scanoops' command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm/timeout=1200 ClhsdbScanOops
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbSource.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbSource.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -30,10 +30,11 @@
 
 import jdk.test.lib.apps.LingeredApp;
 
-/*
+/**
  * @test
  * @bug 8192823
  * @summary Test clhsdb source command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbSource
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbSymbol.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbSymbol.java	Mon Jun 25 23:04:21 2018 +0200
@@ -28,10 +28,11 @@
 import jdk.test.lib.apps.LingeredApp;
 import jdk.test.lib.Platform;
 
-/*
+/**
  * @test
  * @bug 8190198
  * @summary Test clhsdb symboldump command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbSymbol
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbSymbolTable.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbSymbolTable.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -27,10 +27,11 @@
 import java.util.ArrayList;
 import jdk.test.lib.apps.LingeredApp;
 
-/*
+/**
  * @test
  * @bug 8191538
  * @summary Test the clhsdb 'symboltable' and 'symbol' commands
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbSymbolTable
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbThread.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbThread.java	Mon Jun 25 23:04:21 2018 +0200
@@ -26,10 +26,11 @@
 import java.util.Map;
 import jdk.test.lib.apps.LingeredApp;
 
-/*
+/**
  * @test
  * @bug 8193352
  * @summary Test clhsdb 'thread' and 'threads' commands
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbThread
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbVmStructsDump.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbVmStructsDump.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -26,10 +26,11 @@
 import java.util.Map;
 import jdk.test.lib.apps.LingeredApp;
 
-/*
+/**
  * @test
  * @bug 8191538
  * @summary Test clhsdb 'vmstructsdump' command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbVmStructsDump
  */
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbWhere.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbWhere.java	Mon Jun 25 23:04:21 2018 +0200
@@ -28,10 +28,11 @@
 import jdk.test.lib.apps.LingeredApp;
 import jdk.test.lib.Platform;
 
-/*
+/**
  * @test
  * @bug 8190198
  * @summary Test clhsdb where command
+ * @requires vm.hasSA
  * @library /test/lib
  * @run main/othervm ClhsdbWhere
  */
--- a/test/hotspot/jtreg/serviceability/sa/DeadlockDetectionTest.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/DeadlockDetectionTest.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -35,9 +35,10 @@
 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
@@ -69,14 +70,6 @@
     public static void main(String[] args) throws Exception {
         System.out.println("Starting DeadlockDetectionTest");
 
-        if (!Platform.shouldSAAttach()) {
-            // Silently skip the test if we don't have enough permissions to attach
-            // Not all conditions checked by function is relevant to SA but it's worth
-            // to check
-            System.err.println("Error! Insufficient permissions to attach.");
-            return;
-        }
-
         if (Platform.isOSX()) {
             // Coredump stackwalking is not implemented for Darwin
             System.out.println("This test is not expected to work on OS X. Skipping");
--- a/test/hotspot/jtreg/serviceability/sa/JhsdbThreadInfoTest.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/JhsdbThreadInfoTest.java	Mon Jun 25 23:04:21 2018 +0200
@@ -32,18 +32,15 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.Utils;
 
-/*
+/**
  * @test
+ * @requires vm.hasSAandCanAttach
  * @library /test/lib
  * @run main JhsdbThreadInfoTest
  */
 public class JhsdbThreadInfoTest {
 
     public static void main(String[] args) throws Exception {
-        if (!Platform.shouldSAAttach()) {
-            System.out.println("SA attach not expected to work - test skipped.");
-            return;
-        }
 
         LingeredApp app = null;
 
--- a/test/hotspot/jtreg/serviceability/sa/TestClassDump.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestClassDump.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -30,10 +30,11 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
-/*
+/**
  * @test
  * @bug 8184982
  * @summary Test ClassDump tool
+ * @requires vm.hasSAandCanAttach
  * @library /test/lib
  * @run main/othervm TestClassDump
  */
@@ -82,12 +83,6 @@
     }
 
     public static void main(String[] args) throws Exception {
-        if (!Platform.shouldSAAttach()) {
-            // Silently skip the test if we don't have enough permissions to attach
-            System.out.println("SA attach not expected to work - test skipped.");
-            return;
-        }
-
         LingeredApp theApp = null;
         try {
             theApp = LingeredApp.startApp();
--- a/test/hotspot/jtreg/serviceability/sa/TestClhsdbJstackLock.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestClhsdbJstackLock.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -36,8 +36,9 @@
 import jdk.test.lib.Utils;
 import jdk.test.lib.Asserts;
 
-/*
+/**
  * @test
+ * @requires vm.hasSAandCanAttach
  * @library /test/lib
  * @run main/othervm TestClhsdbJstackLock
  */
@@ -145,11 +146,6 @@
 
         LingeredApp app = null;
 
-        if (!Platform.shouldSAAttach()) {
-            System.out.println("SA attach not expected to work - test skipped.");
-            return;
-        }
-
         try {
             List<String> vmArgs = new ArrayList<String>(Utils.getVmOptions());
 
--- a/test/hotspot/jtreg/serviceability/sa/TestCpoolForInvokeDynamic.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestCpoolForInvokeDynamic.java	Mon Jun 25 23:04:21 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, 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
@@ -41,10 +41,10 @@
 import jdk.test.lib.Utils;
 import jdk.test.lib.Asserts;
 
-/*
+/**
  * @test
  * @library /test/lib
- * @requires os.family != "mac"
+ * @requires vm.hasSAandCanAttach & os.family != "mac"
  * @modules java.base/jdk.internal.misc
  *          jdk.hotspot.agent/sun.jvm.hotspot
  *          jdk.hotspot.agent/sun.jvm.hotspot.utilities
@@ -120,12 +120,6 @@
                                           "LingeredAppWithInvokeDynamic"
                                       };
 
-        if (!Platform.shouldSAAttach()) {
-            System.out.println(
-               "SA attach not expected to work - test skipped.");
-            return;
-        }
-
         if (args == null || args.length == 0) {
             try {
                 List<String> vmArgs = new ArrayList<String>();
--- a/test/hotspot/jtreg/serviceability/sa/TestDefaultMethods.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestDefaultMethods.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -40,10 +40,10 @@
 import jdk.test.lib.Utils;
 import jdk.test.lib.Asserts;
 
-/*
+/**
  * @test
  * @library /test/lib
- * @requires os.family != "mac"
+ * @requires vm.hasSAandCanAttach & os.family != "mac"
  * @modules java.base/jdk.internal.misc
  *          jdk.hotspot.agent/sun.jvm.hotspot
  *          jdk.hotspot.agent/sun.jvm.hotspot.utilities
@@ -131,12 +131,6 @@
                                           "SlytherinSpeak"
                                       };
 
-        if (!Platform.shouldSAAttach()) {
-            System.out.println(
-               "SA attach not expected to work - test skipped.");
-            return;
-        }
-
         if (args == null || args.length == 0) {
             try {
                 List<String> vmArgs = new ArrayList<String>();
--- a/test/hotspot/jtreg/serviceability/sa/TestG1HeapRegion.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestG1HeapRegion.java	Mon Jun 25 23:04:21 2018 +0200
@@ -36,10 +36,10 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.Utils;
 
-/*
+/**
  * @test
  * @library /test/lib
- * @requires os.family != "mac"
+ * @requires vm.hasSAandCanAttach & os.family != "mac"
  * @requires vm.gc.G1
  * @modules jdk.hotspot.agent/sun.jvm.hotspot
  *          jdk.hotspot.agent/sun.jvm.hotspot.gc.g1
@@ -88,12 +88,6 @@
     }
 
     public static void main (String... args) throws Exception {
-        if (!Platform.shouldSAAttach()) {
-            System.out.println(
-               "SA attach not expected to work - test skipped.");
-            return;
-        }
-
         if (args == null || args.length == 0) {
             try {
                 List<String> vmArgs = new ArrayList<String>();
--- a/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -46,10 +46,10 @@
 import jdk.test.lib.hprof.parser.PositionDataInputStream;
 import jdk.test.lib.hprof.model.Snapshot;
 
-/*
+/**
  * @test
  * @library /test/lib
- * @requires os.family != "mac"
+ * @requires vm.hasSAandCanAttach & os.family != "mac"
  * @modules java.base/jdk.internal.misc
  *          jdk.hotspot.agent/sun.jvm.hotspot
  *          jdk.hotspot.agent/sun.jvm.hotspot.utilities
@@ -115,12 +115,6 @@
 
         String heapDumpFileName = "lambdaHeapDump.bin";
 
-        if (!Platform.shouldSAAttach()) {
-            System.out.println(
-               "SA attach not expected to work - test skipped.");
-            return;
-        }
-
         File heapDumpFile = new File(heapDumpFileName);
         if (heapDumpFile.exists()) {
             heapDumpFile.delete();
--- a/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForLargeArray.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForLargeArray.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -42,11 +42,11 @@
 import jdk.test.lib.Utils;
 import jdk.test.lib.Asserts;
 
-/*
+/**
  * @test
  * @library /test/lib
  * @bug 8171084
- * @requires (vm.bits == "64" & os.maxMemory > 8g)
+ * @requires vm.hasSAandCanAttach & (vm.bits == "64" & os.maxMemory > 8g)
  * @modules java.base/jdk.internal.misc
  *          jdk.hotspot.agent/sun.jvm.hotspot
  *          jdk.hotspot.agent/sun.jvm.hotspot.utilities
@@ -89,12 +89,6 @@
 
         String heapDumpFileName = "LargeArrayHeapDump.bin";
 
-        if (!Platform.shouldSAAttach()) {
-            System.out.println(
-               "SA attach not expected to work - test skipped.");
-            return;
-        }
-
         File heapDumpFile = new File(heapDumpFileName);
         if (heapDumpFile.exists()) {
             heapDumpFile.delete();
--- a/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSize.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSize.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -41,9 +41,10 @@
 import java.io.*;
 import java.util.*;
 
-/*
+/**
  * @test
  * @library /test/lib
+ * @requires vm.hasSAandCanAttach
  * @modules java.base/jdk.internal.misc
  *          jdk.hotspot.agent/sun.jvm.hotspot
  *          jdk.hotspot.agent/sun.jvm.hotspot.utilities
@@ -174,11 +175,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        if (!Platform.shouldSAAttach()) {
-            System.out.println("SA attach not expected to work - test skipped.");
-            return;
-        }
-
         if (args == null || args.length == 0) {
             System.out.println ("No args run. Starting with args now.");
             startMeWithArgs();
--- a/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSizeForInterface.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSizeForInterface.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -38,9 +38,10 @@
 import jdk.test.lib.Utils;
 import jdk.test.lib.Asserts;
 
-/*
+/**
  * @test
  * @library /test/lib
+ * @requires vm.hasSAandCanAttach
  * @modules java.base/jdk.internal.misc
  *          jdk.hotspot.agent/sun.jvm.hotspot
  *          jdk.hotspot.agent/sun.jvm.hotspot.utilities
@@ -152,12 +153,6 @@
                                           "LingeredAppWithInterface$1"
                                       };
 
-        if (!Platform.shouldSAAttach()) {
-            System.out.println(
-               "SA attach not expected to work - test skipped.");
-            return;
-        }
-
         if (args == null || args.length == 0) {
             try {
                 List<String> vmArgs = new ArrayList<String>();
--- a/test/hotspot/jtreg/serviceability/sa/TestIntConstant.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestIntConstant.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -32,10 +32,11 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.Utils;
 
-/*
+/**
  * @test
  * @summary Test the 'intConstant' command of jhsdb clhsdb.
  * @bug 8190307
+ * @requires vm.hasSAandCanAttach
  * @library /test/lib
  * @build jdk.test.lib.apps.*
  * @run main/othervm TestIntConstant
@@ -129,12 +130,6 @@
 
     public static void main (String... args) throws Exception {
 
-        if (!Platform.shouldSAAttach()) {
-            System.out.println(
-               "SA attach not expected to work - test skipped.");
-            return;
-        }
-
         try {
             testIntConstant();
         } catch (Exception e) {
--- a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackLock.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackLock.java	Mon Jun 25 23:04:21 2018 +0200
@@ -37,8 +37,9 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.Utils;
 
-/*
+/**
  * @test
+ * @requires vm.hasSAandCanAttach
  * @library /test/lib
  * @run main/othervm TestJhsdbJstackLock
  */
@@ -49,11 +50,6 @@
 
         LingeredApp app = null;
 
-        if (!Platform.shouldSAAttach()) {
-            System.out.println("SA attach not expected to work - test skipped.");
-            return;
-        }
-
         try {
             List<String> vmArgs = new ArrayList<String>(Utils.getVmOptions());
 
--- a/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java	Mon Jun 25 23:04:21 2018 +0200
@@ -21,9 +21,10 @@
  * questions.
  */
 
-/*
+/**
  * @test TestJmapCore
  * @summary Test verifies that jhsdb jmap could generate heap dump from core when heap is full
+ * @requires vm.hasSA
  * @library /test/lib
  * @run driver/timeout=240 TestJmapCore run heap
  */
--- a/test/hotspot/jtreg/serviceability/sa/TestJmapCoreMetaspace.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestJmapCoreMetaspace.java	Mon Jun 25 23:04:21 2018 +0200
@@ -21,9 +21,10 @@
  * questions.
  */
 
-/*
+/**
  * @test TestJmapCoreMetaspace
  * @summary Test verifies that jhsdb jmap could generate heap dump from core when metspace is full
+ * @requires vm.hasSA
  * @library /test/lib
  * @run driver/timeout=240 TestJmapCore run metaspace
  */
--- a/test/hotspot/jtreg/serviceability/sa/TestPrintMdo.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestPrintMdo.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -36,9 +36,10 @@
 import jdk.test.lib.Utils;
 import jdk.test.lib.Asserts;
 
-/*
+/**
  * @test
  * @library /test/lib
+ * @requires vm.hasSAandCanAttach
  * @requires vm.flavor == "server" & !vm.emulatedClient & !(vm.opt.TieredStopAtLevel == 1)
  * @build jdk.test.lib.apps.*
  * @run main/othervm TestPrintMdo
@@ -148,12 +149,6 @@
 
         LingeredApp app = null;
 
-        if (!Platform.shouldSAAttach()) {
-            System.out.println(
-               "SA attach not expected to work - test skipped.");
-            return;
-        }
-
         try {
             List<String> vmArgs = new ArrayList<String>();
             vmArgs.add("-XX:+ProfileInterpreter");
--- a/test/hotspot/jtreg/serviceability/sa/TestRevPtrsForInvokeDynamic.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestRevPtrsForInvokeDynamic.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -36,10 +36,10 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.Utils;
 
-/*
+/**
  * @test
  * @library /test/lib
- * @requires os.family != "mac"
+ * @requires vm.hasSAandCanAttach & os.family != "mac"
  * @modules java.base/jdk.internal.misc
  *          jdk.hotspot.agent/sun.jvm.hotspot
  *          jdk.hotspot.agent/sun.jvm.hotspot.utilities
@@ -80,12 +80,6 @@
     }
 
     public static void main (String... args) throws Exception {
-        if (!Platform.shouldSAAttach()) {
-            System.out.println(
-               "SA attach not expected to work - test skipped.");
-            return;
-        }
-
         if (args == null || args.length == 0) {
             try {
                 List<String> vmArgs = new ArrayList<String>();
--- a/test/hotspot/jtreg/serviceability/sa/TestType.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestType.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -32,10 +32,11 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.Utils;
 
-/*
+/**
  * @test
  * @summary Test the 'type' command of jhsdb clhsdb.
  * @bug 8190307
+ * @requires vm.hasSAandCanAttach
  * @library /test/lib
  * @build jdk.test.lib.apps.*
  * @run main/othervm TestType
@@ -95,12 +96,6 @@
     public static void main (String... args) throws Exception {
         LingeredApp app = null;
 
-        if (!Platform.shouldSAAttach()) {
-            System.out.println(
-               "SA attach not expected to work - test skipped.");
-            return;
-        }
-
         try {
             List<String> vmArgs = new ArrayList<String>();
             vmArgs.addAll(Utils.getVmOptions());
--- a/test/hotspot/jtreg/serviceability/sa/TestUniverse.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/TestUniverse.java	Mon Jun 25 23:04:21 2018 +0200
@@ -33,10 +33,10 @@
 import jdk.test.lib.Platform;
 import jdk.test.lib.process.OutputAnalyzer;
 
-/*
+/**
  * @test
  * @summary Test the 'universe' command of jhsdb clhsdb.
- * @requires vm.gc != "Z"
+ * @requires vm.hasSAandCanAttach & vm.gc != "Z"
  * @bug 8190307
  * @library /test/lib
  * @build jdk.test.lib.apps.*
@@ -45,10 +45,10 @@
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestUniverse withoutZ
  */
 
-/*
+/**
  * @test
  * @summary Test the 'universe' command of jhsdb clhsdb.
- * @requires vm.gc == "Z"
+ * @requires vm.hasSAandCanAttach & vm.gc == "Z"
  * @bug 8190307
  * @library /test/lib
  * @build jdk.test.lib.apps.*
@@ -147,13 +147,6 @@
 
 
     public static void main (String... args) throws Exception {
-
-        if (!Platform.shouldSAAttach()) {
-            System.out.println(
-               "SA attach not expected to work - test skipped.");
-            return;
-        }
-
         try {
             test("-XX:+UseG1GC");
             test("-XX:+UseParallelGC");
--- a/test/hotspot/jtreg/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java	Mon Jun 25 23:04:21 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, 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
@@ -37,10 +37,11 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
-/*
+/**
  * @test
  * @bug 6313383
  * @key regression
+ * @requires vm.hasSAandCanAttach
  * @summary Regression test for hprof export issue due to large heaps (>2G)
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
@@ -58,10 +59,6 @@
     private static final long G = 1024L * M;
 
     public static void main(String[] args) throws Exception {
-        if (!Platform.shouldSAAttach()) {
-            System.out.println("SA attach not expected to work - test skipped.");
-            return;
-        }
 
         // All heap dumps should create 1.0.2 file format
         testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_2);
--- a/test/hotspot/jtreg/serviceability/sa/sadebugd/SADebugDTest.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/sadebugd/SADebugDTest.java	Mon Jun 25 23:04:21 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, 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
@@ -21,15 +21,17 @@
  * questions.
  */
 
-/*
+/**
  * @test
  * @summary Checks that the jshdb debugd utility sucessfully starts
  *          and tries to attach to a running process
+ * @requires vm.hasSAandCanAttach
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  *
  * @run main/othervm SADebugDTest
  */
+
 import java.io.File;
 import java.util.concurrent.CountDownLatch;
 import java.io.InputStreamReader;
@@ -38,7 +40,6 @@
 import java.util.concurrent.TimeUnit;
 import java.util.function.Predicate;
 import static jdk.test.lib.Asserts.assertTrue;
-import static jdk.test.lib.Platform.shouldSAAttach;
 import static jdk.test.lib.process.ProcessTools.startProcess;
 
 public class SADebugDTest {
@@ -55,11 +56,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        if (!shouldSAAttach()) {
-            log("Not possible to attach the SA. Skipping the test");
-            return;
-        }
-
         long ourPid = ProcessHandle.current().pid();
 
         // The string we are expecting in the debugd ouput
--- a/test/hotspot/jtreg/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/hotspot/jtreg/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Mon Jun 25 23:04:21 2018 +0200
@@ -51,7 +51,7 @@
         VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero", "isEmbedded"),
         MODE("isInt", "isMixed", "isComp"),
         IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild", "isSlowDebugBuild",
-                "shouldSAAttach", "isTieredSupported", "areCustomLoadersSupportedForCDS");
+                "hasSA", "shouldSAAttach", "isTieredSupported", "areCustomLoadersSupportedForCDS");
 
         public final List<String> methodNames;
 
--- a/test/jdk/TEST.ROOT	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/jdk/TEST.ROOT	Mon Jun 25 23:04:21 2018 +0200
@@ -40,6 +40,8 @@
     vm.gc.Z \
     vm.graal.enabled \
     vm.cds \
+    vm.hasSA \
+    vm.hasSAandCanAttach \
     docker.support \
     release.implementor
 
--- a/test/jdk/sun/tools/jhsdb/AlternateHashingTest.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/jdk/sun/tools/jhsdb/AlternateHashingTest.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -21,10 +21,11 @@
  * questions.
  */
 
-/*
+/**
  * @test
  * @bug 8030750
  * @summary Test alternate hashing of strings in Serviceability Agent.
+ * @requires vm.hasSAandCanAttach
  * @library /test/lib
  * @library /lib/testlibrary
  * @compile AlternateHashingTest.java
@@ -111,13 +112,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        if (!Platform.shouldSAAttach()) {
-            // Silently skip the test if we don't have enough permissions to attach
-            System.err.println("Error! Insufficient permissions to attach - test skipped.");
-            return;
-        }
-
-
         testAltHashing();
 
         // The test throws RuntimeException on error.
--- a/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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,11 +21,12 @@
  * questions.
  */
 
-/*
+/**
  * @test
  * @summary Basic test for jhsdb launcher
  * @library /test/lib
  * @library /lib/testlibrary
+ * @requires vm.hasSAandCanAttach
  * @build jdk.testlibrary.*
  * @build jdk.test.lib.apps.*
  * @run main BasicLauncherTest
@@ -200,12 +201,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        if (!Platform.shouldSAAttach()) {
-            // Silently skip the test if we don't have enough permissions to attach
-            System.err.println("Error! Insufficient permissions to attach.");
-            return;
-        }
-
         launchCLHSDB();
 
         launch("compiler detected", null, "jmap", "--clstats");
--- a/test/jdk/sun/tools/jhsdb/HeapDumpTest.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/jdk/sun/tools/jhsdb/HeapDumpTest.java	Mon Jun 25 23:04:21 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, 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
@@ -21,10 +21,11 @@
  * questions.
  */
 
-/*
+/**
  * @test
  * @bug 8163346
  * @summary Test hashing of extended characters in Serviceability Agent.
+ * @requires vm.hasSAandCanAttach
  * @library /test/lib
  * @library /lib/testlibrary
  * @compile -encoding utf8 HeapDumpTest.java
@@ -125,13 +126,6 @@
 
     public static void main(String[] args) throws Exception {
 
-        if (!Platform.shouldSAAttach()) {
-            // Silently skip the test if we don't have enough permissions to attach
-            System.err.println("Error! Insufficient permissions to attach - test skipped.");
-            return;
-        }
-
-
         testHeapDump();
 
         // The test throws RuntimeException on error.
--- a/test/jdk/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/jdk/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -32,11 +32,12 @@
 import jdk.testlibrary.Utils;
 import jdk.test.lib.Platform;
 
-/*
+/**
  * @test
  * @bug 8042397
  * @summary Unit test for jmap utility test heap configuration reader
  *
+ * @requires vm.hasSAandCanAttach
  * @library /test/lib
  * @library /lib/testlibrary
  * @modules java.management
@@ -119,12 +120,6 @@
     public static void main(String[] args) throws Exception {
         System.out.println("Starting JMapHeapConfigTest");
 
-        if (!Platform.shouldSAAttach()) {
-            // Silently skip the test if we don't have enough permissions to attach
-            System.err.println("Error! Insufficient permissions to attach.");
-            return;
-        }
-
         if (!LingeredApp.isLastModifiedWorking()) {
             // Exact behaviour of the test depends to operating system and the test nature,
             // so just print the warning and continue
--- a/test/jdk/sun/tools/jstack/DeadlockDetectionTest.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/jdk/sun/tools/jstack/DeadlockDetectionTest.java	Mon Jun 25 23:04:21 2018 +0200
@@ -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
@@ -34,9 +34,10 @@
 import jdk.testlibrary.OutputAnalyzer;
 import jdk.testlibrary.ProcessTools;
 
-/*
+/**
  * @test
  * @summary Test deadlock detection
+ * @requires vm.hasSAandCanAttach
  * @library /test/lib
  * @library /lib/testlibrary
  * @build jdk.testlibrary.*
@@ -69,12 +70,6 @@
     public static void main(String[] args) throws Exception {
         System.out.println("Starting DeadlockDetectionTest");
 
-        if (!Platform.shouldSAAttach()) {
-            // Silently skip the test if we don't have enough permissions to attach
-            System.err.println("Error! Insufficient permissions to attach.");
-            return;
-        }
-
         if (!LingeredApp.isLastModifiedWorking()) {
             // Exact behaviour of the test depends on operating system and the test nature,
             // so just print the warning and continue
--- a/test/jtreg-ext/requires/VMProps.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/jtreg-ext/requires/VMProps.java	Mon Jun 25 23:04:21 2018 +0200
@@ -73,6 +73,12 @@
         map.put("vm.debug", vmDebug());
         map.put("vm.jvmci", vmJvmci());
         map.put("vm.emulatedClient", vmEmulatedClient());
+        // vm.hasSA is "true" if the VM contains the serviceability agent
+        // and jhsdb.
+        map.put("vm.hasSA", vmHasSA());
+        // vm.hasSAandCanAttach is "true" if the VM contains the serviceability agent
+        // and jhsdb and it can attach to the VM.
+        map.put("vm.hasSAandCanAttach", vmHasSAandCanAttach());
         map.put("vm.cpu.features", cpuFeatures());
         map.put("vm.rtm.cpu", vmRTMCPU());
         map.put("vm.rtm.os", vmRTMOS());
@@ -259,6 +265,28 @@
     }
 
     /**
+     * @return "true" if VM has a serviceability agent.
+     */
+    protected String vmHasSA() {
+        return "" + Platform.hasSA();
+    }
+
+    /**
+     * @return "true" if VM has a serviceability agent and it can
+     * attach to the VM.
+     */
+    protected String vmHasSAandCanAttach() {
+        try {
+            return "" + Platform.shouldSAAttach();
+        } catch (IOException e) {
+            System.out.println("Checking whether SA can attach to the VM failed.");
+            e.printStackTrace();
+            // Run the tests anyways.
+            return "true";
+        }
+    }
+
+    /**
      * @return true if VM runs RTM supported OS and false otherwise.
      */
     protected String vmRTMOS() {
--- a/test/lib/jdk/test/lib/Platform.java	Tue Jun 26 09:52:21 2018 -0400
+++ b/test/lib/jdk/test/lib/Platform.java	Mon Jun 25 23:04:21 2018 +0200
@@ -252,16 +252,29 @@
     }
 
     /**
-     * Return a boolean for whether we expect to be able to attach
-     * the SA to our own processes on this system.
+     * Return a boolean for whether SA and jhsdb are ported/available
+     * on this platform.
      */
-    public static boolean shouldSAAttach() throws IOException {
+    public static boolean hasSA() {
         if (isAix()) {
             return false; // SA not implemented.
         } else if (isLinux()) {
             if (isS390x()) {
                 return false; // SA not implemented.
             }
+        }
+        // Other platforms expected to work:
+        return true;
+    }
+
+    /**
+     * Return a boolean for whether we expect to be able to attach
+     * the SA to our own processes on this system.  This requires
+     * that SA is ported/available on this platform.
+     */
+    public static boolean shouldSAAttach() throws IOException {
+        if (!hasSA()) return false;
+        if (isLinux()) {
             return canPtraceAttachLinux();
         } else if (isOSX()) {
             return canAttachOSX();