Fix baremetal test report

Add a fix for failed baremetal jobs
because such jobs use a pre-setup job
and when it fails there is no test group
in the console output which could be
parsed via TEST_GROUP_PATTERN

Change-Id: I98a2da4e97008c5262c4c2f5472e294b70ce326e
This commit is contained in:
Alexander Kurenyshev 2016-11-03 17:53:08 +03:00
parent 5739779be6
commit 7e40299d89

View File

@ -175,9 +175,20 @@ def get_tests_groups_from_jenkins(runner_name, build_number, distros):
groups = re.findall(TEST_GROUP_PATTERN, console)
if not groups:
logger.error("No test group found in console of the job {0}/{1}"
.format(b['jobName'], b['buildNumber']))
continue
# maybe it's failed baremetal job?
# because of a design baremetal tests run pre-setup job
# and when it fails there are no test groups in common meaning:
# groups which could be parsed by TEST_GROUP_PATTERN
baremetal_pattern = re.compile(r'Jenkins Build.*jenkins-(.*)-\d+')
baremetal_groups = re.findall(baremetal_pattern, console)
if not baremetal_groups:
logger.error(
"No test group found in console of the job {0}/{1}".format
(b['jobName'], b['buildNumber']))
continue
# we should get the group via jobName because the test group name
# inside the log could be cut and some symbols will be changed to *
groups = b['jobName'].split('.')
# Use the last group (there can be several groups in upgrade jobs)
test_group = groups[-1]