|
1 # -*- makefile -*- |
|
2 # |
|
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/. |
|
6 |
|
7 ifdef VERBOSE |
|
8 $(warning loading test) |
|
9 endif |
|
10 |
|
11 space=$(null) $(null) |
|
12 GENERATED_DIRS = bogus # test data |
|
13 |
|
14 undefine USE_AUTOTARGETS_MK |
|
15 undefine INCLUDED_AUTOTARGETS_MK |
|
16 include $(topsrcdir)/config/makefiles/autotargets.mk |
|
17 |
|
18 ifndef INCLUDED_AUTOTARGETS_MK |
|
19 $(error autotargets.mk was not included |
|
20 endif |
|
21 |
|
22 $(call requiredfunction,mkdir_deps) |
|
23 |
|
24 |
|
25 # Verify test data populated makefile vars correctly |
|
26 vars = AUTO_DEPS GARBAGE_DIRS GENERATED_DIRS_DEPS |
|
27 $(foreach var,$(vars),$(call errorIfEmpty,$(var))) |
|
28 |
|
29 # Data should also be valid |
|
30 ifneq (bogus,$(findstring bogus,$(AUTO_DEPS))) |
|
31 $(error AUTO_DEPS=[$(AUTO_DEPS)] is not set correctly) |
|
32 endif |
|
33 |
|
34 |
|
35 # relpath |
|
36 path := foo/bar.c |
|
37 exp := foo/.mkdir.done |
|
38 found := $(call mkdir_deps,$(dir $(path))) |
|
39 ifneq ($(exp),$(found)) |
|
40 $(error mkdir_deps($(path))=$(exp) not set correctly [$(found)]) |
|
41 endif |
|
42 |
|
43 # abspath |
|
44 path := /foo//bar/ |
|
45 exp := /foo/bar/.mkdir.done |
|
46 found := $(call mkdir_deps,$(path)) |
|
47 ifneq ($(exp),$(found)) |
|
48 $(error mkdir_deps($(path))=$(exp) not set correctly [$(found)]) |
|
49 endif |
|
50 |
|
51 |
|
52 ## verify strip_slash |
|
53 ##################### |
|
54 |
|
55 path := a/b//c///d////e///// |
|
56 exp := a/b/c/d/e/.mkdir.done |
|
57 found := $(call mkdir_deps,$(path)) |
|
58 ifneq ($(exp),$(found)) |
|
59 $(error mkdir_deps($(path))=$(exp) not set correctly [$(found)]) |
|
60 endif |
|
61 |
|
62 |
|
63 ## verify mkdir_stem() |
|
64 ###################### |
|
65 path := verify/mkdir_stem |
|
66 pathD = $(call mkdir_deps,$(path)) |
|
67 pathS = $(call mkdir_stem,$(pathD)) |
|
68 exp := $(path) |
|
69 |
|
70 ifeq ($(pathD),$(pathS)) |
|
71 $(error mkdir_deps and mkdir_stem should not match [$(pathD)]) |
|
72 endif |
|
73 ifneq ($(pathS),$(exp)) |
|
74 $(error mkdir_stem=[$(pathS)] != exp=[$(exp)]) |
|
75 endif |
|
76 |
|
77 |
|
78 ## Verify embedded whitespace has been protected |
|
79 path := a/b$(space)c//d |
|
80 exp := a/b$(space)c/d |
|
81 found := $(call slash_strip,$(path)) |
|
82 ifneq ($(exp),$(found)) |
|
83 $(error slash_strip($(path))=$(exp) not set correctly [$(found)]) |
|
84 endif |