Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit ec4f597

Browse files
committed
Merge pull request #99 from dawagner/xmlcoverage-ignore-unknown-criterion-option
xmlcoverage: be able to ignore changes to unknown criteria Since a parameter-framework client may set a criterion before calling start(), the logs may show changes to criteria before the coverage script knows the list of criteria. It used to cause an unrecoverable error even with the "--force" option. This option now makes the coverage script ignore such errors. The script already takes the initial values of criteria into account when the parameter-framework starts, so there isn't any information loss. However, if this error happens for any other error than described in the first paragraph, you probably don't want to silence it.
2 parents e3dd83d + ccb164c commit ec4f597

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

tools/coverage/aplog2coverage.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ help () {
5454
# Default values
5555
outputFile="-"
5656
coverage_report_generator_ignorable_errors="\
57+
--ignore-unknown-criterion \
5758
--ignore-incoherent-criterion-state \
5859
--ignore-ineligible-configuration-application"
5960
coverage_report_generator_options=""

tools/coverage/coverage.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,14 @@ class ParsePFWlog():
720720
MATCH = "match"
721721
ACTION = "action"
722722

723+
class ChangeRequestOnUnknownCriterion(CustomError):
724+
def __init__(self, criterion):
725+
self.criterion = criterion
726+
727+
def __str__(self):
728+
return ("Change request on an unknown criterion %s." %
729+
self.criterion)
730+
723731
def __init__(self, domains, criteria, ErrorsToIgnore=()):
724732

725733
self.domains = domains;
@@ -802,7 +810,10 @@ def _changingCriterion(self, matchChangingCriterion):
802810

803811
path = [criterionName]
804812
changeCriterionOperation = lambda criterion : criterion.changeState(newCriterionState)
805-
self.criteria.operationOnChild(path, changeCriterionOperation)
813+
try:
814+
self.criteria.operationOnChild(path, changeCriterionOperation)
815+
except ChildNotFoundError:
816+
raise self.ChangeRequestOnUnknownCriterion(criterionName)
806817

807818
def _configApplication(self, matchConfig):
808819
# Unpack
@@ -967,6 +978,13 @@ def __init__(self):
967978
help="raw coverage output report"
968979
)
969980

981+
myArgParser.add_argument(
982+
'--ignore-unknown-criterion',
983+
dest="unknwonCriterionFlag",
984+
action='store_true',
985+
help="ignore unknown criterion"
986+
)
987+
970988
myArgParser.add_argument(
971989
'--ignore-incoherent-criterion-state',
972990
dest="incoherentCriterionFlag",
@@ -1003,6 +1021,9 @@ def __init__(self):
10031021
errorToIgnore.append(Configuration.IneligibleConfigurationAppliedError)
10041022

10051023
if options.incoherentCriterionFlag:
1024+
errorToIgnore.append(ParsePFWlog.ChangeRequestOnUnknownCriterion)
1025+
1026+
if options.unknwonCriterionFlag:
10061027
errorToIgnore.append(Criterion.ChangeRequestToNonAccessibleState)
10071028

10081029
self.errorToIgnore = tuple(errorToIgnore)

0 commit comments

Comments
 (0)