hotspot/test/Makefile
author bobv
Tue, 29 Aug 2017 15:53:04 -0400
changeset 47100 17953cf82d51
parent 46570 676d6539e0e0
permissions -rw-r--r--
8186248: Allow more flexibility in selecting Heap % of available RAM Reviewed-by: dholmes, drwhite

#
# 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