michael@0: # -*- makefile -*- michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: # You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: ifdef VERBOSE michael@0: $(warning loading test) michael@0: endif michael@0: michael@0: space=$(null) $(null) michael@0: GENERATED_DIRS = bogus # test data michael@0: michael@0: undefine USE_AUTOTARGETS_MK michael@0: undefine INCLUDED_AUTOTARGETS_MK michael@0: include $(topsrcdir)/config/makefiles/autotargets.mk michael@0: michael@0: ifndef INCLUDED_AUTOTARGETS_MK michael@0: $(error autotargets.mk was not included michael@0: endif michael@0: michael@0: $(call requiredfunction,mkdir_deps) michael@0: michael@0: michael@0: # Verify test data populated makefile vars correctly michael@0: vars = AUTO_DEPS GARBAGE_DIRS GENERATED_DIRS_DEPS michael@0: $(foreach var,$(vars),$(call errorIfEmpty,$(var))) michael@0: michael@0: # Data should also be valid michael@0: ifneq (bogus,$(findstring bogus,$(AUTO_DEPS))) michael@0: $(error AUTO_DEPS=[$(AUTO_DEPS)] is not set correctly) michael@0: endif michael@0: michael@0: michael@0: # relpath michael@0: path := foo/bar.c michael@0: exp := foo/.mkdir.done michael@0: found := $(call mkdir_deps,$(dir $(path))) michael@0: ifneq ($(exp),$(found)) michael@0: $(error mkdir_deps($(path))=$(exp) not set correctly [$(found)]) michael@0: endif michael@0: michael@0: # abspath michael@0: path := /foo//bar/ michael@0: exp := /foo/bar/.mkdir.done michael@0: found := $(call mkdir_deps,$(path)) michael@0: ifneq ($(exp),$(found)) michael@0: $(error mkdir_deps($(path))=$(exp) not set correctly [$(found)]) michael@0: endif michael@0: michael@0: michael@0: ## verify strip_slash michael@0: ##################### michael@0: michael@0: path := a/b//c///d////e///// michael@0: exp := a/b/c/d/e/.mkdir.done michael@0: found := $(call mkdir_deps,$(path)) michael@0: ifneq ($(exp),$(found)) michael@0: $(error mkdir_deps($(path))=$(exp) not set correctly [$(found)]) michael@0: endif michael@0: michael@0: michael@0: ## verify mkdir_stem() michael@0: ###################### michael@0: path := verify/mkdir_stem michael@0: pathD = $(call mkdir_deps,$(path)) michael@0: pathS = $(call mkdir_stem,$(pathD)) michael@0: exp := $(path) michael@0: michael@0: ifeq ($(pathD),$(pathS)) michael@0: $(error mkdir_deps and mkdir_stem should not match [$(pathD)]) michael@0: endif michael@0: ifneq ($(pathS),$(exp)) michael@0: $(error mkdir_stem=[$(pathS)] != exp=[$(exp)]) michael@0: endif michael@0: michael@0: michael@0: ## Verify embedded whitespace has been protected michael@0: path := a/b$(space)c//d michael@0: exp := a/b$(space)c/d michael@0: found := $(call slash_strip,$(path)) michael@0: ifneq ($(exp),$(found)) michael@0: $(error slash_strip($(path))=$(exp) not set correctly [$(found)]) michael@0: endif