1 #
   2 # Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 ################################################################################
  27 # This file builds Graal component of the JTReg tests for Hotspot.
  28 # It also covers the test-image part, where the built files are copied to the
  29 # test image.
  30 ################################################################################
  31 
  32 default: all
  33 
  34 include $(SPEC)
  35 include MakeBase.gmk
  36 include SetupJavaCompilers.gmk
  37 
  38 TARGETS_BUILD :=
  39 TARGETS_IMAGE :=
  40 TARGETS_EXTRA_LIB :=
  41 
  42 ifeq ($(INCLUDE_GRAAL), true)
  43   ifneq ($(GRAALUNIT_LIB), )
  44     SRC_DIR := $(TOPDIR)/src/jdk.internal.vm.compiler/share/classes
  45     TEST_DIR := $(TOPDIR)/test/hotspot/jtreg/compiler/graalunit
  46     COMPILE_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/test/graalunit
  47     LIB_OUTPUTDIR := $(TEST_IMAGE_DIR)/hotspot/jtreg/graal
  48 
  49     ### Copy 3rd party libs
  50     $(eval $(call SetupCopyFiles, COPY_GRAALUNIT_LIBS, \
  51         FILES := $(wildcard $(GRAALUNIT_LIB)/*.jar), \
  52         DEST := $(LIB_OUTPUTDIR), \
  53     ))
  54 
  55     TARGETS_EXTRA_LIB += $(COPY_GRAALUNIT_LIBS)
  56 
  57     ### Compile and build graalunit tests
  58     $(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_TESTS, \
  59         SETUP := GENERATE_USINGJDKBYTECODE, \
  60         SRC := \
  61             $(SRC_DIR)/jdk.internal.vm.compiler.collections.test/src \
  62             $(SRC_DIR)/org.graalvm.compiler.api.directives.test/src \
  63             $(SRC_DIR)/org.graalvm.compiler.api.test/src \
  64             $(SRC_DIR)/org.graalvm.compiler.asm.aarch64.test/src \
  65             $(SRC_DIR)/org.graalvm.compiler.asm.amd64.test/src \
  66             $(SRC_DIR)/org.graalvm.compiler.asm.sparc.test/src \
  67             $(SRC_DIR)/org.graalvm.compiler.asm.test/src \
  68             $(SRC_DIR)/org.graalvm.compiler.core.amd64.test/src \
  69             $(SRC_DIR)/org.graalvm.compiler.core.test/src \
  70             $(SRC_DIR)/org.graalvm.compiler.debug.test/src \
  71             $(SRC_DIR)/org.graalvm.compiler.graph.test/src \
  72             $(SRC_DIR)/org.graalvm.compiler.hotspot.amd64.test/src \
  73             $(SRC_DIR)/org.graalvm.compiler.hotspot.lir.test/src \
  74             $(SRC_DIR)/org.graalvm.compiler.hotspot.sparc.test/src \
  75             $(SRC_DIR)/org.graalvm.compiler.hotspot.test/src \
  76             $(SRC_DIR)/org.graalvm.compiler.lir.test/src \
  77             $(SRC_DIR)/org.graalvm.compiler.loop.test/src \
  78             $(SRC_DIR)/org.graalvm.compiler.nodes.test/src \
  79             $(SRC_DIR)/org.graalvm.compiler.options.test/src \
  80             $(SRC_DIR)/org.graalvm.compiler.phases.common.test/src \
  81             $(SRC_DIR)/org.graalvm.compiler.replacements.test/src \
  82             $(SRC_DIR)/org.graalvm.compiler.test/src \
  83             $(SRC_DIR)/org.graalvm.util.test/src \
  84             $(SRC_DIR)/org.graalvm.compiler.jtt/src \
  85             $(SRC_DIR)/org.graalvm.compiler.lir.jtt/src \
  86             , \
  87         BIN := $(COMPILE_OUTPUTDIR)/jdk.vm.compiler.tests, \
  88         JAR := $(COMPILE_OUTPUTDIR)/jdk.vm.compiler.tests.jar, \
  89         CLASSPATH := \
  90             $(JDK_OUTPUTDIR)/modules/jdk.internal.vm.compiler \
  91             $(JDK_OUTPUTDIR)/modules/jdk.internal.vm.ci \
  92             $(LIB_OUTPUTDIR)/junit-4.12.jar \
  93             $(LIB_OUTPUTDIR)/asm-5.0.4.jar \
  94             $(LIB_OUTPUTDIR)/asm-tree-5.0.4.jar \
  95             $(LIB_OUTPUTDIR)/java-allocation-instrumenter.jar \
  96             $(LIB_OUTPUTDIR)/hamcrest-core-1.3.jar \
  97             , \
  98         ADD_JAVAC_FLAGS := \
  99             -Xlint:none -processorpath \
 100             $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.replacements.verifier.jar \
 101             --add-exports jdk.unsupported/sun.misc=ALL-UNNAMED \
 102             , \
 103     ))
 104 
 105     TARGETS_BUILD += $(BUILD_VM_COMPILER_TESTS)
 106 
 107 
 108     ### Compile and build mxtool
 109     $(eval $(call SetupJavaCompilation, BUILD_MXTOOL, \
 110         SETUP := GENERATE_USINGJDKBYTECODE, \
 111         SRC := $(TEST_DIR)/com.oracle.mxtool.junit, \
 112         BIN := $(COMPILE_OUTPUTDIR)/com.oracle.mxtool.junit, \
 113         JAR := $(COMPILE_OUTPUTDIR)/com.oracle.mxtool.junit.jar, \
 114         CLASSPATH := $(LIB_OUTPUTDIR)/junit-4.12.jar, \
 115     ))
 116 
 117     TARGETS_BUILD += $(BUILD_MXTOOL)
 118 
 119 
 120     ################################################################################
 121     # Targets for building test-image.
 122     ################################################################################
 123 
 124     # Copy to hotspot jtreg test image
 125     $(eval $(call SetupCopyFiles, COPY_HOTSPOT_JTREG_GRAAL, \
 126         SRC := $(COMPILE_OUTPUTDIR), \
 127         DEST := $(LIB_OUTPUTDIR), \
 128         FILES := jdk.vm.compiler.tests.jar com.oracle.mxtool.junit.jar, \
 129     ))
 130 
 131     TARGETS_IMAGE += $(COPY_HOTSPOT_JTREG_GRAAL)
 132   else
 133     $(info Skip building of Graal unit tests because 3rd party libraries directory is not specified)
 134   endif
 135 endif
 136 
 137 $(TARGETS_BUILD): $(TARGETS_EXTRA_LIB)
 138 build-test-hotspot-jtreg-graal: $(TARGETS_BUILD)
 139 test-image-hotspot-jtreg-graal: $(TARGETS_IMAGE)
 140 
 141 all: build-test-hotspot-jtreg-graal
 142 test-image: test-image-hotspot-jtreg-graal
 143 
 144 .PHONY: default all build-test-hotspot-jtreg-graal test-image-hotspot-jtreg-graal test-image