config/makefiles/test/check_XinY.mk

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     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 # Verify dependencies are available
     8 $(call requiredfunction,getargv subargv is_XinY errorifneq)
    10 ifdef VERBOSE
    11   $(warning loading test)
    12 endif
    14 zero := 0
    15 one  := 1
    17 # Verify 'invalid' is not matched
    18 val  := invalid
    19 $(call errorifneq,$(zero),$(words $(call is_XinY,foo,$(val))))
    20 $(call errorifneq,$(zero),$(words $(call is_XinY,clean,$(val))))
    21 $(call errorifneq,$(zero),$(words $(call is_XinY,clean%,$(val))))
    23 # verify strcmp('clean')
    24 val  := clean
    25 $(call errorifneq,$(zero),$(words $(call is_XinY,foo,$(val))))
    26 $(call errorifneq,$(one),$(words $(call is_XinY,clean,$(val))))
    27 $(call errorifneq,$(one),$(words $(call is_XinY,clean%,$(val))))
    28 $(call errorifneq,$(one),$(words $(call is_XinY,%clean,$(val))))
    30 # List match for 'clean'
    31 val     := blah clean distclean FcleanG clean-level-1
    32 wanted  := clean distclean clean-level-1
    33 $(call errorifneq,$(zero),$(words $(call is_XinY_debug,foo,$(val))))
    34 $(call errorifneq,$(one),$(words $(call is_XinY,clean,$(val))))
    35 $(call errorifneq,$(one),$(words $(call is_XinY,distclean,$(val))))
    37 # pattern match 'clean'
    38 #     match: clean, distclean, clean-level-1
    39 #   exclude: FcleanG
    40 TEST_MAKECMDGOALS := $(val)
    41 $(call errorifneq,3,$(words $(call isTargetStemClean)))
    43 TEST_MAKECMDGOALS := invalid
    44 $(call errorifneq,$(zero),$(words $(call isTargetStemClean)))
    47 #############################
    48 ifdef VERBOSE
    49   $(call banner,Unit test: isTargetStem)
    50 endif
    52 # Verify list argument processing
    53 TEST_MAKECMDGOALS := echo
    54 $(call errorifneq,$(one),$(words $(call isTargetStem,echo,show)))
    56 TEST_MAKECMDGOALS := echo-123
    57 $(call errorifneq,$(one),$(words $(call isTargetStem,echo,show)))
    59 TEST_MAKECMDGOALS := show
    60 $(call errorifneq,$(one),$(words $(call isTargetStem,echo,show)))
    62 TEST_MAKECMDGOALS := show-123
    63 $(call errorifneq,$(one),$(words $(call isTargetStem,echo,show)))
    65 TEST_MAKECMDGOALS := show-123-echo
    66 $(call errorifneq,$(one),$(words $(call isTargetStem,echo,show)))
    68 TEST_MAKECMDGOALS := invalid
    69 $(call errorifneq,$(zero),$(words $(call isTargetStem,echo,show)))

mercurial