author | ihse |
Mon, 27 Nov 2017 14:39:58 +0100 | |
branch | ihse-testmakefiles-branch |
changeset 55889 | 3934c59055ab |
parent 55888 | cd05c5ba480a |
child 55899 | 789766475fe4 |
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 |
|
48 |
define VerifyVariable |
|
49 |
ifeq ($$($1), ) |
|
55884 | 50 |
ifeq ($2, ) |
51 |
$$(info Error: Variable $1 is missing, needed for run-tests-prebuilt) |
|
52 |
$$(error Cannot continue.) |
|
53 |
else |
|
54 |
$$(info Variable $1 is missing, using default $2) |
|
55 |
$1:=$2 |
|
56 |
endif |
|
55881 | 57 |
else |
55889 | 58 |
ifneq ($$(findstring $$(LOG), debug trace), ) |
59 |
$$(info Prebuilt variable $1=$$($1)) |
|
60 |
endif |
|
61 |
endif |
|
62 |
endef |
|
63 |
||
64 |
define VerifyOptionalVariable |
|
65 |
ifeq ($$($1), ) |
|
66 |
ifneq ($$(findstring $$(LOG), debug trace), ) |
|
67 |
$$(info Optional prebuilt variable $1 not provided) |
|
68 |
endif |
|
69 |
else |
|
70 |
ifneq ($$(findstring $$(LOG), debug trace), ) |
|
55881 | 71 |
$$(info Prebuilt variable $1=$$($1)) |
72 |
endif |
|
73 |
endif |
|
74 |
endef |
|
75 |
||
55884 | 76 |
# Create an ephemeral spec file |
77 |
# $1: the output file name |
|
78 |
# $2..n: The lines to output to the file. |
|
79 |
define CreateNewSpec |
|
55888 | 80 |
$(if $(strip $(16)), \ |
55884 | 81 |
$(error Internal makefile error: \ |
82 |
Too many arguments to macro, please update CreateNewSpec in RunTestsPrebuilt.gmk) \ |
|
83 |
) \ |
|
84 |
$(shell rm -f $1) \ |
|
55888 | 85 |
$(foreach i, 2 3 4 5 6 7 8 9 10 11 12 13 14 15, \ |
55884 | 86 |
$(if $(strip $($i)), \ |
87 |
$(call AppendFile, $(strip $($i)), $1) \ |
|
88 |
) \ |
|
89 |
) |
|
90 |
endef |
|
91 |
||
92 |
################################################################################ |
|
93 |
# Setup ephemeral spec file |
|
94 |
################################################################################ |
|
95 |
||
96 |
# Verify that user has given correct additional input. |
|
97 |
||
98 |
# These variables are absolutely necessary |
|
55882 | 99 |
$(eval $(call VerifyVariable,OUTPUTDIR)) |
55881 | 100 |
$(eval $(call VerifyVariable,BOOT_JDK)) |
101 |
$(eval $(call VerifyVariable,JT_HOME)) |
|
55884 | 102 |
|
103 |
# These can have default values based on the ones above |
|
104 |
$(eval $(call VerifyVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk)) |
|
105 |
$(eval $(call VerifyVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test)) |
|
55881 | 106 |
|
55888 | 107 |
# Provide default values for tools that we need |
108 |
$(eval $(call VerifyVariable,MAKE,make)) |
|
109 |
$(eval $(call VerifyVariable,BASH,bash)) |
|
110 |
||
55889 | 111 |
# Check optional variables |
112 |
$(eval $(call VerifyOptionalVariable,JIB_JAR)) |
|
113 |
||
114 |
||
55884 | 115 |
# Now that we have verified that we have the required variables available, we |
116 |
# can include the prebuilt spec file ourselves, without an ephemeral spec |
|
117 |
# wrapper. This is required so we can include MakeBase which is needed for |
|
118 |
# CreateNewSpec. |
|
119 |
SPEC := $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk |
|
120 |
include $(SPEC) |
|
121 |
include $(TOPDIR)/make/common/MakeBase.gmk |
|
122 |
||
123 |
# Now we can include additional custom support. |
|
124 |
# This might define CUSTOM_NEW_SPEC_LINE |
|
125 |
ifneq ($(CUSTOM_MAKE_DIR), ) |
|
126 |
include $(CUSTOM_MAKE_DIR)/RunTestsPrebuilt.gmk |
|
127 |
endif |
|
128 |
||
129 |
NEW_SPEC := $(OUTPUTDIR)/run-test-spec.gmk |
|
130 |
||
131 |
$(call CreateNewSpec, $(NEW_SPEC), \ |
|
55881 | 132 |
# Generated file -- do not edit!, \ |
133 |
SPEC := $(NEW_SPEC), \ |
|
55884 | 134 |
TOPDIR := $(TOPDIR), \ |
55882 | 135 |
OUTPUTDIR := $(OUTPUTDIR), \ |
55881 | 136 |
BOOT_JDK := $(BOOT_JDK), \ |
55888 | 137 |
JT_HOME := $(JT_HOME), \ |
55881 | 138 |
JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \ |
139 |
TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \ |
|
55888 | 140 |
MAKE := $(MAKE), \ |
141 |
BASH := $(BASH), \ |
|
55889 | 142 |
JIB_JAR := $(JIB_JAR), \ |
55886
ff90766e3c60
Cleanup leftover custom stuff, include custom at the end.
ihse
parents:
55884
diff
changeset
|
143 |
include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \ |
55884 | 144 |
$(CUSTOM_NEW_SPEC_LINE), \ |
55881 | 145 |
) |
146 |
||
55884 | 147 |
|
148 |
################################################################################ |
|
149 |
# The run-test-prebuilt target |
|
55881 | 150 |
################################################################################ |
151 |
||
152 |
default: all |
|
153 |
||
55884 | 154 |
run-test-prebuilt: |
55881 | 155 |
@$(RM) -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error |
55884 | 156 |
@cd $(TOPDIR) && $(MAKE) -r -R -j 1 -s -I make/common/ \ |
55881 | 157 |
SPEC=$(NEW_SPEC) \ |
158 |
-f make/RunTests.gmk run-test TEST="$(TEST)" |
|
159 |
@if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \ |
|
160 |
exit 1 ; \ |
|
161 |
fi |
|
162 |
||
163 |
||
55884 | 164 |
all: run-test-prebuilt |
55881 | 165 |
|
166 |
.PHONY: default all |