author | ihse |
Mon, 27 Nov 2017 14:31:44 +0100 | |
branch | ihse-testmakefiles-branch |
changeset 55888 | cd05c5ba480a |
parent 55886 | ff90766e3c60 |
child 55889 | 3934c59055ab |
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 |
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 |
|
55888 | 68 |
$(if $(strip $(16)), \ |
55884 | 69 |
$(error Internal makefile error: \ |
70 |
Too many arguments to macro, please update CreateNewSpec in RunTestsPrebuilt.gmk) \ |
|
71 |
) \ |
|
72 |
$(shell rm -f $1) \ |
|
55888 | 73 |
$(foreach i, 2 3 4 5 6 7 8 9 10 11 12 13 14 15, \ |
55884 | 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 |
|
55888 | 95 |
# Provide default values for tools that we need |
96 |
$(eval $(call VerifyVariable,MAKE,make)) |
|
97 |
$(eval $(call VerifyVariable,BASH,bash)) |
|
98 |
||
55884 | 99 |
# Now that we have verified that we have the required variables available, we |
100 |
# can include the prebuilt spec file ourselves, without an ephemeral spec |
|
101 |
# wrapper. This is required so we can include MakeBase which is needed for |
|
102 |
# CreateNewSpec. |
|
103 |
SPEC := $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk |
|
104 |
include $(SPEC) |
|
105 |
include $(TOPDIR)/make/common/MakeBase.gmk |
|
106 |
||
107 |
# Now we can include additional custom support. |
|
108 |
# This might define CUSTOM_NEW_SPEC_LINE |
|
109 |
ifneq ($(CUSTOM_MAKE_DIR), ) |
|
110 |
include $(CUSTOM_MAKE_DIR)/RunTestsPrebuilt.gmk |
|
111 |
endif |
|
112 |
||
113 |
NEW_SPEC := $(OUTPUTDIR)/run-test-spec.gmk |
|
114 |
||
115 |
$(call CreateNewSpec, $(NEW_SPEC), \ |
|
55881 | 116 |
# Generated file -- do not edit!, \ |
117 |
SPEC := $(NEW_SPEC), \ |
|
55884 | 118 |
TOPDIR := $(TOPDIR), \ |
55882 | 119 |
OUTPUTDIR := $(OUTPUTDIR), \ |
55881 | 120 |
BOOT_JDK := $(BOOT_JDK), \ |
55888 | 121 |
JT_HOME := $(JT_HOME), \ |
55881 | 122 |
JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \ |
123 |
TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \ |
|
55888 | 124 |
MAKE := $(MAKE), \ |
125 |
BASH := $(BASH), \ |
|
55886
ff90766e3c60
Cleanup leftover custom stuff, include custom at the end.
ihse
parents:
55884
diff
changeset
|
126 |
include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \ |
55884 | 127 |
$(CUSTOM_NEW_SPEC_LINE), \ |
55881 | 128 |
) |
129 |
||
55884 | 130 |
|
131 |
################################################################################ |
|
132 |
# The run-test-prebuilt target |
|
55881 | 133 |
################################################################################ |
134 |
||
135 |
default: all |
|
136 |
||
55884 | 137 |
run-test-prebuilt: |
55881 | 138 |
@$(RM) -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error |
55884 | 139 |
@cd $(TOPDIR) && $(MAKE) -r -R -j 1 -s -I make/common/ \ |
55881 | 140 |
SPEC=$(NEW_SPEC) \ |
141 |
-f make/RunTests.gmk run-test TEST="$(TEST)" |
|
142 |
@if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \ |
|
143 |
exit 1 ; \ |
|
144 |
fi |
|
145 |
||
146 |
||
55884 | 147 |
all: run-test-prebuilt |
55881 | 148 |
|
149 |
.PHONY: default all |