author | ihse |
Tue, 28 Nov 2017 09:40:50 +0100 | |
branch | ihse-testmakefiles-branch |
changeset 55899 | 789766475fe4 |
parent 55889 | 3934c59055ab |
child 55914 | dda999e8814c |
permissions | -rw-r--r-- |
55881 | 1 |
# |
2 |
# Copyright (c) 2017, 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 |
||
55884 | 26 |
################################################################################ |
27 |
# Initial bootstrapping, copied and stripped down from Makefile and Init.gmk |
|
28 |
################################################################################ |
|
55881 | 29 |
|
30 |
# In Cygwin, the MAKE variable gets prepended with the current directory if the |
|
31 |
# make executable is called using a Windows mixed path (c:/cygwin/bin/make.exe). |
|
32 |
ifneq ($(findstring :, $(MAKE)), ) |
|
33 |
export MAKE := $(patsubst $(CURDIR)%, %, $(patsubst $(CURDIR)/%, %, $(MAKE))) |
|
34 |
endif |
|
35 |
||
36 |
# Locate this Makefile |
|
37 |
ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))),) |
|
38 |
makefile_path := $(CURDIR)/$(strip $(lastword $(MAKEFILE_LIST))) |
|
39 |
else |
|
40 |
makefile_path := $(lastword $(MAKEFILE_LIST)) |
|
41 |
endif |
|
55884 | 42 |
TOPDIR := $(strip $(patsubst %/make/, %, $(dir $(makefile_path)))) |
55881 | 43 |
|
44 |
################################################################################ |
|
55884 | 45 |
# Functions |
46 |
################################################################################ |
|
55881 | 47 |
|
55899 | 48 |
# Setup a required or optional variable, and/or check that it is properly |
49 |
# given. |
|
50 |
# Note: No spaces are allowed around the arguments. |
|
51 |
# |
|
52 |
# $1: The name of the argument |
|
53 |
# $2: The default value, if any, or OPTIONAL (do not provide a default but |
|
54 |
# do not exit if it is missing) |
|
55 |
# $3: If NO_CHECK, disable checking for target file/directory existence |
|
56 |
define SetupVariable |
|
55881 | 57 |
ifeq ($$($1), ) |
55884 | 58 |
ifeq ($2, ) |
59 |
$$(info Error: Variable $1 is missing, needed for run-tests-prebuilt) |
|
60 |
$$(error Cannot continue.) |
|
55899 | 61 |
else ifeq ($2, OPTIONAL) |
62 |
ifneq ($$(findstring $$(LOG), debug trace), ) |
|
63 |
$$(info Optional prebuilt variable $1 not provided) |
|
64 |
endif |
|
55884 | 65 |
else |
66 |
$$(info Variable $1 is missing, using default $2) |
|
67 |
$1:=$2 |
|
68 |
endif |
|
55881 | 69 |
else |
55889 | 70 |
ifneq ($$(findstring $$(LOG), debug trace), ) |
71 |
$$(info Prebuilt variable $1=$$($1)) |
|
72 |
endif |
|
73 |
endif |
|
55899 | 74 |
# If $1 has a value (is not optional), and $3 is not set (to NO_CHECK), |
75 |
# and if wildcard is empty, then complain that the file is missing. |
|
76 |
ifeq ($$(strip $$(if $$($1), , OPTIONAL) $$(wildcard $$($1)) $3), ) |
|
77 |
$$(info Error: Variable $1 points to missing file/directory:) |
|
78 |
$$(info '$$($1)') |
|
79 |
$$(error Cannot continue.) |
|
55881 | 80 |
endif |
81 |
endef |
|
82 |
||
55884 | 83 |
# Create an ephemeral spec file |
55899 | 84 |
# |
85 |
# $1: The output file name |
|
86 |
# $2..$N: The lines to output to the file |
|
55884 | 87 |
define CreateNewSpec |
55888 | 88 |
$(if $(strip $(16)), \ |
55884 | 89 |
$(error Internal makefile error: \ |
90 |
Too many arguments to macro, please update CreateNewSpec in RunTestsPrebuilt.gmk) \ |
|
91 |
) \ |
|
92 |
$(shell rm -f $1) \ |
|
55888 | 93 |
$(foreach i, 2 3 4 5 6 7 8 9 10 11 12 13 14 15, \ |
55884 | 94 |
$(if $(strip $($i)), \ |
95 |
$(call AppendFile, $(strip $($i)), $1) \ |
|
96 |
) \ |
|
97 |
) |
|
98 |
endef |
|
99 |
||
100 |
################################################################################ |
|
101 |
# Setup ephemeral spec file |
|
102 |
################################################################################ |
|
103 |
||
104 |
# Verify that user has given correct additional input. |
|
105 |
||
106 |
# These variables are absolutely necessary |
|
55899 | 107 |
$(eval $(call SetupVariable,OUTPUTDIR)) |
108 |
$(eval $(call SetupVariable,BOOT_JDK)) |
|
109 |
$(eval $(call SetupVariable,JT_HOME)) |
|
55884 | 110 |
|
111 |
# These can have default values based on the ones above |
|
55899 | 112 |
$(eval $(call SetupVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk)) |
113 |
$(eval $(call SetupVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test)) |
|
55881 | 114 |
|
55888 | 115 |
# Provide default values for tools that we need |
55899 | 116 |
$(eval $(call SetupVariable,MAKE,make,NO_CHECK)) |
117 |
$(eval $(call SetupVariable,BASH,bash,NO_CHECK)) |
|
55888 | 118 |
|
55889 | 119 |
# Check optional variables |
55899 | 120 |
$(eval $(call SetupVariable,JIB_JAR,OPTIONAL)) |
55889 | 121 |
|
55884 | 122 |
# Now that we have verified that we have the required variables available, we |
123 |
# can include the prebuilt spec file ourselves, without an ephemeral spec |
|
124 |
# wrapper. This is required so we can include MakeBase which is needed for |
|
125 |
# CreateNewSpec. |
|
126 |
SPEC := $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk |
|
127 |
include $(SPEC) |
|
128 |
include $(TOPDIR)/make/common/MakeBase.gmk |
|
129 |
||
130 |
# Now we can include additional custom support. |
|
131 |
# This might define CUSTOM_NEW_SPEC_LINE |
|
132 |
ifneq ($(CUSTOM_MAKE_DIR), ) |
|
133 |
include $(CUSTOM_MAKE_DIR)/RunTestsPrebuilt.gmk |
|
134 |
endif |
|
135 |
||
136 |
NEW_SPEC := $(OUTPUTDIR)/run-test-spec.gmk |
|
137 |
||
138 |
$(call CreateNewSpec, $(NEW_SPEC), \ |
|
55881 | 139 |
# Generated file -- do not edit!, \ |
140 |
SPEC := $(NEW_SPEC), \ |
|
55884 | 141 |
TOPDIR := $(TOPDIR), \ |
55882 | 142 |
OUTPUTDIR := $(OUTPUTDIR), \ |
55881 | 143 |
BOOT_JDK := $(BOOT_JDK), \ |
55888 | 144 |
JT_HOME := $(JT_HOME), \ |
55881 | 145 |
JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \ |
146 |
TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \ |
|
55888 | 147 |
MAKE := $(MAKE), \ |
148 |
BASH := $(BASH), \ |
|
55889 | 149 |
JIB_JAR := $(JIB_JAR), \ |
55886
ff90766e3c60
Cleanup leftover custom stuff, include custom at the end.
ihse
parents:
55884
diff
changeset
|
150 |
include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \ |
55884 | 151 |
$(CUSTOM_NEW_SPEC_LINE), \ |
55881 | 152 |
) |
153 |
||
55884 | 154 |
|
155 |
################################################################################ |
|
156 |
# The run-test-prebuilt target |
|
55881 | 157 |
################################################################################ |
158 |
||
159 |
default: all |
|
160 |
||
55884 | 161 |
run-test-prebuilt: |
55881 | 162 |
@$(RM) -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error |
55884 | 163 |
@cd $(TOPDIR) && $(MAKE) -r -R -j 1 -s -I make/common/ \ |
55881 | 164 |
SPEC=$(NEW_SPEC) \ |
165 |
-f make/RunTests.gmk run-test TEST="$(TEST)" |
|
166 |
@if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \ |
|
167 |
exit 1 ; \ |
|
168 |
fi |
|
169 |
||
170 |
||
55884 | 171 |
all: run-test-prebuilt |
55881 | 172 |
|
173 |
.PHONY: default all |