config/makefiles/test/check-autotargets.mk

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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/.
     7 ifdef VERBOSE
     8   $(warning loading test)
     9 endif
    11 space=$(null) $(null)
    12 GENERATED_DIRS = bogus # test data
    14 undefine USE_AUTOTARGETS_MK
    15 undefine INCLUDED_AUTOTARGETS_MK
    16 include $(topsrcdir)/config/makefiles/autotargets.mk
    18 ifndef INCLUDED_AUTOTARGETS_MK
    19   $(error autotargets.mk was not included
    20 endif
    22 $(call requiredfunction,mkdir_deps)
    25 # Verify test data populated makefile vars correctly
    26 vars = AUTO_DEPS GARBAGE_DIRS GENERATED_DIRS_DEPS
    27 $(foreach var,$(vars),$(call errorIfEmpty,$(var)))
    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
    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
    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
    52 ## verify strip_slash
    53 #####################
    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
    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)
    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
    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

mercurial