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
|
|
58 |
ifneq ($$(findstring $$(LOG_LEVEL), debug trace), )
|
|
59 |
$$(info Prebuilt variable $1=$$($1))
|
|
60 |
endif
|
|
61 |
endif
|
|
62 |
endef
|
|
63 |
|
55884
|
64 |
# Create an ephemeral spec file
|
|
65 |
# $1: the output file name
|
|
66 |
# $2..n: The lines to output to the file.
|
|
67 |
define CreateNewSpec
|
|
68 |
$(if $(strip $(13)), \
|
|
69 |
$(error Internal makefile error: \
|
|
70 |
Too many arguments to macro, please update CreateNewSpec in RunTestsPrebuilt.gmk) \
|
|
71 |
) \
|
|
72 |
$(shell rm -f $1) \
|
|
73 |
$(foreach i, 2 3 4 5 6 7 8 9 10 11 12, \
|
|
74 |
$(if $(strip $($i)), \
|
|
75 |
$(call AppendFile, $(strip $($i)), $1) \
|
|
76 |
) \
|
|
77 |
)
|
|
78 |
endef
|
|
79 |
|
|
80 |
################################################################################
|
|
81 |
# Setup ephemeral spec file
|
|
82 |
################################################################################
|
|
83 |
|
|
84 |
# Verify that user has given correct additional input.
|
|
85 |
|
|
86 |
# These variables are absolutely necessary
|
55882
|
87 |
$(eval $(call VerifyVariable,OUTPUTDIR))
|
55881
|
88 |
$(eval $(call VerifyVariable,BOOT_JDK))
|
|
89 |
$(eval $(call VerifyVariable,JT_HOME))
|
55884
|
90 |
|
|
91 |
# These can have default values based on the ones above
|
|
92 |
$(eval $(call VerifyVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk))
|
|
93 |
$(eval $(call VerifyVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test))
|
55881
|
94 |
|
55884
|
95 |
# Now that we have verified that we have the required variables available, we
|
|
96 |
# can include the prebuilt spec file ourselves, without an ephemeral spec
|
|
97 |
# wrapper. This is required so we can include MakeBase which is needed for
|
|
98 |
# CreateNewSpec.
|
|
99 |
SPEC := $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk
|
|
100 |
include $(SPEC)
|
|
101 |
include $(TOPDIR)/make/common/MakeBase.gmk
|
|
102 |
|
|
103 |
# Now we can include additional custom support.
|
|
104 |
# This might define CUSTOM_NEW_SPEC_LINE
|
|
105 |
ifneq ($(CUSTOM_MAKE_DIR), )
|
|
106 |
include $(CUSTOM_MAKE_DIR)/RunTestsPrebuilt.gmk
|
|
107 |
endif
|
|
108 |
|
|
109 |
NEW_SPEC := $(OUTPUTDIR)/run-test-spec.gmk
|
|
110 |
|
|
111 |
$(call CreateNewSpec, $(NEW_SPEC), \
|
55881
|
112 |
# Generated file -- do not edit!, \
|
|
113 |
SPEC := $(NEW_SPEC), \
|
55884
|
114 |
TOPDIR := $(TOPDIR), \
|
55882
|
115 |
OUTPUTDIR := $(OUTPUTDIR), \
|
55881
|
116 |
BOOT_JDK := $(BOOT_JDK), \
|
|
117 |
JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \
|
|
118 |
TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \
|
|
119 |
JT_HOME := $(JT_HOME), \
|
55884
|
120 |
$(CUSTOM_NEW_SPEC_LINE), \
|
|
121 |
include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \
|
55881
|
122 |
)
|
|
123 |
|
55884
|
124 |
|
|
125 |
################################################################################
|
|
126 |
# The run-test-prebuilt target
|
55881
|
127 |
################################################################################
|
|
128 |
|
|
129 |
default: all
|
|
130 |
|
55884
|
131 |
run-test-prebuilt:
|
55881
|
132 |
@$(RM) -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error
|
55884
|
133 |
@cd $(TOPDIR) && $(MAKE) -r -R -j 1 -s -I make/common/ \
|
55881
|
134 |
SPEC=$(NEW_SPEC) \
|
|
135 |
-f make/RunTests.gmk run-test TEST="$(TEST)"
|
|
136 |
@if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \
|
|
137 |
exit 1 ; \
|
|
138 |
fi
|
|
139 |
|
|
140 |
|
55884
|
141 |
all: run-test-prebuilt
|
55881
|
142 |
|
|
143 |
.PHONY: default all
|