summaryrefslogtreecommitdiffstats
path: root/config/makefiles/test/check-autotargets.mk
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /config/makefiles/test/check-autotargets.mk
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'config/makefiles/test/check-autotargets.mk')
-rw-r--r--config/makefiles/test/check-autotargets.mk84
1 files changed, 84 insertions, 0 deletions
diff --git a/config/makefiles/test/check-autotargets.mk b/config/makefiles/test/check-autotargets.mk
new file mode 100644
index 000000000..c103f1d02
--- /dev/null
+++ b/config/makefiles/test/check-autotargets.mk
@@ -0,0 +1,84 @@
+# -*- makefile -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+
+ifdef VERBOSE
+ $(warning loading test)
+endif
+
+space=$(null) $(null)
+GENERATED_DIRS = bogus # test data
+
+undefine USE_AUTOTARGETS_MK
+undefine INCLUDED_AUTOTARGETS_MK
+include $(topsrcdir)/config/makefiles/autotargets.mk
+
+ifndef INCLUDED_AUTOTARGETS_MK
+ $(error autotargets.mk was not included
+endif
+
+$(call requiredfunction,mkdir_deps)
+
+
+# Verify test data populated makefile vars correctly
+vars = AUTO_DEPS GARBAGE_DIRS GENERATED_DIRS_DEPS
+$(foreach var,$(vars),$(call errorIfEmpty,$(var)))
+
+# Data should also be valid
+ifneq (bogus,$(findstring bogus,$(AUTO_DEPS)))
+ $(error AUTO_DEPS=[$(AUTO_DEPS)] is not set correctly)
+endif
+
+
+# relpath
+path := foo/bar.c
+exp := foo/.mkdir.done
+found := $(call mkdir_deps,$(dir $(path)))
+ifneq ($(exp),$(found))
+ $(error mkdir_deps($(path))=$(exp) not set correctly [$(found)])
+endif
+
+# abspath
+path := /foo//bar/
+exp := /foo/bar/.mkdir.done
+found := $(call mkdir_deps,$(path))
+ifneq ($(exp),$(found))
+ $(error mkdir_deps($(path))=$(exp) not set correctly [$(found)])
+endif
+
+
+## verify strip_slash
+#####################
+
+path := a/b//c///d////e/////
+exp := a/b/c/d/e/.mkdir.done
+found := $(call mkdir_deps,$(path))
+ifneq ($(exp),$(found))
+ $(error mkdir_deps($(path))=$(exp) not set correctly [$(found)])
+endif
+
+
+## verify mkdir_stem()
+######################
+path := verify/mkdir_stem
+pathD = $(call mkdir_deps,$(path))
+pathS = $(call mkdir_stem,$(pathD))
+exp := $(path)
+
+ifeq ($(pathD),$(pathS))
+ $(error mkdir_deps and mkdir_stem should not match [$(pathD)])
+endif
+ifneq ($(pathS),$(exp))
+ $(error mkdir_stem=[$(pathS)] != exp=[$(exp)])
+endif
+
+
+## Verify embedded whitespace has been protected
+path := a/b$(space)c//d
+exp := a/b$(space)c/d
+found := $(call slash_strip,$(path))
+ifneq ($(exp),$(found))
+ $(error slash_strip($(path))=$(exp) not set correctly [$(found)])
+endif