Setup target os/cpu for prebuilt. ihse-testmakefiles-branch
authorihse
Wed, 29 Nov 2017 22:02:21 +0100
branchihse-testmakefiles-branch
changeset 55914 dda999e8814c
parent 55913 deb731bd1dc3
child 55915 edbc895d637b
Setup target os/cpu for prebuilt.
make/RunTestsPrebuilt.gmk
make/RunTestsPrebuiltSpec.gmk
--- a/make/RunTestsPrebuilt.gmk	Wed Nov 29 21:27:15 2017 +0100
+++ b/make/RunTestsPrebuilt.gmk	Wed Nov 29 22:02:21 2017 +0100
@@ -98,7 +98,7 @@
 endef
 
 ################################################################################
-# Setup ephemeral spec file
+# Check input and setup basic buildsystem support
 ################################################################################
 
 # Verify that user has given correct additional input.
@@ -127,6 +127,85 @@
 include $(SPEC)
 include $(TOPDIR)/make/common/MakeBase.gmk
 
+################################################################################
+# Determine what platform we're running on
+################################################################################
+UNAME := uname
+
+# Get OS name from uname (Cygwin inexplicably adds _NT-x.x)
+UNAME_OS := $(shell $(UNAME) -s | $(CUT) -f1 -d_)
+
+ifeq ($(UNAME_OS), CYGWIN)
+  OPENJDK_TARGET_OS := windows
+  OPENJDK_TARGET_OS_TYPE := windows
+  OPENJDK_TARGET_OS_ENV := windows.cygwin
+else
+  OPENJDK_TARGET_OS_TYPE:=unix
+  ifeq ($(UNAME_OS), Linux)
+    OPENJDK_TARGET_OS := linux
+  else ifeq ($(UNAME_OS), Darwin)
+    OPENJDK_TARGET_OS := macosx
+  else ifeq ($(UNAME_OS), SunOS)
+    OPENJDK_TARGET_OS := solaris
+  else
+    OPENJDK_TARGET_OS := $(UNAME_OS)
+  endif
+  OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS)
+endif
+
+# Assume little endian unless otherwise specified
+OPENJDK_TARGET_CPU_ENDIAN := little
+
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+  # On solaris, use uname -p
+  UNAME_CPU := $(shell $(UNAME) -p)
+  # Assume 64-bit platform
+  OPENJDK_TARGET_CPU_BITS := 64
+  ifeq ($(UNAME_CPU), i386)
+    OPENJDK_TARGET_CPU := x86_64
+  else ifeq ($(UNAME_CPU), sparc)
+    OPENJDK_TARGET_CPU := sparcv9
+    OPENJDK_TARGET_CPU_ENDIAN := big
+  else
+    OPENJDK_TARGET_CPU := $(UNAME_CPU)
+  endif
+else
+  # ... all other user uname -m
+  UNAME_CPU := $(shell $(UNAME) -m)
+  ifeq ($(UNAME_CPU), i686)
+    OPENJDK_TARGET_CPU := x86
+    OPENJDK_TARGET_CPU_BITS := 32
+  else
+    # Assume all others are 64-bit. We use the same CPU name as uname for
+    # at least x86_64 and aarch64.
+    OPENJDK_TARGET_CPU := $(UNAME_CPU)
+    OPENJDK_TARGET_CPU_BITS := 64
+  endif
+endif
+
+OPENJDK_TARGET_CPU_ARCH := $(OPENJDK_TARGET_CPU)
+ifeq ($(OPENJDK_TARGET_CPU), x86_64)
+  OPENJDK_TARGET_CPU_ARCH := x86
+else ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
+  OPENJDK_TARGET_CPU_ARCH := sparc
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  ifeq ($(wildcard $(TEST_IMAGE_DIR)/bin/fixpath.exe), )
+    $$(info Error: fixpath is missing from test image '$(TEST_IMAGE_DIR)')
+    $$(error Cannot continue.)
+  endif
+  FIXPATH := $(TEST_IMAGE_DIR)/bin/fixpath.exe -c
+  PATH_SEP:=;
+else
+  FIXPATH :=
+  PATH_SEP:=:
+endif
+
+################################################################################
+# Generate the ephemeral spec file
+################################################################################
+
 # Now we can include additional custom support.
 # This might define CUSTOM_NEW_SPEC_LINE
 ifneq ($(CUSTOM_MAKE_DIR), )
@@ -147,6 +226,15 @@
     MAKE := $(MAKE), \
     BASH := $(BASH), \
     JIB_JAR := $(JIB_JAR), \
+    FIXPATH := $(FIXPATH), \
+    PATH_SEP := $(PATH_SEP), \
+    OPENJDK_TARGET_OS := $(OPENJDK_TARGET_OS), \
+    OPENJDK_TARGET_OS_TYPE := $(OPENJDK_TARGET_OS_TYPE), \
+    OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS_ENV), \
+    OPENJDK_TARGET_CPU := $(OPENJDK_TARGET_CPU), \
+    OPENJDK_TARGET_CPU_ARCH := $(OPENJDK_TARGET_CPU_ARCH), \
+    OPENJDK_TARGET_CPU_BITS := $(OPENJDK_TARGET_CPU_BITS), \
+    OPENJDK_TARGET_CPU_ENDIAN := $(OPENJDK_TARGET_CPU_ENDIAN), \
     include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \
     $(CUSTOM_NEW_SPEC_LINE), \
 )
--- a/make/RunTestsPrebuiltSpec.gmk	Wed Nov 29 21:27:15 2017 +0100
+++ b/make/RunTestsPrebuiltSpec.gmk	Wed Nov 29 22:02:21 2017 +0100
@@ -23,7 +23,9 @@
 # questions.
 #
 
+################################################################################
 # Fake minimalistic spec file for RunTestsPrebuilt.gmk.
+################################################################################
 
 define VerifyVariable
   ifeq ($$($1), )
@@ -48,71 +50,60 @@
 $(eval $(call VerifyVariable,MAKE))
 $(eval $(call VerifyVariable,BASH))
 
-# FIXMEs
-
-FIXPATH :=
-CYGPATH := cygpath
-
+################################################################################
+# The "human readable" name of this configuration
+CONF_NAME := run-test-prebuilt
 
 ###FIXME
-# colon or semicolon
-PATH_SEP:=:
-
-
-LOG_LEVEL=info
+# Information about the build system
+NUM_CORES:=16
+MEMORY_SIZE:=28130
+# Number of parallel jobs to use for compilation
+JOBS?=16
+TEST_JOBS?=0
+#LOG_LEVEL=info
 #LOG_LEVEL=$(LOG_LEVEL)
 #MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS)
 
-# The built jdk will run in this target system.
-
-OPENJDK_TARGET_OS:=linux
-OPENJDK_TARGET_OS_TYPE:=unix
-OPENJDK_TARGET_OS_ENV:=linux
-
-OPENJDK_TARGET_CPU:=x86_64
-OPENJDK_TARGET_CPU_ARCH:=x86
-OPENJDK_TARGET_CPU_BITS:=64
-OPENJDK_TARGET_CPU_ENDIAN:=little
-
-#DEBUG_LEVEL:=@DEBUG_LEVEL@
-#HOTSPOT_DEBUG_LEVEL:=@HOTSPOT_DEBUG_LEVEL@
-
-#BUILD_GTEST := @BUILD_GTEST@
-
-### FIXME
-BUILD_FAILURE_HANDLER := true
-
-### FIXME
-# Information about the build system
-NUM_CORES:=16
-MEMORY_SIZE:=28130
-
-## FIXME
-# Number of parallel jobs to use for compilation
-JOBS?=16
-TEST_JOBS?=0
+### FIXME?
+#JAVA_FLAGS:= -Duser.language=en -Duser.country=US
+#JAVA_FLAGS_BIG:= -Xms64M -Xmx1600M -XX:ThreadStackSize=1536
+#JAVA_FLAGS_SMALL:= -XX:+UseSerialGC -Xms32M -Xmx512M -XX:TieredStopAtLevel=1
+#JAVA_FLAGS_JAVAC:= -XX:+UseSerialGC -Xms32M -Xmx512M -XX:TieredStopAtLevel=1
+#JAVA_TOOL_FLAGS_SMALL:= -J-XX:+UseSerialGC -J-Xms32M -J-Xmx512M -J-XX:TieredStopAtLevel=1
 
 ################################################################################
-
-
-# SPACE and COMMA are defined in MakeBase.gmk, but they are also used in
-# some definitions here, and are needed if MakeBase.gmk is not included before
-# this file.
+# Hard-coded values copied from spec.gmk.in.
 X:=
 SPACE:=$(X) $(X)
 COMMA:=,
-
-# The default make arguments
 MAKE_ARGS = $(MAKE_LOG_FLAGS) -r -R -I $(TOPDIR)/make/common SPEC=$(SPEC) \
     MAKE_LOG_FLAGS="$(MAKE_LOG_FLAGS)" LOG_LEVEL=$(LOG_LEVEL)
+BASH_ARGS := -o pipefail -e
+SHELL := $(BASH) $(BASH_ARGS)
 
-# Override the shell with bash
-BASH_ARGS := -o pipefail -e
-SHELL:=$(BASH) $(BASH_ARGS)
+################################################################################
+# Set some reasonable defaults for features
+DEBUG_LEVEL := release
+HOTSPOT_DEBUG_LEVEL := release
+BUILD_GTEST := true
+BUILD_FAILURE_HANDLER := true
 
-# The "human readable" name of this configuration
-CONF_NAME := run-test-prebuilt
+################################################################################
+# Alias some paths (that should not really be used) to our JDK image under test.
+SUPPORT_OUTPUTDIR := $(OUTPUTDIR)/support
+BUILDTOOLS_OUTPUTDIR := $(OUTPUTDIR)/buildtools
+HOTSPOT_OUTPUTDIR := $(OUTPUTDIR)/hotspot
+JDK_OUTPUTDIR := $(OUTPUTDIR)/jdk
+IMAGES_OUTPUTDIR := $(OUTPUTDIR)/images
+BUNDLES_OUTPUTDIR := $(OUTPUTDIR)/bundles
+TESTMAKE_OUTPUTDIR := $(OUTPUTDIR)/test-make
+MAKESUPPORT_OUTPUTDIR := $(OUTPUTDIR)/make-support
+BUILDJDK_OUTPUTDIR := $(OUTPUTDIR)/buildjdk
 
+JRE_IMAGE_DIR := $(JDK_IMAGE_DIR)
+
+################################################################################
 # Assume target platform is same as build platform
 OPENJDK_TARGET_OS := $(OPENJDK_BUILD_OS)
 OPENJDK_TARGET_OS_TYPE := $(OPENJDK_BUILD_OS_TYPE)
@@ -123,45 +114,28 @@
 OPENJDK_TARGET_CPU_BITS := $(OPENJDK_BUILD_CPU_BITS)
 OPENJDK_TARGET_CPU_ENDIAN := $(OPENJDK_BUILD_CPU_ENDIAN)
 
-SUPPORT_OUTPUTDIR := $(OUTPUTDIR)/support
-BUILDTOOLS_OUTPUTDIR := $(OUTPUTDIR)/buildtools
-
-HOTSPOT_OUTPUTDIR := $(OUTPUTDIR)/hotspot
-JDK_OUTPUTDIR := $(OUTPUTDIR)/jdk
-IMAGES_OUTPUTDIR := $(OUTPUTDIR)/images
-BUNDLES_OUTPUTDIR := $(OUTPUTDIR)/bundles
-TESTMAKE_OUTPUTDIR := $(OUTPUTDIR)/test-make
-MAKESUPPORT_OUTPUTDIR := $(OUTPUTDIR)/make-support
-BUILDJDK_OUTPUTDIR := $(OUTPUTDIR)/buildjdk
-
-### FIXME?
-#JAVA_FLAGS:= -Duser.language=en -Duser.country=US
-#JAVA_FLAGS_BIG:= -Xms64M -Xmx1600M -XX:ThreadStackSize=1536
-#JAVA_FLAGS_SMALL:= -XX:+UseSerialGC -Xms32M -Xmx512M -XX:TieredStopAtLevel=1
-#JAVA_FLAGS_JAVAC:= -XX:+UseSerialGC -Xms32M -Xmx512M -XX:TieredStopAtLevel=1
-#JAVA_TOOL_FLAGS_SMALL:= -J-XX:+UseSerialGC -J-Xms32M -J-Xmx512M -J-XX:TieredStopAtLevel=1
-
-JAVA_CMD:=$(BOOT_JDK)/bin/java
-JAVAC_CMD:=$(BOOT_JDK)/bin/javac
-JAVAH_CMD:=$(BOOT_JDK)/bin/javah
-JAR_CMD:=$(BOOT_JDK)/bin/jar
+################################################################################
+# Java executable definitions
+JAVA_CMD := $(BOOT_JDK)/bin/java
+JAVAC_CMD := $(BOOT_JDK)/bin/javac
+JAVAH_CMD := $(BOOT_JDK)/bin/javah
+JAR_CMD := $(BOOT_JDK)/bin/jar
 JLINK_CMD := $(JDK_OUTPUTDIR)/bin/jlink
 JMOD_CMD := $(JDK_OUTPUTDIR)/bin/jmod
-JARSIGNER_CMD:=$(BOOT_JDK)/bin/jarsigner
+JARSIGNER_CMD := $(BOOT_JDK)/bin/jarsigner
 
-# These variables are meant to be used. They are defined with = instead of := to make
-# it possible to override only the *_CMD variables.
-JAVA=$(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
-JAVA_SMALL=$(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
-JAVA_JAVAC=$(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_JAVAC) $(JAVA_FLAGS)
-JAVAC=$(FIXPATH) $(JAVAC_CMD)
-JAVAH=$(FIXPATH) $(JAVAH_CMD)
-JAR=$(FIXPATH) $(JAR_CMD)
-JLINK = $(FIXPATH) $(JLINK_CMD) $(JAVA_TOOL_FLAGS_SMALL)
-JMOD = $(FIXPATH) $(JMOD_CMD) $(JAVA_TOOL_FLAGS_SMALL)
-JARSIGNER=$(FIXPATH) $(JARSIGNER_CMD)
+JAVA := $(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
+JAVA_SMALL := $(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
+JAVA_JAVAC := $(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_JAVAC) $(JAVA_FLAGS)
+JAVAC := $(FIXPATH) $(JAVAC_CMD)
+JAVAH := $(FIXPATH) $(JAVAH_CMD)
+JAR := $(FIXPATH) $(JAR_CMD)
+JLINK := $(FIXPATH) $(JLINK_CMD) $(JAVA_TOOL_FLAGS_SMALL)
+JMOD := $(FIXPATH) $(JMOD_CMD) $(JAVA_TOOL_FLAGS_SMALL)
+JARSIGNER := $(FIXPATH) $(JARSIGNER_CMD)
 
-# Tools adhering to a minimal and common standard of posix compliance.
+################################################################################
+# Some common tools. Assume most common name and no path.
 AWK := awk
 BASENAME := basename
 CAT := cat
@@ -206,10 +180,3 @@
 EXPR := expr
 FILE := file
 HG := hg
-
-####################################################
-#
-# Misc
-#
-
-JRE_IMAGE_DIR := $(JDK_IMAGE_DIR)