changeset 59154:03150e4dffd6

8244385: various clean-ups in runtime tests Reviewed-by: minqi
author iignatyev
date Tue, 05 May 2020 09:27:22 -0700
parents 8e3850fc4344
children fe3c5d0b4002
files test/hotspot/jtreg/runtime/8176717/TestInheritFD.java test/hotspot/jtreg/runtime/ClassFile/PreviewVersion.java test/hotspot/jtreg/runtime/CompressedOops/CompressedClassSpaceSize.java test/hotspot/jtreg/runtime/ErrorHandling/BadNativeStackInErrorHandlingTest.java test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java test/hotspot/jtreg/runtime/LoadClass/TestResize.java test/hotspot/jtreg/runtime/Safepoint/AssertSafepointCheckConsistency1.java test/hotspot/jtreg/runtime/Safepoint/AssertSafepointCheckConsistency2.java test/hotspot/jtreg/runtime/Safepoint/AssertSafepointCheckConsistency3.java test/hotspot/jtreg/runtime/Safepoint/AssertSafepointCheckConsistency4.java test/hotspot/jtreg/runtime/Safepoint/NoSafepointVerifier.java test/hotspot/jtreg/runtime/Unsafe/RangeCheck.java test/hotspot/jtreg/runtime/cds/appcds/TestCombinedCompressedFlags.java test/hotspot/jtreg/runtime/cds/appcds/TestZGCWithCDS.java test/hotspot/jtreg/runtime/logging/ItablesTest.java test/hotspot/jtreg/runtime/logging/RemovedDevelopFlagsTest.java test/hotspot/jtreg/runtime/memory/LargePages/TestLargePageSizeInBytes.java test/hotspot/jtreg/runtime/memory/RunUnitTestsConcurrently.java test/hotspot/jtreg/runtime/symboltable/ShortLivedSymbolCleanup.java
diffstat 19 files changed, 233 insertions(+), 256 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java	Tue May 05 09:27:22 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2020, 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,6 +30,7 @@
 import static jdk.test.lib.process.ProcessTools.createJavaProcessBuilder;
 import static jdk.test.lib.Platform.isWindows;
 import jdk.test.lib.Utils;
+import jtreg.SkippedException;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -50,6 +51,7 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
+ * @run driver TestInheritFD
  */
 
 /**
@@ -83,9 +85,7 @@
         File commFile = Utils.createTempFile("communication", ".txt").toFile();
 
         if (!isWindows() && !lsofCommand().isPresent()) {
-            System.out.println("Could not find lsof like command");
-            System.out.println("Exit test case as successful though it could not verify anything");
-            return;
+            throw new SkippedException("Could not find lsof like command");
         }
 
         ProcessBuilder pb = createJavaProcessBuilder(
--- a/test/hotspot/jtreg/runtime/ClassFile/PreviewVersion.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/ClassFile/PreviewVersion.java	Tue May 05 09:27:22 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2020, 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
@@ -64,12 +64,14 @@
             "-cp", "." + File.pathSeparator + System.getProperty("test.classes"), "PVTest");
         oa = new OutputAnalyzer(pb.start());
         oa.shouldContain("Hi!");
+        oa.shouldHaveExitValue(0);
 
         // Test -Xlog:class+preview
         pb = ProcessTools.createJavaProcessBuilder("--enable-preview", "-Xlog:class+preview",
             "-cp", "." + File.pathSeparator + System.getProperty("test.classes"), "PVTest");
         oa = new OutputAnalyzer(pb.start());
         oa.shouldContain("[info][class,preview] Loading class PVTest that depends on preview features");
+        oa.shouldHaveExitValue(0);
 
         // Subtract 1 from class's major version.  The class should fail to load
         // because its major_version does not match the JVM current version.
--- a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassSpaceSize.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassSpaceSize.java	Tue May 05 09:27:22 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2020, 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,9 +29,9 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main CompressedClassSpaceSize
+ * @run driver CompressedClassSpaceSize
  */
-import jdk.test.lib.Platform;
+
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 
@@ -40,71 +40,62 @@
     public static void main(String[] args) throws Exception {
         ProcessBuilder pb;
         OutputAnalyzer output;
-        if (Platform.is64bit()) {
-            // Minimum size is 1MB
-            pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=0",
-                                                       "-version");
-            output = new OutputAnalyzer(pb.start());
-            output.shouldContain("outside the allowed range")
-                  .shouldHaveExitValue(1);
+        // Minimum size is 1MB
+        pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=0",
+                                                   "-version");
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("outside the allowed range")
+              .shouldHaveExitValue(1);
 
-            // Invalid size of -1 should be handled correctly
-            pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=-1",
-                                                       "-version");
-            output = new OutputAnalyzer(pb.start());
-            output.shouldContain("Improperly specified VM option 'CompressedClassSpaceSize=-1'")
-                  .shouldHaveExitValue(1);
+        // Invalid size of -1 should be handled correctly
+        pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=-1",
+                                                   "-version");
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Improperly specified VM option 'CompressedClassSpaceSize=-1'")
+              .shouldHaveExitValue(1);
 
 
-            // Maximum size is 3GB
-            pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=4g",
-                                                       "-version");
-            output = new OutputAnalyzer(pb.start());
-            output.shouldContain("outside the allowed range")
-                  .shouldHaveExitValue(1);
+        // Maximum size is 3GB
+        pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=4g",
+                                                   "-version");
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("outside the allowed range")
+              .shouldHaveExitValue(1);
 
 
-            // Make sure the minimum size is set correctly and printed
-            pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions",
-                                                       "-XX:CompressedClassSpaceSize=1m",
-                                                       "-Xlog:gc+metaspace=trace",
-                                                       "-version");
-            output = new OutputAnalyzer(pb.start());
-            output.shouldContain("Compressed class space size: 1048576")
-                  .shouldHaveExitValue(0);
+        // Make sure the minimum size is set correctly and printed
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions",
+                                                   "-XX:CompressedClassSpaceSize=1m",
+                                                   "-Xlog:gc+metaspace=trace",
+                                                   "-version");
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Compressed class space size: 1048576")
+              .shouldHaveExitValue(0);
 
 
-            // Make sure the maximum size is set correctly and printed
-            pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions",
-                                                       "-XX:CompressedClassSpaceSize=3g",
-                                                       "-Xlog:gc+metaspace=trace",
-                                                       "-version");
-            output = new OutputAnalyzer(pb.start());
-            output.shouldContain("Compressed class space size: 3221225472")
-                  .shouldHaveExitValue(0);
+        // Make sure the maximum size is set correctly and printed
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions",
+                                                   "-XX:CompressedClassSpaceSize=3g",
+                                                   "-Xlog:gc+metaspace=trace",
+                                                   "-version");
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Compressed class space size: 3221225472")
+              .shouldHaveExitValue(0);
 
 
-            pb = ProcessTools.createJavaProcessBuilder("-XX:-UseCompressedOops",
-                                                       "-XX:CompressedClassSpaceSize=1m",
-                                                       "-version");
-            output = new OutputAnalyzer(pb.start());
-            output.shouldContain("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used")
-                  .shouldHaveExitValue(0);
+        pb = ProcessTools.createJavaProcessBuilder("-XX:-UseCompressedOops",
+                                                   "-XX:CompressedClassSpaceSize=1m",
+                                                   "-version");
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used")
+              .shouldHaveExitValue(0);
 
 
-            pb = ProcessTools.createJavaProcessBuilder("-XX:-UseCompressedClassPointers",
-                                                       "-XX:CompressedClassSpaceSize=1m",
-                                                       "-version");
-            output = new OutputAnalyzer(pb.start());
-            output.shouldContain("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used")
-                  .shouldHaveExitValue(0);
-        } else {
-            // 32bit platforms doesn't have compressed oops
-            pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=1m",
-                                                       "-version");
-            output = new OutputAnalyzer(pb.start());
-            output.shouldContain("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used")
-                  .shouldHaveExitValue(0);
-        }
+        pb = ProcessTools.createJavaProcessBuilder("-XX:-UseCompressedClassPointers",
+                                                   "-XX:CompressedClassSpaceSize=1m",
+                                                   "-version");
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used")
+              .shouldHaveExitValue(0);
     }
 }
--- a/test/hotspot/jtreg/runtime/ErrorHandling/BadNativeStackInErrorHandlingTest.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/ErrorHandling/BadNativeStackInErrorHandlingTest.java	Tue May 05 09:27:22 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2020, 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,7 +27,6 @@
 import java.io.InputStreamReader;
 import java.util.regex.Pattern;
 
-import jdk.test.lib.Platform;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
@@ -36,16 +35,15 @@
  * @bug 8194652
  * @summary Printing native stack shows an "error occurred during error reporting".
  * @modules java.base/jdk.internal.misc
+ * @requires vm.debug
+ * @requires vm.flavor != "zero"
  * @library /test/lib
+ * @run driver BadNativeStackInErrorHandlingTest
  */
 
 // This test was adapted from SafeFetchInErrorHandlingTest.java.
 public class BadNativeStackInErrorHandlingTest {
   public static void main(String[] args) throws Exception {
-    if (!Platform.isDebugBuild() || Platform.isZero()) {
-      return;
-    }
-
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
         "-XX:+UnlockDiagnosticVMOptions",
         "-Xmx100M",
--- a/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java	Tue May 05 09:27:22 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, 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,13 +44,16 @@
     }
 
     public static void main(String[] args) throws Exception {
-        runTest("-XX:-CreateCoredumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped");
+        runTest("-XX:-CreateCoredumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped")
+                                             .shouldNotHaveExitValue(0);
 
         if (Platform.isWindows()) {
             // The old CreateMinidumpOnCrash option should still work
-            runTest("-XX:-CreateMinidumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped");
+            runTest("-XX:-CreateMinidumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped")
+                                                 .shouldNotHaveExitValue(0);
         } else {
-            runTest("-XX:+CreateCoredumpOnCrash").shouldNotContain("CreateCoredumpOnCrash turned off, no core file dumped");
+            runTest("-XX:+CreateCoredumpOnCrash").shouldNotContain("CreateCoredumpOnCrash turned off, no core file dumped")
+                                                 .shouldNotHaveExitValue(0);
         }
 
     }
--- a/test/hotspot/jtreg/runtime/LoadClass/TestResize.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/LoadClass/TestResize.java	Tue May 05 09:27:22 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2020, 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
@@ -25,11 +25,11 @@
  * @test
  * @bug 8184765
  * @summary make sure the SystemDictionary gets resized when load factor is too high
+ * @requires vm.debug
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @compile TriggerResize.java
- * @requires (vm.debug == true)
  * @run driver TestResize
  */
 
@@ -112,16 +112,14 @@
   }
 
   public static void main(String[] args) throws Exception {
-    if (Platform.isDebugBuild()) {
-      // -XX:+PrintSystemDictionaryAtExit will print the details of system dictionary,
-      // that will allow us to calculate the table's load factor.
-      // -Xlog:safepoint+cleanup will print out cleanup details at safepoint
-      // that will allow us to detect if the system dictionary resized.
-      ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintSystemDictionaryAtExit",
-                                                                "-Xlog:safepoint+cleanup",
-                                                                "TriggerResize",
-                                                                "50000");
-      analyzeOutputOn(pb);
-    }
+    // -XX:+PrintSystemDictionaryAtExit will print the details of system dictionary,
+    // that will allow us to calculate the table's load factor.
+    // -Xlog:safepoint+cleanup will print out cleanup details at safepoint
+    // that will allow us to detect if the system dictionary resized.
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintSystemDictionaryAtExit",
+                                                              "-Xlog:safepoint+cleanup",
+                                                              "TriggerResize",
+                                                              "50000");
+    analyzeOutputOn(pb);
   }
-}
\ No newline at end of file
+}
--- a/test/hotspot/jtreg/runtime/Safepoint/AssertSafepointCheckConsistency1.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/Safepoint/AssertSafepointCheckConsistency1.java	Tue May 05 09:27:22 2020 -0700
@@ -25,17 +25,17 @@
  * @test
  * @bug 8047290
  * @summary Ensure that a Monitor::lock_without_safepoint_check fires an assert when it incorrectly acquires a lock which must always have safepoint checks.
+ * @requires vm.debug
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main AssertSafepointCheckConsistency1
+ * @run driver AssertSafepointCheckConsistency1
  */
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Platform;
 
 import sun.hotspot.WhiteBox;
 
@@ -43,18 +43,19 @@
     public static void main(String args[]) throws Exception {
         if (args.length > 0) {
             WhiteBox.getWhiteBox().assertMatchingSafepointCalls(true, true);
+            return;
         }
-        if (Platform.isDebugBuild()){
-            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-                  "-Xbootclasspath/a:.",
-                  "-XX:+UnlockDiagnosticVMOptions",
-                  "-XX:+WhiteBoxAPI",
-                  "-XX:-CreateCoredumpOnCrash",
-                  "-Xmx128m",
-                  "AssertSafepointCheckConsistency1",
-                  "test");
-            OutputAnalyzer output = new OutputAnalyzer(pb.start());
-            output.shouldContain("assert").shouldContain("always");
-        }
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+              "-Xbootclasspath/a:.",
+              "-XX:+UnlockDiagnosticVMOptions",
+              "-XX:+WhiteBoxAPI",
+              "-XX:-CreateCoredumpOnCrash",
+              "-Xmx128m",
+              "AssertSafepointCheckConsistency1",
+              "test");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("assert")
+              .shouldContain("always")
+              .shouldNotHaveExitValue(0);
     }
 }
--- a/test/hotspot/jtreg/runtime/Safepoint/AssertSafepointCheckConsistency2.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/Safepoint/AssertSafepointCheckConsistency2.java	Tue May 05 09:27:22 2020 -0700
@@ -25,17 +25,17 @@
  * @test
  * @bug 8047290
  * @summary Ensure that a Monitor::lock fires an assert when it incorrectly acquires a lock which must never have safepoint checks.
+ * @requires vm.debug
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main AssertSafepointCheckConsistency2
+ * @run driver AssertSafepointCheckConsistency2
  */
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Platform;
 
 import sun.hotspot.WhiteBox;
 
@@ -43,19 +43,20 @@
     public static void main(String args[]) throws Exception {
         if (args.length > 0) {
             WhiteBox.getWhiteBox().assertMatchingSafepointCalls(false, false);
+            return;
         }
-        if (Platform.isDebugBuild()){
-            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-                  "-Xbootclasspath/a:.",
-                  "-XX:+UnlockDiagnosticVMOptions",
-                  "-XX:+WhiteBoxAPI",
-                  "-XX:-CreateCoredumpOnCrash",
-                  "-Xmx128m",
-                  "AssertSafepointCheckConsistency2",
-                  "test");
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+              "-Xbootclasspath/a:.",
+              "-XX:+UnlockDiagnosticVMOptions",
+              "-XX:+WhiteBoxAPI",
+              "-XX:-CreateCoredumpOnCrash",
+              "-Xmx128m",
+              "AssertSafepointCheckConsistency2",
+              "test");
 
-            OutputAnalyzer output = new OutputAnalyzer(pb.start());
-            output.shouldContain("assert").shouldContain("never");
-        }
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("assert")
+              .shouldContain("never")
+              .shouldNotHaveExitValue(0);
     }
 }
--- a/test/hotspot/jtreg/runtime/Safepoint/AssertSafepointCheckConsistency3.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/Safepoint/AssertSafepointCheckConsistency3.java	Tue May 05 09:27:22 2020 -0700
@@ -25,17 +25,17 @@
  * @test
  * @bug 8047290
  * @summary Ensure that Monitor::lock_without_safepoint_check does not assert when it correctly acquires a lock which must never have safepoint checks.
+ * @requires vm.debug
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main AssertSafepointCheckConsistency3
+ * @run driver AssertSafepointCheckConsistency3
  */
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Platform;
 
 import sun.hotspot.WhiteBox;
 
@@ -43,21 +43,21 @@
     public static void main(String args[]) throws Exception {
         if (args.length > 0) {
             WhiteBox.getWhiteBox().assertMatchingSafepointCalls(false, true);
+            return;
         }
-        if (Platform.isDebugBuild()){
-            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-                  "-Xbootclasspath/a:.",
-                  "-XX:+UnlockDiagnosticVMOptions",
-                  "-XX:+WhiteBoxAPI",
-                  "-XX:-CreateCoredumpOnCrash",
-                  "-Xmx32m",
-                  "AssertSafepointCheckConsistency3",
-                  "test");
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+              "-Xbootclasspath/a:.",
+              "-XX:+UnlockDiagnosticVMOptions",
+              "-XX:+WhiteBoxAPI",
+              "-XX:-CreateCoredumpOnCrash",
+              "-Xmx32m",
+              "AssertSafepointCheckConsistency3",
+              "test");
 
-            OutputAnalyzer output = new OutputAnalyzer(pb.start());
-            output.shouldNotContain("assert");
-            output.shouldNotContain("never");
-            output.shouldNotContain("always");
-        }
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldNotContain("assert")
+              .shouldNotContain("never")
+              .shouldNotContain("always")
+              .shouldHaveExitValue(0);
     }
 }
--- a/test/hotspot/jtreg/runtime/Safepoint/AssertSafepointCheckConsistency4.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/Safepoint/AssertSafepointCheckConsistency4.java	Tue May 05 09:27:22 2020 -0700
@@ -25,17 +25,17 @@
  * @test
  * @bug 8047290
  * @summary Ensure that Monitor::lock does not assert when it correctly acquires a lock which must always have safepoint checks.
+ * @requires vm.debug
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main AssertSafepointCheckConsistency4
+ * @run driver AssertSafepointCheckConsistency4
  */
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Platform;
 
 import sun.hotspot.WhiteBox;
 
@@ -43,22 +43,22 @@
     public static void main(String args[]) throws Exception {
         if (args.length > 0) {
             WhiteBox.getWhiteBox().assertMatchingSafepointCalls(true, false);
+            return;
         }
-        if (Platform.isDebugBuild()){
-            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-               "-Xbootclasspath/a:.",
-               "-XX:+UnlockDiagnosticVMOptions",
-               "-XX:+WhiteBoxAPI",
-               "-XX:-CreateCoredumpOnCrash",
-               "-Xmx32m",
-               "AssertSafepointCheckConsistency4",
-               "test");
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+           "-Xbootclasspath/a:.",
+           "-XX:+UnlockDiagnosticVMOptions",
+           "-XX:+WhiteBoxAPI",
+           "-XX:-CreateCoredumpOnCrash",
+           "-Xmx32m",
+           "AssertSafepointCheckConsistency4",
+           "test");
 
-            OutputAnalyzer output = new OutputAnalyzer(pb.start());
-            output.shouldNotContain("assert");
-            output.shouldNotContain("never");
-            output.shouldNotContain("always");
-        }
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldNotContain("assert")
+              .shouldNotContain("never")
+              .shouldNotContain("always")
+              .shouldHaveExitValue(0);
     }
 }
 
--- a/test/hotspot/jtreg/runtime/Safepoint/NoSafepointVerifier.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/Safepoint/NoSafepointVerifier.java	Tue May 05 09:27:22 2020 -0700
@@ -25,34 +25,33 @@
  * @test
  * @bug 8184732
  * @summary Ensure that special locks never safepoint check.
+ * @requires vm.debug
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main NoSafepointVerifier
+ * @run driver NoSafepointVerifier
  */
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Platform;
 
 import sun.hotspot.WhiteBox;
 
 public class NoSafepointVerifier {
 
     static void runTest(String test) throws Exception {
-        if (Platform.isDebugBuild()){
-            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-                  "-Xbootclasspath/a:.",
-                  "-XX:+UnlockDiagnosticVMOptions",
-                  "-XX:+WhiteBoxAPI",
-                  "-XX:-CreateCoredumpOnCrash",
-                  "NoSafepointVerifier",
-                  test);
-            OutputAnalyzer output = new OutputAnalyzer(pb.start());
-            output.shouldContain(test);
-        }
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+              "-Xbootclasspath/a:.",
+              "-XX:+UnlockDiagnosticVMOptions",
+              "-XX:+WhiteBoxAPI",
+              "-XX:-CreateCoredumpOnCrash",
+              "NoSafepointVerifier",
+              test);
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain(test)
+              .shouldNotHaveExitValue(0);
     }
 
     static String test1 = "Special locks or below should never safepoint";
--- a/test/hotspot/jtreg/runtime/Unsafe/RangeCheck.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/Unsafe/RangeCheck.java	Tue May 05 09:27:22 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2020, 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
@@ -25,25 +25,21 @@
  * @test
  * @bug 8001071
  * @summary Add simple range check into VM implemenation of Unsafe access methods
+ * @requires vm.debug
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
+ * @run driver RangeCheck
  */
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Platform;
 
 import jdk.internal.misc.Unsafe;
 
 public class RangeCheck {
 
     public static void main(String args[]) throws Exception {
-        if (!Platform.isDebugBuild()) {
-            System.out.println("Testing assert which requires a debug build. Passing silently.");
-            return;
-        }
-
         ProcessBuilder pb = ProcessTools.createTestJvm(
                 "-Xmx128m",
                 "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
@@ -53,6 +49,7 @@
 
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
         output.shouldMatch("assert\\(byte_offset < p_size\\) failed: Unsafe access: offset \\d+ > object's size \\d+");
+        output.shouldNotHaveExitValue(0);
     }
 
     public static class DummyClassWithMainRangeCheck {
--- a/test/hotspot/jtreg/runtime/cds/appcds/TestCombinedCompressedFlags.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/cds/appcds/TestCombinedCompressedFlags.java	Tue May 05 09:27:22 2020 -0700
@@ -26,18 +26,17 @@
  * @bug 8232069
  * @summary Testing different combination of CompressedOops and CompressedClassPointers
  * @requires vm.cds
- * @requires (vm.gc=="null")
+ * @requires vm.gc == "null"
+ * @requires vm.bits == 64
  * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
  * @compile test-classes/Hello.java
  * @modules java.base/jdk.internal.misc
- * @run main/othervm  TestCombinedCompressedFlags
+ * @run driver TestCombinedCompressedFlags
  */
 
-import jdk.test.lib.Platform;
 import jdk.test.lib.process.OutputAnalyzer;
 import java.util.List;
 import java.util.ArrayList;
-import jtreg.SkippedException;
 
 public class TestCombinedCompressedFlags {
     public static String HELLO_STRING = "Hello World";
@@ -161,10 +160,6 @@
     }
 
     public static void main(String[] args) throws Exception {
-        if (!Platform.is64bit()) {
-            throw new SkippedException("Platform is not 64 bit, skipped");
-        }
-
         String helloJar = JarBuilder.build("hello", "Hello");
         configureRunArgs();
         OutputAnalyzer out;
--- a/test/hotspot/jtreg/runtime/cds/appcds/TestZGCWithCDS.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/cds/appcds/TestZGCWithCDS.java	Tue May 05 09:27:22 2020 -0700
@@ -1,38 +1,46 @@
+/*
+ * Copyright (c) 2020, 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.
+ */
+
 /*
  * @test 8232069 for ZGC
  * @requires vm.cds
- * @requires (vm.gc=="null")
+ * @requires vm.bits == 64
+ * @requires vm.gc.Z
+ * @comment Graal does not support ZGC
+ * @requires !vm.graal.enabled
  * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
  * @compile test-classes/Hello.java
- * @build sun.hotspot.WhiteBox
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestZGCWithCDS
+ * @run driver TestZGCWithCDS
  */
 
 import jdk.test.lib.Platform;
 import jdk.test.lib.process.OutputAnalyzer;
-import jtreg.SkippedException;
-
-import sun.hotspot.gc.GC;
-import sun.hotspot.code.Compiler;
 
 public class TestZGCWithCDS {
     public final static String HELLO = "Hello World";
     public final static String UNABLE_TO_USE_ARCHIVE = "Unable to use shared archive.";
     public final static String ERR_MSG = "The saved state of UseCompressedOops and UseCompressedClassPointers is different from runtime, CDS will be disabled.";
     public static void main(String... args) throws Exception {
-         // The test is only for 64-bit
-         if (!Platform.is64bit()) {
-             throw new SkippedException("Platform is not 64 bit, skipped");
-         }
-
-         // Platform must support ZGC
-         if (!GC.Z.isSupported()) {
-             throw new SkippedException("Platform does not support ZGC, skipped");
-         } else if (Compiler.isGraalEnabled()) {
-             throw new SkippedException("Graal does not support ZGC, skipped");
-         }
-
          String helloJar = JarBuilder.build("hello", "Hello");
          // 0. dump with ZGC
          System.out.println("0. Dump with ZGC");
--- a/test/hotspot/jtreg/runtime/logging/ItablesTest.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/logging/ItablesTest.java	Tue May 05 09:27:22 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, 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,7 @@
  * @bug 8141564
  * @summary itables=trace should have logging from each of the statements
  *          in the code
+ * @requires vm.debug
  * @library /test/lib
  * @compile ClassB.java
  *          ItablesVtableTest.java
@@ -36,27 +37,24 @@
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Platform;
 
 public class ItablesTest {
     public static void main(String[] args) throws Exception {
-        if (Platform.isDebugBuild()) {
-            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:itables=trace", "ClassB");
-            OutputAnalyzer output = new OutputAnalyzer(pb.start());
-            output.shouldContain(": Initializing itables for ClassB");
-            output.shouldContain(": Initializing itable indices for interface ");
-            output.shouldContain("itable index ");
-            output.shouldContain("target: ClassB.Method1()V, method_holder: ClassB target_method flags: public");
-            output.shouldContain("invokeinterface resolved interface method: caller-class");
-            output.shouldContain("invokespecial resolved method: caller-class:ClassB");
-            output.shouldContain("invokespecial selected method: resolved-class:ClassB");
-            output.shouldContain("invokeinterface selected method: receiver-class");
-            output.shouldHaveExitValue(0);
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:itables=trace", "ClassB");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain(": Initializing itables for ClassB");
+        output.shouldContain(": Initializing itable indices for interface ");
+        output.shouldContain("itable index ");
+        output.shouldContain("target: ClassB.Method1()V, method_holder: ClassB target_method flags: public");
+        output.shouldContain("invokeinterface resolved interface method: caller-class");
+        output.shouldContain("invokespecial resolved method: caller-class:ClassB");
+        output.shouldContain("invokespecial selected method: resolved-class:ClassB");
+        output.shouldContain("invokeinterface selected method: receiver-class");
+        output.shouldHaveExitValue(0);
 
-            pb = ProcessTools.createJavaProcessBuilder("-Xlog:itables=trace", "ItablesVtableTest");
-            output = new OutputAnalyzer(pb.start());
-            output.shouldContain("vtable index ");
-            output.shouldHaveExitValue(0);
-        }
+        pb = ProcessTools.createJavaProcessBuilder("-Xlog:itables=trace", "ItablesVtableTest");
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("vtable index ");
+        output.shouldHaveExitValue(0);
     }
 }
--- a/test/hotspot/jtreg/runtime/logging/RemovedDevelopFlagsTest.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/logging/RemovedDevelopFlagsTest.java	Tue May 05 09:27:22 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, 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,10 @@
  * @test RemovedDevelopFlagsTest
  * @bug 8146632
  * @modules java.base/jdk.internal.misc
+ * @requires vm.debug
  * @library /test/lib
  * @run driver RemovedDevelopFlagsTest
  */
-import jdk.test.lib.Platform;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 
@@ -50,16 +50,14 @@
     }
 
     public static void main(String... args) throws Exception {
-        if (Platform.isDebugBuild()){
-            exec("TraceClassInitialization", "-Xlog:class+init");
-            exec("TraceClassLoaderData", "-Xlog:class+loader+data");
-            exec("TraceDefaultMethods", "-Xlog:defaultmethods=debug");
-            exec("TraceItables", "-Xlog:itables=debug");
-            exec("TraceSafepoint", "-Xlog:safepoint=debug");
-            exec("TraceStartupTime", "-Xlog:startuptime");
-            exec("TraceVMOperation", "-Xlog:vmoperation=debug");
-            exec("PrintVtables", "-Xlog:vtables=debug");
-            exec("VerboseVerification", "-Xlog:verification");
-        }
-    };
+        exec("TraceClassInitialization", "-Xlog:class+init");
+        exec("TraceClassLoaderData", "-Xlog:class+loader+data");
+        exec("TraceDefaultMethods", "-Xlog:defaultmethods=debug");
+        exec("TraceItables", "-Xlog:itables=debug");
+        exec("TraceSafepoint", "-Xlog:safepoint=debug");
+        exec("TraceStartupTime", "-Xlog:startuptime");
+        exec("TraceVMOperation", "-Xlog:vmoperation=debug");
+        exec("PrintVtables", "-Xlog:vtables=debug");
+        exec("VerboseVerification", "-Xlog:verification");
+    }
 }
--- a/test/hotspot/jtreg/runtime/memory/LargePages/TestLargePageSizeInBytes.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/memory/LargePages/TestLargePageSizeInBytes.java	Tue May 05 09:27:22 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2020, 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 TestLargePageSizeInBytes
  * @summary Tests that the flag -XX:LargePageSizeInBytes does not cause warnings on Solaris
  * @bug 8049536
+ * @requires os.family == "solaris"
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
@@ -31,7 +32,6 @@
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Platform;
 import jdk.test.lib.process.ProcessTools;
 
 public class TestLargePageSizeInBytes {
@@ -39,11 +39,6 @@
     private static long G = 1024L * M;
 
     public static void main(String[] args) throws Exception {
-        if (!Platform.isSolaris()) {
-            // We only use the syscall mencntl on Solaris
-            return;
-        }
-
         testLargePageSizeInBytes(4 * M);
         testLargePageSizeInBytes(256 * M);
         testLargePageSizeInBytes(512 * M);
--- a/test/hotspot/jtreg/runtime/memory/RunUnitTestsConcurrently.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/memory/RunUnitTestsConcurrently.java	Tue May 05 09:27:22 2020 -0700
@@ -24,6 +24,8 @@
 /*
  * @test
  * @summary Test launches unit tests inside vm concurrently
+ * @requires vm.debug
+ * @requires vm.bits == 64
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
@@ -32,7 +34,6 @@
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI RunUnitTestsConcurrently 30 15000
  */
 
-import jdk.test.lib.Platform;
 import sun.hotspot.WhiteBox;
 
 public class RunUnitTestsConcurrently {
@@ -45,15 +46,12 @@
     @Override
     public void run() {
       while (System.currentTimeMillis() - timeStamp < timeout) {
-        WhiteBox.getWhiteBox().runMemoryUnitTests();
+        wb.runMemoryUnitTests();
       }
     }
   }
 
   public static void main(String[] args) throws InterruptedException {
-    if (!Platform.isDebugBuild() || !Platform.is64bit()) {
-      return;
-    }
     wb = WhiteBox.getWhiteBox();
     System.out.println("Starting threads");
 
--- a/test/hotspot/jtreg/runtime/symboltable/ShortLivedSymbolCleanup.java	Tue May 05 12:32:40 2020 -0400
+++ b/test/hotspot/jtreg/runtime/symboltable/ShortLivedSymbolCleanup.java	Tue May 05 09:27:22 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2020, 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
@@ -25,13 +25,13 @@
  * @test
  * @bug 8195100
  * @summary a short lived Symbol should be cleaned up
+ * @requires vm.debug
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires (vm.debug == true)
+ * @run driver ShortLivedSymbolCleanup
  */
 
-import jdk.test.lib.Platform;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 import java.util.Scanner;
@@ -88,19 +88,14 @@
   }
 
   public static void main(String[] args) throws Exception {
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:symboltable=trace",
+                                                              "-version");
+    int size = getSymbolTableSize(pb);
 
-      if (Platform.isDebugBuild()) {
-        {
-          ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:symboltable=trace",
-                                                                    "-version");
-          int size = getSymbolTableSize(pb);
-
-          pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintSymbolTableSizeHistogram",
-                                                                    LotsOfTempSymbols.class.getName(),
-                                                                    Integer.toString(size));
-          analyzeOutputOn(size, pb);
-        }
-     }
+    pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintSymbolTableSizeHistogram",
+                                               LotsOfTempSymbols.class.getName(),
+                                               Integer.toString(size));
+    analyzeOutputOn(size, pb);
   }
 
   static class LotsOfTempSymbols {
@@ -116,4 +111,4 @@
       }
     }
   }
-}
\ No newline at end of file
+}