Simplify regex and use named capture groups
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
This commit is contained in:
parent
c2bac00530
commit
83aa604ce5
1 changed files with 9 additions and 4 deletions
|
@ -52,7 +52,10 @@ def main():
|
||||||
proc = subprocess.Popen(['./psa-arch-tests-crypto'],
|
proc = subprocess.Popen(['./psa-arch-tests-crypto'],
|
||||||
bufsize=1, stdout=subprocess.PIPE, universal_newlines=True)
|
bufsize=1, stdout=subprocess.PIPE, universal_newlines=True)
|
||||||
|
|
||||||
test_re = re.compile('^TEST(?:: ([0-9]*)| RESULT: (FAILED|PASSED))')
|
test_re = re.compile(
|
||||||
|
'^TEST: (?P<test_num>[0-9]*)|'
|
||||||
|
'^TEST RESULT: (?P<test_result>FAILED|PASSED)'
|
||||||
|
)
|
||||||
test = -1
|
test = -1
|
||||||
unexpected_successes = set(EXPECTED_FAILURES)
|
unexpected_successes = set(EXPECTED_FAILURES)
|
||||||
expected_failures = []
|
expected_failures = []
|
||||||
|
@ -61,9 +64,11 @@ def main():
|
||||||
print(line, end='')
|
print(line, end='')
|
||||||
match = test_re.match(line)
|
match = test_re.match(line)
|
||||||
if match is not None:
|
if match is not None:
|
||||||
if match.group(1) is not None:
|
groupdict = match.groupdict()
|
||||||
test = int(match.group(1))
|
test_num = groupdict['test_num']
|
||||||
elif match.group(2) == 'FAILED':
|
if test_num is not None:
|
||||||
|
test = int(test_num)
|
||||||
|
elif groupdict['test_result'] == 'FAILED':
|
||||||
try:
|
try:
|
||||||
unexpected_successes.remove(test)
|
unexpected_successes.remove(test)
|
||||||
expected_failures.append(test)
|
expected_failures.append(test)
|
||||||
|
|
Loading…
Reference in a new issue