[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 <kevinx.rocard@intel.com>
Reviewed-on: http://android.intel.com:8080/114694
Reviewed-by: Denneulin, Guillaume <guillaume.denneulin@intel.com>
Reviewed-by: De Chivre, Renaud <renaud.de.chivre@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Tested-by: Dixon, CharlesX <charlesx.dixon@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
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 @@
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 @@
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