changeset 59816:9f4cf92a95ab

8211977: move testlibrary tests into one place Reviewed-by: erikj, dholmes, ihse
author iignatyev
date Tue, 16 Jun 2020 09:50:45 -0700
parents 4909f59f6854
children 3a37f96258e9
files make/Main.gmk make/RunTests.gmk make/common/FindTests.gmk make/test/JtregNativeHotspot.gmk make/test/JtregNativeLibTest.gmk test/hotspot/jtreg/TEST.groups test/hotspot/jtreg/testlibrary/jvmti/libSimpleClassFileLoadHook.c test/hotspot/jtreg/testlibrary_tests/AssertsTest.java test/hotspot/jtreg/testlibrary_tests/OutputAnalyzerReportingTest.java test/hotspot/jtreg/testlibrary_tests/OutputAnalyzerTest.java test/hotspot/jtreg/testlibrary_tests/RandomGeneratorTest.java test/hotspot/jtreg/testlibrary_tests/RedefineClassTest.java test/hotspot/jtreg/testlibrary_tests/SimpleClassFileLoadHookTest.java test/hotspot/jtreg/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java test/hotspot/jtreg/testlibrary_tests/TestPlatformIsTieredSupported.java test/hotspot/jtreg/testlibrary_tests/jvmti/SimpleClassFileLoadHookTest.java test/hotspot/jtreg/testlibrary_tests/process/Test.java test/hotspot/jtreg/testlibrary_tests/process/TestNativeProcessBuilder.java test/hotspot/jtreg/testlibrary_tests/process/exejvm-test-launcher.c test/hotspot/jtreg/testlibrary_tests/whitebox/BlobSanityTest.java test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/BooleanTest.java test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/DoubleTest.java test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/IntxTest.java test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/SizeTTest.java test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/StringTest.java test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/Uint64Test.java test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/UintxTest.java test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java test/jdk/lib/testlibrary/AssertsTest.java test/jdk/lib/testlibrary/CPUInfoTest.java test/jdk/lib/testlibrary/OutputAnalyzerReportingTest.java test/jdk/lib/testlibrary/OutputAnalyzerTest.java test/lib-test/ProblemList.txt test/lib-test/RedefineClassTest.java test/lib-test/TEST.ROOT test/lib-test/TEST.groups test/lib-test/jdk/test/lib/AssertsTest.java test/lib-test/jdk/test/lib/RandomGeneratorTest.java test/lib-test/jdk/test/lib/TestMutuallyExclusivePlatformPredicates.java test/lib-test/jdk/test/lib/TestPlatformIsTieredSupported.java test/lib-test/jdk/test/lib/apps/LingeredAppTest.java test/lib-test/jdk/test/lib/process/OutputAnalyzerReportingTest.java test/lib-test/jdk/test/lib/process/OutputAnalyzerTest.java test/lib-test/jdk/test/lib/process/TestNativeProcessBuilder.java test/lib-test/jdk/test/lib/process/exejvm-test-launcher.c test/lib-test/sun/hotspot/whitebox/BlobSanityTest.java test/lib-test/sun/hotspot/whitebox/CPUInfoTest.java test/lib-test/sun/hotspot/whitebox/vm_flags/BooleanTest.java test/lib-test/sun/hotspot/whitebox/vm_flags/DoubleTest.java test/lib-test/sun/hotspot/whitebox/vm_flags/IntxTest.java test/lib-test/sun/hotspot/whitebox/vm_flags/SizeTTest.java test/lib-test/sun/hotspot/whitebox/vm_flags/StringTest.java test/lib-test/sun/hotspot/whitebox/vm_flags/Uint64Test.java test/lib-test/sun/hotspot/whitebox/vm_flags/UintxTest.java test/lib-test/sun/hotspot/whitebox/vm_flags/VmFlagTest.java
diffstat 55 files changed, 2115 insertions(+), 2477 deletions(-) [+]
line wrap: on
line diff
--- a/make/Main.gmk	Tue Jun 16 08:03:40 2020 -0700
+++ b/make/Main.gmk	Tue Jun 16 09:50:45 2020 -0700
@@ -640,6 +640,18 @@
     DEPS := build-test-jdk-jtreg-native, \
 ))
 
+$(eval $(call SetupTarget, build-test-libtest-jtreg-native, \
+    MAKEFILE := test/JtregNativeLibTest, \
+    TARGET := build-test-libtest-jtreg-native, \
+    DEPS := buildtools-jdk, \
+))
+
+$(eval $(call SetupTarget, test-image-libtest-jtreg-native, \
+    MAKEFILE := test/JtregNativeLibTest, \
+    TARGET := test-image-libtest-jtreg-native, \
+    DEPS := build-test-libtest-jtreg-native, \
+))
+
 $(eval $(call SetupTarget, build-test-hotspot-jtreg-graal, \
     MAKEFILE := test/JtregGraalUnit, \
     TARGET := build-test-hotspot-jtreg-graal, \
@@ -982,6 +994,7 @@
   interim-image: $(INTERIM_JMOD_TARGETS)
 
   build-test-hotspot-jtreg-native: hotspot-$(JVM_VARIANT_MAIN)-libs
+  build-test-libtest-jtreg-native: hotspot-$(JVM_VARIANT_MAIN)-libs
 
 endif
 
@@ -1105,7 +1118,7 @@
 docs-image: docs-jdk
 
 # This target builds the test image
-test-image: prepare-test-image test-image-jdk-jtreg-native test-image-demos-jdk
+test-image: prepare-test-image test-image-jdk-jtreg-native test-image-demos-jdk test-image-libtest-jtreg-native
 
 ifneq ($(JVM_TEST_IMAGE_TARGETS), )
   # If JVM_TEST_IMAGE_TARGETS is externally defined, use it instead of the
--- a/make/RunTests.gmk	Tue Jun 16 08:03:40 2020 -0700
+++ b/make/RunTests.gmk	Tue Jun 16 09:50:45 2020 -0700
@@ -342,11 +342,13 @@
 hotspot_JTREG_ASSERT := false
 hotspot_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/hotspot/jtreg/native
 jdk_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/jdk/jtreg/native
+lib-test_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/lib-test/jtreg/native
 
 jdk_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jdk/ProblemList.txt
 jaxp_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jaxp/ProblemList.txt
 langtools_JTREG_PROBLEM_LIST += $(TOPDIR)/test/langtools/ProblemList.txt
 hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt
+lib-test_JTREG_PROBLEM_LIST += $(TOPDIR)/test/lib-test/ProblemList.txt
 
 langtools_JTREG_MAX_MEM := 768m
 
--- a/make/common/FindTests.gmk	Tue Jun 16 08:03:40 2020 -0700
+++ b/make/common/FindTests.gmk	Tue Jun 16 09:50:45 2020 -0700
@@ -43,7 +43,7 @@
 TEST_BASEDIRS += $(TOPDIR)/test $(TOPDIR)
 
 # JTREG_TESTROOTS might have been set by a custom extension
-JTREG_TESTROOTS += $(addprefix $(TOPDIR)/test/, hotspot/jtreg jdk langtools jaxp)
+JTREG_TESTROOTS += $(addprefix $(TOPDIR)/test/, hotspot/jtreg jdk langtools jaxp lib-test)
 
 # Extract the names of the Jtreg group files from the TEST.ROOT files. The
 # TEST.ROOT files being properties files can be interpreted as makefiles so
--- a/make/test/JtregNativeHotspot.gmk	Tue Jun 16 08:03:40 2020 -0700
+++ b/make/test/JtregNativeHotspot.gmk	Tue Jun 16 09:50:45 2020 -0700
@@ -872,10 +872,8 @@
 ifeq ($(call isTargetOs, windows), true)
     BUILD_HOTSPOT_JTREG_EXECUTABLES_CFLAGS_exeFPRegs := -MT
     BUILD_HOTSPOT_JTREG_EXCLUDE += exesigtest.c libterminatedThread.c
-    BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exejvm-test-launcher := jvm.lib
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libatExit := jvm.lib
 else
-    BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exejvm-test-launcher := -ljvm
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libbootclssearch_agent += -lpthread
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libsystemclssearch_agent += -lpthread
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libgetsysprop001 += -lpthread
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/test/JtregNativeLibTest.gmk	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,94 @@
+#
+# 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.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# 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.
+#
+
+################################################################################
+# This file builds the native component of the JTReg tests for testlibrary.
+# It also covers the test-image part, where the built files are copied to the
+# test image.
+################################################################################
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include TestFilesCompilation.gmk
+
+$(eval $(call IncludeCustomExtension, test/JtregNativeLibTest.gmk))
+
+################################################################################
+# Targets for building the native tests themselves.
+################################################################################
+
+# This might have been added to by a custom extension.
+BUILD_LIBTEST_JTREG_NATIVE_SRC += $(TOPDIR)/test/lib-test
+
+BUILD_LIBTEST_JTREG_OUTPUT_DIR := $(OUTPUTDIR)/support/test/lib-test/jtreg/native
+
+BUILD_LIBTEST_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/lib-test/jtreg
+
+ifeq ($(call isTargetOs, windows), true)
+    BUILD_LIBTEST_JTREG_EXECUTABLES_LIBS_exejvm-test-launcher := jvm.lib
+else
+    BUILD_LIBTEST_JTREG_EXECUTABLES_LIBS_exejvm-test-launcher := -ljvm
+endif
+
+# This evaluation is expensive and should only be done if this target was
+# explicitly called.
+ifneq ($(filter build-test-libtest-jtreg-native, $(MAKECMDGOALS)), )
+  $(eval $(call SetupTestFilesCompilation, BUILD_LIBTEST_JTREG_LIBRARIES, \
+      TYPE := LIBRARY, \
+      SOURCE_DIRS := $(BUILD_LIBTEST_JTREG_NATIVE_SRC), \
+      OUTPUT_DIR := $(BUILD_LIBTEST_JTREG_OUTPUT_DIR), \
+      EXCLUDE := $(BUILD_LIBTEST_JTREG_EXCLUDE), \
+  ))
+
+  $(eval $(call SetupTestFilesCompilation, BUILD_LIBTEST_JTREG_EXECUTABLES, \
+      TYPE := PROGRAM, \
+      SOURCE_DIRS := $(BUILD_LIBTEST_JTREG_NATIVE_SRC), \
+      OUTPUT_DIR := $(BUILD_LIBTEST_JTREG_OUTPUT_DIR), \
+      EXCLUDE := $(BUILD_LIBTEST_JTREG_EXCLUDE), \
+  ))
+endif
+
+build-test-libtest-jtreg-native: $(BUILD_LIBTEST_JTREG_LIBRARIES) $(BUILD_LIBTEST_JTREG_EXECUTABLES)
+
+################################################################################
+# Targets for building test-image.
+################################################################################
+
+# Copy to lib-test jtreg test image
+$(eval $(call SetupCopyFiles, COPY_LIBTEST_JTREG_NATIVE, \
+    SRC := $(BUILD_LIBTEST_JTREG_OUTPUT_DIR), \
+    DEST := $(TEST_IMAGE_DIR)/lib-test/jtreg/native, \
+    FILES := $(wildcard $(addprefix $(BUILD_LIBTEST_JTREG_OUTPUT_DIR), /bin/* /lib/*)), \
+    FLATTEN := true, \
+))
+
+test-image-libtest-jtreg-native: $(COPY_LIBTEST_JTREG_NATIVE)
+
+all: build-test-libtest-jtreg-native
+test-image: test-image-libtest-jtreg-native
+
+.PHONY: default all build-test-libtest-jtreg-native test-image-libtest-jtreg-native test-image
--- a/test/hotspot/jtreg/TEST.groups	Tue Jun 16 08:03:40 2020 -0700
+++ b/test/hotspot/jtreg/TEST.groups	Tue Jun 16 09:50:45 2020 -0700
@@ -309,7 +309,6 @@
  -runtime/Thread/TestThreadDumpMonitorContention.java \
  -runtime/Unsafe/RangeCheck.java \
   sanity/ \
-  testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java \
  -:tier1_runtime_appcds_exclude \
  -runtime/signal
 
--- a/test/hotspot/jtreg/testlibrary/jvmti/libSimpleClassFileLoadHook.c	Tue Jun 16 08:03:40 2020 -0700
+++ b/test/hotspot/jtreg/testlibrary/jvmti/libSimpleClassFileLoadHook.c	Tue Jun 16 09:50:45 2020 -0700
@@ -22,7 +22,7 @@
  */
 
 /*
- * A simple way to test JVMTI ClassFileLoadHook. See ../testlibrary_tests/SimpleClassFileLoadHookTest.java
+ * A simple way to test JVMTI ClassFileLoadHook. See ../testlibrary_tests/jvmti/SimpleClassFileLoadHookTest.java
  * for an example.
  */
 #include <stdio.h>
--- a/test/hotspot/jtreg/testlibrary_tests/AssertsTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2013, 2016, 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.
- */
-
-import static jdk.test.lib.Asserts.*;
-
-/* @test
- * @summary Tests the different assertions in the Assert class
- * @modules java.base/jdk.internal.misc
- * @library /test/lib
- */
-public class AssertsTest {
-    private static class Foo implements Comparable<Foo> {
-        final int id;
-        public Foo(int id) {
-            this.id = id;
-        }
-
-        public int compareTo(Foo f) {
-            return new Integer(id).compareTo(new Integer(f.id));
-        }
-    }
-
-    public static void main(String[] args) throws Exception {
-        testLessThan();
-        testLessThanOrEqual();
-        testEquals();
-        testGreaterThanOrEqual();
-        testGreaterThan();
-        testNotEquals();
-        testNull();
-        testNotNull();
-        testTrue();
-        testFalse();
-    }
-
-    private static void testLessThan() throws Exception {
-        expectPass(Assertion.LT, 1, 2);
-
-        expectFail(Assertion.LT, 2, 2);
-        expectFail(Assertion.LT, 2, 1);
-        expectFail(Assertion.LT, null, 2);
-        expectFail(Assertion.LT, 2, null);
-    }
-
-    private static void testLessThanOrEqual() throws Exception {
-        expectPass(Assertion.LTE, 1, 2);
-        expectPass(Assertion.LTE, 2, 2);
-
-        expectFail(Assertion.LTE, 3, 2);
-        expectFail(Assertion.LTE, null, 2);
-        expectFail(Assertion.LTE, 2, null);
-    }
-
-    private static void testEquals() throws Exception {
-        expectPass(Assertion.EQ, 1, 1);
-        expectPass(Assertion.EQ, null, null);
-
-        Foo f1 = new Foo(1);
-        expectPass(Assertion.EQ, f1, f1);
-
-        Foo f2 = new Foo(1);
-        expectFail(Assertion.EQ, f1, f2);
-        expectFail(Assertion.LTE, null, 2);
-        expectFail(Assertion.LTE, 2, null);
-    }
-
-    private static void testGreaterThanOrEqual() throws Exception {
-        expectPass(Assertion.GTE, 1, 1);
-        expectPass(Assertion.GTE, 2, 1);
-
-        expectFail(Assertion.GTE, 1, 2);
-        expectFail(Assertion.GTE, null, 2);
-        expectFail(Assertion.GTE, 2, null);
-    }
-
-    private static void testGreaterThan() throws Exception {
-        expectPass(Assertion.GT, 2, 1);
-
-        expectFail(Assertion.GT, 1, 1);
-        expectFail(Assertion.GT, 1, 2);
-        expectFail(Assertion.GT, null, 2);
-        expectFail(Assertion.GT, 2, null);
-    }
-
-    private static void testNotEquals() throws Exception {
-        expectPass(Assertion.NE, null, 1);
-        expectPass(Assertion.NE, 1, null);
-
-        Foo f1 = new Foo(1);
-        Foo f2 = new Foo(1);
-        expectPass(Assertion.NE, f1, f2);
-
-        expectFail(Assertion.NE, null, null);
-        expectFail(Assertion.NE, f1, f1);
-        expectFail(Assertion.NE, 1, 1);
-    }
-
-    private static void testNull() throws Exception {
-        expectPass(Assertion.NULL, null);
-
-        expectFail(Assertion.NULL, 1);
-    }
-
-    private static void testNotNull() throws Exception {
-        expectPass(Assertion.NOTNULL, 1);
-
-        expectFail(Assertion.NOTNULL, null);
-    }
-
-    private static void testTrue() throws Exception {
-        expectPass(Assertion.TRUE, true);
-
-        expectFail(Assertion.TRUE, false);
-    }
-
-    private static void testFalse() throws Exception {
-        expectPass(Assertion.FALSE, false);
-
-        expectFail(Assertion.FALSE, true);
-    }
-
-    private static <T extends Comparable<T>> void expectPass(Assertion assertion, T ... args)
-        throws Exception {
-        Assertion.run(assertion, args);
-    }
-
-    private static <T extends Comparable<T>> void expectFail(Assertion assertion, T ... args)
-        throws Exception {
-        try {
-            Assertion.run(assertion, args);
-        } catch (RuntimeException e) {
-            return;
-        }
-        throw new Exception("Expected " + Assertion.format(assertion, (Object[]) args) +
-                            " to throw a RuntimeException");
-    }
-
-}
-
-enum Assertion {
-    LT, LTE, EQ, GTE, GT, NE, NULL, NOTNULL, FALSE, TRUE;
-
-    public static <T extends Comparable<T>> void run(Assertion assertion, T ... args) {
-        String msg = "Expected " + format(assertion, args) + " to pass";
-        switch (assertion) {
-            case LT:
-                assertLessThan(args[0], args[1], msg);
-                break;
-            case LTE:
-                assertLessThanOrEqual(args[0], args[1], msg);
-                break;
-            case EQ:
-                assertEquals(args[0], args[1], msg);
-                break;
-            case GTE:
-                assertGreaterThanOrEqual(args[0], args[1], msg);
-                break;
-            case GT:
-                assertGreaterThan(args[0], args[1], msg);
-                break;
-            case NE:
-                assertNotEquals(args[0], args[1], msg);
-                break;
-            case NULL:
-                assertNull(args == null ? args : args[0], msg);
-                break;
-            case NOTNULL:
-                assertNotNull(args == null ? args : args[0], msg);
-                break;
-            case FALSE:
-                assertFalse((Boolean) args[0], msg);
-                break;
-            case TRUE:
-                assertTrue((Boolean) args[0], msg);
-                break;
-            default:
-                // do nothing
-        }
-    }
-
-    public static String format(Assertion assertion, Object ... args) {
-        switch (assertion) {
-            case LT:
-                return asString("assertLessThan", args);
-            case LTE:
-                return asString("assertLessThanOrEqual", args);
-            case EQ:
-                return asString("assertEquals", args);
-            case GTE:
-                return asString("assertGreaterThanOrEquals", args);
-            case GT:
-                return asString("assertGreaterThan", args);
-            case NE:
-                return asString("assertNotEquals", args);
-            case NULL:
-                return asString("assertNull", args);
-            case NOTNULL:
-                return asString("assertNotNull", args);
-            case FALSE:
-                return asString("assertFalse", args);
-            case TRUE:
-                return asString("assertTrue", args);
-            default:
-                return "";
-        }
-    }
-
-    private static String asString(String assertion, Object ... args) {
-        if (args == null) {
-            return String.format("%s(null)", assertion);
-        }
-        if (args.length == 1) {
-            return String.format("%s(%s)", assertion, args[0]);
-        } else {
-            return String.format("%s(%s, %s)", assertion, args[0], args[1]);
-        }
-    }
-}
--- a/test/hotspot/jtreg/testlibrary_tests/OutputAnalyzerReportingTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2013, 2016, 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
- * @summary Test the OutputAnalyzer reporting functionality,
- *     such as printing additional diagnostic info
- *     (exit code, stdout, stderr, command line, etc.)
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- */
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.process.ProcessTools;
-
-
-public class OutputAnalyzerReportingTest {
-
-    public static void main(String[] args) throws Exception {
-        // Create the output analyzer under test
-        String stdout = "aaaaaa";
-        String stderr = "bbbbbb";
-        OutputAnalyzer output = new OutputAnalyzer(stdout, stderr);
-
-        // Expected summary values should be the same for all cases,
-        // since the outputAnalyzer object is the same
-        String expectedExitValue = "-1";
-        String expectedSummary =
-                " stdout: [" + stdout + "];\n" +
-                " stderr: [" + stderr + "]\n" +
-                " exitValue = " + expectedExitValue + "\n";
-
-
-        DiagnosticSummaryTestRunner testRunner =
-                new DiagnosticSummaryTestRunner();
-
-        // should have exit value
-        testRunner.init(expectedSummary);
-        int unexpectedExitValue = 2;
-        try {
-            output.shouldHaveExitValue(unexpectedExitValue);
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-        // should not contain
-        testRunner.init(expectedSummary);
-        try {
-            output.shouldNotContain(stdout);
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-        // should contain
-        testRunner.init(expectedSummary);
-        try {
-            output.shouldContain("unexpected-stuff");
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-        // should not match
-        testRunner.init(expectedSummary);
-        try {
-            output.shouldNotMatch("[a]");
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-        // should match
-        testRunner.init(expectedSummary);
-        try {
-            output.shouldMatch("[qwerty]");
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-    }
-
-    private static class DiagnosticSummaryTestRunner {
-        private ByteArrayOutputStream byteStream =
-                new ByteArrayOutputStream(10000);
-
-        private String expectedSummary = "";
-        private PrintStream errStream;
-
-
-        public void init(String expectedSummary) {
-            this.expectedSummary = expectedSummary;
-            byteStream.reset();
-            errStream = new PrintStream(byteStream);
-            System.setErr(errStream);
-        }
-
-        public void closeAndCheckResults() {
-            // check results
-            errStream.close();
-            String stdErrStr = byteStream.toString();
-            if (!stdErrStr.contains(expectedSummary)) {
-                throw new RuntimeException("The output does not contain "
-                    + "the diagnostic message, or the message is incorrect");
-            }
-        }
-    }
-
-}
--- a/test/hotspot/jtreg/testlibrary_tests/OutputAnalyzerTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 2013, 2016, 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
- * @summary Test the OutputAnalyzer utility class
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- */
-
-import jdk.test.lib.process.OutputAnalyzer;
-
-public class OutputAnalyzerTest {
-
-  public static void main(String args[]) throws Exception {
-
-    String stdout = "aaaaaa";
-    String stderr = "bbbbbb";
-
-    // Regexps used for testing pattern matching of the test input
-    String stdoutPattern = "[a]";
-    String stderrPattern = "[b]";
-    String nonExistingPattern = "[c]";
-
-    OutputAnalyzer output = new OutputAnalyzer(stdout, stderr);
-
-    if (!stdout.equals(output.getStdout())) {
-      throw new Exception("getStdout() returned '" + output.getStdout() + "', expected '" + stdout + "'");
-    }
-
-    if (!stderr.equals(output.getStderr())) {
-      throw new Exception("getStderr() returned '" + output.getStderr() + "', expected '" + stderr + "'");
-    }
-
-    try {
-      output.shouldContain(stdout);
-      output.stdoutShouldContain(stdout);
-      output.shouldContain(stderr);
-      output.stderrShouldContain(stderr);
-    } catch (RuntimeException e) {
-      throw new Exception("shouldContain() failed", e);
-    }
-
-    try {
-      output.shouldContain("cccc");
-      throw new Exception("shouldContain() failed to throw exception");
-    } catch (RuntimeException e) {
-      // expected
-    }
-
-    try {
-      output.stdoutShouldContain(stderr);
-      throw new Exception("stdoutShouldContain() failed to throw exception");
-    } catch (RuntimeException e) {
-      // expected
-    }
-
-    try {
-      output.stderrShouldContain(stdout);
-      throw new Exception("stdoutShouldContain() failed to throw exception");
-    } catch (RuntimeException e) {
-      // expected
-    }
-
-    try {
-      output.shouldNotContain("cccc");
-      output.stdoutShouldNotContain("cccc");
-      output.stderrShouldNotContain("cccc");
-    } catch (RuntimeException e) {
-      throw new Exception("shouldNotContain() failed", e);
-    }
-
-    try {
-      output.shouldNotContain(stdout);
-      throw new Exception("shouldContain() failed to throw exception");
-    } catch (RuntimeException e) {
-      // expected
-    }
-
-    try {
-      output.stdoutShouldNotContain(stdout);
-      throw new Exception("shouldContain() failed to throw exception");
-    } catch (RuntimeException e) {
-      // expected
-    }
-
-    try {
-        output.stderrShouldNotContain(stderr);
-        throw new Exception("shouldContain() failed to throw exception");
-    } catch (RuntimeException e) {
-        // expected
-    }
-
-    // Should match
-    try {
-        output.shouldMatch(stdoutPattern);
-        output.stdoutShouldMatch(stdoutPattern);
-        output.shouldMatch(stderrPattern);
-        output.stderrShouldMatch(stderrPattern);
-    } catch (RuntimeException e) {
-        throw new Exception("shouldMatch() failed", e);
-    }
-
-    try {
-        output.shouldMatch(nonExistingPattern);
-        throw new Exception("shouldMatch() failed to throw exception");
-    } catch (RuntimeException e) {
-        // expected
-    }
-
-    try {
-        output.stdoutShouldMatch(stderrPattern);
-        throw new Exception(
-                "stdoutShouldMatch() failed to throw exception");
-    } catch (RuntimeException e) {
-        // expected
-    }
-
-    try {
-        output.stderrShouldMatch(stdoutPattern);
-        throw new Exception(
-                "stderrShouldMatch() failed to throw exception");
-    } catch (RuntimeException e) {
-        // expected
-    }
-
-    // Should not match
-    try {
-        output.shouldNotMatch(nonExistingPattern);
-        output.stdoutShouldNotMatch(nonExistingPattern);
-        output.stderrShouldNotMatch(nonExistingPattern);
-    } catch (RuntimeException e) {
-        throw new Exception("shouldNotMatch() failed", e);
-    }
-
-    try {
-        output.shouldNotMatch(stdoutPattern);
-        throw new Exception("shouldNotMatch() failed to throw exception");
-    } catch (RuntimeException e) {
-        // expected
-    }
-
-    try {
-        output.stdoutShouldNotMatch(stdoutPattern);
-        throw new Exception("shouldNotMatch() failed to throw exception");
-    } catch (RuntimeException e) {
-        // expected
-    }
-
-    try {
-        output.stderrShouldNotMatch(stderrPattern);
-        throw new Exception("shouldNotMatch() failed to throw exception");
-    } catch (RuntimeException e) {
-        // expected
-    }
-
-    {
-      String aaaa = "aaaa";
-      String result = output.firstMatch(aaaa);
-      if (!aaaa.equals(result)) {
-        throw new Exception("firstMatch(String) faild to match. Expected: " + aaaa + " got: " + result);
-      }
-    }
-
-    {
-      String aa = "aa";
-      String aa_grouped_aa = aa + "(" + aa + ")";
-      String result = output.firstMatch(aa_grouped_aa, 1);
-      if (!aa.equals(result)) {
-        throw new Exception("firstMatch(String, int) failed to match. Expected: " + aa + " got: " + result);
-      }
-    }
-  }
-}
--- a/test/hotspot/jtreg/testlibrary_tests/RandomGeneratorTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
- * 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
- * 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
- * @key randomness
- * @summary Verify correctnes of the random generator from Utils.java
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @run driver RandomGeneratorTest SAME_SEED
- * @run driver RandomGeneratorTest NO_SEED
- * @run driver RandomGeneratorTest DIFFERENT_SEED
- */
-
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.Utils;
-
-/**
- * The test verifies correctness of work {@link jdk.test.lib.Utils#getRandomInstance()}.
- * Test works in three modes: same seed provided, no seed provided and
- * different seed provided. In the first case the test expects that all random numbers
- * will be repeated in all next iterations. For other two modes test expects that
- * randomly generated numbers differ from original.
- */
-public class RandomGeneratorTest {
-    private static final String SEED_VM_OPTION = "-D" + Utils.SEED_PROPERTY_NAME + "=";
-
-    public static void main( String[] args) throws Throwable {
-        if (args.length == 0) {
-            throw new Error("TESTBUG: No test mode provided.");
-        }
-        SeedOption seedOpt = SeedOption.valueOf(args[0]);
-        List<String> jvmArgs = new ArrayList<String>();
-        String optStr = seedOpt.getSeedOption();
-        if (optStr != null) {
-            jvmArgs.add(optStr);
-        }
-        jvmArgs.add(RandomRunner.class.getName());
-        String origFileName = seedOpt.name() + "_orig";
-        jvmArgs.add(origFileName);
-        int fileNameIndex = jvmArgs.size() - 1;
-        String[] cmdLineArgs = jvmArgs.toArray(new String[jvmArgs.size()]);
-        ProcessTools.executeTestJvm(cmdLineArgs).shouldHaveExitValue(0);
-        String etalon = Utils.fileAsString(origFileName).trim();
-        cmdLineArgs[fileNameIndex] = seedOpt.name();
-        seedOpt.verify(etalon, cmdLineArgs);
-    }
-
-    /**
-     * The utility enum helps to generate an appropriate string that should be passed
-     * to the command line depends on the testing mode. It is also responsible for the result
-     * validation.
-     */
-    private enum SeedOption {
-        SAME_SEED {
-            @Override
-            public String getSeedOption() {
-                return SEED_VM_OPTION + Utils.SEED;
-            }
-
-            @Override
-            protected boolean isOutputExpected(String orig, String output) {
-                return output.equals(orig);
-            }
-        },
-        DIFFERENT_SEED {
-            @Override
-            public String getSeedOption() {
-                return SEED_VM_OPTION + Utils.getRandomInstance().nextLong();
-            }
-
-            @Override
-            public void verify(String orig, String[] cmdLine) {
-                cmdLine[0] = getSeedOption();
-                super.verify(orig, cmdLine);
-            }
-        },
-        NO_SEED {
-            @Override
-            public String getSeedOption() {
-                return null;
-            }
-        };
-
-        /**
-         * Generates a string to be added as a command line argument.
-         * It contains "-D" prefix, system property name, '=' sign
-         * and seed value.
-         * @return command line argument
-         */
-        public abstract String getSeedOption();
-
-        protected boolean isOutputExpected(String orig, String output) {
-            return !output.equals(orig);
-        }
-
-        /**
-         * Verifies that the original output meets expectations
-         * depending on the test mode. It compares the output of second execution
-         * to original one.
-         * @param orig original output
-         * @param cmdLine command line arguments
-         * @throws Throwable - Throws an exception in case test failure.
-         */
-        public void verify(String orig, String[] cmdLine) {
-            String output;
-            OutputAnalyzer oa;
-            try {
-                oa = ProcessTools.executeTestJvm(cmdLine);
-            } catch (Throwable t) {
-                throw new Error("TESTBUG: Unexpedted exception during jvm execution.", t);
-            }
-            oa.shouldHaveExitValue(0);
-            try {
-                output = Utils.fileAsString(name()).trim();
-            } catch (IOException ioe) {
-                throw new Error("TESTBUG: Problem during IO operation with file: " + name(), ioe);
-            }
-            if (!isOutputExpected(orig, output)) {
-                System.err.println("Initial output: " + orig);
-                System.err.println("Second run output: " + output);
-                throw new AssertionError("Unexpected random number sequence for mode: " + this.name());
-            }
-        }
-    }
-
-    /**
-     * The helper class generates several random numbers
-     * and put results to a file. The file name came as first
-     * command line argument.
-     */
-    public static class RandomRunner {
-        private static final int COUNT = 10;
-        public static void main(String[] args) {
-            StringBuilder sb = new StringBuilder();
-            Random rng = Utils.getRandomInstance();
-            for (int i = 0; i < COUNT; i++) {
-                sb.append(rng.nextLong()).append(' ');
-            }
-            try (PrintWriter pw = new PrintWriter(new FileWriter(args[0]))) {
-                pw.write(sb.toString());
-            } catch (IOException ioe) {
-                throw new Error("TESTBUG: Problem during IO operation with file: " + args[0], ioe);
-            }
-        }
-    }
-}
--- a/test/hotspot/jtreg/testlibrary_tests/RedefineClassTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2014, 2019, 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
- * @library /test/lib
- * @summary Proof of concept test for RedefineClassHelper
- * @modules java.base/jdk.internal.misc
- * @modules java.compiler
- *          java.instrument
- * @run main RedefineClassHelper
- * @run main/othervm -javaagent:redefineagent.jar RedefineClassTest
- */
-
-import static jdk.test.lib.Asserts.*;
-
-/*
- * Proof of concept test for the test utility class RedefineClassHelper
- */
-
-// package access top-level class to avoid problem with RedefineClassHelper
-// and nested types.
-class RedefineClassTest_A {
-    public int Method() {
-        return 1;
-    }
-}
-
-public class RedefineClassTest {
-
-    public static String newClass = "class RedefineClassTest_A { public int Method() { return 2; } }";
-    public static void main(String[] args) throws Exception {
-        RedefineClassTest_A a = new RedefineClassTest_A();
-        assertTrue(a.Method() == 1);
-        RedefineClassHelper.redefineClass(RedefineClassTest_A.class, newClass);
-        assertTrue(a.Method() == 2);
-    }
-}
--- a/test/hotspot/jtreg/testlibrary_tests/SimpleClassFileLoadHookTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2016, 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
- * @library /test/lib
- * @requires vm.flavor != "minimal"
- * @run main/othervm/native -agentlib:SimpleClassFileLoadHook=Foo,XXX,YYY
- *      SimpleClassFileLoadHookTest
- */
-import jdk.test.lib.Asserts;
-
-class Foo {
-    static String getValue() {
-        return "XXX";
-    }
-    static String getOtherValue() {
-        return "xXXXxx";
-    }
-}
-public class SimpleClassFileLoadHookTest {
-    public static void main(String args[]) {
-        System.out.println(Foo.getValue());
-        System.out.println(Foo.getOtherValue());
-        Asserts.assertTrue("YYY".equals(Foo.getValue()) &&
-                           "xYYYxx".equals(Foo.getOtherValue()),
-                           "SimpleClassFileLoadHook should replace XXX with YYY");
-    }
-}
--- a/test/hotspot/jtreg/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
- * 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
- * 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.
- */
-
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Platform;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @test
- * @summary Verify that for each group of mutually exclusive predicates defined
- *          in jdk.test.lib.Platform one and only one predicate
- *          evaluates to true.
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @run main TestMutuallyExclusivePlatformPredicates
- */
-public class TestMutuallyExclusivePlatformPredicates {
-    private static enum MethodGroup {
-        ARCH("isAArch64", "isARM", "isPPC", "isS390x", "isX64", "isX86"),
-        BITNESS("is32bit", "is64bit"),
-        OS("isAix", "isLinux", "isOSX", "isWindows"),
-        VM_TYPE("isClient", "isServer", "isMinimal", "isZero", "isEmbedded"),
-        MODE("isInt", "isMixed", "isComp"),
-        IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild",
-                "isSlowDebugBuild", "hasSA", "isRoot", "isTieredSupported",
-                "areCustomLoadersSupportedForCDS", "isDefaultCDSArchiveSupported",
-                "isSignedOSX");
-
-        public final List<String> methodNames;
-
-        private MethodGroup(String... methodNames) {
-            this.methodNames = Collections.unmodifiableList(
-                    Arrays.asList(methodNames));
-        }
-    }
-
-    public static void main(String args[]) {
-        EnumSet<MethodGroup> notIgnoredMethodGroups
-                = EnumSet.complementOf(EnumSet.of(MethodGroup.IGNORED));
-
-        notIgnoredMethodGroups.forEach(
-                TestMutuallyExclusivePlatformPredicates::verifyPredicates);
-
-        TestMutuallyExclusivePlatformPredicates.verifyCoverage();
-    }
-
-    /**
-     * Verifies that one and only one predicate method defined in
-     * {@link jdk.test.lib.Platform}, whose name included into
-     * methodGroup will return {@code true}.
-     * @param methodGroup The group of methods that should be tested.
-     */
-    private static void verifyPredicates(MethodGroup methodGroup) {
-        System.out.println("Verifying method group: " + methodGroup.name());
-        long truePredicatesCount = methodGroup.methodNames.stream()
-                .filter(TestMutuallyExclusivePlatformPredicates
-                        ::evaluatePredicate)
-                .count();
-
-        Asserts.assertEQ(truePredicatesCount, 1L, String.format(
-                "Only one predicate from group %s should be evaluated to true "
-                        + "(Actually %d predicates were evaluated to true).",
-                methodGroup.name(), truePredicatesCount));
-    }
-
-    /**
-     * Verifies that all predicates defined in
-     * {@link jdk.test.lib.Platform} were either tested or
-     * explicitly ignored.
-     */
-    private static void verifyCoverage() {
-        Set<String> allMethods = new HashSet<>();
-        for (MethodGroup group : MethodGroup.values()) {
-            allMethods.addAll(group.methodNames);
-        }
-
-        for (Method m : Platform.class.getMethods()) {
-            if (m.getParameterCount() == 0
-                    && m.getReturnType() == boolean.class) {
-                Asserts.assertTrue(allMethods.contains(m.getName()),
-                        "All Platform's methods with signature '():Z' should "
-                                + "be tested. Missing: " + m.getName());
-            }
-        }
-    }
-
-    /**
-     * Evaluates predicate method with name {@code name} defined in
-     * {@link jdk.test.lib.Platform}.
-     *
-     * @param name The name of a predicate to be evaluated.
-     * @return evaluated predicate's value.
-     * @throws java.lang.Error if predicate is not defined or could not be
-     *                         evaluated.
-     */
-    private static boolean evaluatePredicate(String name) {
-        try {
-            System.out.printf("Trying to evaluate predicate with name %s%n",
-                    name);
-            boolean value
-                    = (Boolean) Platform.class.getMethod(name).invoke(null);
-            System.out.printf("Predicate evaluated to: %s%n", value);
-            return value;
-        } catch (NoSuchMethodException e) {
-            throw new Error("Predicate with name " + name
-                    + " is not defined in " + Platform.class.getName(), e);
-        } catch (IllegalAccessException | InvocationTargetException e) {
-            throw new Error("Unable to evaluate predicate " + name, e);
-        }
-    }
-}
--- a/test/hotspot/jtreg/testlibrary_tests/TestPlatformIsTieredSupported.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * 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
- * 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.
- */
-
-import jdk.test.lib.Asserts;
-import jdk.test.lib.Platform;
-import sun.hotspot.WhiteBox;
-
-/**
- * @test
- * @summary Verifies that Platform::isTieredSupported returns correct value.
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @build sun.hotspot.WhiteBox
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI -XX:+TieredCompilation
- *                   TestPlatformIsTieredSupported
- */
-public class TestPlatformIsTieredSupported {
-    public static void main(String args[]) {
-        WhiteBox whiteBox = WhiteBox.getWhiteBox();
-        boolean tieredCompilation = whiteBox.getBooleanVMFlag(
-                "TieredCompilation");
-        Asserts.assertEQ(Platform.isTieredSupported(), tieredCompilation,
-                "Platform::isTieredSupported should report the same value as "
-                        + "TieredCompilation flag's value when "
-                        + "+TieredCompilation was explicitly passed to JVM.");
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/testlibrary_tests/jvmti/SimpleClassFileLoadHookTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2016, 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
+ * @library /test/lib
+ * @requires vm.flavor != "minimal"
+ * @run main/othervm/native -agentlib:SimpleClassFileLoadHook=Foo,XXX,YYY
+ *      SimpleClassFileLoadHookTest
+ */
+import jdk.test.lib.Asserts;
+
+class Foo {
+    static String getValue() {
+        return "XXX";
+    }
+    static String getOtherValue() {
+        return "xXXXxx";
+    }
+}
+public class SimpleClassFileLoadHookTest {
+    public static void main(String args[]) {
+        System.out.println(Foo.getValue());
+        System.out.println(Foo.getOtherValue());
+        Asserts.assertTrue("YYY".equals(Foo.getValue()) &&
+                           "xYYYxx".equals(Foo.getOtherValue()),
+                           "SimpleClassFileLoadHook should replace XXX with YYY");
+    }
+}
--- a/test/hotspot/jtreg/testlibrary_tests/process/Test.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-
-public class Test {
-    public static void test() {
-        System.out.println ("Hello Test");
-    }
-}
--- a/test/hotspot/jtreg/testlibrary_tests/process/TestNativeProcessBuilder.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * 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
- * @summary Test the native process builder API.
- * @library /test/lib
- * @build Test
- * @run main/native TestNativeProcessBuilder
- */
-
-
-import jdk.test.lib.Utils;
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.process.OutputAnalyzer;
-
-public class TestNativeProcessBuilder {
-    public static void main(String args[]) throws Exception {
-        ProcessBuilder pb = ProcessTools.createNativeTestProcessBuilder("jvm-test-launcher");
-        pb.environment().put("CLASSPATH", Utils.TEST_CLASS_PATH);
-        new OutputAnalyzer(pb.start())
-            .shouldHaveExitValue(0);
-    }
-}
--- a/test/hotspot/jtreg/testlibrary_tests/process/exejvm-test-launcher.c	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-
-#include <jni.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-JNIEnv* create_vm(JavaVM **jvm)
-{
-    JNIEnv* env;
-    JavaVMInitArgs args;
-    JavaVMOption options[1];
-
-    char classpath[4096];
-    snprintf(classpath, sizeof classpath,
-             "-Djava.class.path=%s", getenv("CLASSPATH"));
-    options[0].optionString = classpath;
-
-    args.version = JNI_VERSION_1_8;
-    args.nOptions = 1;
-    args.options = &options[0];
-    args.ignoreUnrecognized = 0;
-
-    int ret = JNI_CreateJavaVM(jvm, (void**)&env, &args);
-    if (ret < 0)
-      exit(10);
-
-    return env;
-}
-
-
-void run(JNIEnv *env) {
-  jclass test_class;
-  jmethodID test_method;
-
-  test_class = (*env)->FindClass(env, "Test");
-  if (test_class == NULL)
-    exit(11);
-
-  test_method = (*env)->GetStaticMethodID(env, test_class, "test", "()V");
-  if (test_method == NULL)
-    exit(12);
-
-  (*env)->CallStaticVoidMethod(env, test_class, test_method);
-}
-
-
-int main(int argc, char **argv)
-{
-  JavaVM *jvm;
-  JNIEnv *env = create_vm(&jvm);
-
-  run(env);
-
-  return 0;
-}
--- a/test/hotspot/jtreg/testlibrary_tests/whitebox/BlobSanityTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * 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
- * 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 BlobSanityTest
- * @bug 8132980
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management/sun.management
- * @build sun.hotspot.WhiteBox
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI BlobSanityTest
- * @summary sanity testing of allocateCodeBlob, freeCodeBlob and getCodeBlob
- */
-
-
-import sun.hotspot.WhiteBox;
-
-import java.util.function.Consumer;
-import jdk.test.lib.Utils;
-
-public class BlobSanityTest {
-
-    private static void runTest(Consumer<Integer> consumer, int val, String testCaseName, Class<? extends Throwable>
-            expectedException) {
-            System.out.println("Calling " + testCaseName);
-            Utils.runAndCheckException(() -> consumer.accept(val), expectedException);
-            System.out.println("Looks ok");
-    }
-
-    public static void main(String[] args) throws Exception {
-        System.out.println("Crash means that sanity check failed");
-
-        WhiteBox wb = WhiteBox.getWhiteBox();
-
-        runTest(wb::freeCodeBlob, 0, "wb::freeCodeBlob(0)", null);
-        runTest(wb::getCodeBlob, 0, "wb::getCodeBlob(0)", NullPointerException.class);
-        runTest(x -> wb.allocateCodeBlob(x, 0), -1, "wb::allocateCodeBlob(-1,0)", IllegalArgumentException.class);
-    }
-}
--- a/test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/BooleanTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * 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
- * 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 BooleanTest
- * @bug 8028756
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.compiler
- *          java.management/sun.management
- *          jdk.internal.jvmstat/sun.jvmstat.monitor
- * @build sun.hotspot.WhiteBox
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI BooleanTest
- * @summary testing of WB::set/getBooleanVMFlag()
- * @author igor.ignatyev@oracle.com
- */
-
-import sun.hotspot.WhiteBox;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.process.ProcessTools;
-import sun.management.*;
-import com.sun.management.*;
-
-public class BooleanTest {
-    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
-    private static final Boolean[] TESTS = {true, false, true, true, false};
-    private static final String TEST_NAME = "BooleanTest";
-    private static final String FLAG_NAME = "PrintCompilation";
-    private static final String FLAG_DEBUG_NAME = "SafepointALot";
-    private static final String METHOD = TEST_NAME + "::method";
-    private static final String METHOD1 = METHOD + "1";
-    private static final String METHOD2 = METHOD + "2";
-
-    public static void main(String[] args) throws Exception {
-        if (args.length == 0) {
-            VmFlagTest.runTest(FLAG_NAME, TESTS,
-                VmFlagTest.WHITE_BOX::setBooleanVMFlag,
-                VmFlagTest.WHITE_BOX::getBooleanVMFlag);
-            testFunctional(false);
-            testFunctional(true);
-            VmFlagTest.runTest(FLAG_DEBUG_NAME, VmFlagTest.WHITE_BOX::getBooleanVMFlag);
-        } else {
-            boolean value = Boolean.valueOf(args[0]);
-            method1();
-            VmFlagTest.WHITE_BOX.setBooleanVMFlag(FLAG_NAME, value);
-            method2();
-        }
-    }
-
-    private static void testFunctional(boolean value) throws Exception {
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-Xbootclasspath/a:.",
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:+WhiteBoxAPI",
-            "-Xcomp",
-            "-XX:CompileCommand=compileonly," + METHOD + "*",
-            "-XX:" + (value ? "-" : "+") + FLAG_NAME,
-            TEST_NAME,
-            "" + value);
-        OutputAnalyzer out = new OutputAnalyzer(pb.start());
-        if (value) {
-            out.shouldNotContain(METHOD1);
-            out.shouldContain(METHOD2);
-        } else {
-            out.shouldContain(METHOD1);
-            out.shouldNotContain(METHOD2);
-        }
-    }
-
-    private static void method1() { }
-    private static void method2() { }
-}
-
--- a/test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/DoubleTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * 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
- * 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 DoubleTest
- * @bug 8028756
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management/sun.management
- * @build sun.hotspot.WhiteBox
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DoubleTest
- * @summary testing of WB::set/getDoubleVMFlag()
- * @author igor.ignatyev@oracle.com
- */
-
-public class DoubleTest {
-    private static final String FLAG_NAME = "CompileThresholdScaling";
-    private static final Double[] TESTS = {0d, -0d, 1d, Double.MAX_VALUE};
-
-    public static void main(String[] args) throws Exception {
-        VmFlagTest.runTest(FLAG_NAME, TESTS,
-            VmFlagTest.WHITE_BOX::setDoubleVMFlag,
-            VmFlagTest.WHITE_BOX::getDoubleVMFlag);
-    }
-}
-
--- a/test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/IntxTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * 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
- * 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 IntxTest
- * @bug 8038756
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management/sun.management
- * @build sun.hotspot.WhiteBox
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xint -XX:-ProfileInterpreter IntxTest
- * @summary testing of WB::set/getIntxVMFlag()
- * @author igor.ignatyev@oracle.com
- */
-import jdk.test.lib.Platform;
-public class IntxTest {
-    private static final String FLAG_NAME = "OnStackReplacePercentage";
-    private static final String FLAG_DEBUG_NAME = "InlineFrequencyCount";
-    private static final long COMPILE_THRESHOLD = VmFlagTest.WHITE_BOX.getIntxVMFlag("CompileThreshold");
-    private static final Long[] TESTS = {0L, 100L, (long)(Integer.MAX_VALUE>>3)*100L};
-
-    public static void main(String[] args) throws Exception {
-        find_and_set_max_osrp();
-        VmFlagTest.runTest(FLAG_NAME, TESTS,
-            VmFlagTest.WHITE_BOX::setIntxVMFlag,
-            VmFlagTest.WHITE_BOX::getIntxVMFlag);
-        VmFlagTest.runTest(FLAG_DEBUG_NAME, VmFlagTest.WHITE_BOX::getIntxVMFlag);
-    }
-
-    static void find_and_set_max_osrp() {
-        long max_percentage_limit = (long)(Integer.MAX_VALUE>>3)*100L;
-        max_percentage_limit = COMPILE_THRESHOLD == 0  ? max_percentage_limit : max_percentage_limit/COMPILE_THRESHOLD;
-        if (Platform.is32bit() && max_percentage_limit > Integer.MAX_VALUE) {
-          max_percentage_limit = Integer.MAX_VALUE;
-        }
-        TESTS[2] = max_percentage_limit;
-    }
-}
-
--- a/test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/SizeTTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * 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
- * 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 SizeTTest
- * @bug 8054823
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management/sun.management
- * @build sun.hotspot.WhiteBox
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions SizeTTest
- * @summary testing of WB::set/getSizeTVMFlag()
- */
-import jdk.test.lib.Platform;
-
-public class SizeTTest {
-    private static final String FLAG_NAME = "ArrayAllocatorMallocLimit";
-    private static final Long[] TESTS = {0L, 100L, (long) Integer.MAX_VALUE,
-        (1L << 32L) - 1L, 1L << 32L};
-    private static final Long[] EXPECTED_64 = TESTS;
-    private static final Long[] EXPECTED_32 = {0L, 100L,
-        (long) Integer.MAX_VALUE, (1L << 32L) - 1L, 0L};
-
-    public static void main(String[] args) throws Exception {
-        VmFlagTest.runTest(FLAG_NAME, TESTS,
-            Platform.is64bit() ? EXPECTED_64 : EXPECTED_32,
-            VmFlagTest.WHITE_BOX::setSizeTVMFlag,
-            VmFlagTest.WHITE_BOX::getSizeTVMFlag);
-    }
-}
--- a/test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/StringTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * 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
- * 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 StringTest
- * @bug 8028756
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management/sun.management
- * @build sun.hotspot.WhiteBox
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI StringTest
- * @summary testing of WB::set/getStringVMFlag()
- * @author igor.ignatyev@oracle.com
- */
-
-public class StringTest {
-    private static final String FLAG_NAME = "CompileOnly";
-    private static final String FLAG_DEBUG_NAME = "SuppressErrorAt";
-    private static final String[] TESTS = {"StringTest::*", ""};
-
-    public static void main(String[] args) throws Exception {
-        VmFlagTest.runTest(FLAG_NAME, TESTS,
-            VmFlagTest.WHITE_BOX::setStringVMFlag,
-            VmFlagTest.WHITE_BOX::getStringVMFlag);
-        VmFlagTest.runTest(FLAG_DEBUG_NAME, VmFlagTest.WHITE_BOX::getStringVMFlag);
-    }
-}
-
--- a/test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/Uint64Test.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * 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
- * 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 Uint64Test
- * @bug 8028756
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management/sun.management
- * @build sun.hotspot.WhiteBox
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI Uint64Test
- * @summary testing of WB::set/getUint64VMFlag()
- * @author igor.ignatyev@oracle.com
- */
-
-public class Uint64Test {
-    private static final String FLAG_NAME = "MaxRAM";
-    private static final Long[] TESTS = {0L, 100L, (long) Integer.MAX_VALUE,
-            -1L, Long.MAX_VALUE, Long.MIN_VALUE};
-
-    public static void main(String[] args) throws Exception {
-        VmFlagTest.runTest(FLAG_NAME, TESTS,
-            VmFlagTest.WHITE_BOX::setUint64VMFlag,
-            VmFlagTest.WHITE_BOX::getUint64VMFlag);
-    }
-}
-
--- a/test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/UintxTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * 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
- * 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 UintxTest
- * @bug 8028756
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management/sun.management
- * @build sun.hotspot.WhiteBox
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI UintxTest
- * @summary testing of WB::set/getUintxVMFlag()
- * @author igor.ignatyev@oracle.com
- */
-import jdk.test.lib.Platform;
-
-public class UintxTest {
-    private static final String FLAG_NAME = "VerifyGCStartAt";
-    private static final String FLAG_DEBUG_NAME = "CodeCacheMinimumUseSpace";
-    private static final Long[] TESTS = {0L, 100L, (long) Integer.MAX_VALUE,
-        (1L << 32L) - 1L, 1L << 32L};
-    private static final Long[] EXPECTED_64 = TESTS;
-    private static final Long[] EXPECTED_32 = {0L, 100L,
-        (long) Integer.MAX_VALUE, (1L << 32L) - 1L, 0L};
-
-    public static void main(String[] args) throws Exception {
-        VmFlagTest.runTest(FLAG_NAME, TESTS,
-            Platform.is64bit() ? EXPECTED_64 : EXPECTED_32,
-            VmFlagTest.WHITE_BOX::setUintxVMFlag,
-            VmFlagTest.WHITE_BOX::getUintxVMFlag);
-        VmFlagTest.runTest(FLAG_DEBUG_NAME, VmFlagTest.WHITE_BOX::getUintxVMFlag);
-    }
-}
-
--- a/test/hotspot/jtreg/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, 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.
- */
-
-import java.util.function.BiConsumer;
-import java.util.function.Function;
-import sun.hotspot.WhiteBox;
-import sun.management.*;
-import com.sun.management.*;
-import jdk.test.lib.Asserts;
-import java.lang.management.ManagementFactory;
-
-public final class VmFlagTest<T> {
-    public static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
-
-    private static final String NONEXISTENT_FLAG = "NonexistentFlag";
-    private final String flagName;
-    private final BiConsumer<T, T> test;
-    private final BiConsumer<String, T> set;
-    private final Function<String, T> get;
-    private final boolean isPositive;
-
-    protected VmFlagTest(String flagName, BiConsumer<String, T> set,
-            Function<String, T> get, boolean isPositive) {
-        this.flagName = flagName;
-        this.set = set;
-        this.get = get;
-        this.isPositive = isPositive;
-        if (isPositive) {
-            test = this::testWritePositive;
-        } else {
-            test = this::testWriteNegative;
-        }
-    }
-
-    private void setNewValue(T value) {
-        set.accept(flagName, value);
-    }
-
-    private T getValue() {
-        return get.apply(flagName);
-    }
-
-    protected static <T> void runTest(String existentFlag, T[] tests,
-            BiConsumer<String, T> set, Function<String, T> get) {
-        runTest(existentFlag, tests, tests, set, get);
-    }
-
-    protected static <T> void runTest(String existentFlag, Function<String, T> get) {
-        runTest(existentFlag, null, null, null, get);
-    }
-
-    protected static <T> void runTest(String existentFlag, T[] tests,
-            T[] results, BiConsumer<String, T> set, Function<String, T> get) {
-        if (existentFlag != null) {
-            new VmFlagTest(existentFlag, set, get, true).test(tests, results);
-        }
-        new VmFlagTest(NONEXISTENT_FLAG, set, get, false).test(tests, results);
-    }
-
-    public final void test(T[] tests, T[] results) {
-        if (isPositive) {
-            testRead();
-        }
-        if (tests != null) {
-            Asserts.assertEQ(tests.length, results.length, "[TESTBUG] tests.length != results.length");
-            for (int i = 0, n = tests.length ; i < n; ++i) {
-                test.accept(tests[i], results[i]);
-            }
-        }
-    }
-
-    protected String getVMOptionAsString() {
-        if (WHITE_BOX.isConstantVMFlag(flagName) || WHITE_BOX.isLockedVMFlag(flagName)) {
-          // JMM cannot access debug flags in product builds or locked flags,
-          // use whitebox methods to get such flags value.
-          return asString(getValue());
-        }
-        HotSpotDiagnosticMXBean diagnostic
-                = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
-        VMOption tmp;
-        try {
-            tmp = diagnostic.getVMOption(flagName);
-        } catch (IllegalArgumentException e) {
-            tmp = null;
-        }
-        return tmp == null ? null : tmp.getValue();
-    }
-
-    private String testRead() {
-        String value = getVMOptionAsString();
-        Asserts.assertNotNull(value);
-        Asserts.assertEQ(value, asString(getValue()));
-        Asserts.assertEQ(value, asString(WHITE_BOX.getVMFlag(flagName)));
-        return value;
-    }
-
-    private void testWritePositive(T value, T expected) {
-        setNewValue(value);
-        String newValue = testRead();
-        Asserts.assertEQ(newValue, asString(expected));
-    }
-
-    private void testWriteNegative(T value, T expected) {
-        // Should always return false for non-existing flags
-        Asserts.assertFalse(WHITE_BOX.isConstantVMFlag(flagName));
-        Asserts.assertFalse(WHITE_BOX.isLockedVMFlag(flagName));
-        String oldValue = getVMOptionAsString();
-        Asserts.assertEQ(oldValue, asString(getValue()));
-        Asserts.assertEQ(oldValue, asString(WHITE_BOX.getVMFlag(flagName)));
-        setNewValue(value);
-        String newValue = getVMOptionAsString();
-        Asserts.assertEQ(oldValue, newValue);
-    }
-
-    private String asString(Object value) {
-        return value == null ? null : "" + value;
-    }
-}
--- a/test/jdk/lib/testlibrary/AssertsTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,275 +0,0 @@
-/*
- * 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
- * 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.
- */
-
-import java.lang.SuppressWarnings;
-
-import static jdk.test.lib.Asserts.*;
-
-/*
- * @test
- * @library /test/lib
- * @summary Tests the different assertions in the Assert class
- */
-public class AssertsTest {
-    private static class Foo implements Comparable<Foo> {
-        final int id;
-        public Foo(int id) {
-            this.id = id;
-        }
-
-        public int compareTo(Foo f) {
-            return new Integer(id).compareTo(new Integer(f.id));
-        }
-        public String toString() {
-            return "Foo(" + Integer.toString(id) + ")";
-        }
-    }
-
-    public static void main(String[] args) throws Exception {
-        testLessThan();
-        testLessThanOrEqual();
-        testEquals();
-        testGreaterThanOrEqual();
-        testGreaterThan();
-        testNotEquals();
-        testNull();
-        testNotNull();
-        testTrue();
-        testFalse();
-        testFail();
-    }
-
-    private static void testLessThan() throws Exception {
-        expectPass(Assertion.LT, 1, 2);
-
-        expectFail(Assertion.LT, 2, 2);
-        expectFail(Assertion.LT, 2, 1);
-        expectFail(Assertion.LT, null, 2);
-        expectFail(Assertion.LT, 2, null);
-    }
-
-    private static void testLessThanOrEqual() throws Exception {
-        expectPass(Assertion.LTE, 1, 2);
-        expectPass(Assertion.LTE, 2, 2);
-
-        expectFail(Assertion.LTE, 3, 2);
-        expectFail(Assertion.LTE, null, 2);
-        expectFail(Assertion.LTE, 2, null);
-    }
-
-    private static void testEquals() throws Exception {
-        expectPass(Assertion.EQ, 1, 1);
-        expectPass(Assertion.EQ, (Integer)null, (Integer)null);
-
-        Foo f1 = new Foo(1);
-        expectPass(Assertion.EQ, f1, f1);
-
-        Foo f2 = new Foo(1);
-        expectFail(Assertion.EQ, f1, f2);
-        expectFail(Assertion.LTE, null, 2);
-        expectFail(Assertion.LTE, 2, null);
-    }
-
-    private static void testGreaterThanOrEqual() throws Exception {
-        expectPass(Assertion.GTE, 1, 1);
-        expectPass(Assertion.GTE, 2, 1);
-
-        expectFail(Assertion.GTE, 1, 2);
-        expectFail(Assertion.GTE, null, 2);
-        expectFail(Assertion.GTE, 2, null);
-    }
-
-    private static void testGreaterThan() throws Exception {
-        expectPass(Assertion.GT, 2, 1);
-
-        expectFail(Assertion.GT, 1, 1);
-        expectFail(Assertion.GT, 1, 2);
-        expectFail(Assertion.GT, null, 2);
-        expectFail(Assertion.GT, 2, null);
-    }
-
-    private static void testNotEquals() throws Exception {
-        expectPass(Assertion.NE, null, 1);
-        expectPass(Assertion.NE, 1, null);
-
-        Foo f1 = new Foo(1);
-        Foo f2 = new Foo(1);
-        expectPass(Assertion.NE, f1, f2);
-
-        expectFail(Assertion.NE, (Integer)null, (Integer)null);
-        expectFail(Assertion.NE, f1, f1);
-        expectFail(Assertion.NE, 1, 1);
-    }
-
-    private static void testNull() throws Exception {
-        expectPass(Assertion.NULL, (Integer)null);
-
-        expectFail(Assertion.NULL, 1);
-    }
-
-    private static void testNotNull() throws Exception {
-        expectPass(Assertion.NOTNULL, 1);
-
-        expectFail(Assertion.NOTNULL, (Integer)null);
-    }
-
-    private static void testTrue() throws Exception {
-        expectPass(Assertion.TRUE, true);
-
-        expectFail(Assertion.TRUE, false);
-    }
-
-    private static void testFalse() throws Exception {
-        expectPass(Assertion.FALSE, false);
-
-        expectFail(Assertion.FALSE, true);
-    }
-
-    private static void testFail() throws Exception {
-        try {
-            fail();
-        } catch (RuntimeException re) {
-            assertEquals("fail", re.getMessage());
-        }
-
-        try {
-            fail("Failure");
-        } catch (RuntimeException re) {
-            assertEquals("Failure", re.getMessage());
-        }
-
-        Exception e = new Exception("the cause");
-        try {
-            fail("Fail w/ cause", e);
-        } catch (RuntimeException re) {
-            assertEquals("Fail w/ cause", re.getMessage());
-            assertEquals(e, re.getCause(), "Cause mismatch");
-        }
-
-        try {
-            fail(1, 2, "Different", "vs");
-        } catch (RuntimeException re) {
-            assertEquals("Different <1> vs <2>", re.getMessage());
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private static <T extends Comparable<T>> void expectPass(Assertion assertion, T ... args)
-        throws Exception {
-        Assertion.run(assertion, args);
-    }
-
-    @SuppressWarnings("unchecked")
-    private static <T extends Comparable<T>> void expectFail(Assertion assertion, T ... args)
-        throws Exception {
-        try {
-            Assertion.run(assertion, args);
-        } catch (RuntimeException e) {
-            return;
-        }
-        throw new Exception("Expected " + Assertion.format(assertion, (Object[]) args) +
-                            " to throw a RuntimeException");
-    }
-
-}
-
-enum Assertion {
-    LT, LTE, EQ, GTE, GT, NE, NULL, NOTNULL, FALSE, TRUE;
-
-    @SuppressWarnings("unchecked")
-    public static <T extends Comparable<T>> void run(Assertion assertion, T ... args) {
-        String msg = "Expected " + format(assertion, (Object[])args) + " to pass";
-        switch (assertion) {
-            case LT:
-                assertLessThan(args[0], args[1], msg);
-                break;
-            case LTE:
-                assertLessThanOrEqual(args[0], args[1], msg);
-                break;
-            case EQ:
-                assertEquals(args[0], args[1], msg);
-                break;
-            case GTE:
-                assertGreaterThanOrEqual(args[0], args[1], msg);
-                break;
-            case GT:
-                assertGreaterThan(args[0], args[1], msg);
-                break;
-            case NE:
-                assertNotEquals(args[0], args[1], msg);
-                break;
-            case NULL:
-                assertNull(args == null ? args : args[0], msg);
-                break;
-            case NOTNULL:
-                assertNotNull(args == null ? args : args[0], msg);
-                break;
-            case FALSE:
-                assertFalse((Boolean) args[0], msg);
-                break;
-            case TRUE:
-                assertTrue((Boolean) args[0], msg);
-                break;
-            default:
-                // do nothing
-        }
-    }
-
-    public static String format(Assertion assertion, Object ... args) {
-        switch (assertion) {
-            case LT:
-                return asString("assertLessThan", args);
-            case LTE:
-                return asString("assertLessThanOrEqual", args);
-            case EQ:
-                return asString("assertEquals", args);
-            case GTE:
-                return asString("assertGreaterThanOrEquals", args);
-            case GT:
-                return asString("assertGreaterThan", args);
-            case NE:
-                return asString("assertNotEquals", args);
-            case NULL:
-                return asString("assertNull", args);
-            case NOTNULL:
-                return asString("assertNotNull", args);
-            case FALSE:
-                return asString("assertFalse", args);
-            case TRUE:
-                return asString("assertTrue", args);
-            default:
-                return "";
-        }
-    }
-
-    private static String asString(String assertion, Object ... args) {
-        if (args == null) {
-            return String.format("%s(null)", assertion);
-        }
-        if (args.length == 1) {
-            return String.format("%s(%s)", assertion, args[0]);
-        } else {
-            return String.format("%s(%s, %s)", assertion, args[0], args[1]);
-        }
-    }
-}
--- a/test/jdk/lib/testlibrary/CPUInfoTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * 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
- * @library /test/lib /
- *
- * @build sun.hotspot.WhiteBox
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   CPUInfoTest
- */
-
-import java.util.Set;
-import java.util.List;
-import jdk.test.lib.Platform;
-import sun.hotspot.WhiteBox;
-import sun.hotspot.cpuinfo.CPUInfo;
-
-import static jdk.test.lib.Asserts.*;
-
-public class CPUInfoTest {
-    static final WhiteBox WB = WhiteBox.getWhiteBox();
-
-    private static final Set<String> wellKnownCPUFeatures;
-
-    static {
-        if (Platform.isX86() || Platform.isX64()) {
-            wellKnownCPUFeatures = Set.of(
-                    "adx", "aes", "bmi1", "bmi2", "cmov", "cx8", "fxsr", "mmx", "clmul", "clflush", "clflushopt", "clwb",
-                    "sha", "fma", "popcnt", "vzeroupper", "erms", "rtm", "mmxext", "3dnowpref", "lzcnt", "ht",
-                    "tsc", "tscinvbit", "tscinv", "sse", "sse2", "sse3", "ssse3", "sse4.1", "sse4.2", "sse4a", "avx", "avx2",
-                    "avx512f", "avx512dq", "avx512pf", "avx512er", "avx512cd", "avx512bw", "avx512vl",
-                    "avx512_vpopcntdq", "avx512_vpclmulqdq", "avx512_vbmi2", "avx512_vaes", "avx512_vnni");
-        } else {
-            wellKnownCPUFeatures = null;
-        }
-    }
-
-    public static void main(String args[]) throws Throwable {
-        System.out.println("WB.getCPUFeatures(): \"" + WB.getCPUFeatures() + "\"");
-
-        String additionalCpuInfo = CPUInfo.getAdditionalCPUInfo();
-        assertTrue(additionalCpuInfo != null);
-        System.out.println("CPUInfo.getAdditionalCPUInfo(): \"" + additionalCpuInfo + "\"");
-
-        List<String> features = CPUInfo.getFeatures();
-        assertTrue(features != null);
-        System.out.println("CPUInfo.getFeatures(): " + features);
-
-        for (String feature : features) {
-            assertTrue(CPUInfo.hasFeature(feature), feature);
-        }
-
-        if (wellKnownCPUFeatures != null) {
-            System.out.println("Well-known CPU features: " + wellKnownCPUFeatures);
-            assertTrue(wellKnownCPUFeatures.containsAll(features), "not all features are known");
-        }
-
-        System.out.println("TEST PASSED");
-    }
-}
--- a/test/jdk/lib/testlibrary/OutputAnalyzerReportingTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * 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
- * 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
- * @summary Test the OutputAnalyzer reporting functionality,
- *     such as printing additional diagnostic info
- *     (exit code, stdout, stderr, command line, etc.)
- * @modules java.management
- * @library /test/lib
- * @run main OutputAnalyzerReportingTest
- */
-
-import jdk.test.lib.process.OutputAnalyzer;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-public class OutputAnalyzerReportingTest {
-
-    public static void main(String[] args) throws Exception {
-        // Create the output analyzer under test
-        String stdout = "aaaaaa";
-        String stderr = "bbbbbb";
-        OutputAnalyzer output = new OutputAnalyzer(stdout, stderr);
-
-        // Expected summary values should be the same for all cases,
-        // since the outputAnalyzer object is the same
-        String expectedExitValue = "-1";
-        String expectedSummary =
-                " stdout: [" + stdout + "];\n" +
-                " stderr: [" + stderr + "]\n" +
-                " exitValue = " + expectedExitValue + "\n";
-
-
-        DiagnosticSummaryTestRunner testRunner =
-                new DiagnosticSummaryTestRunner();
-
-        // should have exit value
-        testRunner.init(expectedSummary);
-        int unexpectedExitValue = 2;
-        try {
-            output.shouldHaveExitValue(unexpectedExitValue);
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-        // should not contain
-        testRunner.init(expectedSummary);
-        try {
-            output.shouldNotContain(stdout);
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-        // should contain
-        testRunner.init(expectedSummary);
-        try {
-            output.shouldContain("unexpected-stuff");
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-        // should not match
-        testRunner.init(expectedSummary);
-        try {
-            output.shouldNotMatch("[a]");
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-        // should match
-        testRunner.init(expectedSummary);
-        try {
-            output.shouldMatch("[qwerty]");
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-    }
-
-    private static class DiagnosticSummaryTestRunner {
-        private ByteArrayOutputStream byteStream =
-                new ByteArrayOutputStream(10000);
-
-        private String expectedSummary = "";
-        private PrintStream errStream;
-
-
-        public void init(String expectedSummary) {
-            this.expectedSummary = expectedSummary;
-            byteStream.reset();
-            errStream = new PrintStream(byteStream);
-            System.setErr(errStream);
-        }
-
-        public void closeAndCheckResults() {
-            // check results
-            errStream.close();
-            String stdErrStr = byteStream.toString();
-            if (!stdErrStr.contains(expectedSummary)) {
-                throw new RuntimeException("The output does not contain "
-                    + "the diagnostic message, or the message is incorrect");
-            }
-        }
-    }
-
-}
--- a/test/jdk/lib/testlibrary/OutputAnalyzerTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*
- * 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
- * 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
- * @summary Test the OutputAnalyzer utility class
- * @modules java.management
- * @library /test/lib
- * @run main OutputAnalyzerTest
- */
-
-import jdk.test.lib.process.OutputAnalyzer;
-
-public class OutputAnalyzerTest {
-
-    public static void main(String args[]) throws Exception {
-
-        String stdout = "aaaaaa";
-        String stderr = "bbbbbb";
-        String nonExistingString = "cccc";
-
-        OutputAnalyzer output = new OutputAnalyzer(stdout, stderr);
-
-        if (!stdout.equals(output.getStdout())) {
-            throw new Exception("getStdout() returned '" + output.getStdout()
-                    + "', expected '" + stdout + "'");
-        }
-
-        if (!stderr.equals(output.getStderr())) {
-            throw new Exception("getStderr() returned '" + output.getStderr()
-                    + "', expected '" + stderr + "'");
-        }
-
-        try {
-            output.shouldContain(stdout);
-            output.stdoutShouldContain(stdout);
-            output.shouldContain(stderr);
-            output.stderrShouldContain(stderr);
-        } catch (RuntimeException e) {
-            throw new Exception("shouldContain() failed", e);
-        }
-
-        try {
-            output.shouldContain(nonExistingString);
-            throw new Exception("shouldContain() failed to throw exception");
-        } catch (RuntimeException e) {
-            // expected
-        }
-
-        try {
-            output.stdoutShouldContain(stderr);
-            throw new Exception(
-                    "stdoutShouldContain() failed to throw exception");
-        } catch (RuntimeException e) {
-            // expected
-        }
-
-        try {
-            output.stderrShouldContain(stdout);
-            throw new Exception(
-                    "stdoutShouldContain() failed to throw exception");
-        } catch (RuntimeException e) {
-            // expected
-        }
-
-        try {
-            output.shouldNotContain(nonExistingString);
-            output.stdoutShouldNotContain(nonExistingString);
-            output.stderrShouldNotContain(nonExistingString);
-        } catch (RuntimeException e) {
-            throw new Exception("shouldNotContain() failed", e);
-        }
-
-        try {
-            output.shouldNotContain(stdout);
-            throw new Exception("shouldContain() failed to throw exception");
-        } catch (RuntimeException e) {
-            // expected
-        }
-
-        try {
-            output.stdoutShouldNotContain(stdout);
-            throw new Exception("shouldContain() failed to throw exception");
-        } catch (RuntimeException e) {
-            // expected
-        }
-
-        try {
-            output.stderrShouldNotContain(stderr);
-            throw new Exception("shouldContain() failed to throw exception");
-        } catch (RuntimeException e) {
-            // expected
-        }
-
-        String stdoutPattern = "[a]";
-        String stdoutByLinePattern = "a*";
-        String stderrPattern = "[b]";
-        String nonExistingPattern = "[c]";
-        String byLinePattern = "[ab]*";
-
-        // Should match
-        try {
-            output.shouldMatch(stdoutPattern);
-            output.stdoutShouldMatch(stdoutPattern);
-            output.shouldMatch(stderrPattern);
-            output.stderrShouldMatch(stderrPattern);
-        } catch (RuntimeException e) {
-            throw new Exception("shouldMatch() failed", e);
-        }
-
-        try {
-            output.shouldMatch(nonExistingPattern);
-            throw new Exception("shouldMatch() failed to throw exception");
-        } catch (RuntimeException e) {
-            // expected
-        }
-
-        try {
-            output.stdoutShouldMatch(stderrPattern);
-            throw new Exception(
-                    "stdoutShouldMatch() failed to throw exception");
-        } catch (RuntimeException e) {
-            // expected
-        }
-
-        try {
-            output.stderrShouldMatch(stdoutPattern);
-            throw new Exception(
-                    "stderrShouldMatch() failed to throw exception");
-        } catch (RuntimeException e) {
-            // expected
-        }
-
-        try {
-            output.shouldMatchByLine(byLinePattern);
-        } catch (RuntimeException e) {
-            throw new Exception("shouldMatchByLine() failed", e);
-        }
-
-        try {
-            output.shouldMatchByLine(nonExistingPattern);
-            throw new Exception("shouldMatchByLine() failed to throw exception");
-        } catch (RuntimeException e) {
-            // expected
-        }
-
-        try {
-            output.stdoutShouldMatchByLine(stdoutByLinePattern);
-        } catch (RuntimeException e) {
-            throw new Exception("stdoutShouldMatchByLine() failed", e);
-        }
-
-        // Should not match
-        try {
-            output.shouldNotMatch(nonExistingPattern);
-            output.stdoutShouldNotMatch(nonExistingPattern);
-            output.stderrShouldNotMatch(nonExistingPattern);
-        } catch (RuntimeException e) {
-            throw new Exception("shouldNotMatch() failed", e);
-        }
-
-        try {
-            output.shouldNotMatch(stdoutPattern);
-            throw new Exception("shouldNotMatch() failed to throw exception");
-        } catch (RuntimeException e) {
-            // expected
-        }
-
-        try {
-            output.stdoutShouldNotMatch(stdoutPattern);
-            throw new Exception("shouldNotMatch() failed to throw exception");
-        } catch (RuntimeException e) {
-            // expected
-        }
-
-        try {
-            output.stderrShouldNotMatch(stderrPattern);
-            throw new Exception("shouldNotMatch() failed to throw exception");
-        } catch (RuntimeException e) {
-            // expected
-        }
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/ProblemList.txt	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,40 @@
+#
+# 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.
+#
+
+#############################################################################
+#
+# List of quarantined tests -- tests that should not be run by default, because
+# they may fail due to known reason. The reason (CR#) must be mandatory specified.
+#
+# List items are testnames followed by labels, all MUST BE commented
+#   as to why they are here and use a label:
+#     generic-all   Problems on all platforms
+#     generic-ARCH  Where ARCH is one of: x64, i586, ppc64, ppc64le, s390x etc.
+#     OSNAME-all    Where OSNAME is one of: linux, windows, macosx, aix
+#     OSNAME-ARCH   Specific on to one OSNAME and ARCH, e.g. macosx-x64
+#     OSNAME-REV    Specific on to one OSNAME and REV, e.g. macosx-10.7.4
+#
+# More than one label is allowed but must be on the same line.
+#
+#############################################################################
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/RedefineClassTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 2019, 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
+ * @library /test/lib
+ * @summary Proof of concept test for RedefineClassHelper
+ * @modules java.base/jdk.internal.misc
+ * @modules java.compiler
+ *          java.instrument
+ * @run main RedefineClassHelper
+ * @run main/othervm -javaagent:redefineagent.jar RedefineClassTest
+ */
+
+import static jdk.test.lib.Asserts.*;
+
+/*
+ * Proof of concept test for the test utility class RedefineClassHelper
+ */
+
+// package access top-level class to avoid problem with RedefineClassHelper
+// and nested types.
+class RedefineClassTest_A {
+    public int Method() {
+        return 1;
+    }
+}
+
+public class RedefineClassTest {
+
+    public static String newClass = "class RedefineClassTest_A { public int Method() { return 2; } }";
+    public static void main(String[] args) throws Exception {
+        RedefineClassTest_A a = new RedefineClassTest_A();
+        assertTrue(a.Method() == 1);
+        RedefineClassHelper.redefineClass(RedefineClassTest_A.class, newClass);
+        assertTrue(a.Method() == 2);
+    }
+}
--- a/test/lib-test/TEST.ROOT	Tue Jun 16 08:03:40 2020 -0700
+++ b/test/lib-test/TEST.ROOT	Tue Jun 16 09:50:45 2020 -0700
@@ -1,9 +1,38 @@
+#
+# 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.
+#
+
 # This file identifies the root of the test-suite hierarchy.
 # It also contains test-suite configuration information.
 
+# The list of keywords supported in this test suite
+# randomness:           test uses randomness, test cases differ from run to run
+keys=randomness
+
 # Minimum jtreg version
 requiredVersion=5.1 b1
 
 # Path to libraries in the topmost test directory. This is needed so @library
 # does not need ../../ notation to reach them
 external.lib.roots = ../../
+
+groups=TEST.groups
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/TEST.groups	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+
+tier1 = .
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/jdk/test/lib/AssertsTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,275 @@
+/*
+ * 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
+ * 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.
+ */
+
+import java.lang.SuppressWarnings;
+
+import static jdk.test.lib.Asserts.*;
+
+/*
+ * @test
+ * @library /test/lib
+ * @summary Tests the different assertions in the Assert class
+ */
+public class AssertsTest {
+    private static class Foo implements Comparable<Foo> {
+        final int id;
+        public Foo(int id) {
+            this.id = id;
+        }
+
+        public int compareTo(Foo f) {
+            return new Integer(id).compareTo(new Integer(f.id));
+        }
+        public String toString() {
+            return "Foo(" + Integer.toString(id) + ")";
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        testLessThan();
+        testLessThanOrEqual();
+        testEquals();
+        testGreaterThanOrEqual();
+        testGreaterThan();
+        testNotEquals();
+        testNull();
+        testNotNull();
+        testTrue();
+        testFalse();
+        testFail();
+    }
+
+    private static void testLessThan() throws Exception {
+        expectPass(Assertion.LT, 1, 2);
+
+        expectFail(Assertion.LT, 2, 2);
+        expectFail(Assertion.LT, 2, 1);
+        expectFail(Assertion.LT, null, 2);
+        expectFail(Assertion.LT, 2, null);
+    }
+
+    private static void testLessThanOrEqual() throws Exception {
+        expectPass(Assertion.LTE, 1, 2);
+        expectPass(Assertion.LTE, 2, 2);
+
+        expectFail(Assertion.LTE, 3, 2);
+        expectFail(Assertion.LTE, null, 2);
+        expectFail(Assertion.LTE, 2, null);
+    }
+
+    private static void testEquals() throws Exception {
+        expectPass(Assertion.EQ, 1, 1);
+        expectPass(Assertion.EQ, (Integer)null, (Integer)null);
+
+        Foo f1 = new Foo(1);
+        expectPass(Assertion.EQ, f1, f1);
+
+        Foo f2 = new Foo(1);
+        expectFail(Assertion.EQ, f1, f2);
+        expectFail(Assertion.LTE, null, 2);
+        expectFail(Assertion.LTE, 2, null);
+    }
+
+    private static void testGreaterThanOrEqual() throws Exception {
+        expectPass(Assertion.GTE, 1, 1);
+        expectPass(Assertion.GTE, 2, 1);
+
+        expectFail(Assertion.GTE, 1, 2);
+        expectFail(Assertion.GTE, null, 2);
+        expectFail(Assertion.GTE, 2, null);
+    }
+
+    private static void testGreaterThan() throws Exception {
+        expectPass(Assertion.GT, 2, 1);
+
+        expectFail(Assertion.GT, 1, 1);
+        expectFail(Assertion.GT, 1, 2);
+        expectFail(Assertion.GT, null, 2);
+        expectFail(Assertion.GT, 2, null);
+    }
+
+    private static void testNotEquals() throws Exception {
+        expectPass(Assertion.NE, null, 1);
+        expectPass(Assertion.NE, 1, null);
+
+        Foo f1 = new Foo(1);
+        Foo f2 = new Foo(1);
+        expectPass(Assertion.NE, f1, f2);
+
+        expectFail(Assertion.NE, (Integer)null, (Integer)null);
+        expectFail(Assertion.NE, f1, f1);
+        expectFail(Assertion.NE, 1, 1);
+    }
+
+    private static void testNull() throws Exception {
+        expectPass(Assertion.NULL, (Integer)null);
+
+        expectFail(Assertion.NULL, 1);
+    }
+
+    private static void testNotNull() throws Exception {
+        expectPass(Assertion.NOTNULL, 1);
+
+        expectFail(Assertion.NOTNULL, (Integer)null);
+    }
+
+    private static void testTrue() throws Exception {
+        expectPass(Assertion.TRUE, true);
+
+        expectFail(Assertion.TRUE, false);
+    }
+
+    private static void testFalse() throws Exception {
+        expectPass(Assertion.FALSE, false);
+
+        expectFail(Assertion.FALSE, true);
+    }
+
+    private static void testFail() throws Exception {
+        try {
+            fail();
+        } catch (RuntimeException re) {
+            assertEquals("fail", re.getMessage());
+        }
+
+        try {
+            fail("Failure");
+        } catch (RuntimeException re) {
+            assertEquals("Failure", re.getMessage());
+        }
+
+        Exception e = new Exception("the cause");
+        try {
+            fail("Fail w/ cause", e);
+        } catch (RuntimeException re) {
+            assertEquals("Fail w/ cause", re.getMessage());
+            assertEquals(e, re.getCause(), "Cause mismatch");
+        }
+
+        try {
+            fail(1, 2, "Different", "vs");
+        } catch (RuntimeException re) {
+            assertEquals("Different <1> vs <2>", re.getMessage());
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    private static <T extends Comparable<T>> void expectPass(Assertion assertion, T ... args)
+        throws Exception {
+        Assertion.run(assertion, args);
+    }
+
+    @SuppressWarnings("unchecked")
+    private static <T extends Comparable<T>> void expectFail(Assertion assertion, T ... args)
+        throws Exception {
+        try {
+            Assertion.run(assertion, args);
+        } catch (RuntimeException e) {
+            return;
+        }
+        throw new Exception("Expected " + Assertion.format(assertion, (Object[]) args) +
+                            " to throw a RuntimeException");
+    }
+
+}
+
+enum Assertion {
+    LT, LTE, EQ, GTE, GT, NE, NULL, NOTNULL, FALSE, TRUE;
+
+    @SuppressWarnings("unchecked")
+    public static <T extends Comparable<T>> void run(Assertion assertion, T ... args) {
+        String msg = "Expected " + format(assertion, (Object[])args) + " to pass";
+        switch (assertion) {
+            case LT:
+                assertLessThan(args[0], args[1], msg);
+                break;
+            case LTE:
+                assertLessThanOrEqual(args[0], args[1], msg);
+                break;
+            case EQ:
+                assertEquals(args[0], args[1], msg);
+                break;
+            case GTE:
+                assertGreaterThanOrEqual(args[0], args[1], msg);
+                break;
+            case GT:
+                assertGreaterThan(args[0], args[1], msg);
+                break;
+            case NE:
+                assertNotEquals(args[0], args[1], msg);
+                break;
+            case NULL:
+                assertNull(args == null ? args : args[0], msg);
+                break;
+            case NOTNULL:
+                assertNotNull(args == null ? args : args[0], msg);
+                break;
+            case FALSE:
+                assertFalse((Boolean) args[0], msg);
+                break;
+            case TRUE:
+                assertTrue((Boolean) args[0], msg);
+                break;
+            default:
+                // do nothing
+        }
+    }
+
+    public static String format(Assertion assertion, Object ... args) {
+        switch (assertion) {
+            case LT:
+                return asString("assertLessThan", args);
+            case LTE:
+                return asString("assertLessThanOrEqual", args);
+            case EQ:
+                return asString("assertEquals", args);
+            case GTE:
+                return asString("assertGreaterThanOrEquals", args);
+            case GT:
+                return asString("assertGreaterThan", args);
+            case NE:
+                return asString("assertNotEquals", args);
+            case NULL:
+                return asString("assertNull", args);
+            case NOTNULL:
+                return asString("assertNotNull", args);
+            case FALSE:
+                return asString("assertFalse", args);
+            case TRUE:
+                return asString("assertTrue", args);
+            default:
+                return "";
+        }
+    }
+
+    private static String asString(String assertion, Object ... args) {
+        if (args == null) {
+            return String.format("%s(null)", assertion);
+        }
+        if (args.length == 1) {
+            return String.format("%s(%s)", assertion, args[0]);
+        } else {
+            return String.format("%s(%s, %s)", assertion, args[0], args[1]);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/jdk/test/lib/RandomGeneratorTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,175 @@
+/*
+ * 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
+ * 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
+ * @key randomness
+ * @summary Verify correctnes of the random generator from Utils.java
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @run driver RandomGeneratorTest SAME_SEED
+ * @run driver RandomGeneratorTest NO_SEED
+ * @run driver RandomGeneratorTest DIFFERENT_SEED
+ */
+
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.Utils;
+
+/**
+ * The test verifies correctness of work {@link jdk.test.lib.Utils#getRandomInstance()}.
+ * Test works in three modes: same seed provided, no seed provided and
+ * different seed provided. In the first case the test expects that all random numbers
+ * will be repeated in all next iterations. For other two modes test expects that
+ * randomly generated numbers differ from original.
+ */
+public class RandomGeneratorTest {
+    private static final String SEED_VM_OPTION = "-D" + Utils.SEED_PROPERTY_NAME + "=";
+
+    public static void main( String[] args) throws Throwable {
+        if (args.length == 0) {
+            throw new Error("TESTBUG: No test mode provided.");
+        }
+        SeedOption seedOpt = SeedOption.valueOf(args[0]);
+        List<String> jvmArgs = new ArrayList<String>();
+        String optStr = seedOpt.getSeedOption();
+        if (optStr != null) {
+            jvmArgs.add(optStr);
+        }
+        jvmArgs.add(RandomRunner.class.getName());
+        String origFileName = seedOpt.name() + "_orig";
+        jvmArgs.add(origFileName);
+        int fileNameIndex = jvmArgs.size() - 1;
+        String[] cmdLineArgs = jvmArgs.toArray(new String[jvmArgs.size()]);
+        ProcessTools.executeTestJvm(cmdLineArgs).shouldHaveExitValue(0);
+        String etalon = Utils.fileAsString(origFileName).trim();
+        cmdLineArgs[fileNameIndex] = seedOpt.name();
+        seedOpt.verify(etalon, cmdLineArgs);
+    }
+
+    /**
+     * The utility enum helps to generate an appropriate string that should be passed
+     * to the command line depends on the testing mode. It is also responsible for the result
+     * validation.
+     */
+    private enum SeedOption {
+        SAME_SEED {
+            @Override
+            public String getSeedOption() {
+                return SEED_VM_OPTION + Utils.SEED;
+            }
+
+            @Override
+            protected boolean isOutputExpected(String orig, String output) {
+                return output.equals(orig);
+            }
+        },
+        DIFFERENT_SEED {
+            @Override
+            public String getSeedOption() {
+                return SEED_VM_OPTION + Utils.getRandomInstance().nextLong();
+            }
+
+            @Override
+            public void verify(String orig, String[] cmdLine) {
+                cmdLine[0] = getSeedOption();
+                super.verify(orig, cmdLine);
+            }
+        },
+        NO_SEED {
+            @Override
+            public String getSeedOption() {
+                return null;
+            }
+        };
+
+        /**
+         * Generates a string to be added as a command line argument.
+         * It contains "-D" prefix, system property name, '=' sign
+         * and seed value.
+         * @return command line argument
+         */
+        public abstract String getSeedOption();
+
+        protected boolean isOutputExpected(String orig, String output) {
+            return !output.equals(orig);
+        }
+
+        /**
+         * Verifies that the original output meets expectations
+         * depending on the test mode. It compares the output of second execution
+         * to original one.
+         * @param orig original output
+         * @param cmdLine command line arguments
+         * @throws Throwable - Throws an exception in case test failure.
+         */
+        public void verify(String orig, String[] cmdLine) {
+            String output;
+            OutputAnalyzer oa;
+            try {
+                oa = ProcessTools.executeTestJvm(cmdLine);
+            } catch (Throwable t) {
+                throw new Error("TESTBUG: Unexpedted exception during jvm execution.", t);
+            }
+            oa.shouldHaveExitValue(0);
+            try {
+                output = Utils.fileAsString(name()).trim();
+            } catch (IOException ioe) {
+                throw new Error("TESTBUG: Problem during IO operation with file: " + name(), ioe);
+            }
+            if (!isOutputExpected(orig, output)) {
+                System.err.println("Initial output: " + orig);
+                System.err.println("Second run output: " + output);
+                throw new AssertionError("Unexpected random number sequence for mode: " + this.name());
+            }
+        }
+    }
+
+    /**
+     * The helper class generates several random numbers
+     * and put results to a file. The file name came as first
+     * command line argument.
+     */
+    public static class RandomRunner {
+        private static final int COUNT = 10;
+        public static void main(String[] args) {
+            StringBuilder sb = new StringBuilder();
+            Random rng = Utils.getRandomInstance();
+            for (int i = 0; i < COUNT; i++) {
+                sb.append(rng.nextLong()).append(' ');
+            }
+            try (PrintWriter pw = new PrintWriter(new FileWriter(args[0]))) {
+                pw.write(sb.toString());
+            } catch (IOException ioe) {
+                throw new Error("TESTBUG: Problem during IO operation with file: " + args[0], ioe);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/jdk/test/lib/TestMutuallyExclusivePlatformPredicates.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,140 @@
+/*
+ * 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
+ * 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.
+ */
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Platform;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @test
+ * @summary Verify that for each group of mutually exclusive predicates defined
+ *          in jdk.test.lib.Platform one and only one predicate
+ *          evaluates to true.
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @run main TestMutuallyExclusivePlatformPredicates
+ */
+public class TestMutuallyExclusivePlatformPredicates {
+    private static enum MethodGroup {
+        ARCH("isAArch64", "isARM", "isPPC", "isS390x", "isX64", "isX86"),
+        BITNESS("is32bit", "is64bit"),
+        OS("isAix", "isLinux", "isOSX", "isWindows"),
+        VM_TYPE("isClient", "isServer", "isMinimal", "isZero", "isEmbedded"),
+        MODE("isInt", "isMixed", "isComp"),
+        IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild",
+                "isSlowDebugBuild", "hasSA", "isRoot", "isTieredSupported",
+                "areCustomLoadersSupportedForCDS", "isDefaultCDSArchiveSupported",
+                "isSignedOSX");
+
+        public final List<String> methodNames;
+
+        private MethodGroup(String... methodNames) {
+            this.methodNames = Collections.unmodifiableList(
+                    Arrays.asList(methodNames));
+        }
+    }
+
+    public static void main(String args[]) {
+        EnumSet<MethodGroup> notIgnoredMethodGroups
+                = EnumSet.complementOf(EnumSet.of(MethodGroup.IGNORED));
+
+        notIgnoredMethodGroups.forEach(
+                TestMutuallyExclusivePlatformPredicates::verifyPredicates);
+
+        TestMutuallyExclusivePlatformPredicates.verifyCoverage();
+    }
+
+    /**
+     * Verifies that one and only one predicate method defined in
+     * {@link jdk.test.lib.Platform}, whose name included into
+     * methodGroup will return {@code true}.
+     * @param methodGroup The group of methods that should be tested.
+     */
+    private static void verifyPredicates(MethodGroup methodGroup) {
+        System.out.println("Verifying method group: " + methodGroup.name());
+        long truePredicatesCount = methodGroup.methodNames.stream()
+                .filter(TestMutuallyExclusivePlatformPredicates
+                        ::evaluatePredicate)
+                .count();
+
+        Asserts.assertEQ(truePredicatesCount, 1L, String.format(
+                "Only one predicate from group %s should be evaluated to true "
+                        + "(Actually %d predicates were evaluated to true).",
+                methodGroup.name(), truePredicatesCount));
+    }
+
+    /**
+     * Verifies that all predicates defined in
+     * {@link jdk.test.lib.Platform} were either tested or
+     * explicitly ignored.
+     */
+    private static void verifyCoverage() {
+        Set<String> allMethods = new HashSet<>();
+        for (MethodGroup group : MethodGroup.values()) {
+            allMethods.addAll(group.methodNames);
+        }
+
+        for (Method m : Platform.class.getMethods()) {
+            if (m.getParameterCount() == 0
+                    && m.getReturnType() == boolean.class) {
+                Asserts.assertTrue(allMethods.contains(m.getName()),
+                        "All Platform's methods with signature '():Z' should "
+                                + "be tested. Missing: " + m.getName());
+            }
+        }
+    }
+
+    /**
+     * Evaluates predicate method with name {@code name} defined in
+     * {@link jdk.test.lib.Platform}.
+     *
+     * @param name The name of a predicate to be evaluated.
+     * @return evaluated predicate's value.
+     * @throws java.lang.Error if predicate is not defined or could not be
+     *                         evaluated.
+     */
+    private static boolean evaluatePredicate(String name) {
+        try {
+            System.out.printf("Trying to evaluate predicate with name %s%n",
+                    name);
+            boolean value
+                    = (Boolean) Platform.class.getMethod(name).invoke(null);
+            System.out.printf("Predicate evaluated to: %s%n", value);
+            return value;
+        } catch (NoSuchMethodException e) {
+            throw new Error("Predicate with name " + name
+                    + " is not defined in " + Platform.class.getName(), e);
+        } catch (IllegalAccessException | InvocationTargetException e) {
+            throw new Error("Unable to evaluate predicate " + name, e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/jdk/test/lib/TestPlatformIsTieredSupported.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,50 @@
+/*
+ * 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
+ * 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.
+ */
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Platform;
+import sun.hotspot.WhiteBox;
+
+/**
+ * @test
+ * @summary Verifies that Platform::isTieredSupported returns correct value.
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:+TieredCompilation
+ *                   TestPlatformIsTieredSupported
+ */
+public class TestPlatformIsTieredSupported {
+    public static void main(String args[]) {
+        WhiteBox whiteBox = WhiteBox.getWhiteBox();
+        boolean tieredCompilation = whiteBox.getBooleanVMFlag(
+                "TieredCompilation");
+        Asserts.assertEQ(Platform.isTieredSupported(), tieredCompilation,
+                "Platform::isTieredSupported should report the same value as "
+                        + "TieredCompilation flag's value when "
+                        + "+TieredCompilation was explicitly passed to JVM.");
+    }
+}
--- a/test/lib-test/jdk/test/lib/apps/LingeredAppTest.java	Tue Jun 16 08:03:40 2020 -0700
+++ b/test/lib-test/jdk/test/lib/apps/LingeredAppTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -24,9 +24,9 @@
 /*
  * @test
  * @summary Unit test for LingeredApp
- * @compile LingeredAppTest.java
- * @compile LingeredApp.java
- * @run main LingeredAppTest
+ * @library /test/lib
+ * @build jdk.test.lib.apps.LingeredAppTest jdk.test.lib.apps.LingeredApp
+ * @run main jdk.test.lib.apps.LingeredAppTest
  */
 
 package jdk.test.lib.apps;
@@ -52,13 +52,13 @@
 
             cmd.add("-XX:+PrintFlagsFinal");
 
-            LingeredApp a = LingeredApp.startApp(cmd.toArray(new String[cmd.length]);
+            LingeredApp a = LingeredApp.startApp(cmd.toArray(new String[cmd.size()]));
             System.out.printf("App pid: %d\n", a.getPid());
             a.stopApp();
 
             System.out.println("App output:");
             int count = 0;
-            for (String line : a.getAppOutput()) {
+            for (String line : a.getOutput().getStdoutAsList()) {
                 count += 1;
             }
             System.out.println("Found " + count + " lines in VM output");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/jdk/test/lib/process/OutputAnalyzerReportingTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,123 @@
+/*
+ * 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
+ * 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
+ * @summary Test the OutputAnalyzer reporting functionality,
+ *     such as printing additional diagnostic info
+ *     (exit code, stdout, stderr, command line, etc.)
+ * @modules java.management
+ * @library /test/lib
+ * @run main OutputAnalyzerReportingTest
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+public class OutputAnalyzerReportingTest {
+
+    public static void main(String[] args) throws Exception {
+        // Create the output analyzer under test
+        String stdout = "aaaaaa";
+        String stderr = "bbbbbb";
+        OutputAnalyzer output = new OutputAnalyzer(stdout, stderr);
+
+        // Expected summary values should be the same for all cases,
+        // since the outputAnalyzer object is the same
+        String expectedExitValue = "-1";
+        String expectedSummary =
+                " stdout: [" + stdout + "];\n" +
+                " stderr: [" + stderr + "]\n" +
+                " exitValue = " + expectedExitValue + "\n";
+
+
+        DiagnosticSummaryTestRunner testRunner =
+                new DiagnosticSummaryTestRunner();
+
+        // should have exit value
+        testRunner.init(expectedSummary);
+        int unexpectedExitValue = 2;
+        try {
+            output.shouldHaveExitValue(unexpectedExitValue);
+        } catch (RuntimeException e) { }
+        testRunner.closeAndCheckResults();
+
+        // should not contain
+        testRunner.init(expectedSummary);
+        try {
+            output.shouldNotContain(stdout);
+        } catch (RuntimeException e) { }
+        testRunner.closeAndCheckResults();
+
+        // should contain
+        testRunner.init(expectedSummary);
+        try {
+            output.shouldContain("unexpected-stuff");
+        } catch (RuntimeException e) { }
+        testRunner.closeAndCheckResults();
+
+        // should not match
+        testRunner.init(expectedSummary);
+        try {
+            output.shouldNotMatch("[a]");
+        } catch (RuntimeException e) { }
+        testRunner.closeAndCheckResults();
+
+        // should match
+        testRunner.init(expectedSummary);
+        try {
+            output.shouldMatch("[qwerty]");
+        } catch (RuntimeException e) { }
+        testRunner.closeAndCheckResults();
+
+    }
+
+    private static class DiagnosticSummaryTestRunner {
+        private ByteArrayOutputStream byteStream =
+                new ByteArrayOutputStream(10000);
+
+        private String expectedSummary = "";
+        private PrintStream errStream;
+
+
+        public void init(String expectedSummary) {
+            this.expectedSummary = expectedSummary;
+            byteStream.reset();
+            errStream = new PrintStream(byteStream);
+            System.setErr(errStream);
+        }
+
+        public void closeAndCheckResults() {
+            // check results
+            errStream.close();
+            String stdErrStr = byteStream.toString();
+            if (!stdErrStr.contains(expectedSummary)) {
+                throw new RuntimeException("The output does not contain "
+                    + "the diagnostic message, or the message is incorrect");
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/jdk/test/lib/process/OutputAnalyzerTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2013, 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
+ * @summary Test the OutputAnalyzer utility class
+ * @modules java.management
+ * @library /test/lib
+ * @run main OutputAnalyzerTest
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+
+public class OutputAnalyzerTest {
+
+    public static void main(String args[]) throws Exception {
+
+        String stdout = "aaaaaa";
+        String stderr = "bbbbbb";
+        String nonExistingString = "cccc";
+
+        OutputAnalyzer output = new OutputAnalyzer(stdout, stderr);
+
+        if (!stdout.equals(output.getStdout())) {
+            throw new Exception("getStdout() returned '" + output.getStdout()
+                    + "', expected '" + stdout + "'");
+        }
+
+        if (!stderr.equals(output.getStderr())) {
+            throw new Exception("getStderr() returned '" + output.getStderr()
+                    + "', expected '" + stderr + "'");
+        }
+
+        try {
+            output.shouldContain(stdout);
+            output.stdoutShouldContain(stdout);
+            output.shouldContain(stderr);
+            output.stderrShouldContain(stderr);
+        } catch (RuntimeException e) {
+            throw new Exception("shouldContain() failed", e);
+        }
+
+        try {
+            output.shouldContain(nonExistingString);
+            throw new Exception("shouldContain() failed to throw exception");
+        } catch (RuntimeException e) {
+            // expected
+        }
+
+        try {
+            output.stdoutShouldContain(stderr);
+            throw new Exception(
+                    "stdoutShouldContain() failed to throw exception");
+        } catch (RuntimeException e) {
+            // expected
+        }
+
+        try {
+            output.stderrShouldContain(stdout);
+            throw new Exception(
+                    "stdoutShouldContain() failed to throw exception");
+        } catch (RuntimeException e) {
+            // expected
+        }
+
+        try {
+            output.shouldNotContain(nonExistingString);
+            output.stdoutShouldNotContain(nonExistingString);
+            output.stderrShouldNotContain(nonExistingString);
+        } catch (RuntimeException e) {
+            throw new Exception("shouldNotContain() failed", e);
+        }
+
+        try {
+            output.shouldNotContain(stdout);
+            throw new Exception("shouldContain() failed to throw exception");
+        } catch (RuntimeException e) {
+            // expected
+        }
+
+        try {
+            output.stdoutShouldNotContain(stdout);
+            throw new Exception("shouldContain() failed to throw exception");
+        } catch (RuntimeException e) {
+            // expected
+        }
+
+        try {
+            output.stderrShouldNotContain(stderr);
+            throw new Exception("shouldContain() failed to throw exception");
+        } catch (RuntimeException e) {
+            // expected
+        }
+
+        String stdoutPattern = "[a]";
+        String stdoutByLinePattern = "a*";
+        String stderrPattern = "[b]";
+        String nonExistingPattern = "[c]";
+        String byLinePattern = "[ab]*";
+
+        // Should match
+        try {
+            output.shouldMatch(stdoutPattern);
+            output.stdoutShouldMatch(stdoutPattern);
+            output.shouldMatch(stderrPattern);
+            output.stderrShouldMatch(stderrPattern);
+        } catch (RuntimeException e) {
+            throw new Exception("shouldMatch() failed", e);
+        }
+
+        try {
+            output.shouldMatch(nonExistingPattern);
+            throw new Exception("shouldMatch() failed to throw exception");
+        } catch (RuntimeException e) {
+            // expected
+        }
+
+        try {
+            output.stdoutShouldMatch(stderrPattern);
+            throw new Exception(
+                    "stdoutShouldMatch() failed to throw exception");
+        } catch (RuntimeException e) {
+            // expected
+        }
+
+        try {
+            output.stderrShouldMatch(stdoutPattern);
+            throw new Exception(
+                    "stderrShouldMatch() failed to throw exception");
+        } catch (RuntimeException e) {
+            // expected
+        }
+
+        try {
+            output.shouldMatchByLine(byLinePattern);
+        } catch (RuntimeException e) {
+            throw new Exception("shouldMatchByLine() failed", e);
+        }
+
+        try {
+            output.shouldMatchByLine(nonExistingPattern);
+            throw new Exception("shouldMatchByLine() failed to throw exception");
+        } catch (RuntimeException e) {
+            // expected
+        }
+
+        try {
+            output.stdoutShouldMatchByLine(stdoutByLinePattern);
+        } catch (RuntimeException e) {
+            throw new Exception("stdoutShouldMatchByLine() failed", e);
+        }
+
+        // Should not match
+        try {
+            output.shouldNotMatch(nonExistingPattern);
+            output.stdoutShouldNotMatch(nonExistingPattern);
+            output.stderrShouldNotMatch(nonExistingPattern);
+        } catch (RuntimeException e) {
+            throw new Exception("shouldNotMatch() failed", e);
+        }
+
+        try {
+            output.shouldNotMatch(stdoutPattern);
+            throw new Exception("shouldNotMatch() failed to throw exception");
+        } catch (RuntimeException e) {
+            // expected
+        }
+
+        try {
+            output.stdoutShouldNotMatch(stdoutPattern);
+            throw new Exception("shouldNotMatch() failed to throw exception");
+        } catch (RuntimeException e) {
+            // expected
+        }
+
+        try {
+            output.stderrShouldNotMatch(stderrPattern);
+            throw new Exception("shouldNotMatch() failed to throw exception");
+        } catch (RuntimeException e) {
+            // expected
+        }
+
+        {
+            String aaaa = "aaaa";
+            String result = output.firstMatch(aaaa);
+            if (!aaaa.equals(result)) {
+                throw new Exception("firstMatch(String) failed to match. Expected: " + aaaa + " got: " + result);
+            }
+        }
+
+        {
+            String aa = "aa";
+            String aa_grouped_aa = aa + "(" + aa + ")";
+            String result = output.firstMatch(aa_grouped_aa, 1);
+            if (!aa.equals(result)) {
+                throw new Exception("firstMatch(String, int) failed to match. Expected: " + aa + " got: " + result);
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/jdk/test/lib/process/TestNativeProcessBuilder.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,50 @@
+/*
+ * 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
+ * @summary Test the native process builder API.
+ * @library /test/lib
+ * @run main/native TestNativeProcessBuilder
+ */
+
+
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+public class TestNativeProcessBuilder {
+    public static void main(String args[]) throws Exception {
+        ProcessBuilder pb = ProcessTools.createNativeTestProcessBuilder("jvm-test-launcher");
+        pb.environment().put("CLASSPATH", Utils.TEST_CLASS_PATH);
+        new OutputAnalyzer(pb.start())
+            .shouldHaveExitValue(0)
+            .stdoutShouldContain("Hello Test");
+    }
+
+    public static class Test {
+        public static void test() {
+            System.out.println("Hello Test");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/jdk/test/lib/process/exejvm-test-launcher.c	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+#include <jni.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+JNIEnv* create_vm(JavaVM **jvm)
+{
+    JNIEnv* env;
+    JavaVMInitArgs args;
+    JavaVMOption options[1];
+
+    char classpath[4096];
+    snprintf(classpath, sizeof classpath,
+             "-Djava.class.path=%s", getenv("CLASSPATH"));
+    options[0].optionString = classpath;
+
+    args.version = JNI_VERSION_1_8;
+    args.nOptions = 1;
+    args.options = &options[0];
+    args.ignoreUnrecognized = 0;
+
+    int ret = JNI_CreateJavaVM(jvm, (void**)&env, &args);
+    if (ret < 0) {
+      exit(10);
+    }
+
+    return env;
+}
+
+
+void run(JNIEnv *env) {
+  jclass test_class;
+  jmethodID test_method;
+
+  test_class = (*env)->FindClass(env, "TestNativeProcessBuilder$Test");
+  if (test_class == NULL) {
+    exit(11);
+  }
+
+  test_method = (*env)->GetStaticMethodID(env, test_class, "test", "()V");
+  if (test_method == NULL) {
+    exit(12);
+  }
+
+  (*env)->CallStaticVoidMethod(env, test_class, test_method);
+}
+
+
+int main(int argc, char **argv)
+{
+  JavaVM *jvm;
+  JNIEnv *env = create_vm(&jvm);
+
+  run(env);
+
+  return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/sun/hotspot/whitebox/BlobSanityTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,60 @@
+/*
+ * 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
+ * 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 BlobSanityTest
+ * @bug 8132980
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @modules java.management/sun.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI BlobSanityTest
+ * @summary sanity testing of allocateCodeBlob, freeCodeBlob and getCodeBlob
+ */
+
+
+import sun.hotspot.WhiteBox;
+
+import java.util.function.Consumer;
+import jdk.test.lib.Utils;
+
+public class BlobSanityTest {
+
+    private static void runTest(Consumer<Integer> consumer, int val, String testCaseName, Class<? extends Throwable>
+            expectedException) {
+            System.out.println("Calling " + testCaseName);
+            Utils.runAndCheckException(() -> consumer.accept(val), expectedException);
+            System.out.println("Looks ok");
+    }
+
+    public static void main(String[] args) throws Exception {
+        System.out.println("Crash means that sanity check failed");
+
+        WhiteBox wb = WhiteBox.getWhiteBox();
+
+        runTest(wb::freeCodeBlob, 0, "wb::freeCodeBlob(0)", null);
+        runTest(wb::getCodeBlob, 0, "wb::getCodeBlob(0)", NullPointerException.class);
+        runTest(x -> wb.allocateCodeBlob(x, 0), -1, "wb::allocateCodeBlob(-1,0)", IllegalArgumentException.class);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/sun/hotspot/whitebox/CPUInfoTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,83 @@
+/*
+ * 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
+ * @library /test/lib /
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   CPUInfoTest
+ */
+
+import java.util.Set;
+import java.util.List;
+import jdk.test.lib.Platform;
+import sun.hotspot.WhiteBox;
+import sun.hotspot.cpuinfo.CPUInfo;
+
+import static jdk.test.lib.Asserts.*;
+
+public class CPUInfoTest {
+    static final WhiteBox WB = WhiteBox.getWhiteBox();
+
+    private static final Set<String> wellKnownCPUFeatures;
+
+    static {
+        if (Platform.isX86() || Platform.isX64()) {
+            wellKnownCPUFeatures = Set.of(
+                    "adx", "aes", "bmi1", "bmi2", "cmov", "cx8", "fxsr", "mmx", "clmul", "clflush", "clflushopt", "clwb",
+                    "sha", "fma", "popcnt", "vzeroupper", "erms", "rtm", "mmxext", "3dnowpref", "lzcnt", "ht",
+                    "tsc", "tscinvbit", "tscinv", "sse", "sse2", "sse3", "ssse3", "sse4.1", "sse4.2", "sse4a", "avx", "avx2",
+                    "avx512f", "avx512dq", "avx512pf", "avx512er", "avx512cd", "avx512bw", "avx512vl",
+                    "avx512_vpopcntdq", "avx512_vpclmulqdq", "avx512_vbmi2", "avx512_vaes", "avx512_vnni");
+        } else {
+            wellKnownCPUFeatures = null;
+        }
+    }
+
+    public static void main(String args[]) throws Throwable {
+        System.out.println("WB.getCPUFeatures(): \"" + WB.getCPUFeatures() + "\"");
+
+        String additionalCpuInfo = CPUInfo.getAdditionalCPUInfo();
+        assertTrue(additionalCpuInfo != null);
+        System.out.println("CPUInfo.getAdditionalCPUInfo(): \"" + additionalCpuInfo + "\"");
+
+        List<String> features = CPUInfo.getFeatures();
+        assertTrue(features != null);
+        System.out.println("CPUInfo.getFeatures(): " + features);
+
+        for (String feature : features) {
+            assertTrue(CPUInfo.hasFeature(feature), feature);
+        }
+
+        if (wellKnownCPUFeatures != null) {
+            System.out.println("Well-known CPU features: " + wellKnownCPUFeatures);
+            assertTrue(wellKnownCPUFeatures.containsAll(features), "not all features are known");
+        }
+
+        System.out.println("TEST PASSED");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/sun/hotspot/whitebox/vm_flags/BooleanTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,94 @@
+/*
+ * 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
+ * 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 BooleanTest
+ * @bug 8028756
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.compiler
+ *          java.management/sun.management
+ *          jdk.internal.jvmstat/sun.jvmstat.monitor
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI BooleanTest
+ * @summary testing of WB::set/getBooleanVMFlag()
+ * @author igor.ignatyev@oracle.com
+ */
+
+import sun.hotspot.WhiteBox;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import sun.management.*;
+import com.sun.management.*;
+
+public class BooleanTest {
+    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+    private static final Boolean[] TESTS = {true, false, true, true, false};
+    private static final String TEST_NAME = "BooleanTest";
+    private static final String FLAG_NAME = "PrintCompilation";
+    private static final String FLAG_DEBUG_NAME = "SafepointALot";
+    private static final String METHOD = TEST_NAME + "::method";
+    private static final String METHOD1 = METHOD + "1";
+    private static final String METHOD2 = METHOD + "2";
+
+    public static void main(String[] args) throws Exception {
+        if (args.length == 0) {
+            VmFlagTest.runTest(FLAG_NAME, TESTS,
+                VmFlagTest.WHITE_BOX::setBooleanVMFlag,
+                VmFlagTest.WHITE_BOX::getBooleanVMFlag);
+            testFunctional(false);
+            testFunctional(true);
+            VmFlagTest.runTest(FLAG_DEBUG_NAME, VmFlagTest.WHITE_BOX::getBooleanVMFlag);
+        } else {
+            boolean value = Boolean.valueOf(args[0]);
+            method1();
+            VmFlagTest.WHITE_BOX.setBooleanVMFlag(FLAG_NAME, value);
+            method2();
+        }
+    }
+
+    private static void testFunctional(boolean value) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-Xbootclasspath/a:.",
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:+WhiteBoxAPI",
+            "-Xcomp",
+            "-XX:CompileCommand=compileonly," + METHOD + "*",
+            "-XX:" + (value ? "-" : "+") + FLAG_NAME,
+            TEST_NAME,
+            "" + value);
+        OutputAnalyzer out = new OutputAnalyzer(pb.start());
+        if (value) {
+            out.shouldNotContain(METHOD1);
+            out.shouldContain(METHOD2);
+        } else {
+            out.shouldContain(METHOD1);
+            out.shouldNotContain(METHOD2);
+        }
+    }
+
+    private static void method1() { }
+    private static void method2() { }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/sun/hotspot/whitebox/vm_flags/DoubleTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,47 @@
+/*
+ * 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
+ * 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 DoubleTest
+ * @bug 8028756
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @modules java.management/sun.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DoubleTest
+ * @summary testing of WB::set/getDoubleVMFlag()
+ * @author igor.ignatyev@oracle.com
+ */
+
+public class DoubleTest {
+    private static final String FLAG_NAME = "CompileThresholdScaling";
+    private static final Double[] TESTS = {0d, -0d, 1d, Double.MAX_VALUE};
+
+    public static void main(String[] args) throws Exception {
+        VmFlagTest.runTest(FLAG_NAME, TESTS,
+            VmFlagTest.WHITE_BOX::setDoubleVMFlag,
+            VmFlagTest.WHITE_BOX::getDoubleVMFlag);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/sun/hotspot/whitebox/vm_flags/IntxTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,60 @@
+/*
+ * 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
+ * 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 IntxTest
+ * @bug 8038756
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @modules java.management/sun.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xint -XX:-ProfileInterpreter IntxTest
+ * @summary testing of WB::set/getIntxVMFlag()
+ * @author igor.ignatyev@oracle.com
+ */
+import jdk.test.lib.Platform;
+public class IntxTest {
+    private static final String FLAG_NAME = "OnStackReplacePercentage";
+    private static final String FLAG_DEBUG_NAME = "InlineFrequencyCount";
+    private static final long COMPILE_THRESHOLD = VmFlagTest.WHITE_BOX.getIntxVMFlag("CompileThreshold");
+    private static final Long[] TESTS = {0L, 100L, (long)(Integer.MAX_VALUE>>3)*100L};
+
+    public static void main(String[] args) throws Exception {
+        find_and_set_max_osrp();
+        VmFlagTest.runTest(FLAG_NAME, TESTS,
+            VmFlagTest.WHITE_BOX::setIntxVMFlag,
+            VmFlagTest.WHITE_BOX::getIntxVMFlag);
+        VmFlagTest.runTest(FLAG_DEBUG_NAME, VmFlagTest.WHITE_BOX::getIntxVMFlag);
+    }
+
+    static void find_and_set_max_osrp() {
+        long max_percentage_limit = (long)(Integer.MAX_VALUE>>3)*100L;
+        max_percentage_limit = COMPILE_THRESHOLD == 0  ? max_percentage_limit : max_percentage_limit/COMPILE_THRESHOLD;
+        if (Platform.is32bit() && max_percentage_limit > Integer.MAX_VALUE) {
+          max_percentage_limit = Integer.MAX_VALUE;
+        }
+        TESTS[2] = max_percentage_limit;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/sun/hotspot/whitebox/vm_flags/SizeTTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,51 @@
+/*
+ * 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
+ * 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 SizeTTest
+ * @bug 8054823
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management/sun.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions SizeTTest
+ * @summary testing of WB::set/getSizeTVMFlag()
+ */
+import jdk.test.lib.Platform;
+
+public class SizeTTest {
+    private static final String FLAG_NAME = "ArrayAllocatorMallocLimit";
+    private static final Long[] TESTS = {0L, 100L, (long) Integer.MAX_VALUE,
+        (1L << 32L) - 1L, 1L << 32L};
+    private static final Long[] EXPECTED_64 = TESTS;
+    private static final Long[] EXPECTED_32 = {0L, 100L,
+        (long) Integer.MAX_VALUE, (1L << 32L) - 1L, 0L};
+
+    public static void main(String[] args) throws Exception {
+        VmFlagTest.runTest(FLAG_NAME, TESTS,
+            Platform.is64bit() ? EXPECTED_64 : EXPECTED_32,
+            VmFlagTest.WHITE_BOX::setSizeTVMFlag,
+            VmFlagTest.WHITE_BOX::getSizeTVMFlag);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/sun/hotspot/whitebox/vm_flags/StringTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,49 @@
+/*
+ * 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
+ * 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 StringTest
+ * @bug 8028756
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @modules java.management/sun.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI StringTest
+ * @summary testing of WB::set/getStringVMFlag()
+ * @author igor.ignatyev@oracle.com
+ */
+
+public class StringTest {
+    private static final String FLAG_NAME = "CompileOnly";
+    private static final String FLAG_DEBUG_NAME = "SuppressErrorAt";
+    private static final String[] TESTS = {"StringTest::*", ""};
+
+    public static void main(String[] args) throws Exception {
+        VmFlagTest.runTest(FLAG_NAME, TESTS,
+            VmFlagTest.WHITE_BOX::setStringVMFlag,
+            VmFlagTest.WHITE_BOX::getStringVMFlag);
+        VmFlagTest.runTest(FLAG_DEBUG_NAME, VmFlagTest.WHITE_BOX::getStringVMFlag);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/sun/hotspot/whitebox/vm_flags/Uint64Test.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,48 @@
+/*
+ * 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
+ * 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 Uint64Test
+ * @bug 8028756
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @modules java.management/sun.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI Uint64Test
+ * @summary testing of WB::set/getUint64VMFlag()
+ * @author igor.ignatyev@oracle.com
+ */
+
+public class Uint64Test {
+    private static final String FLAG_NAME = "MaxRAM";
+    private static final Long[] TESTS = {0L, 100L, (long) Integer.MAX_VALUE,
+            -1L, Long.MAX_VALUE, Long.MIN_VALUE};
+
+    public static void main(String[] args) throws Exception {
+        VmFlagTest.runTest(FLAG_NAME, TESTS,
+            VmFlagTest.WHITE_BOX::setUint64VMFlag,
+            VmFlagTest.WHITE_BOX::getUint64VMFlag);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/sun/hotspot/whitebox/vm_flags/UintxTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,55 @@
+/*
+ * 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
+ * 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 UintxTest
+ * @bug 8028756
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management/sun.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI UintxTest
+ * @summary testing of WB::set/getUintxVMFlag()
+ * @author igor.ignatyev@oracle.com
+ */
+import jdk.test.lib.Platform;
+
+public class UintxTest {
+    private static final String FLAG_NAME = "VerifyGCStartAt";
+    private static final String FLAG_DEBUG_NAME = "CodeCacheMinimumUseSpace";
+    private static final Long[] TESTS = {0L, 100L, (long) Integer.MAX_VALUE,
+        (1L << 32L) - 1L, 1L << 32L};
+    private static final Long[] EXPECTED_64 = TESTS;
+    private static final Long[] EXPECTED_32 = {0L, 100L,
+        (long) Integer.MAX_VALUE, (1L << 32L) - 1L, 0L};
+
+    public static void main(String[] args) throws Exception {
+        VmFlagTest.runTest(FLAG_NAME, TESTS,
+            Platform.is64bit() ? EXPECTED_64 : EXPECTED_32,
+            VmFlagTest.WHITE_BOX::setUintxVMFlag,
+            VmFlagTest.WHITE_BOX::getUintxVMFlag);
+        VmFlagTest.runTest(FLAG_DEBUG_NAME, VmFlagTest.WHITE_BOX::getUintxVMFlag);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib-test/sun/hotspot/whitebox/vm_flags/VmFlagTest.java	Tue Jun 16 09:50:45 2020 -0700
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2014, 2016, 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.
+ */
+
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import sun.hotspot.WhiteBox;
+import sun.management.*;
+import com.sun.management.*;
+import jdk.test.lib.Asserts;
+import java.lang.management.ManagementFactory;
+
+public final class VmFlagTest<T> {
+    public static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+
+    private static final String NONEXISTENT_FLAG = "NonexistentFlag";
+    private final String flagName;
+    private final BiConsumer<T, T> test;
+    private final BiConsumer<String, T> set;
+    private final Function<String, T> get;
+    private final boolean isPositive;
+
+    protected VmFlagTest(String flagName, BiConsumer<String, T> set,
+            Function<String, T> get, boolean isPositive) {
+        this.flagName = flagName;
+        this.set = set;
+        this.get = get;
+        this.isPositive = isPositive;
+        if (isPositive) {
+            test = this::testWritePositive;
+        } else {
+            test = this::testWriteNegative;
+        }
+    }
+
+    private void setNewValue(T value) {
+        set.accept(flagName, value);
+    }
+
+    private T getValue() {
+        return get.apply(flagName);
+    }
+
+    protected static <T> void runTest(String existentFlag, T[] tests,
+            BiConsumer<String, T> set, Function<String, T> get) {
+        runTest(existentFlag, tests, tests, set, get);
+    }
+
+    protected static <T> void runTest(String existentFlag, Function<String, T> get) {
+        runTest(existentFlag, null, null, null, get);
+    }
+
+    protected static <T> void runTest(String existentFlag, T[] tests,
+            T[] results, BiConsumer<String, T> set, Function<String, T> get) {
+        if (existentFlag != null) {
+            new VmFlagTest(existentFlag, set, get, true).test(tests, results);
+        }
+        new VmFlagTest(NONEXISTENT_FLAG, set, get, false).test(tests, results);
+    }
+
+    public final void test(T[] tests, T[] results) {
+        if (isPositive) {
+            testRead();
+        }
+        if (tests != null) {
+            Asserts.assertEQ(tests.length, results.length, "[TESTBUG] tests.length != results.length");
+            for (int i = 0, n = tests.length ; i < n; ++i) {
+                test.accept(tests[i], results[i]);
+            }
+        }
+    }
+
+    protected String getVMOptionAsString() {
+        if (WHITE_BOX.isConstantVMFlag(flagName) || WHITE_BOX.isLockedVMFlag(flagName)) {
+          // JMM cannot access debug flags in product builds or locked flags,
+          // use whitebox methods to get such flags value.
+          return asString(getValue());
+        }
+        HotSpotDiagnosticMXBean diagnostic
+                = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
+        VMOption tmp;
+        try {
+            tmp = diagnostic.getVMOption(flagName);
+        } catch (IllegalArgumentException e) {
+            tmp = null;
+        }
+        return tmp == null ? null : tmp.getValue();
+    }
+
+    private String testRead() {
+        String value = getVMOptionAsString();
+        Asserts.assertNotNull(value);
+        Asserts.assertEQ(value, asString(getValue()));
+        Asserts.assertEQ(value, asString(WHITE_BOX.getVMFlag(flagName)));
+        return value;
+    }
+
+    private void testWritePositive(T value, T expected) {
+        setNewValue(value);
+        String newValue = testRead();
+        Asserts.assertEQ(newValue, asString(expected));
+    }
+
+    private void testWriteNegative(T value, T expected) {
+        // Should always return false for non-existing flags
+        Asserts.assertFalse(WHITE_BOX.isConstantVMFlag(flagName));
+        Asserts.assertFalse(WHITE_BOX.isLockedVMFlag(flagName));
+        String oldValue = getVMOptionAsString();
+        Asserts.assertEQ(oldValue, asString(getValue()));
+        Asserts.assertEQ(oldValue, asString(WHITE_BOX.getVMFlag(flagName)));
+        setNewValue(value);
+        String newValue = getVMOptionAsString();
+        Asserts.assertEQ(oldValue, newValue);
+    }
+
+    private String asString(Object value) {
+        return value == null ? null : "" + value;
+    }
+}