Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | # -*- makefile -*- |
michael@0 | 2 | # |
michael@0 | 3 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 5 | # You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 6 | |
michael@0 | 7 | ifdef VERBOSE |
michael@0 | 8 | $(warning loading test) |
michael@0 | 9 | endif |
michael@0 | 10 | |
michael@0 | 11 | space=$(null) $(null) |
michael@0 | 12 | GENERATED_DIRS = bogus # test data |
michael@0 | 13 | |
michael@0 | 14 | undefine USE_AUTOTARGETS_MK |
michael@0 | 15 | undefine INCLUDED_AUTOTARGETS_MK |
michael@0 | 16 | include $(topsrcdir)/config/makefiles/autotargets.mk |
michael@0 | 17 | |
michael@0 | 18 | ifndef INCLUDED_AUTOTARGETS_MK |
michael@0 | 19 | $(error autotargets.mk was not included |
michael@0 | 20 | endif |
michael@0 | 21 | |
michael@0 | 22 | $(call requiredfunction,mkdir_deps) |
michael@0 | 23 | |
michael@0 | 24 | |
michael@0 | 25 | # Verify test data populated makefile vars correctly |
michael@0 | 26 | vars = AUTO_DEPS GARBAGE_DIRS GENERATED_DIRS_DEPS |
michael@0 | 27 | $(foreach var,$(vars),$(call errorIfEmpty,$(var))) |
michael@0 | 28 | |
michael@0 | 29 | # Data should also be valid |
michael@0 | 30 | ifneq (bogus,$(findstring bogus,$(AUTO_DEPS))) |
michael@0 | 31 | $(error AUTO_DEPS=[$(AUTO_DEPS)] is not set correctly) |
michael@0 | 32 | endif |
michael@0 | 33 | |
michael@0 | 34 | |
michael@0 | 35 | # relpath |
michael@0 | 36 | path := foo/bar.c |
michael@0 | 37 | exp := foo/.mkdir.done |
michael@0 | 38 | found := $(call mkdir_deps,$(dir $(path))) |
michael@0 | 39 | ifneq ($(exp),$(found)) |
michael@0 | 40 | $(error mkdir_deps($(path))=$(exp) not set correctly [$(found)]) |
michael@0 | 41 | endif |
michael@0 | 42 | |
michael@0 | 43 | # abspath |
michael@0 | 44 | path := /foo//bar/ |
michael@0 | 45 | exp := /foo/bar/.mkdir.done |
michael@0 | 46 | found := $(call mkdir_deps,$(path)) |
michael@0 | 47 | ifneq ($(exp),$(found)) |
michael@0 | 48 | $(error mkdir_deps($(path))=$(exp) not set correctly [$(found)]) |
michael@0 | 49 | endif |
michael@0 | 50 | |
michael@0 | 51 | |
michael@0 | 52 | ## verify strip_slash |
michael@0 | 53 | ##################### |
michael@0 | 54 | |
michael@0 | 55 | path := a/b//c///d////e///// |
michael@0 | 56 | exp := a/b/c/d/e/.mkdir.done |
michael@0 | 57 | found := $(call mkdir_deps,$(path)) |
michael@0 | 58 | ifneq ($(exp),$(found)) |
michael@0 | 59 | $(error mkdir_deps($(path))=$(exp) not set correctly [$(found)]) |
michael@0 | 60 | endif |
michael@0 | 61 | |
michael@0 | 62 | |
michael@0 | 63 | ## verify mkdir_stem() |
michael@0 | 64 | ###################### |
michael@0 | 65 | path := verify/mkdir_stem |
michael@0 | 66 | pathD = $(call mkdir_deps,$(path)) |
michael@0 | 67 | pathS = $(call mkdir_stem,$(pathD)) |
michael@0 | 68 | exp := $(path) |
michael@0 | 69 | |
michael@0 | 70 | ifeq ($(pathD),$(pathS)) |
michael@0 | 71 | $(error mkdir_deps and mkdir_stem should not match [$(pathD)]) |
michael@0 | 72 | endif |
michael@0 | 73 | ifneq ($(pathS),$(exp)) |
michael@0 | 74 | $(error mkdir_stem=[$(pathS)] != exp=[$(exp)]) |
michael@0 | 75 | endif |
michael@0 | 76 | |
michael@0 | 77 | |
michael@0 | 78 | ## Verify embedded whitespace has been protected |
michael@0 | 79 | path := a/b$(space)c//d |
michael@0 | 80 | exp := a/b$(space)c/d |
michael@0 | 81 | found := $(call slash_strip,$(path)) |
michael@0 | 82 | ifneq ($(exp),$(found)) |
michael@0 | 83 | $(error slash_strip($(path))=$(exp) not set correctly [$(found)]) |
michael@0 | 84 | endif |