changeset 49018:62b6e9b1dfdc

8196197: Enable the make system to calculate concurrency for JDK tests Reviewed-by: erikj, tbell
author ctornqvi
date Mon, 29 Jan 2018 08:19:37 -0500
parents f8188cc0d01d
children bcce1fa183e7
files test/TestCommon.gmk test/hotspot/jtreg/Makefile
diffstat 2 files changed, 38 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/test/TestCommon.gmk	Fri Jan 26 16:20:14 2018 -0800
+++ b/test/TestCommon.gmk	Mon Jan 29 08:19:37 2018 -0500
@@ -332,9 +332,45 @@
   TEST_SELECTION = $(TESTDIRS)
 endif
 
-ifdef CONCURRENCY
-  JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY)
+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
+
+ifndef CONCURRENCY_FACTOR
+  CONCURRENCY_FACTOR = 1
+endif
+
+# Concurrency based on min(cores / 2, 12) * CONCURRENCY_FACTOR
+CONCURRENCY := $(shell awk \
+  'BEGIN { \
+    c = $(NUM_CORES) / 2; \
+    if (c > 12) c = 12; \
+    c = c * $(CONCURRENCY_FACTOR); \
+    if (c < 1) c = 1; \
+    printf "%.0f", c; \
+  }')
+JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY)
+
+# 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))
+
 ifdef EXTRA_JTREG_OPTIONS
   JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
 endif
--- a/test/hotspot/jtreg/Makefile	Fri Jan 26 16:20:14 2018 -0800
+++ b/test/hotspot/jtreg/Makefile	Mon Jan 29 08:19:37 2018 -0500
@@ -38,47 +38,6 @@
 
 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
-
-ifndef CONCURRENCY_FACTOR
-  CONCURRENCY_FACTOR = 1
-endif
-
-# Concurrency based on min(cores / 2, 12) * CONCURRENCY_FACTOR
-CONCURRENCY := $(shell awk \
-  'BEGIN { \
-    c = $(NUM_CORES) / 2; \
-    if (c > 12) c = 12; \
-    c = c * $(CONCURRENCY_FACTOR); \
-    if (c < 1) c = 1; \
-    printf "%.0f", c; \
-  }')
-
-# 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 ../../TestCommon.gmk