diff options
-rwxr-xr-x | tools/coverage/aplog2coverage.sh | 1 | ||||
-rwxr-xr-x | tools/coverage/coverage.py | 23 |
2 files changed, 23 insertions, 1 deletions
diff --git a/tools/coverage/aplog2coverage.sh b/tools/coverage/aplog2coverage.sh index 0f0d76e..5e0e59c 100755 --- a/tools/coverage/aplog2coverage.sh +++ b/tools/coverage/aplog2coverage.sh @@ -54,6 +54,7 @@ help () { # Default values outputFile="-" coverage_report_generator_ignorable_errors="\ +--ignore-unknown-criterion \ --ignore-incoherent-criterion-state \ --ignore-ineligible-configuration-application" coverage_report_generator_options="" diff --git a/tools/coverage/coverage.py b/tools/coverage/coverage.py index 8c18bc7..6879460 100755 --- a/tools/coverage/coverage.py +++ b/tools/coverage/coverage.py @@ -720,6 +720,14 @@ class ParsePFWlog(): MATCH = "match" ACTION = "action" + class ChangeRequestOnUnknownCriterion(CustomError): + def __init__(self, criterion): + self.criterion = criterion + + def __str__(self): + return ("Change request on an unknown criterion %s." % + self.criterion) + def __init__(self, domains, criteria, ErrorsToIgnore=()): self.domains = domains; @@ -802,7 +810,10 @@ class ParsePFWlog(): path = [criterionName] changeCriterionOperation = lambda criterion : criterion.changeState(newCriterionState) - self.criteria.operationOnChild(path, changeCriterionOperation) + try: + self.criteria.operationOnChild(path, changeCriterionOperation) + except ChildNotFoundError: + raise self.ChangeRequestOnUnknownCriterion(criterionName) def _configApplication(self, matchConfig): # Unpack @@ -968,6 +979,13 @@ class ArgumentParser: ) myArgParser.add_argument( + '--ignore-unknown-criterion', + dest="unknwonCriterionFlag", + action='store_true', + help="ignore unknown criterion" + ) + + myArgParser.add_argument( '--ignore-incoherent-criterion-state', dest="incoherentCriterionFlag", action='store_true', @@ -1003,6 +1021,9 @@ class ArgumentParser: errorToIgnore.append(Configuration.IneligibleConfigurationAppliedError) if options.incoherentCriterionFlag: + errorToIgnore.append(ParsePFWlog.ChangeRequestOnUnknownCriterion) + + if options.unknwonCriterionFlag: errorToIgnore.append(Criterion.ChangeRequestToNonAccessibleState) self.errorToIgnore = tuple(errorToIgnore) |