3
# This Source Code Form is subject to the terms of the Mozilla Public
4
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
5
# You can obtain one at http://mozilla.org/MPL/2.0/.
8
$(warning loading test)
12
GENERATED_DIRS = bogus # test data
14
NOWARN_AUTOTARGETS = 1 # Unit test includes makefile twice.
16
undefine USE_AUTOTARGETS_MK
17
undefine INCLUDED_AUTOTARGETS_MK
18
include $(topsrcdir)/config/makefiles/autotargets.mk
20
ifndef INCLUDED_AUTOTARGETS_MK
21
$(error autotargets.mk was not included
24
$(call requiredfunction,mkdir_deps)
27
# Verify test data populated makefile vars correctly
28
vars = AUTO_DEPS GARBAGE_DIRS GENERATED_DIRS_DEPS
29
$(foreach var,$(vars),$(call errorIfEmpty,$(var)))
31
# Data should also be valid
32
ifneq (bogus,$(findstring bogus,$(AUTO_DEPS)))
33
$(error AUTO_DEPS=[$(AUTO_DEPS)] is not set correctly)
39
exp := foo/.mkdir.done
40
found := $(call mkdir_deps,$(dir $(path)))
41
ifneq ($(exp),$(found))
42
$(error mkdir_deps($(path))=$(exp) not set correctly [$(found)])
47
exp := /foo/bar/.mkdir.done
48
found := $(call mkdir_deps,$(path))
49
ifneq ($(exp),$(found))
50
$(error mkdir_deps($(path))=$(exp) not set correctly [$(found)])
57
path := a/b//c///d////e/////
58
exp := a/b/c/d/e/.mkdir.done
59
found := $(call mkdir_deps,$(path))
60
ifneq ($(exp),$(found))
61
$(error mkdir_deps($(path))=$(exp) not set correctly [$(found)])
65
## verify mkdir_stem()
66
######################
67
path := verify/mkdir_stem
68
pathD = $(call mkdir_deps,$(path))
69
pathS = $(call mkdir_stem,$(pathD))
72
ifeq ($(pathD),$(pathS))
73
$(error mkdir_deps and mkdir_stem should not match [$(pathD)])
75
ifneq ($(pathS),$(exp))
76
$(error mkdir_stem=[$(pathS)] != exp=[$(exp)])
80
## Verify embedded whitespace has been protected
81
path := a/b$(space)c//d
83
found := $(call slash_strip,$(path))
84
ifneq ($(exp),$(found))
85
$(error slash_strip($(path))=$(exp) not set correctly [$(found)])