test/make/TestMakeBase.gmk
author ihse
Thu, 18 Oct 2018 09:19:29 +0200
changeset 52186 0dac3131b0fd
parent 47334 09d386ddaa42
child 52342 9341b077bd55
permissions -rw-r--r--
8212587: equals in MakeBase does not handle empty strings correctly Reviewed-by: erikj
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     1
#
52186
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 47334
diff changeset
     2
# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     4
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    10
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    15
# accompanied this code).
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    16
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    20
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    23
# questions.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    24
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    25
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    26
default: all
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    27
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    28
include $(SPEC)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    29
include MakeBase.gmk
47334
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents: 47217
diff changeset
    30
include UtilsForTests.gmk
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    31
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 44027
diff changeset
    32
THIS_FILE := $(TOPDIR)/test/make/TestMakeBase.gmk
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    33
DEPS := $(THIS_FILE) \
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 44027
diff changeset
    34
    $(TOPDIR)/make/common/MakeBase.gmk \
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    35
    #
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    36
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    37
OUTPUT_DIR := $(TESTMAKE_OUTPUTDIR)/make-base
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    38
$(call MakeDir, $(OUTPUT_DIR))
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    39
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    40
################################################################################
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    41
# Escape $
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    42
ifneq ($(call EscapeDollar, foo$$bar), foo\$$bar)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    43
  $(error EscapeDollar failed $(call EscapeDollar, foo$$bar) foo\$$bar)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    44
endif
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    45
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    46
ESCAPE_DOLLAR_DIR := $(OUTPUT_DIR)/escape-dollar
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    47
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    48
$(ESCAPE_DOLLAR_DIR)/_escape_dollar: $(DEPS)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    49
	$(RM) -r $(@D)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    50
	$(MKDIR) -p $(@D)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    51
	$(ECHO) foo\$$bar > $(@D)/file1
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    52
	$(ECHO) $(call EscapeDollar, foo$$bar) > $(@D)/file2
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    53
	$(ECHO) $(call EscapeDollar, foo\$$bar) > $(@D)/file3
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    54
	$(DIFF) $(@D)/file1 $(@D)/file2
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    55
	$(DIFF) $(@D)/file1 $(@D)/file3
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    56
	$(TOUCH) $@
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    57
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    58
TEST_TARGETS += $(ESCAPE_DOLLAR_DIR)/_escape_dollar
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    59
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    60
################################################################################
32553
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    61
# Test containing and not-containing
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    62
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    63
CONT_LIST := foo bar baz foobar foobaz
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    64
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    65
# Param 1 - string to look for
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    66
# Param 2 - expected result
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    67
define TestContaining
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    68
  value := $$(call containing, $1, $(CONT_LIST))
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    69
  ifneq ($$(value), $2)
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    70
    $$(info (call containing, $1, $(CONT_LIST)))
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    71
    $$(error result >$$(value)<, expected >$2<)
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    72
  endif
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    73
endef
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    74
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    75
$(eval $(call TestContaining,bar,bar foobar))
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    76
$(eval $(call TestContaining,foo bar,foo bar foobar foobaz))
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
# Param 1 - string to look for
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    79
# Param 2 - expected result
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    80
define TestNotContaining
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    81
  value := $$(call not-containing, $1, $(CONT_LIST))
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    82
  ifneq ($$(value), $2)
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    83
    $$(info (call not-containing, $1, $(CONT_LIST)))
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    84
    $$(error result >$$(value)<, expected >$2<)
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    85
  endif
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    86
endef
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    87
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    88
$(eval $(call TestNotContaining,bar,foo baz foobaz))
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    89
$(eval $(call TestNotContaining,foo bar,baz))
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    90
418e3b5ff477 8136383: Improve make utilities containing and not-containing
erikj
parents: 30095
diff changeset
    91
################################################################################
28607
380f123263d8 8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents: 28600
diff changeset
    92
# Test Equals
380f123263d8 8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents: 28600
diff changeset
    93
380f123263d8 8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents: 28600
diff changeset
    94
EQUALS_VALUE1 := value1$(SPACE)
380f123263d8 8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents: 28600
diff changeset
    95
EQUALS_VALUE2 := value2
52186
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 47334
diff changeset
    96
EQUALS_EMPTY :=
28607
380f123263d8 8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents: 28600
diff changeset
    97
380f123263d8 8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents: 28600
diff changeset
    98
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
    99
  $(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
   100
endif
380f123263d8 8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents: 28600
diff changeset
   101
380f123263d8 8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents: 28600
diff changeset
   102
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
   103
  $(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
   104
endif
380f123263d8 8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents: 28600
diff changeset
   105
52186
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 47334
diff changeset
   106
ifeq ($(call equals, $(EQUALS_EMPTY), $(EQUALS_EMPTY)), )
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 47334
diff changeset
   107
  $(error The strings >$(EQUALS_EMPTY)< and >$(EQUALS_EMPTY)< are not equal)
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 47334
diff changeset
   108
endif
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 47334
diff changeset
   109
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 47334
diff changeset
   110
ifneq ($(call equals, $(EQUALS_EMPTY), $(EQUALS_VALUE2)), )
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 47334
diff changeset
   111
  $(error The strings >$(EQUALS_EMPTY)< and >$(EQUALS_VALUE2)< are equal)
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 47334
diff changeset
   112
endif
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 47334
diff changeset
   113
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 47334
diff changeset
   114
ifneq ($(call equals, $(EQUALS_VALUE2), $(EQUALS_EMPTY)), )
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 47334
diff changeset
   115
  $(error The strings >$(EQUALS_VALUE2)< and >$(EQUALS_EMPTY)< are equal)
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 47334
diff changeset
   116
endif
0dac3131b0fd 8212587: equals in MakeBase does not handle empty strings correctly
ihse
parents: 47334
diff changeset
   117
28607
380f123263d8 8071651: infinite build loops in 9-dev windows platform on Jan 26
erikj
parents: 28600
diff changeset
   118
################################################################################
30095
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   119
# Test remove-prefixes
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   120
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   121
$(eval $(call assert-equals, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   122
    $(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
   123
    Prefixes not properly removed))
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   124
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   125
$(eval $(call assert-equals, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   126
    $(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
   127
    Prefixes not properly removed))
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   128
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   129
################################################################################
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   130
# Test ShellQuote
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   131
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   132
SHELL_QUOTE_VALUE := foo '""' "''" bar
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   133
SHELL_QUOTE_RESULT := $(shell $(ECHO) $(call ShellQuote, \
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   134
    $(SHELL_QUOTE_VALUE)))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   135
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   136
ifneq ($(SHELL_QUOTE_VALUE), $(SHELL_QUOTE_RESULT))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   137
  $(error Expected: >$(SHELL_QUOTE_VALUE)< - Result: >$(SHELL_QUOTE_RESULT)<)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   138
endif
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   139
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   140
################################################################################
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   141
# Test read and write to file
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
READ_WRITE_FILE := $(OUTPUT_DIR)/read-write
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   144
READ_WRITE_VALUE := foo '""' "''" \t\n\\ bar
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   145
$(call WriteFile, $(READ_WRITE_VALUE), $(READ_WRITE_FILE))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   146
READ_WRITE_RESULT := $(call ReadFile, $(READ_WRITE_FILE))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   147
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   148
ifneq ($(READ_WRITE_VALUE), $(READ_WRITE_RESULT))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   149
  $(error Expected: >$(READ_WRITE_VALUE)< - Result: >$(READ_WRITE_RESULT)<)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   150
endif
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   151
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   152
################################################################################
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   153
# Test creating dependencies on make variables
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
VARDEP_DIR := $(OUTPUT_DIR)/vardep
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   156
VARDEP_SRC_FILE := $(VARDEP_DIR)/src-file
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   157
VARDEP_TARGET_FILE := $(VARDEP_DIR)/target-file
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   158
VARDEP_FLAG_FILE := $(VARDEP_DIR)/flag-file
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   159
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   160
$(VARDEP_DIR)/src-file:
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   161
	$(MKDIR) -p $(@D)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   162
	$(ECHO) "some string XXX" > $@
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   163
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   164
$(VARDEP_TARGET_FILE): $(VARDEP_DIR)/src-file \
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   165
    $(call DependOnVariable, VARDEP_TEST_VAR)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   166
	$(MKDIR) -p $(@D)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   167
	$(SED) -e 's/XXX/$(VARDEP_TEST_VAR)/g' $< > $@
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   168
	$(TOUCH) $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   169
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   170
test-vardep:
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   171
	$(RM) $(VARDEP_SRC_FILE) $(VARDEP_TARGET_FILE) $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   172
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   173
        # 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
   174
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   175
	$(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
   176
	$(PRINTF) "Expecting value1: %s\n" "`$(CAT) $(VARDEP_DIR)/target-file`"
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   177
	test "some string value1" = "`$(CAT) $(VARDEP_DIR)/target-file`"
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   178
	test -e $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   179
        #
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   180
        # Make the target file again and verify that the value is updated with
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   181
        # the new value
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   182
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   183
	$(SLEEP_ON_MAC)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   184
	$(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
   185
	$(PRINTF) "Expecting value2: %s\n" "`$(CAT) $(VARDEP_DIR)/target-file`"
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   186
	test "some string value2" = "`$(CAT) $(VARDEP_DIR)/target-file`"
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   187
	test -e $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   188
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   189
        # 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
   190
        # 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
   191
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   192
	$(SLEEP_ON_MAC)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   193
	$(RM) $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   194
	$(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
   195
	$(PRINTF) "Expecting value2: %s\n" "`$(CAT) $(VARDEP_DIR)/target-file`"
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   196
	test "some string value2" = "`$(CAT) $(VARDEP_DIR)/target-file`"
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   197
	test ! -e $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   198
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   199
        # 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
   200
        # 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
   201
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   202
	$(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
   203
	$(RM) $(VARDEP_FLAG_FILE)
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
	test ! -e $(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)
33054
bcb9f5ea5761 8140484: Vardeps broken when variable value contains '$'
erikj
parents: 32807
diff changeset
   208
        #
bcb9f5ea5761 8140484: Vardeps broken when variable value contains '$'
erikj
parents: 32807
diff changeset
   209
        # Test including some problematic characters
41875
854ef5325653 8160491: tar.gz bundles missing files containing $
erikj
parents: 41260
diff changeset
   210
	$(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
   211
	$(RM) $(VARDEP_FLAG_FILE)
41875
854ef5325653 8160491: tar.gz bundles missing files containing $
erikj
parents: 41260
diff changeset
   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
	test ! -e $(VARDEP_FLAG_FILE)
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   214
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   215
# Test specifying a specific value file to store variable in
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   216
VARDEP_VALUE_FILE := $(VARDEP_DIR)/value-file
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   217
VARDEP_TEST_VAR2 := value3
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   218
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   219
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
   220
$(eval $(call assert-equals, $(VARDEP_RETURN_VALUE), $(VARDEP_VALUE_FILE), \
20386e6d858f 8136385: Various build speed improvements for windows
erikj
parents: 32553
diff changeset
   221
    Wrong filename returned))
33054
bcb9f5ea5761 8140484: Vardeps broken when variable value contains '$'
erikj
parents: 32807
diff changeset
   222
-include $(VARDEP_VALUE_FILE)
bcb9f5ea5761 8140484: Vardeps broken when variable value contains '$'
erikj
parents: 32807
diff changeset
   223
$(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
   224
    Wrong contents in vardeps file))
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   225
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   226
# 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
   227
VARDEP_TEST_VAR3 := foo '""' "''" bar \$$ORIGIN &\#x00a9
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   228
VARDEP_VALUE_FILE := $(call DependOnVariable, VARDEP_TEST_VAR3)
33054
bcb9f5ea5761 8140484: Vardeps broken when variable value contains '$'
erikj
parents: 32807
diff changeset
   229
-include $(VARDEP_VALUE_FILE)
42134
bbcdb49521b1 8169860: Clean up and unify the refactored Javadoc generation
ihse
parents: 41875
diff changeset
   230
$(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
   231
    $(call EscapeHash,$(VARDEP_TEST_VAR3)), \
32807
20386e6d858f 8136385: Various build speed improvements for windows
erikj
parents: 32553
diff changeset
   232
    Wrong contents in vardep file))
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   233
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   234
TEST_TARGETS += test-vardep
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
################################################################################
29312
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28607
diff changeset
   237
# Test sequence
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28607
diff changeset
   238
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28607
diff changeset
   239
ifneq ($(call sequence, 1, 1), 1)
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28607
diff changeset
   240
  $(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
   241
endif
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28607
diff changeset
   242
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28607
diff changeset
   243
ifneq ($(call sequence, 2, 3), 2 3)
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28607
diff changeset
   244
  $(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
   245
endif
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28607
diff changeset
   246
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28607
diff changeset
   247
ifneq ($(call sequence, 4, 9), 4 5 6 7 8 9)
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28607
diff changeset
   248
  $(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
   249
endif
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28607
diff changeset
   250
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28607
diff changeset
   251
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
   252
  $(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
   253
      but was $(call sequence, 5, 15))
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28607
diff changeset
   254
endif
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   255
37030
e047c2f3f510 8153969: Clean up module src dir logic
erikj
parents: 33054
diff changeset
   256
################################################################################
e047c2f3f510 8153969: Clean up module src dir logic
erikj
parents: 33054
diff changeset
   257
# Test that PathList is safe when called multiple nested times.
e047c2f3f510 8153969: Clean up module src dir logic
erikj
parents: 33054
diff changeset
   258
e047c2f3f510 8153969: Clean up module src dir logic
erikj
parents: 33054
diff changeset
   259
PATHLIST_INPUT := foo bar baz
e047c2f3f510 8153969: Clean up module src dir logic
erikj
parents: 33054
diff changeset
   260
e047c2f3f510 8153969: Clean up module src dir logic
erikj
parents: 33054
diff changeset
   261
$(eval $(call assert-equals, \
e047c2f3f510 8153969: Clean up module src dir logic
erikj
parents: 33054
diff changeset
   262
    $(call PathList, $(call PathList, $(PATHLIST_INPUT))), \
e047c2f3f510 8153969: Clean up module src dir logic
erikj
parents: 33054
diff changeset
   263
    $(call PathList, $(PATHLIST_INPUT)), \
e047c2f3f510 8153969: Clean up module src dir logic
erikj
parents: 33054
diff changeset
   264
    PathList call not safe for calling twice))
e047c2f3f510 8153969: Clean up module src dir logic
erikj
parents: 33054
diff changeset
   265
41260
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   266
################################################################################
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   267
# Test FindCommonPathPrefix
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   268
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   269
$(eval $(call assert-equals, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   270
    $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/banan), \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   271
    /foo/bar, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   272
    FindCommonPathPrefix, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   273
))
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   274
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   275
$(eval $(call assert-equals, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   276
    $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar), \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   277
    /foo/bar, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   278
    FindCommonPathPrefix, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   279
))
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   280
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   281
$(eval $(call assert-equals, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   282
    $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/), \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   283
    /foo/bar, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   284
    FindCommonPathPrefix, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   285
))
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   286
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   287
$(eval $(call assert-equals, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   288
    $(call FindCommonPathPrefix, foo/bar/baz, foo/bar/banan), \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   289
    foo/bar, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   290
    FindCommonPathPrefix, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   291
))
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   292
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   293
$(eval $(call assert-equals, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   294
    $(call FindCommonPathPrefix, foo/bar/baz, /foo/bar/banan), \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   295
    , \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   296
    FindCommonPathPrefix, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   297
))
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   298
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   299
################################################################################
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   300
# DirToDotDot
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   301
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   302
$(eval $(call assert-equals, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   303
    $(call DirToDotDot, foo/bar/baz/), \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   304
    ../../.., \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   305
    DirToDotDot, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   306
))
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   307
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   308
$(eval $(call assert-equals, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   309
    $(call DirToDotDot, foo/bar), \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   310
    ../.., \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   311
    DirToDotDot, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   312
))
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   313
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   314
$(eval $(call assert-equals, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   315
    $(call DirToDotDot, /foo), \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   316
    .., \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   317
    DirToDotDot, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   318
))
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   319
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   320
################################################################################
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   321
# RelativePath
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   322
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   323
$(eval $(call assert-equals, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   324
    $(call RelativePath, foo/bar/baz, foo/bar/banan), \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   325
    ../baz, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   326
    RelativePath, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   327
))
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   328
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   329
$(eval $(call assert-equals, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   330
    $(call RelativePath, foo/bar/baz/banan/kung, foo/bar/banan/kung), \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   331
    ../../baz/banan/kung, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   332
    RelativePath, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   333
))
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   334
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   335
$(eval $(call assert-equals, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   336
    $(call RelativePath, /foo/bar/baz/banan/kung, /foo/bar/banan/kung/), \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   337
    ../../baz/banan/kung, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   338
    RelativePath, \
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   339
))
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   340
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   341
################################################################################
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   342
# Test ParseKeywordVariable
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   343
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   344
KWBASE := APA=banan;GURKA=tomat;COUNT=1%202%203%204%205;SUM=1+2+3+4+5;MANY_WORDS=I have the best words.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   345
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   346
$(eval $(call ParseKeywordVariable, KWBASE, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   347
    KEYWORDS := APA GURKA SUM, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   348
    STRING_KEYWORDS := COUNT MANY_WORDS, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   349
))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   350
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   351
$(eval $(call assert-equals, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   352
    $(KWBASE_APA), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   353
    banan, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   354
    ParseKeywordVariable failed to parse APA, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   355
))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   356
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   357
$(eval $(call assert-equals, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   358
    $(KWBASE_COUNT), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   359
    1 2 3 4 5, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   360
    ParseKeywordVariable failed to parse COUNT, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   361
))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   362
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   363
$(eval $(call assert-equals, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   364
    $(KWBASE_SUM), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   365
    1+2+3+4+5, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   366
    ParseKeywordVariable failed to parse SUM, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   367
))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   368
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   369
$(eval $(call assert-equals, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   370
    $(KWBASE_MANY_WORDS), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   371
    I have the best words., \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   372
    ParseKeywordVariable failed to parse MANY_WORDS, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   373
))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   374
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   375
# Simulate variable set from command line by using "override"
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   376
override KWBASE_WEIRD_GURKA := paprika
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   377
KWBASE_WEIRD := ;;APA=banan;;;GURKA=apelsin;APA=skansen;;
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   378
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   379
$(eval $(call ParseKeywordVariable, KWBASE_WEIRD, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   380
    KEYWORDS := APA GURKA SUM, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   381
    STRING_KEYWORDS := COUNT, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   382
))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   383
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   384
$(eval $(call assert-equals, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   385
    $(KWBASE_WEIRD_APA), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   386
    skansen, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   387
    ParseKeywordVariable failed to overwrite APA, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   388
))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   389
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   390
$(eval $(call assert-equals, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   391
    $(KWBASE_WEIRD_GURKA), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   392
    paprika, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   393
    ParseKeywordVariable failed to preserve GURKA, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   394
))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   395
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 42134
diff changeset
   396
################################################################################
41260
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 37030
diff changeset
   397
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   398
all: $(TEST_TARGETS)