test/hotspot/jtreg/Makefile
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 47100 hotspot/test/Makefile@17953cf82d51
child 47218 918745561887
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse

#
# Copyright (c) 1995, 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.  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.
#
#

NATIVE_TEST_PATH := hotspot/jtreg/native

TREAT_EXIT_CODE_1_AS_0 := true

CLEAN_BEFORE_PREP := true

USE_JTREG_VERSION := 4.1

USE_JTREG_ASSERT := false

LIMIT_JTREG_VM_MEMORY := false

IGNORE_MARKED_TESTS := true

# Get OS name from uname (Cygwin inexplicably adds _NT-5.1)
UNAME_S := $(shell uname -s | cut -f1 -d_)

ifeq ($(UNAME_S), SunOS)
  NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line)
endif
ifeq ($(UNAME_S), Linux)
  NUM_CORES := $(shell cat /proc/cpuinfo  | grep -c processor)
endif
ifeq ($(UNAME_S), Darwin)
  NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu)
endif
ifeq ($(findstring CYGWIN,$(UNAME_S)), CYGWIN)
  ifneq ($(NUMBER_OF_PROCESSORS), )
    NUM_CORES := $(NUMBER_OF_PROCESSORS)
  else
    ifneq ($(HOTSPOT_BUILD_JOBS), )
      NUM_CORES := $(HOTSPOT_BUILD_JOBS)
    else
      NUM_CORES := 1 # fallback
    endif
  endif
endif

# Concurrency based on min(cores / 2, 12)
CONCURRENCY := $(shell expr $(NUM_CORES) / 2)
ifeq ($(CONCURRENCY), 0)
  CONCURRENCY := 1
else ifeq ($(shell expr $(CONCURRENCY) \> 12), 1)
  CONCURRENCY := 12
endif

# Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since we may end up with a lot of JVM's
JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMPercentage=$(shell expr 25 / $(CONCURRENCY))

# Include the common base file with most of the logic
include ../../test/TestCommon.gmk

################################################################
# Default make rule (runs jtreg_tests)
all: hotspot_all
	@$(ECHO) "Testing completed successfully"

# Support "hotspot_" prefixed test make targets (too)
# The hotspot_% targets are used by the top level Makefile
# Unless explicitly defined below, hotspot_<x> is interpreted as a jtreg test group name
hotspot_%:
	$(ECHO) "Running tests: $@"
	$(MAKE) -j 1 TEST_SELECTION=":$@" UNIQUE_DIR=$@ jtreg_tests;

hotspot_internal:
	$(ALT_OUTPUTDIR)/jdk/bin/java -XX:+ExecuteInternalVMTests -XX:+ShowMessageBoxOnError -version

################################################################
ALT_MAKE ?= closed
-include $(ALT_MAKE)/Makefile

################################################################

# Set up the directory in which the jvm directories live (client/, server/, etc.)
ifeq ($(PLATFORM),windows)
JVMS_DIR := $(PRODUCT_HOME)/bin
else
JVMS_DIR := $(PRODUCT_HOME)/lib
endif

# Use the existance of a directory as a sign that jvm variant is available
CANDIDATE_JVM_VARIANTS := client minimal server
JVM_VARIANTS := $(strip $(foreach x,$(CANDIDATE_JVM_VARIANTS),$(if $(wildcard $(JVMS_DIR)/$(x)),$(x))))

################################################################

# Run the native gtest tests from the test image

define NEWLINE


endef


hotspot_gtest:
	$(foreach v, $(JVM_VARIANTS), \
	  $(MAKE) hotspot_gtest$v $(NEWLINE) )

hotspot_gtestserver hotspot_gtestclient hotspot_gtestminimal: hotspot_gtest%:
	$(TESTNATIVE_DIR)/hotspot/gtest/$*/gtestLauncher \
	    -jdk $(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")

PHONY_LIST += hotspot_gtest hotspot_gtestserver hotspot_gtestclient \
    hotspot_gtestminimal