author | mchung |
Wed, 07 Jun 2017 21:14:58 -0700 | |
changeset 45545 | 4580a3cc0899 |
parent 42134 | bbcdb49521b1 |
child 44027 | 3a3050924db2 |
permissions | -rw-r--r-- |
25854 | 1 |
# |
41260 | 2 |
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
25854 | 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 |
||
26 |
default: all |
|
27 |
||
28 |
include $(SPEC) |
|
29 |
include MakeBase.gmk |
|
30 |
||
31 |
THIS_FILE := $(SRC_ROOT)/test/make/TestMakeBase.gmk |
|
32 |
DEPS := $(THIS_FILE) \ |
|
33 |
$(SRC_ROOT)/make/common/MakeBase.gmk \ |
|
34 |
# |
|
35 |
||
30095
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
36 |
# Assert two strings are equal |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
37 |
# 1 - Tested value |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
38 |
# 2 - Exepected value |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
39 |
# 3 - Error message |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
40 |
define assert-equals |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
41 |
ifneq ($$(strip $1),$$(strip $2)) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
42 |
$$(error $3 - Expected >$$(strip $2)< - Got >$$(strip $1)<) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
43 |
endif |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
44 |
endef |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
45 |
|
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
46 |
# On macosx, file system timestamps only have 1 second resultion so must add |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
47 |
# sleeps to properly test dependencies. |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
48 |
ifeq ($(OPENJDK_BUILD_OS), macosx) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
49 |
SLEEP_ON_MAC := sleep 1 |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
50 |
endif |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
51 |
|
25854 | 52 |
OUTPUT_DIR := $(TESTMAKE_OUTPUTDIR)/make-base |
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
53 |
$(call MakeDir, $(OUTPUT_DIR)) |
25854 | 54 |
|
55 |
################################################################################ |
|
56 |
# Escape $ |
|
57 |
ifneq ($(call EscapeDollar, foo$$bar), foo\$$bar) |
|
58 |
$(error EscapeDollar failed $(call EscapeDollar, foo$$bar) foo\$$bar) |
|
59 |
endif |
|
60 |
||
61 |
ESCAPE_DOLLAR_DIR := $(OUTPUT_DIR)/escape-dollar |
|
62 |
||
63 |
$(ESCAPE_DOLLAR_DIR)/_escape_dollar: $(DEPS) |
|
64 |
$(RM) -r $(@D) |
|
65 |
$(MKDIR) -p $(@D) |
|
66 |
$(ECHO) foo\$$bar > $(@D)/file1 |
|
67 |
$(ECHO) $(call EscapeDollar, foo$$bar) > $(@D)/file2 |
|
68 |
$(ECHO) $(call EscapeDollar, foo\$$bar) > $(@D)/file3 |
|
69 |
$(DIFF) $(@D)/file1 $(@D)/file2 |
|
70 |
$(DIFF) $(@D)/file1 $(@D)/file3 |
|
71 |
$(TOUCH) $@ |
|
72 |
||
73 |
TEST_TARGETS += $(ESCAPE_DOLLAR_DIR)/_escape_dollar |
|
74 |
||
75 |
################################################################################ |
|
32553
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
76 |
# Test containing and not-containing |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
77 |
|
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
78 |
CONT_LIST := foo bar baz foobar foobaz |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
79 |
|
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
80 |
# Param 1 - string to look for |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
81 |
# Param 2 - expected result |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
82 |
define TestContaining |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
83 |
value := $$(call containing, $1, $(CONT_LIST)) |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
84 |
ifneq ($$(value), $2) |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
85 |
$$(info (call containing, $1, $(CONT_LIST))) |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
86 |
$$(error result >$$(value)<, expected >$2<) |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
87 |
endif |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
88 |
endef |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
89 |
|
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
90 |
$(eval $(call TestContaining,bar,bar foobar)) |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
91 |
$(eval $(call TestContaining,foo bar,foo bar foobar foobaz)) |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
92 |
|
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
93 |
# Param 1 - string to look for |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
94 |
# Param 2 - expected result |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
95 |
define TestNotContaining |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
96 |
value := $$(call not-containing, $1, $(CONT_LIST)) |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
97 |
ifneq ($$(value), $2) |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
98 |
$$(info (call not-containing, $1, $(CONT_LIST))) |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
99 |
$$(error result >$$(value)<, expected >$2<) |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
100 |
endif |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
101 |
endef |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
102 |
|
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
103 |
$(eval $(call TestNotContaining,bar,foo baz foobaz)) |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
104 |
$(eval $(call TestNotContaining,foo bar,baz)) |
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
105 |
|
418e3b5ff477
8136383: Improve make utilities containing and not-containing
erikj
parents:
30095
diff
changeset
|
106 |
################################################################################ |
28607
380f123263d8
8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents:
28600
diff
changeset
|
107 |
# Test Equals |
380f123263d8
8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents:
28600
diff
changeset
|
108 |
|
380f123263d8
8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents:
28600
diff
changeset
|
109 |
EQUALS_VALUE1 := value1$(SPACE) |
380f123263d8
8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents:
28600
diff
changeset
|
110 |
EQUALS_VALUE2 := value2 |
380f123263d8
8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents:
28600
diff
changeset
|
111 |
|
380f123263d8
8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents:
28600
diff
changeset
|
112 |
ifneq ($(call equals, $(EQUALS_VALUE1), $(EQUALS_VALUE2)), ) |
380f123263d8
8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents:
28600
diff
changeset
|
113 |
$(error The strings >$(EQUALS_VALUE1)< and >$(EQUALS_VALUE2)< are equal) |
380f123263d8
8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents:
28600
diff
changeset
|
114 |
endif |
380f123263d8
8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents:
28600
diff
changeset
|
115 |
|
380f123263d8
8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents:
28600
diff
changeset
|
116 |
ifeq ($(call equals, $(EQUALS_VALUE1), $(EQUALS_VALUE1)), ) |
380f123263d8
8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents:
28600
diff
changeset
|
117 |
$(error The strings >$(EQUALS_VALUE1)< and >$(EQUALS_VALUE1)< are not equal) |
380f123263d8
8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents:
28600
diff
changeset
|
118 |
endif |
380f123263d8
8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents:
28600
diff
changeset
|
119 |
|
380f123263d8
8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents:
28600
diff
changeset
|
120 |
################################################################################ |
30095
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
121 |
# Test remove-prefixes |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
122 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
123 |
$(eval $(call assert-equals, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
124 |
$(call remove-prefixes, pre, prefix postfix), fix postfix, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
125 |
Prefixes not properly removed)) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
126 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
127 |
$(eval $(call assert-equals, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
128 |
$(call remove-prefixes, pre post, prefix postfix), fix fix, \ |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
129 |
Prefixes not properly removed)) |
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
130 |
|
0034766ccb09
8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents:
29312
diff
changeset
|
131 |
################################################################################ |
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
132 |
# Test ShellQuote |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
133 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
134 |
SHELL_QUOTE_VALUE := foo '""' "''" bar |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
135 |
SHELL_QUOTE_RESULT := $(shell $(ECHO) $(call ShellQuote, \ |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
136 |
$(SHELL_QUOTE_VALUE))) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
137 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
138 |
ifneq ($(SHELL_QUOTE_VALUE), $(SHELL_QUOTE_RESULT)) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
139 |
$(error Expected: >$(SHELL_QUOTE_VALUE)< - Result: >$(SHELL_QUOTE_RESULT)<) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
140 |
endif |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
141 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
142 |
################################################################################ |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
143 |
# Test read and write to file |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
144 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
145 |
READ_WRITE_FILE := $(OUTPUT_DIR)/read-write |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
146 |
READ_WRITE_VALUE := foo '""' "''" \t\n\\ bar |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
147 |
$(call WriteFile, $(READ_WRITE_VALUE), $(READ_WRITE_FILE)) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
148 |
READ_WRITE_RESULT := $(call ReadFile, $(READ_WRITE_FILE)) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
149 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
150 |
ifneq ($(READ_WRITE_VALUE), $(READ_WRITE_RESULT)) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
151 |
$(error Expected: >$(READ_WRITE_VALUE)< - Result: >$(READ_WRITE_RESULT)<) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
152 |
endif |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
153 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
154 |
################################################################################ |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
155 |
# Test creating dependencies on make variables |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
156 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
157 |
VARDEP_DIR := $(OUTPUT_DIR)/vardep |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
158 |
VARDEP_SRC_FILE := $(VARDEP_DIR)/src-file |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
159 |
VARDEP_TARGET_FILE := $(VARDEP_DIR)/target-file |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
160 |
VARDEP_FLAG_FILE := $(VARDEP_DIR)/flag-file |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
161 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
162 |
$(VARDEP_DIR)/src-file: |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
163 |
$(MKDIR) -p $(@D) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
164 |
$(ECHO) "some string XXX" > $@ |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
165 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
166 |
$(VARDEP_TARGET_FILE): $(VARDEP_DIR)/src-file \ |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
167 |
$(call DependOnVariable, VARDEP_TEST_VAR) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
168 |
$(MKDIR) -p $(@D) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
169 |
$(SED) -e 's/XXX/$(VARDEP_TEST_VAR)/g' $< > $@ |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
170 |
$(TOUCH) $(VARDEP_FLAG_FILE) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
171 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
172 |
test-vardep: |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
173 |
$(RM) $(VARDEP_SRC_FILE) $(VARDEP_TARGET_FILE) $(VARDEP_FLAG_FILE) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
174 |
# |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
175 |
# Simply create the target file and verify that it has the correct value |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
176 |
# |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
177 |
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR=value1 $(VARDEP_TARGET_FILE) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
178 |
$(PRINTF) "Expecting value1: %s\n" "`$(CAT) $(VARDEP_DIR)/target-file`" |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
179 |
test "some string value1" = "`$(CAT) $(VARDEP_DIR)/target-file`" |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
180 |
test -e $(VARDEP_FLAG_FILE) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
181 |
# |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
182 |
# Make the target file again and verify that the value is updated with |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
183 |
# the new value |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
184 |
# |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
185 |
$(SLEEP_ON_MAC) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
186 |
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR=value2 $(VARDEP_TARGET_FILE) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
187 |
$(PRINTF) "Expecting value2: %s\n" "`$(CAT) $(VARDEP_DIR)/target-file`" |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
188 |
test "some string value2" = "`$(CAT) $(VARDEP_DIR)/target-file`" |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
189 |
test -e $(VARDEP_FLAG_FILE) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
190 |
# |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
191 |
# Make the target again with the same value and verify that the recipe |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
192 |
# was never run by checking that the flag file was not recreated |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
193 |
# |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
194 |
$(SLEEP_ON_MAC) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
195 |
$(RM) $(VARDEP_FLAG_FILE) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
196 |
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR=value2 $(VARDEP_TARGET_FILE) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
197 |
$(PRINTF) "Expecting value2: %s\n" "`$(CAT) $(VARDEP_DIR)/target-file`" |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
198 |
test "some string value2" = "`$(CAT) $(VARDEP_DIR)/target-file`" |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
199 |
test ! -e $(VARDEP_FLAG_FILE) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
200 |
# |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
201 |
# Test running with spaces at the end and the middle of the value |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
202 |
# and verify that the file isn't rewritten the second time |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
203 |
# |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
204 |
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR="value3 foo " $(VARDEP_TARGET_FILE) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
205 |
$(RM) $(VARDEP_FLAG_FILE) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
206 |
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR="value3 foo" $(VARDEP_TARGET_FILE) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
207 |
test ! -e $(VARDEP_FLAG_FILE) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
208 |
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR=" value3 foo" $(VARDEP_TARGET_FILE) |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
209 |
test ! -e $(VARDEP_FLAG_FILE) |
33054
bcb9f5ea5761
8140484: Vardeps broken when variable value contains '$'
erikj
parents:
32807
diff
changeset
|
210 |
# |
bcb9f5ea5761
8140484: Vardeps broken when variable value contains '$'
erikj
parents:
32807
diff
changeset
|
211 |
# Test including some problematic characters |
41875 | 212 |
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR='value4 \$$ORIGIN' $(VARDEP_TARGET_FILE) |
33054
bcb9f5ea5761
8140484: Vardeps broken when variable value contains '$'
erikj
parents:
32807
diff
changeset
|
213 |
$(RM) $(VARDEP_FLAG_FILE) |
41875 | 214 |
$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR='value4 \$$ORIGIN' $(VARDEP_TARGET_FILE) |
33054
bcb9f5ea5761
8140484: Vardeps broken when variable value contains '$'
erikj
parents:
32807
diff
changeset
|
215 |
test ! -e $(VARDEP_FLAG_FILE) |
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
216 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
217 |
# Test specifying a specific value file to store variable in |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
218 |
VARDEP_VALUE_FILE := $(VARDEP_DIR)/value-file |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
219 |
VARDEP_TEST_VAR2 := value3 |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
220 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
221 |
VARDEP_RETURN_VALUE := $(call DependOnVariable, VARDEP_TEST_VAR2, $(VARDEP_VALUE_FILE)) |
32807
20386e6d858f
8136385: Various build speed improvements for windows
erikj
parents:
32553
diff
changeset
|
222 |
$(eval $(call assert-equals, $(VARDEP_RETURN_VALUE), $(VARDEP_VALUE_FILE), \ |
20386e6d858f
8136385: Various build speed improvements for windows
erikj
parents:
32553
diff
changeset
|
223 |
Wrong filename returned)) |
33054
bcb9f5ea5761
8140484: Vardeps broken when variable value contains '$'
erikj
parents:
32807
diff
changeset
|
224 |
-include $(VARDEP_VALUE_FILE) |
bcb9f5ea5761
8140484: Vardeps broken when variable value contains '$'
erikj
parents:
32807
diff
changeset
|
225 |
$(eval $(call assert-equals, $(VARDEP_TEST_VAR2_old), $(VARDEP_TEST_VAR2), \ |
32807
20386e6d858f
8136385: Various build speed improvements for windows
erikj
parents:
32553
diff
changeset
|
226 |
Wrong contents in vardeps file)) |
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
227 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
228 |
# Test with a variable value containing some problematic characters |
42134
bbcdb49521b1
8169860: Clean up and unify the refactored Javadoc generation
ihse
parents:
41875
diff
changeset
|
229 |
VARDEP_TEST_VAR3 := foo '""' "''" bar \$$ORIGIN &\#x00a9 |
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
230 |
VARDEP_VALUE_FILE := $(call DependOnVariable, VARDEP_TEST_VAR3) |
33054
bcb9f5ea5761
8140484: Vardeps broken when variable value contains '$'
erikj
parents:
32807
diff
changeset
|
231 |
-include $(VARDEP_VALUE_FILE) |
42134
bbcdb49521b1
8169860: Clean up and unify the refactored Javadoc generation
ihse
parents:
41875
diff
changeset
|
232 |
$(eval $(call assert-equals, $(call EscapeHash,$(VARDEP_TEST_VAR3_old)), \ |
bbcdb49521b1
8169860: Clean up and unify the refactored Javadoc generation
ihse
parents:
41875
diff
changeset
|
233 |
$(call EscapeHash,$(VARDEP_TEST_VAR3)), \ |
32807
20386e6d858f
8136385: Various build speed improvements for windows
erikj
parents:
32553
diff
changeset
|
234 |
Wrong contents in vardep file)) |
28600
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
235 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
236 |
TEST_TARGETS += test-vardep |
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
237 |
|
09dd1740f176
8069261: Create make dependencies on make variable values
erikj
parents:
25854
diff
changeset
|
238 |
################################################################################ |
29312
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
239 |
# Test sequence |
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
240 |
|
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
241 |
ifneq ($(call sequence, 1, 1), 1) |
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
242 |
$(error Sequence 1, 1 should be "1", but was $(call sequence, 1, 1)) |
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
243 |
endif |
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
244 |
|
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
245 |
ifneq ($(call sequence, 2, 3), 2 3) |
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
246 |
$(error Sequence 2, 3 should be "2 3", but was $(call sequence, 2, 3)) |
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
247 |
endif |
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
248 |
|
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
249 |
ifneq ($(call sequence, 4, 9), 4 5 6 7 8 9) |
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
250 |
$(error Sequence 4, 9 should be "4 5 6 7 8 9", but was $(call sequence, 4, 9)) |
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
251 |
endif |
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
252 |
|
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
253 |
ifneq ($(call sequence, 5, 15), 5 6 7 8 9 10 11 12 13 14 15) |
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
254 |
$(error Sequence 5, 15 should be "5 6 7 8 9 10 11 12 13 14 15", \ |
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
255 |
but was $(call sequence, 5, 15)) |
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
28607
diff
changeset
|
256 |
endif |
25854 | 257 |
|
37030 | 258 |
################################################################################ |
259 |
# Test that PathList is safe when called multiple nested times. |
|
260 |
||
261 |
PATHLIST_INPUT := foo bar baz |
|
262 |
||
263 |
$(eval $(call assert-equals, \ |
|
264 |
$(call PathList, $(call PathList, $(PATHLIST_INPUT))), \ |
|
265 |
$(call PathList, $(PATHLIST_INPUT)), \ |
|
266 |
PathList call not safe for calling twice)) |
|
267 |
||
41260 | 268 |
################################################################################ |
269 |
# Test FindCommonPathPrefix |
|
270 |
||
271 |
$(eval $(call assert-equals, \ |
|
272 |
$(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/banan), \ |
|
273 |
/foo/bar, \ |
|
274 |
FindCommonPathPrefix, \ |
|
275 |
)) |
|
276 |
||
277 |
$(eval $(call assert-equals, \ |
|
278 |
$(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar), \ |
|
279 |
/foo/bar, \ |
|
280 |
FindCommonPathPrefix, \ |
|
281 |
)) |
|
282 |
||
283 |
$(eval $(call assert-equals, \ |
|
284 |
$(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/), \ |
|
285 |
/foo/bar, \ |
|
286 |
FindCommonPathPrefix, \ |
|
287 |
)) |
|
288 |
||
289 |
$(eval $(call assert-equals, \ |
|
290 |
$(call FindCommonPathPrefix, foo/bar/baz, foo/bar/banan), \ |
|
291 |
foo/bar, \ |
|
292 |
FindCommonPathPrefix, \ |
|
293 |
)) |
|
294 |
||
295 |
$(eval $(call assert-equals, \ |
|
296 |
$(call FindCommonPathPrefix, foo/bar/baz, /foo/bar/banan), \ |
|
297 |
, \ |
|
298 |
FindCommonPathPrefix, \ |
|
299 |
)) |
|
300 |
||
301 |
################################################################################ |
|
302 |
# DirToDotDot |
|
303 |
||
304 |
$(eval $(call assert-equals, \ |
|
305 |
$(call DirToDotDot, foo/bar/baz/), \ |
|
306 |
../../.., \ |
|
307 |
DirToDotDot, \ |
|
308 |
)) |
|
309 |
||
310 |
$(eval $(call assert-equals, \ |
|
311 |
$(call DirToDotDot, foo/bar), \ |
|
312 |
../.., \ |
|
313 |
DirToDotDot, \ |
|
314 |
)) |
|
315 |
||
316 |
$(eval $(call assert-equals, \ |
|
317 |
$(call DirToDotDot, /foo), \ |
|
318 |
.., \ |
|
319 |
DirToDotDot, \ |
|
320 |
)) |
|
321 |
||
322 |
################################################################################ |
|
323 |
# RelativePath |
|
324 |
||
325 |
$(eval $(call assert-equals, \ |
|
326 |
$(call RelativePath, foo/bar/baz, foo/bar/banan), \ |
|
327 |
../baz, \ |
|
328 |
RelativePath, \ |
|
329 |
)) |
|
330 |
||
331 |
$(eval $(call assert-equals, \ |
|
332 |
$(call RelativePath, foo/bar/baz/banan/kung, foo/bar/banan/kung), \ |
|
333 |
../../baz/banan/kung, \ |
|
334 |
RelativePath, \ |
|
335 |
)) |
|
336 |
||
337 |
$(eval $(call assert-equals, \ |
|
338 |
$(call RelativePath, /foo/bar/baz/banan/kung, /foo/bar/banan/kung/), \ |
|
339 |
../../baz/banan/kung, \ |
|
340 |
RelativePath, \ |
|
341 |
)) |
|
342 |
||
343 |
################################################################################ |
|
344 |
||
25854 | 345 |
all: $(TEST_TARGETS) |