--- a/make/Main.gmk Thu Jun 28 16:45:15 2018 -0700
+++ b/make/Main.gmk Thu Jun 28 17:07:34 2018 -0700
@@ -487,6 +487,14 @@
+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNativeJdk.gmk \
test-image-jdk-jtreg-native)
+build-test-hotspot-jtreg-graal:
+ +($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregGraalUnit.gmk \
+ build-test-hotspot-jtreg-graal)
+
+test-image-hotspot-jtreg-graal:
+ +($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregGraalUnit.gmk \
+ test-image-hotspot-jtreg-graal)
+
run-test:
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$(TEST)")
@@ -523,6 +531,7 @@
test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \
test-failure-handler test-image-failure-handler test-image-hotspot-gtest \
+ test-image-hotspot-jtreg-graal build-test-hotspot-jtreg-graal \
run-test exploded-run-test
################################################################################
@@ -853,10 +862,14 @@
build-test-jdk-jtreg-native: buildtools-jdk java.base-libs
+ build-test-hotspot-jtreg-graal: exploded-image-optimize
+
test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
+ test-image-hotspot-jtreg-graal: build-test-hotspot-jtreg-graal
+
test-image-hotspot-gtest: hotspot
test-hotspot-internal: exploded-image
@@ -993,6 +1006,10 @@
# If not already set, set the JVM specific targets to build the test image
JVM_TEST_IMAGE_TARGETS ?= test-image-hotspot-jtreg-native test-image-hotspot-gtest
+ifeq ($(INCLUDE_GRAAL), true)
+ JVM_TEST_IMAGE_TARGETS += test-image-hotspot-jtreg-graal
+endif
+
# This target builds the test image
test-image: prepare-test-image \
test-image-jdk-jtreg-native test-image-failure-handler \
--- a/make/RunTests.gmk Thu Jun 28 16:45:15 2018 -0700
+++ b/make/RunTests.gmk Thu Jun 28 17:07:34 2018 -0700
@@ -535,6 +535,8 @@
$1_JTREG_BASIC_OPTIONS += -cpa:$$(JIB_JAR)
endif
+ $1_JTREG_BASIC_OPTIONS += -e:TEST_IMAGE_GRAAL_DIR=${TEST_IMAGE_DIR}/hotspot/jtreg/graal
+
ifneq ($$(JTREG_FAILURE_HANDLER_OPTIONS), )
$1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)"
endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/autoconf/lib-tests.m4 Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,57 @@
+#
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. 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.
+#
+
+###############################################################################
+#
+# Check for graalunit libs, needed for running graalunit tests.
+#
+AC_DEFUN_ONCE([LIB_TESTS_SETUP_GRAALUNIT],
+[
+ AC_ARG_WITH(graalunit-lib, [AS_HELP_STRING([--with-graalunit-lib],
+ [specify location of 3rd party libraries used by Graal unit tests])])
+
+ GRAALUNIT_LIB=
+ if test "x${with_graalunit_lib}" != x; then
+ AC_MSG_CHECKING([for graalunit libs])
+ if test "x${with_graalunit_lib}" = xno; then
+ AC_MSG_RESULT([disabled, graalunit tests can not be run])
+ elif test "x${with_graalunit_lib}" = xyes; then
+ AC_MSG_RESULT([not specified])
+ AC_MSG_ERROR([You must specify the path to 3rd party libraries used by Graal unit tests])
+ else
+ GRAALUNIT_LIB="${with_graalunit_lib}"
+ if test ! -d "${GRAALUNIT_LIB}"; then
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Could not find graalunit 3rd party libraries as specified. (${with_graalunit_lib})])
+ else
+ AC_MSG_RESULT([$GRAALUNIT_LIB])
+ fi
+ fi
+ fi
+
+ BASIC_FIXUP_PATH([GRAALUNIT_LIB])
+ AC_SUBST(GRAALUNIT_LIB)
+])
+
--- a/make/autoconf/libraries.m4 Thu Jun 28 16:45:15 2018 -0700
+++ b/make/autoconf/libraries.m4 Thu Jun 28 17:07:34 2018 -0700
@@ -32,6 +32,7 @@
m4_include([lib-std.m4])
m4_include([lib-x11.m4])
m4_include([lib-fontconfig.m4])
+m4_include([lib-tests.m4])
################################################################################
# Determine which libraries are needed for this configuration
@@ -101,6 +102,7 @@
LIB_SETUP_BUNDLED_LIBS
LIB_SETUP_MISC_LIBS
LIB_SETUP_SOLARIS_STLPORT
+ LIB_TESTS_SETUP_GRAALUNIT
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
GLOBAL_LIBS="-lc"
--- a/make/autoconf/spec.gmk.in Thu Jun 28 16:45:15 2018 -0700
+++ b/make/autoconf/spec.gmk.in Thu Jun 28 17:07:34 2018 -0700
@@ -347,6 +347,7 @@
LIBFFI_CFLAGS:=@LIBFFI_CFLAGS@
ENABLE_LIBFFI_BUNDLING:=@ENABLE_LIBFFI_BUNDLING@
LIBFFI_LIB_FILE:=@LIBFFI_LIB_FILE@
+GRAALUNIT_LIB := @GRAALUNIT_LIB@
PACKAGE_PATH=@PACKAGE_PATH@
--- a/make/conf/jib-profiles.js Thu Jun 28 16:45:15 2018 -0700
+++ b/make/conf/jib-profiles.js Thu Jun 28 17:07:34 2018 -0700
@@ -378,7 +378,7 @@
"linux-x64": {
target_os: "linux",
target_cpu: "x64",
- dependencies: ["devkit", "autoconf", "graphviz", "pandoc"],
+ dependencies: ["devkit", "autoconf", "graphviz", "pandoc", "graalunit_lib"],
configure_args: concat(common.configure_args_64bit,
"--enable-full-docs", "--with-zlib=system"),
default_make_targets: ["docs-bundles"],
@@ -396,7 +396,7 @@
"macosx-x64": {
target_os: "macosx",
target_cpu: "x64",
- dependencies: ["devkit", "autoconf"],
+ dependencies: ["devkit", "autoconf", "graalunit_lib"],
configure_args: concat(common.configure_args_64bit, "--with-zlib=system",
"--with-macosx-version-max=10.9.0"),
},
@@ -420,7 +420,7 @@
"windows-x64": {
target_os: "windows",
target_cpu: "x64",
- dependencies: ["devkit", "autoconf"],
+ dependencies: ["devkit", "autoconf", "graalunit_lib"],
configure_args: concat(common.configure_args_64bit),
},
@@ -972,6 +972,14 @@
configure_args: "",
},
+ graalunit_lib: {
+ organization: common.organization,
+ ext: "zip",
+ revision: "619_Apr_12_2018",
+ module: "graalunit-lib",
+ configure_args: "--with-graalunit-lib=" + input.get("graalunit_lib", "install_path"),
+ environment_name: "GRAALUNIT_LIB"
+ },
};
// Need to add a value for the Visual Studio tools variable to make
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/test/JtregGraalUnit.gmk Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,144 @@
+#
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. 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 Graal component of the JTReg tests for Hotspot.
+# 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 SetupJavaCompilers.gmk
+
+TARGETS_BUILD :=
+TARGETS_IMAGE :=
+TARGETS_EXTRA_LIB :=
+
+ifeq ($(INCLUDE_GRAAL), true)
+ ifneq ($(GRAALUNIT_LIB), )
+ SRC_DIR := $(TOPDIR)/src/jdk.internal.vm.compiler/share/classes
+ TEST_DIR := $(TOPDIR)/test/hotspot/jtreg/compiler/graalunit
+ COMPILE_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/test/graalunit
+ LIB_OUTPUTDIR := $(TEST_IMAGE_DIR)/hotspot/jtreg/graal
+
+ ### Copy 3rd party libs
+ $(eval $(call SetupCopyFiles, COPY_GRAALUNIT_LIBS, \
+ FILES := $(wildcard $(GRAALUNIT_LIB)/*.jar), \
+ DEST := $(LIB_OUTPUTDIR), \
+ ))
+
+ TARGETS_EXTRA_LIB += $(COPY_GRAALUNIT_LIBS)
+
+ ### Compile and build graalunit tests
+ $(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_TESTS, \
+ SETUP := GENERATE_USINGJDKBYTECODE, \
+ SRC := \
+ $(SRC_DIR)/jdk.internal.vm.compiler.collections.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.api.directives.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.api.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.asm.aarch64.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.asm.amd64.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.asm.sparc.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.asm.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.core.amd64.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.core.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.debug.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.graph.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.hotspot.amd64.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.hotspot.lir.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.hotspot.sparc.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.hotspot.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.lir.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.loop.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.nodes.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.options.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.phases.common.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.replacements.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.test/src \
+ $(SRC_DIR)/org.graalvm.util.test/src \
+ $(SRC_DIR)/org.graalvm.compiler.jtt/src \
+ $(SRC_DIR)/org.graalvm.compiler.lir.jtt/src \
+ , \
+ BIN := $(COMPILE_OUTPUTDIR)/jdk.vm.compiler.tests, \
+ JAR := $(COMPILE_OUTPUTDIR)/jdk.vm.compiler.tests.jar, \
+ CLASSPATH := \
+ $(JDK_OUTPUTDIR)/modules/jdk.internal.vm.compiler \
+ $(JDK_OUTPUTDIR)/modules/jdk.internal.vm.ci \
+ $(LIB_OUTPUTDIR)/junit-4.12.jar \
+ $(LIB_OUTPUTDIR)/asm-5.0.4.jar \
+ $(LIB_OUTPUTDIR)/asm-tree-5.0.4.jar \
+ $(LIB_OUTPUTDIR)/java-allocation-instrumenter.jar \
+ $(LIB_OUTPUTDIR)/hamcrest-core-1.3.jar \
+ , \
+ ADD_JAVAC_FLAGS := \
+ -Xlint:none -processorpath \
+ $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.replacements.verifier.jar \
+ --add-exports jdk.unsupported/sun.misc=ALL-UNNAMED \
+ , \
+ ))
+
+ TARGETS_BUILD += $(BUILD_VM_COMPILER_TESTS)
+
+
+ ### Compile and build mxtool
+ $(eval $(call SetupJavaCompilation, BUILD_MXTOOL, \
+ SETUP := GENERATE_USINGJDKBYTECODE, \
+ SRC := $(TEST_DIR)/com.oracle.mxtool.junit, \
+ BIN := $(COMPILE_OUTPUTDIR)/com.oracle.mxtool.junit, \
+ JAR := $(COMPILE_OUTPUTDIR)/com.oracle.mxtool.junit.jar, \
+ CLASSPATH := $(LIB_OUTPUTDIR)/junit-4.12.jar, \
+ ))
+
+ TARGETS_BUILD += $(BUILD_MXTOOL)
+
+
+ ################################################################################
+ # Targets for building test-image.
+ ################################################################################
+
+ # Copy to hotspot jtreg test image
+ $(eval $(call SetupCopyFiles, COPY_HOTSPOT_JTREG_GRAAL, \
+ SRC := $(COMPILE_OUTPUTDIR), \
+ DEST := $(LIB_OUTPUTDIR), \
+ FILES := jdk.vm.compiler.tests.jar com.oracle.mxtool.junit.jar, \
+ ))
+
+ TARGETS_IMAGE += $(COPY_HOTSPOT_JTREG_GRAAL)
+ else
+ $(ECHO) "Skip building of Graal unit tests because 3rd party libraries directory is not specified"
+ endif
+endif
+
+$(TARGETS_BUILD): $(TARGETS_EXTRA_LIB)
+build-test-hotspot-jtreg-graal: $(TARGETS_BUILD)
+test-image-hotspot-jtreg-graal: $(TARGETS_IMAGE)
+
+all: build-test-hotspot-jtreg-graal
+test-image: test-image-hotspot-jtreg-graal
+
+.PHONY: default all build-test-hotspot-jtreg-graal test-image-hotspot-jtreg-graal test-image
--- a/test/TestCommon.gmk Thu Jun 28 16:45:15 2018 -0700
+++ b/test/TestCommon.gmk Thu Jun 28 17:07:34 2018 -0700
@@ -448,6 +448,9 @@
ifneq ($(VS120COMNTOOLS), )
JTREG_BASIC_OPTIONS += -e:VS120COMNTOOLS="$(shell $(GETMIXEDPATH) "$(patsubst %\,%,$(VS120COMNTOOLS))")"
endif
+
+JTREG_BASIC_OPTIONS += -e:TEST_IMAGE_GRAAL_DIR=${TEST_IMAGE_DIR}/hotspot/jtreg/graal
+
# Set other vm and test options
JTREG_TEST_OPTIONS += $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
ifneq ($(JIB_JAR), )
--- a/test/hotspot/jtreg/ProblemList-graal.txt Thu Jun 28 16:45:15 2018 -0700
+++ b/test/hotspot/jtreg/ProblemList-graal.txt Thu Jun 28 17:07:34 2018 -0700
@@ -171,3 +171,20 @@
compiler/stable/TestStableShort.java 8204347 generic-all
compiler/stable/TestStableUByte.java 8204347 generic-all
compiler/stable/TestStableUShort.java 8204347 generic-all
+
+# Graal unit tests
+org.graalvm.compiler.core.test.CheckGraalInvariants 8205081
+org.graalvm.compiler.core.test.inlining.PolymorphicInliningTest 8205081
+org.graalvm.compiler.core.test.OptionsVerifierTest 8205081
+org.graalvm.compiler.core.test.ProfilingInfoTest 8205081
+org.graalvm.compiler.hotspot.test.CompilationWrapperTest 8205081
+org.graalvm.compiler.hotspot.test.HsErrLogTest 8205081
+org.graalvm.compiler.hotspot.test.OptionsInFileTest 8205081
+org.graalvm.compiler.replacements.test.classfile.ClassfileBytecodeProviderTest 8205081
+org.graalvm.compiler.replacements.test.classfile.RedefineIntrinsicTest 8205081
+
+org.graalvm.compiler.core.test.deopt.CompiledMethodTest 8202955
+org.graalvm.compiler.core.test.CountedLoopTest 8199885
+org.graalvm.compiler.debug.test.DebugContextTest 8203504
+org.graalvm.compiler.debug.test.VersionsTest 8204517
+org.graalvm.compiler.core.test.VerifyDebugUsageTest 8205078
--- a/test/hotspot/jtreg/TEST.groups Thu Jun 28 16:45:15 2018 -0700
+++ b/test/hotspot/jtreg/TEST.groups Thu Jun 28 17:07:34 2018 -0700
@@ -76,7 +76,8 @@
hotspot_not_fast_compiler = \
:hotspot_compiler \
-:tier1_compiler \
- -:hotspot_slow_compiler
+ -:hotspot_slow_compiler \
+ -compiler/graalunit
hotspot_slow_compiler = \
compiler/codegen/aes \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/ApiDirectivesTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.api.directives.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/ApiTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.api.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/AsmAarch64Test.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.asm.aarch64.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/AsmAmd64Test.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.asm.amd64.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/AsmSparcTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.asm.sparc.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/CollectionsTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix jdk.internal.vm.compiler.collections.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/CoreAmd64Test.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.core.amd64.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/CoreSparcTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ * @requires vm.simpleArch == "sparcv9"
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.core.sparc.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/CoreTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.core.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/DebugTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.debug.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/GraphTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ * @requires vm.graal.enabled
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.graph.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/HotspotAmd64Test.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.hotspot.amd64.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/HotspotLirTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.hotspot.lir.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/HotspotTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.hotspot.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/Jtt.MicroTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.micro -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttBackendTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.backend -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttBytecodeTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.bytecode -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttExceptTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.except -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttHotpathTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.hotpath -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttHotspotTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.hotspot -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttJdkTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.jdk -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttLangALTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.lang.[a-lA-L] -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttLangMTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.lang.[mM] -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttLangNZTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.lang.[n-zN-Z] -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttLoopTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.loop -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttOptimizeTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.optimize -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttReflectAETest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.reflect.[a-eA-E] -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttReflectFTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.reflect.[fF] -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttReflectGZTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.reflect.[g-zG-Z] -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttThreadsTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.threads -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/LirJttTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.lir.jtt -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/LoopTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.loop.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/NodesTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ * @requires vm.graal.enabled
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.nodes.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/OptionsTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.options.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/PhasesCommonTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.phases.common.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/README.md Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,36 @@
+This directory contains jtreg tests which are wrapper tests to execute Graal unit tests similar way they are run in Graal project.
+The tests use compiler.graalunit.common.GraalUnitTestLauncher helper class to run Graal unit tests where the set of tests to execute
+is specified by '-prefix' argument. GraalUnitTestLauncher launches ported com.oracle.mxtool.junit.MxJUnitWrapper to run Graal unit
+tests as it is done by "mx unittest" command from Graal project.
+
+All compiler/graalunit/*.java tests were automatically generated by generateTests.sh script which reads
+"testName -> testPrefix [requiresStatement]" mapping from TestPackages.txt file and generates corresponding <testName>Test.java
+tests. The mapping takes into account tests execution time to avoid very long test runs.
+
+Graal unit tests depends on following external jar files:
+ asm-5.0.4.jar:
+ https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/asm-5.0.4.jar
+
+ asm-tree-5.0.4.jar:
+ https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/asm-tree-5.0.4.jar
+
+ junit-4.12.jar:
+ https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/junit-4.12.jar
+
+ hamcrest-core-1.3.jar:
+ https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/hamcrest-core-1.3.jar
+
+ java-allocation-instrumenter.jar:
+ https://lafo.ssw.uni-linz.ac.at/pub/java-allocation-instrumenter/java-allocation-instrumenter-8f0db117e64e.jar
+
+Before running the tests you need to download these jars from above locations in build/<platform>/images/test/hotspot/jtreg/graal/
+directory. Then you can pass it to jtreg as java option by using "-vmoptions:-Dgraalunit.libs=" or as environment variable
+by using "-e:TEST_IMAGE_GRAAL_DIR=..."
+
+Example:
+> jtreg -vt -jdk:<TESTED_JDK> -vmoptions:"-vmoptions:-Dgraalunit.libs=build/<platform>/images/test/hotspot/jtreg/graal"
+ compiler/graalunit/UtilTest.java
+
+To run Graal unit tests in Graal as JIT mode pass additional -vmoptions to jtreg:
+ -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+TieredCompilation -XX:+UseJVMCICompiler -Djvmci.Compiler=graal
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/ReplacementsTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.replacements.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/TestPackages.txt Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+Collections jdk.internal.vm.compiler.collections.test
+ApiDirectives org.graalvm.compiler.api.directives.test
+Api org.graalvm.compiler.api.test
+AsmAarch64 org.graalvm.compiler.asm.aarch64.test
+AsmAmd64 org.graalvm.compiler.asm.amd64.test
+AsmSparc org.graalvm.compiler.asm.sparc.test
+CoreAmd64 org.graalvm.compiler.core.amd64.test
+CoreSparc org.graalvm.compiler.core.sparc.test @requires vm.simpleArch == "sparcv9"
+Core org.graalvm.compiler.core.test
+Debug org.graalvm.compiler.debug.test
+Graph org.graalvm.compiler.graph.test @requires vm.graal.enabled
+HotspotAmd64 org.graalvm.compiler.hotspot.amd64.test
+HotspotLir org.graalvm.compiler.hotspot.lir.test
+Hotspot org.graalvm.compiler.hotspot.test
+Loop org.graalvm.compiler.loop.test
+Nodes org.graalvm.compiler.nodes.test @requires vm.graal.enabled
+Options org.graalvm.compiler.options.test
+PhasesCommon org.graalvm.compiler.phases.common.test
+Replacements org.graalvm.compiler.replacements.test
+Util org.graalvm.util.test
+JttBackend org.graalvm.compiler.jtt.backend
+JttBytecode org.graalvm.compiler.jtt.bytecode
+JttExcept org.graalvm.compiler.jtt.except
+JttHotpath org.graalvm.compiler.jtt.hotpath
+JttHotspot org.graalvm.compiler.jtt.hotspot
+JttJdk org.graalvm.compiler.jtt.jdk
+JttLangAL org.graalvm.compiler.jtt.lang.[a-lA-L]
+JttLangM org.graalvm.compiler.jtt.lang.[mM]
+JttLangNZ org.graalvm.compiler.jtt.lang.[n-zN-Z]
+JttLoop org.graalvm.compiler.jtt.loop
+Jtt.Micro org.graalvm.compiler.jtt.micro
+JttOptimize org.graalvm.compiler.jtt.optimize
+JttReflectAE org.graalvm.compiler.jtt.reflect.[a-eA-E]
+JttReflectF org.graalvm.compiler.jtt.reflect.[fF]
+JttReflectGZ org.graalvm.compiler.jtt.reflect.[g-zG-Z]
+JttThreads org.graalvm.compiler.jtt.threads
+LirJtt org.graalvm.compiler.lir.jtt
+Lir org.graalvm.compiler.lir.test
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/UtilTest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.util.test -exclude ExcludeList.txt
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/AnsiTerminalDecorator.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import org.junit.runner.*;
+import org.junit.runner.notification.*;
+
+/**
+ * Color support for JUnit test output using ANSI escapes codes.
+ */
+class AnsiTerminalDecorator extends MxRunListenerDecorator {
+
+ /** Foreground black. */
+ public static final String BLACK = "\u001b[30m";
+ /** Foreground red. */
+ public static final String RED = "\u001b[31m";
+ /** Foreground green. */
+ public static final String GREEN = "\u001b[32m";
+ /** Foreground yellow. */
+ public static final String YELLOW = "\u001b[33m";
+ /** Foreground blue. */
+ public static final String BLUE = "\u001b[34m";
+ /** Foreground magenta. */
+ public static final String MAGENTA = "\u001b[35m";
+ /** Foreground cyan. */
+ public static final String CYAN = "\u001b[36m";
+ /** Foreground white. */
+ public static final String WHITE = "\u001b[37m";
+
+ /** Foreground bold black. */
+ public static final String BOLD_BLACK = "\u001b[30;1m";
+ /** Foreground bold red. */
+ public static final String BOLD_RED = "\u001b[31;1m";
+ /** Foreground bold green. */
+ public static final String BOLD_GREEN = "\u001b[32;1m";
+ /** Foreground bold yellow. */
+ public static final String BOLD_YELLOW = "\u001b[33;1m";
+ /** Foreground bold blue. */
+ public static final String BOLD_BLUE = "\u001b[34;1m";
+ /** Foreground bold magenta. */
+ public static final String BOLD_MAGENTA = "\u001b[35;1m";
+ /** Foreground bold cyan. */
+ public static final String BOLD_CYAN = "\u001b[36;1m";
+ /** Foreground bold white. */
+ public static final String BOLD_WHITE = "\u001b[37;1m";
+
+ /** Background black. */
+ public static final String BG_BLACK = "\u001b[40m";
+ /** Background red. */
+ public static final String BG_RED = "\u001b[41m";
+ /** Background green. */
+ public static final String BG_GREEN = "\u001b[42m";
+ /** Background yellow. */
+ public static final String BG_YELLOW = "\u001b[43m";
+ /** Background blue. */
+ public static final String BG_BLUE = "\u001b[44m";
+ /** Background magenta. */
+ public static final String BG_MAGENTA = "\u001b[45m";
+ /** Background cyan. */
+ public static final String BG_CYAN = "\u001b[46m";
+ /** Background white. */
+ public static final String BG_WHITE = "\u001b[47m";
+
+ /** Reset. */
+ public static final String RESET = "\u001b[0m";
+ /** Underline. */
+ public static final String UNDERLINED = "\u001b[4m";
+
+ AnsiTerminalDecorator(MxRunListener l) {
+ super(l);
+ }
+
+ @Override
+ public void testSucceeded(Description description) {
+ getWriter().print(GREEN);
+ super.testSucceeded(description);
+ getWriter().print(RESET);
+ }
+
+ @Override
+ public void testAssumptionFailure(Failure failure) {
+ getWriter().print(BLUE);
+ super.testAssumptionFailure(failure);
+ getWriter().print(RESET);
+ }
+
+ @Override
+ public void testFailed(Failure failure) {
+ getWriter().print(RED);
+ super.testFailed(failure);
+ getWriter().print(RESET);
+ }
+
+ @Override
+ public void testIgnored(Description description) {
+ getWriter().print(MAGENTA);
+ super.testIgnored(description);
+ getWriter().print(RESET);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/EagerStackTraceDecorator.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import org.junit.runner.notification.*;
+
+class EagerStackTraceDecorator extends MxRunListenerDecorator {
+
+ EagerStackTraceDecorator(MxRunListener l) {
+ super(l);
+ }
+
+ @Override
+ public void testFailed(Failure failure) {
+ super.testFailed(failure);
+ getWriter().println();
+ getWriter().println(failure.getTestHeader());
+ getWriter().print(failure.getTrace());
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/FindClassesByAnnotatedMethods.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,341 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.io.BufferedInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+/**
+ * Finds classes in given jar files that contain methods annotated by a given set of annotations.
+ */
+public class FindClassesByAnnotatedMethods {
+
+ /**
+ * Finds classes in a given set of jar files that contain at least one method with an annotation
+ * from a given set of annotations. The qualified name and containing jar file (separated by a
+ * space) is written to {@link System#out} for each matching class.
+ *
+ * @param args jar file names, annotations and snippets patterns. Annotations are those starting
+ * with "@" and can be either qualified or unqualified annotation class names,
+ * snippets patterns are those starting with {@code "snippetsPattern:"} and the rest
+ * are jar file names
+ */
+ public static void main(String... args) throws Throwable {
+ Set<String> qualifiedAnnotations = new HashSet<>();
+ Set<String> unqualifiedAnnotations = new HashSet<>();
+ for (String arg : args) {
+ if (isAnnotationArg(arg)) {
+ String annotation = arg.substring(1);
+ int lastDot = annotation.lastIndexOf('.');
+ if (lastDot != -1) {
+ qualifiedAnnotations.add(annotation);
+ } else {
+ String unqualifed = annotation.substring(lastDot + 1);
+ unqualifiedAnnotations.add(unqualifed);
+ }
+ }
+ }
+
+ for (String jarFilePath : args) {
+ if (isSnippetArg(jarFilePath) || isAnnotationArg(jarFilePath)) {
+ continue;
+ }
+ JarFile jarFile = new JarFile(jarFilePath);
+ Enumeration<JarEntry> e = jarFile.entries();
+ int unsupportedClasses = 0;
+ System.out.print(jarFilePath);
+ while (e.hasMoreElements()) {
+ JarEntry je = e.nextElement();
+ if (je.isDirectory() || !je.getName().endsWith(".class")) {
+ continue;
+ }
+ Set<String> methodAnnotationTypes = new HashSet<>();
+ DataInputStream stream = new DataInputStream(new BufferedInputStream(jarFile.getInputStream(je), (int) je.getSize()));
+ boolean isSupported = true;
+ try {
+ readClassfile(stream, methodAnnotationTypes);
+ } catch (UnsupportedClassVersionError ucve) {
+ isSupported = false;
+ unsupportedClasses++;
+ }
+ String className = je.getName().substring(0, je.getName().length() - ".class".length()).replaceAll("/", ".");
+ if (!isSupported) {
+ System.out.print(" !" + className);
+ }
+ for (String annotationType : methodAnnotationTypes) {
+ if (!qualifiedAnnotations.isEmpty()) {
+ if (qualifiedAnnotations.contains(annotationType)) {
+ System.out.print(" " + className);
+ }
+ }
+ if (!unqualifiedAnnotations.isEmpty()) {
+ final int lastDot = annotationType.lastIndexOf('.');
+ if (lastDot != -1) {
+ String simpleName = annotationType.substring(lastDot + 1);
+ int lastDollar = simpleName.lastIndexOf('$');
+ if (lastDollar != -1) {
+ simpleName = simpleName.substring(lastDollar + 1);
+ }
+ if (unqualifiedAnnotations.contains(simpleName)) {
+ System.out.print(" " + className);
+ }
+ }
+ }
+ }
+ }
+ if (unsupportedClasses != 0) {
+ System.err.printf("Warning: %d classes in %s skipped as their class file version is not supported by %s%n", unsupportedClasses, jarFilePath,
+ FindClassesByAnnotatedMethods.class.getSimpleName());
+ }
+ System.out.println();
+ }
+ }
+
+ private static boolean isAnnotationArg(String arg) {
+ return arg.charAt(0) == '@';
+ }
+
+ private static boolean isSnippetArg(String arg) {
+ return arg.startsWith("snippetsPattern:");
+ }
+
+ /*
+ * Small bytecode parser that extract annotations.
+ */
+ private static final int MAJOR_VERSION_JAVA7 = 51;
+ private static final int MAJOR_VERSION_OFFSET = 44;
+ private static final byte CONSTANT_Utf8 = 1;
+ private static final byte CONSTANT_Integer = 3;
+ private static final byte CONSTANT_Float = 4;
+ private static final byte CONSTANT_Long = 5;
+ private static final byte CONSTANT_Double = 6;
+ private static final byte CONSTANT_Class = 7;
+ private static final byte CONSTANT_Fieldref = 9;
+ private static final byte CONSTANT_String = 8;
+ private static final byte CONSTANT_Methodref = 10;
+ private static final byte CONSTANT_InterfaceMethodref = 11;
+ private static final byte CONSTANT_NameAndType = 12;
+ private static final byte CONSTANT_MethodHandle = 15;
+ private static final byte CONSTANT_MethodType = 16;
+ private static final byte CONSTANT_Dynamic = 17;
+ private static final byte CONSTANT_InvokeDynamic = 18;
+
+ private static void readClassfile(DataInputStream stream, Collection<String> methodAnnotationTypes) throws IOException {
+ // magic
+ int magic = stream.readInt();
+ assert magic == 0xCAFEBABE;
+
+ int minor = stream.readUnsignedShort();
+ int major = stream.readUnsignedShort();
+ if (major < MAJOR_VERSION_JAVA7) {
+ throw new UnsupportedClassVersionError("Unsupported class file version: " + major + "." + minor);
+ }
+ // Starting with JDK8, ignore a classfile that has a newer format than the current JDK.
+ String javaVersion = System.getProperties().get("java.specification.version").toString();
+ int majorJavaVersion;
+ if (javaVersion.startsWith("1.")) {
+ javaVersion = javaVersion.substring(2);
+ majorJavaVersion = Integer.parseInt(javaVersion);
+ } else {
+ majorJavaVersion = Integer.parseInt(javaVersion);
+ }
+ if (major > MAJOR_VERSION_OFFSET + majorJavaVersion) {
+ throw new UnsupportedClassVersionError("Unsupported class file version: " + major + "." + minor);
+ }
+
+ String[] cp = readConstantPool(stream, major, minor);
+
+ // access_flags, this_class, super_class
+ stream.skipBytes(6);
+
+ // interfaces
+ stream.skipBytes(stream.readUnsignedShort() * 2);
+
+ // fields
+ skipFields(stream);
+
+ // methods
+ readMethods(stream, cp, methodAnnotationTypes);
+ }
+
+ private static void skipFully(DataInputStream stream, int n) throws IOException {
+ long skipped = 0;
+ do {
+ long s = stream.skip(n - skipped);
+ skipped += s;
+ if (s == 0 && skipped != n) {
+ // Check for EOF (i.e., truncated class file)
+ if (stream.read() == -1) {
+ throw new IOException("truncated stream");
+ }
+ skipped++;
+ }
+ } while (skipped != n);
+ }
+
+ private static String[] readConstantPool(DataInputStream stream, int major, int minor) throws IOException {
+ int count = stream.readUnsignedShort();
+ String[] cp = new String[count];
+
+ int i = 1;
+ while (i < count) {
+ byte tag = stream.readByte();
+ switch (tag) {
+ case CONSTANT_Class:
+ case CONSTANT_String:
+ case CONSTANT_MethodType: {
+ skipFully(stream, 2);
+ break;
+ }
+ case CONSTANT_InterfaceMethodref:
+ case CONSTANT_Methodref:
+ case CONSTANT_Fieldref:
+ case CONSTANT_NameAndType:
+ case CONSTANT_Float:
+ case CONSTANT_Integer:
+ case CONSTANT_Dynamic:
+ case CONSTANT_InvokeDynamic: {
+ skipFully(stream, 4);
+ break;
+ }
+ case CONSTANT_Long:
+ case CONSTANT_Double: {
+ skipFully(stream, 8);
+ break;
+ }
+ case CONSTANT_Utf8: {
+ cp[i] = stream.readUTF();
+ break;
+ }
+ case CONSTANT_MethodHandle: {
+ skipFully(stream, 3);
+ break;
+ }
+ default: {
+ throw new InternalError(String.format("Invalid constant pool tag: " + tag + ". Maybe %s needs updating for changes introduced by class file version %d.%d?",
+ FindClassesByAnnotatedMethods.class, major, minor));
+ }
+ }
+ if ((tag == CONSTANT_Double) || (tag == CONSTANT_Long)) {
+ i += 2;
+ } else {
+ i += 1;
+ }
+ }
+ return cp;
+ }
+
+ private static void skipAttributes(DataInputStream stream) throws IOException {
+ int attributesCount;
+ attributesCount = stream.readUnsignedShort();
+ for (int i = 0; i < attributesCount; i++) {
+ stream.skipBytes(2); // name_index
+ int attributeLength = stream.readInt();
+ skipFully(stream, attributeLength);
+ }
+ }
+
+ private static void readMethodAttributes(DataInputStream stream, String[] cp, Collection<String> methodAnnotationTypes) throws IOException {
+ int attributesCount;
+ attributesCount = stream.readUnsignedShort();
+ for (int i = 0; i < attributesCount; i++) {
+ String attributeName = cp[stream.readUnsignedShort()];
+ int attributeLength = stream.readInt();
+
+ if (attributeName.equals("RuntimeVisibleAnnotations")) {
+ int numAnnotations = stream.readUnsignedShort();
+ for (int a = 0; a != numAnnotations; a++) {
+ readAnnotation(stream, cp, methodAnnotationTypes);
+ }
+ } else {
+ skipFully(stream, attributeLength);
+ }
+ }
+ }
+
+ private static void readAnnotation(DataInputStream stream, String[] cp, Collection<String> methodAnnotationTypes) throws IOException {
+ int typeIndex = stream.readUnsignedShort();
+ int pairs = stream.readUnsignedShort();
+ String type = cp[typeIndex];
+ String className = type.substring(1, type.length() - 1).replace('/', '.');
+ methodAnnotationTypes.add(className);
+ readAnnotationElements(stream, cp, pairs, true, methodAnnotationTypes);
+ }
+
+ private static void readAnnotationElements(DataInputStream stream, String[] cp, int pairs, boolean withElementName, Collection<String> methodAnnotationTypes) throws IOException {
+ for (int p = 0; p < pairs; p++) {
+ if (withElementName) {
+ skipFully(stream, 2);
+ }
+ int tag = stream.readByte();
+ switch (tag) {
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'F':
+ case 'I':
+ case 'J':
+ case 'S':
+ case 'Z':
+ case 's':
+ case 'c':
+ skipFully(stream, 2);
+ break;
+ case 'e':
+ skipFully(stream, 4);
+ break;
+ case '@':
+ readAnnotation(stream, cp, methodAnnotationTypes);
+ break;
+ case '[': {
+ int numValues = stream.readUnsignedShort();
+ readAnnotationElements(stream, cp, numValues, false, methodAnnotationTypes);
+ break;
+ }
+ }
+ }
+ }
+
+ private static void skipFields(DataInputStream stream) throws IOException {
+ int count = stream.readUnsignedShort();
+ for (int i = 0; i < count; i++) {
+ stream.skipBytes(6); // access_flags, name_index, descriptor_index
+ skipAttributes(stream);
+ }
+ }
+
+ private static void readMethods(DataInputStream stream, String[] cp, Collection<String> methodAnnotationTypes) throws IOException {
+ int count = stream.readUnsignedShort();
+ for (int i = 0; i < count; i++) {
+ skipFully(stream, 6); // access_flags, name_index, descriptor_index
+ readMethodAttributes(stream, cp, methodAnnotationTypes);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/GCAfterTestDecorator.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import org.junit.runner.*;
+
+class GCAfterTestDecorator extends MxRunListenerDecorator {
+
+ GCAfterTestDecorator(MxRunListener l) {
+ super(l);
+ }
+
+ @Override
+ public void testFinished(Description description) {
+ System.gc();
+ super.testFinished(description);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/JLModule.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,211 @@
+/*
+ * 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.
+ */
+package com.oracle.mxtool.junit;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Set;
+
+/**
+ * Facade for the {@code java.lang.Module} class introduced in JDK9 that allows tests to be
+ * developed against JDK8 but use module logic if deployed on JDK9.
+ */
+class JLModule {
+
+ private final Object realModule;
+
+ JLModule(Object module) {
+ this.realModule = module;
+ }
+
+ private static final Class<?> moduleClass;
+ private static final Class<?> layerClass;
+
+ private static final Method bootMethod;
+ private static final Method modulesMethod;
+ private static final Method getModuleMethod;
+ private static final Method getUnnamedModuleMethod;
+ private static final Method getNameMethod;
+ private static final Method getPackagesMethod;
+ private static final Method isExportedMethod;
+ private static final Method isExported2Method;
+ private static final Method addExportsMethod;
+ private static final Method addOpensMethod;
+ static {
+ try {
+ moduleClass = findModuleClass();
+ Class<?> modulesClass = Class.forName("jdk.internal.module.Modules");
+ layerClass = findModuleLayerClass();
+ bootMethod = layerClass.getMethod("boot");
+ modulesMethod = layerClass.getMethod("modules");
+ getModuleMethod = Class.class.getMethod("getModule");
+ getUnnamedModuleMethod = ClassLoader.class.getMethod("getUnnamedModule");
+ getNameMethod = moduleClass.getMethod("getName");
+ getPackagesMethod = moduleClass.getMethod("getPackages");
+ isExportedMethod = moduleClass.getMethod("isExported", String.class);
+ isExported2Method = moduleClass.getMethod("isExported", String.class, moduleClass);
+ addExportsMethod = modulesClass.getDeclaredMethod("addExports", moduleClass, String.class, moduleClass);
+ addOpensMethod = getDeclaredMethodOptional(modulesClass, "addOpens", moduleClass, String.class, moduleClass);
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ // API change http://hg.openjdk.java.net/jdk9/dev/hotspot/rev/afedee84773e.
+ protected static Class<?> findModuleClass() throws ClassNotFoundException {
+ try {
+ return Class.forName("java.lang.Module");
+ } catch (ClassNotFoundException e) {
+ return Class.forName("java.lang.reflect.Module");
+ }
+ }
+
+ // API change http://hg.openjdk.java.net/jdk9/dev/hotspot/rev/afedee84773e.
+ protected static Class<?> findModuleLayerClass() throws ClassNotFoundException {
+ try {
+ return Class.forName("java.lang.ModuleLayer");
+ } catch (ClassNotFoundException e) {
+ return Class.forName("java.lang.reflect.Layer");
+ }
+ }
+
+ private static Method getDeclaredMethodOptional(Class<?> declaringClass, String name, Class<?>... parameterTypes) {
+ try {
+ return declaringClass.getDeclaredMethod(name, parameterTypes);
+ } catch (NoSuchMethodException e) {
+ return null;
+ }
+ }
+
+ public static JLModule fromClass(Class<?> cls) {
+ try {
+ return new JLModule(getModuleMethod.invoke(cls));
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static JLModule find(String name) {
+ try {
+ Object bootLayer = bootMethod.invoke(null);
+ Set<Object> modules = (Set<Object>) modulesMethod.invoke(bootLayer);
+ for (Object m : modules) {
+ JLModule module = new JLModule(m);
+ String mname = module.getName();
+ if (mname.equals(name)) {
+ return module;
+ }
+ }
+ } catch (Exception e) {
+ throw new InternalError(e);
+ }
+ return null;
+ }
+
+ public static JLModule getUnnamedModuleFor(ClassLoader cl) {
+ try {
+ return new JLModule(getUnnamedModuleMethod.invoke(cl));
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ public String getName() {
+ try {
+ return (String) getNameMethod.invoke(realModule);
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ /**
+ * Exports all packages in this module to a given module.
+ */
+ public void exportAllPackagesTo(JLModule module) {
+ if (this != module) {
+ for (String pkg : getPackages()) {
+ // Export all JVMCI packages dynamically instead
+ // of requiring a long list of -XaddExports
+ // options on the JVM command line.
+ if (!isExported(pkg, module)) {
+ addExports(pkg, module);
+ addOpens(pkg, module);
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public Iterable<String> getPackages() {
+ try {
+ // API change http://hg.openjdk.java.net/jdk9/dev/hotspot/rev/afedee84773e#l1.15
+ Object res = getPackagesMethod.invoke(realModule);
+ if (res instanceof String[]) {
+ return Arrays.asList((String[]) res);
+ }
+ return (Set<String>) res;
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ public boolean isExported(String pn) {
+ try {
+ return (Boolean) isExportedMethod.invoke(realModule, pn);
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ public boolean isExported(String pn, JLModule other) {
+ try {
+ return (Boolean) isExported2Method.invoke(realModule, pn, other.realModule);
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ public void addExports(String pn, JLModule other) {
+ try {
+ addExportsMethod.invoke(null, realModule, pn, other.realModule);
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ public void addOpens(String pn, JLModule other) {
+ if (addOpensMethod != null) {
+ try {
+ addOpensMethod.invoke(null, realModule, pn, other.realModule);
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return realModule.toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/MxJUnitRequest.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import org.junit.runner.Description;
+import org.junit.runner.Request;
+import org.junit.runner.notification.Failure;
+
+public final class MxJUnitRequest {
+
+ private final Request request;
+
+ final Set<Class<?>> classes;
+ final String methodName;
+
+ final List<Failure> missingClasses;
+
+ private MxJUnitRequest(Request request, Set<Class<?>> classes, String methodName, List<Failure> missingClasses) {
+ this.request = request;
+ this.classes = classes;
+ this.methodName = methodName;
+ this.missingClasses = missingClasses;
+ }
+
+ public Request getRequest() {
+ return request;
+ }
+
+ public static final class BuilderException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private BuilderException(String msg) {
+ super(msg);
+ }
+ }
+
+ public static class Builder {
+
+ private final Set<Class<?>> classes = new LinkedHashSet<>();
+ private String methodName = null;
+ private final List<Failure> missingClasses = new ArrayList<>();
+
+ protected Class<?> resolveClass(String name) throws ClassNotFoundException {
+ return Class.forName(name, false, Builder.class.getClassLoader());
+ }
+
+ public void addTestSpec(String arg) throws BuilderException {
+ String className;
+ /*
+ * Entries of the form class#method are handled specially. Only one can be specified on
+ * the command line as there's no obvious way to build a runner for multiple ones.
+ */
+ if (methodName != null) {
+ throw new BuilderException("Only a single class and method can be specified: " + arg);
+ } else if (arg.contains("#")) {
+ String[] pair = arg.split("#");
+ if (pair.length != 2) {
+ throw new BuilderException("Malformed class and method request: " + arg);
+ } else if (!classes.isEmpty()) {
+ throw new BuilderException("Only a single class and method can be specified: " + arg);
+ } else {
+ methodName = pair[1];
+ className = pair[0];
+ }
+ } else {
+ className = arg;
+ }
+ try {
+ Class<?> cls = resolveClass(className);
+ if ((cls.getModifiers() & Modifier.ABSTRACT) == 0) {
+ classes.add(cls);
+ }
+ } catch (ClassNotFoundException e) {
+ Description description = Description.createSuiteDescription(className);
+ Failure failure = new Failure(description, e);
+ missingClasses.add(failure);
+ }
+ }
+
+ public MxJUnitRequest build() {
+ Request request;
+ if (methodName == null) {
+ request = Request.classes(classes.toArray(new Class<?>[0]));
+ } else {
+ request = Request.method(classes.iterator().next(), methodName);
+ }
+ return new MxJUnitRequest(request, classes, methodName, missingClasses);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/MxJUnitWrapper.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,484 @@
+/*
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.ServiceLoader;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.junit.internal.JUnitSystem;
+import org.junit.internal.RealSystem;
+import org.junit.runner.Description;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Request;
+import org.junit.runner.Result;
+import org.junit.runner.Runner;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.ParentRunner;
+import org.junit.runners.model.RunnerScheduler;
+
+import junit.runner.Version;
+
+public class MxJUnitWrapper {
+
+ public static class MxJUnitConfig {
+
+ public boolean verbose = false;
+ public boolean veryVerbose = false;
+ public boolean enableTiming = false;
+ public boolean failFast = false;
+ public boolean color = false;
+ public boolean eagerStackTrace = false;
+ public boolean gcAfterTest = false;
+ public boolean recordResults = false;
+ public int repeatCount = 1;
+ }
+
+ private static class RepeatingRunner extends Runner {
+
+ private final Runner parent;
+ private int repeat;
+
+ RepeatingRunner(Runner parent, int repeat) {
+ this.parent = parent;
+ this.repeat = repeat;
+ }
+
+ @Override
+ public Description getDescription() {
+ return parent.getDescription();
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ for (int i = 0; i < repeat; i++) {
+ parent.run(notifier);
+ }
+ }
+
+ @Override
+ public int testCount() {
+ return super.testCount() * repeat;
+ }
+ }
+
+ private static class RepeatingRequest extends Request {
+
+ private final Request request;
+ private final int repeat;
+
+ RepeatingRequest(Request request, int repeat) {
+ this.request = request;
+ this.repeat = repeat;
+ }
+
+ @Override
+ public Runner getRunner() {
+ return new RepeatingRunner(request.getRunner(), repeat);
+ }
+ }
+
+ /**
+ * Run the tests contained in the classes named in the <code>args</code>. A single test method
+ * can be specified by adding #method after the class name. Only a single test can be run in
+ * this way. If all tests run successfully, exit with a status of 0. Otherwise exit with a
+ * status of 1. Write feedback while tests are running and write stack traces for all failed
+ * tests after the tests all complete.
+ *
+ * @param args names of classes in which to find tests to run
+ */
+ public static void main(String... args) {
+ JUnitSystem system = new RealSystem();
+ JUnitCore junitCore = new JUnitCore();
+ system.out().println("MxJUnitCore");
+ system.out().println("JUnit version " + Version.id());
+
+ MxJUnitRequest.Builder builder = new MxJUnitRequest.Builder();
+ MxJUnitConfig config = new MxJUnitConfig();
+
+ String[] expandedArgs = expandArgs(args);
+ int i = 0;
+ while (i < expandedArgs.length) {
+ String each = expandedArgs[i];
+ if (each.charAt(0) == '-') {
+ // command line arguments
+ if (each.contentEquals("-JUnitVerbose")) {
+ config.verbose = true;
+ } else if (each.contentEquals("-JUnitVeryVerbose")) {
+ config.veryVerbose = true;
+ } else if (each.contentEquals("-JUnitFailFast")) {
+ config.failFast = true;
+ } else if (each.contentEquals("-JUnitEnableTiming")) {
+ config.enableTiming = true;
+ } else if (each.contentEquals("-JUnitColor")) {
+ config.color = true;
+ } else if (each.contentEquals("-JUnitEagerStackTrace")) {
+ config.eagerStackTrace = true;
+ } else if (each.contentEquals("-JUnitGCAfterTest")) {
+ config.gcAfterTest = true;
+ } else if (each.contentEquals("-JUnitRecordResults")) {
+ config.recordResults = true;
+ } else if (each.contentEquals("-JUnitRepeat")) {
+ if (i + 1 >= expandedArgs.length) {
+ system.out().println("Must include argument for -JUnitRepeat");
+ System.exit(1);
+ }
+ try {
+ config.repeatCount = Integer.parseInt(expandedArgs[++i]);
+ } catch (NumberFormatException e) {
+ system.out().println("Expected integer argument for -JUnitRepeat. Found: " + expandedArgs[i]);
+ System.exit(1);
+ }
+ } else {
+ system.out().println("Unknown command line argument: " + each);
+ }
+
+ } else {
+
+ try {
+ builder.addTestSpec(each);
+ } catch (MxJUnitRequest.BuilderException ex) {
+ system.out().println(ex.getMessage());
+ System.exit(1);
+ }
+ }
+ i++;
+ }
+
+ MxJUnitRequest request = builder.build();
+
+ if (System.getProperty("java.specification.version").compareTo("1.9") >= 0) {
+ addExports(request.classes, system.out());
+ }
+
+ for (RunListener p : ServiceLoader.load(RunListener.class)) {
+ junitCore.addListener(p);
+ }
+
+ Result result = runRequest(junitCore, system, config, request);
+ System.exit(result.wasSuccessful() ? 0 : 1);
+ }
+
+ private static PrintStream openFile(JUnitSystem system, String name) {
+ File file = new File(name).getAbsoluteFile();
+ try {
+ FileOutputStream fos = new FileOutputStream(file);
+ return new PrintStream(fos, true);
+ } catch (FileNotFoundException e) {
+ system.out().println("Could not open " + file + " for writing: " + e);
+ System.exit(1);
+ return null;
+ }
+ }
+
+ public static Result runRequest(JUnitCore junitCore, JUnitSystem system, MxJUnitConfig config, MxJUnitRequest mxRequest) {
+ final TextRunListener textListener;
+ if (config.veryVerbose) {
+ textListener = new VerboseTextListener(system, mxRequest.classes.size(), VerboseTextListener.SHOW_ALL_TESTS);
+ } else if (config.verbose) {
+ textListener = new VerboseTextListener(system, mxRequest.classes.size());
+ } else {
+ textListener = new TextRunListener(system);
+ }
+ TimingDecorator timings = config.enableTiming ? new TimingDecorator(textListener) : null;
+ MxRunListener mxListener = config.enableTiming ? timings : textListener;
+
+ if (config.color) {
+ mxListener = new AnsiTerminalDecorator(mxListener);
+ }
+ if (config.eagerStackTrace) {
+ mxListener = new EagerStackTraceDecorator(mxListener);
+ }
+ if (config.gcAfterTest) {
+ mxListener = new GCAfterTestDecorator(mxListener);
+ }
+ if (config.recordResults) {
+ PrintStream passed = openFile(system, "passed.txt");
+ PrintStream failed = openFile(system, "failed.txt");
+ mxListener = new TestResultLoggerDecorator(passed, failed, mxListener);
+ }
+
+ junitCore.addListener(TextRunListener.createRunListener(mxListener));
+
+ Request request = mxRequest.getRequest();
+ if (mxRequest.methodName == null) {
+ if (config.failFast) {
+ Runner runner = request.getRunner();
+ if (runner instanceof ParentRunner) {
+ ParentRunner<?> parentRunner = (ParentRunner<?>) runner;
+ parentRunner.setScheduler(new RunnerScheduler() {
+ public void schedule(Runnable childStatement) {
+ if (textListener.getLastFailure() == null) {
+ childStatement.run();
+ }
+ }
+
+ public void finished() {
+ }
+ });
+ } else {
+ system.out().println("Unexpected Runner subclass " + runner.getClass().getName() + " - fail fast not supported");
+ }
+ }
+ } else {
+ if (config.failFast) {
+ system.out().println("Single method selected - fail fast not supported");
+ }
+ }
+
+ if (config.repeatCount != 1) {
+ request = new RepeatingRequest(request, config.repeatCount);
+ }
+
+ if (config.enableTiming) {
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
+ public void run() {
+ printTimings(timings);
+ }
+ });
+ }
+
+ Result result = junitCore.run(request);
+ for (Failure each : mxRequest.missingClasses) {
+ result.getFailures().add(each);
+ }
+
+ return result;
+ }
+
+ private static final Pattern MODULE_PACKAGE_RE = Pattern.compile("([^/]+)/(.+)");
+
+ private static class Timing<T> implements Comparable<Timing<T>> {
+ final T subject;
+ final long value;
+
+ Timing(T subject, long value) {
+ this.subject = subject;
+ this.value = value;
+ }
+
+ public int compareTo(Timing<T> o) {
+ if (this.value < o.value) {
+ return -1;
+ }
+ if (this.value > o.value) {
+ return 1;
+ }
+ return 0;
+ }
+ }
+
+ // Should never need to customize so using a system property instead
+ // of a command line option for customization is fine.
+ private static final int TIMINGS_TO_PRINT = Integer.getInteger("mx.junit.timings_to_print", 10);
+
+ private static void printTimings(TimingDecorator timings) {
+ if (TIMINGS_TO_PRINT != 0) {
+ List<Timing<Class<?>>> classTimes = new ArrayList<>(timings.classTimes.size());
+ List<Timing<Description>> testTimes = new ArrayList<>(timings.testTimes.size());
+ for (Map.Entry<Class<?>, Long> e : timings.classTimes.entrySet()) {
+ classTimes.add(new Timing<>(e.getKey(), e.getValue()));
+ }
+ for (Map.Entry<Description, Long> e : timings.testTimes.entrySet()) {
+ testTimes.add(new Timing<>(e.getKey(), e.getValue()));
+ }
+ classTimes.sort(Collections.reverseOrder());
+ testTimes.sort(Collections.reverseOrder());
+
+ System.out.println();
+ System.out.printf("%d longest running test classes:%n", TIMINGS_TO_PRINT);
+ for (int i = 0; i < TIMINGS_TO_PRINT && i < classTimes.size(); i++) {
+ Timing<Class<?>> timing = classTimes.get(i);
+ System.out.printf(" %,10d ms %s%n", timing.value, timing.subject.getName());
+ }
+ System.out.printf("%d longest running tests:%n", TIMINGS_TO_PRINT);
+ for (int i = 0; i < TIMINGS_TO_PRINT && i < testTimes.size(); i++) {
+ Timing<Description> timing = testTimes.get(i);
+ System.out.printf(" %,10d ms %s%n", timing.value, timing.subject);
+ }
+ Object[] current = timings.getCurrentTestDuration();
+ if (current != null) {
+ System.out.printf("Test %s not finished after %d ms%n", current[0], current[1]);
+ }
+
+ }
+ }
+
+ /**
+ * Adds the super types of {@code cls} to {@code supertypes}.
+ */
+ private static void gatherSupertypes(Class<?> cls, Set<Class<?>> supertypes) {
+ if (!supertypes.contains(cls)) {
+ supertypes.add(cls);
+ Class<?> superclass = cls.getSuperclass();
+ if (superclass != null) {
+ gatherSupertypes(superclass, supertypes);
+ }
+ for (Class<?> iface : cls.getInterfaces()) {
+ gatherSupertypes(iface, supertypes);
+ }
+ }
+ }
+
+ /**
+ * Updates modules specified in {@code AddExport} annotations on {@code classes} to export
+ * concealed packages to the annotation classes' declaring modules.
+ */
+ private static void addExports(Set<Class<?>> classes, PrintStream out) {
+ Set<Class<?>> types = new HashSet<>();
+ for (Class<?> cls : classes) {
+ gatherSupertypes(cls, types);
+ }
+ for (Class<?> cls : types) {
+ Annotation[] annos = cls.getAnnotations();
+ for (Annotation a : annos) {
+ Class<? extends Annotation> annotationType = a.annotationType();
+ if (annotationType.getSimpleName().equals("AddExports")) {
+ Optional<String[]> value = getElement("value", String[].class, a);
+ if (value.isPresent()) {
+ for (String export : value.get()) {
+ Matcher m = MODULE_PACKAGE_RE.matcher(export);
+ if (m.matches()) {
+ String moduleName = m.group(1);
+ String packageName = m.group(2);
+ JLModule module = JLModule.find(moduleName);
+ if (module == null) {
+ out.printf("%s: Cannot find module named %s specified in \"AddExports\" annotation: %s%n", cls.getName(), moduleName, a);
+ } else {
+ if (packageName.equals("*")) {
+ module.exportAllPackagesTo(JLModule.fromClass(cls));
+ } else {
+ module.addExports(packageName, JLModule.fromClass(cls));
+ module.addOpens(packageName, JLModule.fromClass(cls));
+ }
+ }
+ } else {
+ out.printf("%s: Ignoring \"AddExports\" annotation with value not matching <module>/<package> pattern: %s%n", cls.getName(), a);
+ }
+ }
+ } else {
+ out.printf("%s: Ignoring \"AddExports\" annotation without `String value` element: %s%n", cls.getName(), a);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Gets the value of the element named {@code name} of type {@code type} from {@code annotation}
+ * if present.
+ *
+ * @return the requested element value wrapped in an {@link Optional} or
+ * {@link Optional#empty()} if {@code annotation} has no element named {@code name}
+ * @throws AssertionError if {@code annotation} has an element of the given name but whose type
+ * is not {@code type} or if there's some problem reading the value via reflection
+ */
+ private static <T> Optional<T> getElement(String name, Class<T> type, Annotation annotation) {
+ Class<? extends Annotation> annotationType = annotation.annotationType();
+ Method valueAccessor;
+ try {
+ valueAccessor = annotationType.getMethod(name);
+ if (!valueAccessor.getReturnType().equals(type)) {
+ throw new AssertionError(String.format("Element %s of %s is of type %s, not %s ", name, annotationType.getName(), valueAccessor.getReturnType().getName(), type.getName()));
+ }
+ } catch (NoSuchMethodException e) {
+ return Optional.empty();
+ }
+ try {
+ return Optional.of(type.cast(valueAccessor.invoke(annotation)));
+ } catch (Exception e) {
+ throw new AssertionError(String.format("Could not read %s element from %s", name, annotation), e);
+ }
+ }
+
+ /**
+ * Expand any arguments starting with @ and return the resulting argument array.
+ *
+ * @return the expanded argument array
+ */
+ private static String[] expandArgs(String[] args) {
+ List<String> result = null;
+ for (int i = 0; i < args.length; i++) {
+ String arg = args[i];
+ if (arg.length() > 0 && arg.charAt(0) == '@') {
+ if (result == null) {
+ result = new ArrayList<>();
+ for (int j = 0; j < i; j++) {
+ result.add(args[j]);
+ }
+ expandArg(arg.substring(1), result);
+ }
+ } else if (result != null) {
+ result.add(arg);
+ }
+ }
+ return result != null ? result.toArray(new String[0]) : args;
+ }
+
+ /**
+ * Add each line from {@code filename} to the list {@code args}.
+ */
+ private static void expandArg(String filename, List<String> args) {
+ BufferedReader br = null;
+ try {
+ br = new BufferedReader(new FileReader(filename));
+
+ String buf;
+ while ((buf = br.readLine()) != null) {
+ args.add(buf);
+ }
+ br.close();
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ System.exit(2);
+ } finally {
+ try {
+ if (br != null) {
+ br.close();
+ }
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ System.exit(3);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/MxRunListener.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.io.*;
+
+import org.junit.internal.*;
+import org.junit.runner.*;
+import org.junit.runner.notification.*;
+
+interface MxRunListener {
+
+ /**
+ * Called before any tests have been run.
+ *
+ * @param description describes the tests to be run
+ */
+ default void testRunStarted(Description description) {
+ }
+
+ /**
+ * Called when all tests have finished.
+ *
+ * @param result the summary of the test run, including all the tests that failed
+ */
+ default void testRunFinished(Result result) {
+ }
+
+ /**
+ * Called when a test class is about to be started.
+ *
+ * @param clazz the test class
+ */
+ default void testClassStarted(Class<?> clazz) {
+ }
+
+ /**
+ * Called when all tests of a test class have finished.
+ *
+ * @param clazz the test class
+ * @param numPassed number of tests in {@code clazz} that passed
+ * @param numFailed number of tests in {@code clazz} that failed
+ */
+ default void testClassFinished(Class<?> clazz, int numPassed, int numFailed) {
+ }
+
+ /**
+ * Called when an atomic test is about to be started. This is also called for ignored tests.
+ *
+ * @param description the description of the test that is about to be run (generally a class and
+ * method name)
+ */
+ default void testStarted(Description description) {
+ }
+
+ /**
+ * Called when an atomic test has finished, whether the test succeeds, fails or is ignored.
+ *
+ * @param description the description of the test that just ran
+ */
+ default void testFinished(Description description) {
+ }
+
+ /**
+ * Called when an atomic test fails.
+ *
+ * @param failure describes the test that failed and the exception that was thrown
+ */
+ default void testFailed(Failure failure) {
+ }
+
+ /**
+ * Called when a test will not be run, generally because a test method is annotated with
+ * {@link org.junit.Ignore}.
+ *
+ * @param description describes the test that will not be run
+ */
+ default void testIgnored(Description description) {
+ }
+
+ /**
+ * Called when an atomic test succeeds.
+ *
+ * @param description describes the test that will not be run
+ */
+ default void testSucceeded(Description description) {
+ }
+
+ /**
+ * Called when an atomic test flags that it assumes a condition that is false.
+ *
+ * @param failure describes the test that failed and the {@link AssumptionViolatedException}
+ * that was thrown
+ */
+ default void testAssumptionFailure(Failure failure) {
+ }
+
+ /**
+ * Called after {@link #testClassFinished(Class, int, int)}.
+ */
+ default void testClassFinishedDelimiter() {
+ }
+
+ /**
+ * Called after {@link #testClassStarted(Class)}.
+ */
+ default void testClassStartedDelimiter() {
+ }
+
+ /**
+ * Called after {@link #testStarted(Description)}.
+ */
+ default void testStartedDelimiter() {
+ }
+
+ /**
+ * Called after {@link #testFailed(Failure)}.
+ */
+ default void testFinishedDelimiter() {
+ }
+
+ default boolean beVerbose() {
+ return false;
+ }
+
+ PrintStream getWriter();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/MxRunListenerDecorator.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.io.*;
+
+import org.junit.runner.*;
+import org.junit.runner.notification.*;
+
+abstract class MxRunListenerDecorator implements MxRunListener {
+
+ private final MxRunListener l;
+
+ MxRunListenerDecorator(MxRunListener l) {
+ this.l = l;
+ }
+
+ @Override
+ public void testRunStarted(Description description) {
+ l.testRunStarted(description);
+ }
+
+ @Override
+ public void testRunFinished(Result result) {
+ l.testRunFinished(result);
+ }
+
+ @Override
+ public void testAssumptionFailure(Failure failure) {
+ l.testAssumptionFailure(failure);
+ }
+
+ @Override
+ public void testIgnored(Description description) {
+ l.testIgnored(description);
+ }
+
+ @Override
+ public void testClassStarted(Class<?> clazz) {
+ l.testClassStarted(clazz);
+ }
+
+ @Override
+ public void testClassFinished(Class<?> clazz, int numPassed, int numFailed) {
+ l.testClassFinished(clazz, numPassed, numFailed);
+ }
+
+ @Override
+ public void testStarted(Description description) {
+ l.testStarted(description);
+ }
+
+ @Override
+ public void testFinished(Description description) {
+ l.testFinished(description);
+ }
+
+ @Override
+ public void testFailed(Failure failure) {
+ l.testFailed(failure);
+ }
+
+ @Override
+ public void testSucceeded(Description description) {
+ l.testSucceeded(description);
+ }
+
+ @Override
+ public PrintStream getWriter() {
+ return l.getWriter();
+ }
+
+ public void testClassFinishedDelimiter() {
+ l.testClassFinishedDelimiter();
+ }
+
+ public void testClassStartedDelimiter() {
+ l.testClassStartedDelimiter();
+ }
+
+ public void testStartedDelimiter() {
+ l.testStartedDelimiter();
+ }
+
+ public void testFinishedDelimiter() {
+ l.testFinishedDelimiter();
+ }
+
+ public boolean beVerbose() {
+ return l.beVerbose();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/TestResultLoggerDecorator.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+package com.oracle.mxtool.junit;
+
+import java.io.PrintStream;
+
+import org.junit.runner.Result;
+
+class TestResultLoggerDecorator extends MxRunListenerDecorator {
+
+ private final PrintStream passed;
+ private final PrintStream failed;
+
+ TestResultLoggerDecorator(PrintStream passed, PrintStream failed, MxRunListener l) {
+ super(l);
+ this.passed = passed;
+ this.failed = failed;
+ }
+
+ @Override
+ public void testClassFinished(Class<?> clazz, int numPassed, int numFailed) {
+ super.testClassFinished(clazz, numPassed, numFailed);
+ if (numFailed != 0) {
+ failed.println(clazz.getName());
+ } else {
+ passed.println(clazz.getName());
+ }
+ }
+
+ @Override
+ public void testRunFinished(Result result) {
+ super.testRunFinished(result);
+ passed.close();
+ failed.close();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/TextRunListener.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.io.PrintStream;
+
+import org.junit.internal.JUnitSystem;
+import org.junit.internal.TextListener;
+import org.junit.runner.Description;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
+
+class TextRunListener implements MxRunListener {
+
+ private final PrintStream fWriter;
+ protected Failure lastFailure;
+
+ TextRunListener(JUnitSystem system) {
+ this(system.out());
+ }
+
+ TextRunListener(PrintStream writer) {
+ fWriter = writer;
+ }
+
+ public boolean beVerbose() {
+ return false;
+ }
+
+ @Override
+ public PrintStream getWriter() {
+ return fWriter;
+ }
+
+ public Failure getLastFailure() {
+ return lastFailure;
+ }
+
+ @Override
+ public void testStarted(Description description) {
+ getWriter().print('.');
+ }
+
+ @Override
+ public void testFailed(Failure failure) {
+ getWriter().print('E');
+ lastFailure = failure;
+ }
+
+ @Override
+ public void testIgnored(Description description) {
+ getWriter().print('I');
+ }
+
+ public static RunListener createRunListener(MxRunListener l) {
+ return new TextListener(l.getWriter()) {
+ private Class<?> lastClass;
+ private int passedInLastClass;
+ private int failedInLastClass;
+ private boolean failed;
+
+ @Override
+ public void testStarted(Description description) {
+ Class<?> currentClass = description.getTestClass();
+ if (currentClass != lastClass) {
+ if (lastClass != null) {
+ l.testClassFinished(lastClass, passedInLastClass, failedInLastClass);
+ l.testClassFinishedDelimiter();
+ }
+ lastClass = currentClass;
+ passedInLastClass = 0;
+ failedInLastClass = 0;
+ l.testClassStarted(currentClass);
+ l.testClassStartedDelimiter();
+ }
+ failed = false;
+ l.testStarted(description);
+ l.testStartedDelimiter();
+ }
+
+ @Override
+ public void testFailure(Failure failure) {
+ failed = true;
+ failedInLastClass++;
+ l.testFailed(failure);
+ }
+
+ @Override
+ public void testFinished(Description description) {
+ // we have to do this because there is no callback for successful tests
+ if (!failed) {
+ l.testSucceeded(description);
+ passedInLastClass++;
+ }
+ l.testFinished(description);
+ l.testFinishedDelimiter();
+ }
+
+ @Override
+ public void testIgnored(Description description) {
+ testStarted(description);
+ l.testIgnored(description);
+ l.testFinished(description);
+ l.testFinishedDelimiter();
+ }
+
+ @Override
+ public void testRunStarted(Description description) {
+ l.testRunStarted(description);
+ }
+
+ @Override
+ public void testRunFinished(Result result) {
+ if (lastClass != null) {
+ l.testClassFinished(lastClass, passedInLastClass, failedInLastClass);
+ }
+ l.testRunFinished(result);
+ super.testRunFinished(result);
+ }
+
+ @Override
+ public void testAssumptionFailure(Failure failure) {
+ l.testAssumptionFailure(failure);
+ }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/TimingDecorator.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.runner.Description;
+
+/**
+ * Timing support for JUnit test runs.
+ */
+class TimingDecorator extends MxRunListenerDecorator {
+
+ private long startTime;
+ private long classStartTime;
+ private Description currentTest;
+ final Map<Class<?>, Long> classTimes;
+ final Map<Description, Long> testTimes;
+
+ TimingDecorator(MxRunListener l) {
+ super(l);
+ this.classTimes = new HashMap<>();
+ this.testTimes = new HashMap<>();
+ }
+
+ @Override
+ public void testClassStarted(Class<?> clazz) {
+ classStartTime = System.nanoTime();
+ super.testClassStarted(clazz);
+ }
+
+ @Override
+ public void testClassFinished(Class<?> clazz, int numPassed, int numFailed) {
+ long totalTime = System.nanoTime() - classStartTime;
+ super.testClassFinished(clazz, numPassed, numFailed);
+ if (beVerbose()) {
+ getWriter().print(' ' + valueToString(totalTime));
+ }
+ classTimes.put(clazz, totalTime / 1_000_000);
+ }
+
+ @Override
+ public void testStarted(Description description) {
+ currentTest = description;
+ startTime = System.nanoTime();
+ super.testStarted(description);
+ }
+
+ @Override
+ public void testFinished(Description description) {
+ long totalTime = System.nanoTime() - startTime;
+ super.testFinished(description);
+ if (beVerbose()) {
+ getWriter().print(" " + valueToString(totalTime));
+ }
+ currentTest = null;
+ testTimes.put(description, totalTime / 1_000_000);
+ }
+
+ private static String valueToString(long valueNS) {
+ long timeWholeMS = valueNS / 1_000_000;
+ long timeFractionMS = (valueNS / 100_000) % 10;
+ return String.format("%d.%d ms", timeWholeMS, timeFractionMS);
+ }
+
+ /**
+ * Gets the test currently starting but not yet completed along with the number of milliseconds
+ * it has been executing.
+ *
+ * @return {@code null} if there is no test currently executing
+ */
+ public Object[] getCurrentTestDuration() {
+ Description current = currentTest;
+ if (current != null) {
+ long timeMS = (System.nanoTime() - startTime) / 1_000_000;
+ return new Object[]{current, timeMS};
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/VerboseTextListener.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,132 @@
+/*
+ * 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.
+ */
+package com.oracle.mxtool.junit;
+
+import java.io.*;
+
+import org.junit.internal.*;
+import org.junit.runner.*;
+import org.junit.runner.notification.*;
+
+class VerboseTextListener extends TextRunListener {
+
+ private static final int DEFAULT_MAX_TEST_PER_CLASS = 50;
+ public static final int SHOW_ALL_TESTS = Integer.MAX_VALUE;
+ private final int classesCount;
+ private final int maxTestsPerClass;
+ private int currentClassNum;
+ private int currentTestNum;
+
+ VerboseTextListener(JUnitSystem system, int classesCount) {
+ this(system.out(), classesCount, DEFAULT_MAX_TEST_PER_CLASS);
+ }
+
+ VerboseTextListener(JUnitSystem system, int classesCount, int maxTests) {
+ this(system.out(), classesCount, maxTests);
+ }
+
+ VerboseTextListener(PrintStream writer, int classesCount, int maxTests) {
+ super(writer);
+ maxTestsPerClass = maxTests;
+ this.classesCount = classesCount;
+ }
+
+ @Override
+ public boolean beVerbose() {
+ return currentTestNum < maxTestsPerClass;
+ }
+
+ @Override
+ public void testClassStarted(Class<?> clazz) {
+ ++currentClassNum;
+ getWriter().printf("%s started (%d of %d)", clazz.getName(), currentClassNum, classesCount);
+ currentTestNum = 0;
+ }
+
+ @Override
+ public void testClassFinished(Class<?> clazz, int numPassed, int numFailed) {
+ getWriter().print(clazz.getName() + " finished");
+ }
+
+ @Override
+ public void testStarted(Description description) {
+ if (beVerbose()) {
+ getWriter().print(" " + description.getMethodName() + ": ");
+ currentTestNum++;
+ } else {
+ super.testStarted(description);
+ }
+ }
+
+ @Override
+ public void testIgnored(Description description) {
+ if (beVerbose()) {
+ getWriter().print("Ignored");
+ } else {
+ super.testIgnored(description);
+ }
+ }
+
+ @Override
+ public void testSucceeded(Description description) {
+ if (beVerbose()) {
+ getWriter().print("Passed");
+ } else {
+ super.testSucceeded(description);
+ }
+ }
+
+ @Override
+ public void testAssumptionFailure(Failure failure) {
+ if (beVerbose()) {
+ getWriter().printf("(%s) ", failure.getMessage());
+ } else {
+ super.testAssumptionFailure(failure);
+ }
+ }
+
+ @Override
+ public void testFailed(Failure failure) {
+ getWriter().print("FAILED");
+ lastFailure = failure;
+ }
+
+ @Override
+ public void testClassFinishedDelimiter() {
+ getWriter().println();
+ }
+
+ @Override
+ public void testClassStartedDelimiter() {
+ getWriter().println();
+ }
+
+ @Override
+ public void testFinishedDelimiter() {
+ if (beVerbose()) {
+ getWriter().println();
+ } else {
+ super.testFinishedDelimiter();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/common/GraalUnitTestLauncher.java Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,266 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package compiler.graalunit.common;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+import java.nio.file.*;
+import java.util.stream.Collectors;
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+/*
+ * This is helper class used to run Graal unit tests.
+ * It accepts two arguments:
+ * -prefix TEST_PREFIX_TO_DEFINE_SET_OF_TESTS_TO_RUN (Ex: -prefix org.graalvm.compiler.api.test)
+ * -exclude EXCLUDED_TESTS_FILE_NAME
+ */
+public class GraalUnitTestLauncher {
+
+ static final String MXTOOL_JARFILE = "com.oracle.mxtool.junit.jar";
+ static final String GRAAL_UNITTESTS_JARFILE = "jdk.vm.compiler.tests.jar";
+
+ static final String[] GRAAL_EXTRA_JARS = {"junit-4.12.jar", "asm-5.0.4.jar", "asm-tree-5.0.4.jar",
+ "hamcrest-core-1.3.jar", "java-allocation-instrumenter.jar"};
+
+ static final String GENERATED_TESTCLASSES_FILENAME = "list.testclasses";
+
+ // Library dir used to find Graal specific jar files.
+ static String libsDir;
+ static {
+ libsDir = System.getProperty("graalunit.libs");
+ if (libsDir == null || libsDir.isEmpty()) {
+ libsDir = System.getenv("TEST_IMAGE_GRAAL_DIR");
+ }
+
+ if (libsDir == null || libsDir.isEmpty())
+ throw new RuntimeException("ERROR: Graal library directory is not specified, use -Dgraalunit.libs or TEST_IMAGE_GRAAL_DIR environment variable.");
+
+ System.out.println("INFO: graal libs dir is '" + libsDir + "'");
+ }
+
+ /*
+ * Generates --add-exports <module>/<package>=<target-module> flags and
+ * returns them as array list.
+ *
+ * @param moduleName
+ * Name of the module to update export data
+ *
+ * @param targetModule
+ * Name of the module to whom to export
+ */
+ static ArrayList<String> getModuleExports(String moduleName, String targetModule) {
+ ArrayList<String> exports = new ArrayList<String>();
+
+ Optional<Module> mod = ModuleLayer.boot().findModule(moduleName);
+ Set<String> packages;
+ if (mod.isPresent()) {
+ packages = mod.get().getPackages();
+
+ for (String pName : packages) {
+ exports.add("--add-exports");
+ exports.add(moduleName + "/" + pName + "=" + targetModule);
+ }
+ }
+
+ return exports;
+ }
+
+ /*
+ * Return list of tests which match specified prefix
+ *
+ * @param testPrefix
+ * String prefix to select tests
+ */
+ static ArrayList<String> getListOfTestsByPrefix(String testPrefix, Set<String> excludeTests) throws Exception {
+ ArrayList<String> classes = new ArrayList<String>();
+
+ final String testAnnotationName = "@Test";
+
+ // return empty list in case no selection prefix specified
+ if (testPrefix == null || testPrefix.isEmpty())
+ return classes;
+
+ // replace "." by "\." in test pattern
+ testPrefix = testPrefix.replaceAll("\\.", "\\\\.") + ".*";
+ System.out.println("INFO: use following pattern to find tests: " + testPrefix);
+
+ String graalUnitTestFilePath = String.join(File.separator, libsDir, GRAAL_UNITTESTS_JARFILE);
+ String classPath = String.join(File.pathSeparator, System.getProperty("java.class.path"),
+ String.join(File.separator, libsDir, MXTOOL_JARFILE));
+
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(false,
+ "-cp", classPath,
+ "com.oracle.mxtool.junit.FindClassesByAnnotatedMethods", graalUnitTestFilePath, testAnnotationName);
+
+ System.out.println("INFO: run command " + String.join(" ", pb.command()));
+
+ OutputAnalyzer out = new OutputAnalyzer(pb.start());
+ int exitCode = out.getExitValue();
+ if (exitCode != 0) {
+ throw new Exception("Failed to find tests, VM crashed with exit code " + exitCode);
+ }
+
+ String[] lines = out.getStdout().split(" ");
+ if (lines.length > 1) { // first line contains jar file name
+ for (int i = 1; i < lines.length; i++) {
+ String className = lines[i];
+
+ if (testPrefix.equals(".*") || className.matches(testPrefix)) {
+ // add the test only in case it is not in exclude list
+ if (excludeTests!= null && excludeTests.contains(className)) {
+ System.out.println("INFO: excluded test: " + className);
+ } else {
+ classes.add(className);
+ }
+ }
+ }
+ }
+
+ return classes;
+ }
+
+ /*
+ * Return set of excluded tests
+ *
+ * @param excludeFileName
+ * Name of the file to read excluded test list
+ */
+ static Set loadExcludeList(String excludeFileName) {
+ Set<String> excludeTests;
+
+ Path excludeFilePath = Paths.get(excludeFileName);
+ try {
+ excludeTests = Files.readAllLines(excludeFilePath).stream()
+ .filter(l -> !l.trim().isEmpty())
+ .filter(l -> !l.trim().startsWith("#"))
+ .map(l -> l.split(" ")[0])
+ .collect(Collectors.toSet());
+
+ } catch (IOException ioe) {
+ throw new Error("TESTBUG: failed to read " + excludeFilePath);
+ }
+
+ return excludeTests;
+ }
+
+ static String getUsageString() {
+ return "Usage: " + GraalUnitTestLauncher.class.getName() + " " +
+ "-prefix (org.graalvm.compiler.api.test) " +
+ "-exclude <ExcludedTestsFileName>" + System.lineSeparator();
+ }
+
+ public static void main(String... args) throws Exception {
+
+ String testPrefix = null;
+ String excludeFileName = null;
+
+ int i=0;
+ String arg, val;
+ while (i+1 < args.length) {
+ arg = args[i++];
+ val = args[i++];
+
+ switch (arg) {
+ case "-prefix":
+ testPrefix = val;
+ break;
+
+ case "-exclude":
+ excludeFileName = val;
+ break;
+
+ default:
+ System.out.println("WARN: illegal option " + arg);
+ break;
+ }
+ }
+
+ if (testPrefix == null)
+ throw new Error("TESTBUG: no tests to run specified." + System.lineSeparator() + getUsageString());
+
+
+ Set<String> excludeTests = null;
+ if (excludeFileName != null) {
+ excludeTests = loadExcludeList(excludeFileName);
+ }
+
+ // Find list of tests which match provided predicate and write into GENERATED_TESTCLASSES_FILENAME file
+ ArrayList<String> tests = getListOfTestsByPrefix(testPrefix, excludeTests);
+ if (tests.size() > 0) {
+ Files.write(Paths.get(GENERATED_TESTCLASSES_FILENAME), String.join(System.lineSeparator(), tests).getBytes());
+ } else {
+ throw new Error("TESTBUG: no tests found for prefix " + testPrefix);
+ }
+
+ ArrayList<String> javaFlags = new ArrayList<String>();
+
+ // add modules and exports
+ javaFlags.add("--add-modules");
+ javaFlags.add("jdk.internal.vm.compiler,jdk.internal.vm.ci");
+ javaFlags.add("--add-exports");
+ javaFlags.add("java.base/jdk.internal.module=ALL-UNNAMED");
+ javaFlags.addAll(getModuleExports("jdk.internal.vm.compiler", "ALL-UNNAMED"));
+ javaFlags.addAll(getModuleExports("jdk.internal.vm.ci", "ALL-UNNAMED,jdk.internal.vm.compiler"));
+
+
+ // add VM flags
+ javaFlags.add("-XX:+UnlockExperimentalVMOptions");
+ javaFlags.add("-XX:+EnableJVMCI");
+ javaFlags.add("-Djava.awt.headless=true");
+ javaFlags.add("-esa");
+ javaFlags.add("-ea");
+
+
+ // generate class path
+ ArrayList<String> graalJars = new ArrayList<String>(Arrays.asList(GRAAL_EXTRA_JARS));
+ graalJars.add(MXTOOL_JARFILE);
+ graalJars.add(GRAAL_UNITTESTS_JARFILE);
+
+ String graalJarsCP = graalJars.stream()
+ .map(s -> String.join(File.separator, libsDir, s))
+ .collect(Collectors.joining(File.pathSeparator));
+
+ javaFlags.add("-cp");
+ javaFlags.add(String.join(File.pathSeparator, System.getProperty("java.class.path"), graalJarsCP));
+
+ //
+ javaFlags.add("com.oracle.mxtool.junit.MxJUnitWrapper");
+ javaFlags.add("-JUnitVerbose");
+ javaFlags.add("-JUnitEagerStackTrace");
+ javaFlags.add("-JUnitEnableTiming");
+
+ javaFlags.add("@"+GENERATED_TESTCLASSES_FILENAME);
+
+ ProcessBuilder javaPB = ProcessTools.createJavaProcessBuilder(true,
+ javaFlags.toArray(new String[javaFlags.size()]));
+ System.out.println("INFO: run command: " + String.join(" ", javaPB.command()));
+
+ OutputAnalyzer outputAnalyzer = new OutputAnalyzer(javaPB.start());
+ System.out.println("INFO: execution result: " + outputAnalyzer.getOutput());
+ outputAnalyzer.shouldHaveExitValue(0);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/generateTests.sh Thu Jun 28 17:07:34 2018 -0700
@@ -0,0 +1,72 @@
+#!/bin/bash
+#
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+while read -r fName pName requireInfo
+do
+ fName="${fName}Test.java"
+ echo "Generate $fName for $pName ..."
+
+ cat << EOF | sed 's/[[:blank:]]*$//' > $fName
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI
+ * $requireInfo
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix $pName -exclude ExcludeList.txt
+ */
+EOF
+
+done < TestPackages.txt
+
--- a/test/jtreg-ext/requires/VMProps.java Thu Jun 28 16:45:15 2018 -0700
+++ b/test/jtreg-ext/requires/VMProps.java Thu Jun 28 17:07:34 2018 -0700
@@ -257,11 +257,12 @@
/**
* Selected sets of final flags.
- * @param map -property-value pairs
+ * @param map - property-value pairs
*/
protected void vmOptFinalFlags(Map<String, String> map) {
vmOptFinalFlag(map, "ClassUnloading");
vmOptFinalFlag(map, "UseCompressedOops");
+ vmOptFinalFlag(map, "EnableJVMCI");
}
/**