From cf031996ede8428065b6d7648e34720a1874f5fa Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Fri, 14 Jun 2013 18:09:54 +0200 Subject: [coverage] Lazy rule evaluation BZ: 115218 The all and any rule were not lazy. This was a mismatch with the PFW. Make all and any compound rules lazy. Change-Id: If29e3b3f888be40ebf4027d318ae6017396d4d7b Signed-off-by: Kevin Rocard Reviewed-on: http://android.intel.com:8080/114694 Reviewed-by: Denneulin, Guillaume Reviewed-by: De Chivre, Renaud Reviewed-by: cactus Tested-by: Dixon, CharlesX Reviewed-by: buildbot Tested-by: buildbot --- tools/coverage.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/coverage.py b/tools/coverage.py index a6d6fa6..8aa941f 100755 --- a/tools/coverage.py +++ b/tools/coverage.py @@ -374,8 +374,11 @@ class Rule(Element): def _isApplicable(self, criteria, childApplicability): - # Forcing evaluation of all child by the list creation - return all(list(childApplicability)) + """Return the rule applicability depending on children applicability. + + If at least one child is applicable, return true""" + # Lazy evaluation as in the PFW + return all(childApplicability) class CriterionRule(FromDomElement, DomPopulatedElement, Rule): @@ -426,8 +429,8 @@ class CompoundRule(FromDomElement, DomPopulatedElement, Rule): if self.ofTypeAll : applicability = super()._isApplicable(criteria, childApplicability) else: - # Forcing evaluation of all child by the list creation - applicability = any(list(childApplicability)) + # Lazy evaluation as in the PFW + applicability = any(childApplicability) return applicability -- cgit v1.1