Bug 735638 - replace functions that were removed by errant b-s merge - r=khuey
☠☠ backed out by e6f4ae0bd30e ☠ ☠
authorJoey Armstrong <jarmstrong@mozilla.com>
Thu, 12 Apr 2012 18:08:28 -0400
changeset 91505 676dca561a2cfbf1ac57a0e35b2455ec2aa2212a
parent 91504 901dfde601838438440841311929e608fba7960e
child 91506 d26c0cd1dfa3a2c277d8d3713774febff1054db7
push id22446
push usercoop@mozilla.com
push dateThu, 12 Apr 2012 22:09:08 +0000
treeherdermozilla-central@676dca561a2c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs735638
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 735638 - replace functions that were removed by errant b-s merge - r=khuey
config/makefiles/makeutils.mk
config/makefiles/test/Makefile.in
--- a/config/makefiles/makeutils.mk
+++ b/config/makefiles/makeutils.mk
@@ -29,8 +29,22 @@ argv +=)
 ###########################################################################
 ## Access function args as a simple list, inline within user functions.
 ## Usage: $(info ** $(call banner,$(getargv)))
 ##    $(call banner,scalar)
 ##    $(call banner,list0 list1 list2)
 ##    $(call banner,ref) ; ref=foo bar tans
 ## getarglist() would be a more accurate name but is longer to type
 getargv = $(if $(call isvar,$(1)),$($(1)),$(argv))
+
+## http://www.gnu.org/software/make/manual/make.html#Call-Function
+## Usage: o = $(call map,origin,o map $(MAKE))
+map = $(foreach val,$(2),$(call $(1),$(val)))
+
+
+# Usage: $(call checkIfEmpty,[error|warning] foo NULL bar)
+checkIfEmpty =$(foreach var,$(wordlist 2,100,$(getargv)),$(if $(strip $($(var))),$(NOP),$(call $(1),Variable $(var) does not contain a value)))
+
+# Usage: $(call errorIfEmpty,foo NULL bar)
+errorIfEmpty =$(call checkIfEmpty,error $(getargv))
+warnIfEmpty  =$(call checkIfEmpty,warning $(getargv))
+
+
--- a/config/makefiles/test/Makefile.in
+++ b/config/makefiles/test/Makefile.in
@@ -31,16 +31,24 @@ check::
 
 ## Logic processed at compile time so be selective about when to test
 ifneq ($(NULL),$(findstring check,$(MAKECMDGOALS)))
 
 $(info ===========================================================================)
 $(info Running test: $(MAKECMDGOALS): pwd=$(CURDIR))
 $(info ===========================================================================)
 
+
+ifdef VERBOSE
+$(info )
+$(info ===========================================================================)
+$(info Running test: istype, getargv)
+$(info ===========================================================================)
+endif
+
 ## Silent errors are oh so much fun
 ifndef istype
   $(error makeutils.mk was not included)
 endif
 
 # arg_scalar = [scalar|literal]
 arg_list = foo bar
 arg_ref  = arg_list
@@ -85,11 +93,37 @@ ifneq (scalar,$(call getargv,scalar))
 endif
 ifneq ($(arg_list),$(call getargv,arg_list))
   $(error getargv(arg_list)=list, found [$(call getargv,arg_list)])
 endif
 ifneq (arg_list,$(call getargv,arg_ref))
   $(error getargv(arg_ref)=list, found [$(call getargv,arg_ref)])
 endif
 
+
+ifdef MANUAL_TEST
+  # For automated testing a callback is needed that can set an external status
+  # variable that can be tested.  Syntax is tricky to get correct functionality.
+  ifdef VERBOSE
+    $(info )
+    $(info ===========================================================================)
+    $(info Running test: checkIfEmpty)
+    $(info ===========================================================================)
+  endif
+
+  #status =
+  #setTRUE =status=true
+  #setFALSE =status=$(NULL)
+  #$(call checkIfEmpty,setFALSE NULL)
+  #$(if $(status),$(error checkIfEmpty(xyz) failed))
+  #$(call checkIfEmpty,setTRUE xyz)
+  #$(if $(status),$(error checkIfEmpty(xyz) failed))
+  xyz=abc
+  $(info STATUS: warnIfEmpty - two vars)
+  $(call warnIfEmpty,foo xyz bar)
+  $(info STATUS: errorIfEmpty - on first var)
+  $(call errorIfEmpty,foo xyz bar)
+  $(error TEST FAILED: processing should not reach this point)
+endif
+
 endif # check in MAKECMDGOALS