summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-29 14:22:07 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-31 09:45:25 +0000
commita9a67dccaa5be0f06eedcab46dcff7cbf9202850 (patch)
treee1332daacb6c9a684b6f5486e02927b6e5550e53 /meta
parent05991bb5bc8018275d03fdeecee3d5a757840c7c (diff)
downloadopenembedded-core-a9a67dccaa5be0f06eedcab46dcff7cbf9202850.tar.gz
openembedded-core-a9a67dccaa5be0f06eedcab46dcff7cbf9202850.tar.bz2
openembedded-core-a9a67dccaa5be0f06eedcab46dcff7cbf9202850.zip
oeqa/utils/logparser: Add in support for duration, exitcode and logs by section
Allow parsing of the ptest duration, exit code and timeout keywords from the logs, returning data on each section. Also include the logs broken out per section. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/runtime/cases/ptest.py4
-rw-r--r--meta/lib/oeqa/utils/logparser.py40
2 files changed, 37 insertions, 7 deletions
diff --git a/meta/lib/oeqa/runtime/cases/ptest.py b/meta/lib/oeqa/runtime/cases/ptest.py
index ae54a01669..3cfd7af7e2 100644
--- a/meta/lib/oeqa/runtime/cases/ptest.py
+++ b/meta/lib/oeqa/runtime/cases/ptest.py
@@ -49,13 +49,15 @@ class PtestRunnerTest(OERuntimeTestCase):
extras['ptestresult.rawlogs'] = {'log': output}
# Parse and save results
- parse_result = PtestParser().parse(ptest_runner_log)
+ parse_result, sections = PtestParser().parse(ptest_runner_log)
parse_result.log_as_files(ptest_log_dir, test_status = ['pass','fail', 'skip'])
if os.path.exists(ptest_log_dir_link):
# Remove the old link to create a new one
os.remove(ptest_log_dir_link)
os.symlink(os.path.basename(ptest_log_dir), ptest_log_dir_link)
+ extras['ptestresult.sections'] = sections
+
trans = str.maketrans("()", "__")
resmap = {'pass': 'PASSED', 'skip': 'SKIPPED', 'fail': 'FAILED'}
for section in parse_result.result_dict:
diff --git a/meta/lib/oeqa/utils/logparser.py b/meta/lib/oeqa/utils/logparser.py
index f8d1c03630..dddea14fc9 100644
--- a/meta/lib/oeqa/utils/logparser.py
+++ b/meta/lib/oeqa/utils/logparser.py
@@ -9,6 +9,7 @@ from . import ftools
class PtestParser(object):
def __init__(self):
self.results = Result()
+ self.sections = {}
def parse(self, logfile):
test_regex = {}
@@ -19,28 +20,55 @@ class PtestParser(object):
section_regex = {}
section_regex['begin'] = re.compile(r"^BEGIN: .*/(.+)/ptest")
section_regex['end'] = re.compile(r"^END: .*/(.+)/ptest")
+ section_regex['duration'] = re.compile(r"^DURATION: (.+)")
+ section_regex['exitcode'] = re.compile(r"^ERROR: Exit status is (.+)")
+ section_regex['timeout'] = re.compile(r"^TIMEOUT: .*/(.+)/ptest")
+
+ def newsection():
+ return { 'name': "No-section", 'log': "" }
+
+ current_section = newsection()
with open(logfile, errors='replace') as f:
for line in f:
result = section_regex['begin'].search(line)
if result:
- current_section = result.group(1)
+ current_section['name'] = result.group(1)
continue
result = section_regex['end'].search(line)
if result:
- if current_section != result.group(1):
- bb.warn("Ptest log section mismatch %s vs. %s" % (current_section, result.group(1)))
- current_section = None
+ if current_section['name'] != result.group(1):
+ bb.warn("Ptest END log section mismatch %s vs. %s" % (current_section['name'], result.group(1)))
+ if current_section['name'] in self.sections:
+ bb.warn("Ptest duplicate section for %s" % (current_section['name']))
+ self.sections[current_section['name']] = current_section
+ del self.sections[current_section['name']]['name']
+ current_section = newsection()
+ continue
+
+ result = section_regex['timeout'].search(line)
+ if result:
+ if current_section['name'] != result.group(1):
+ bb.warn("Ptest TIMEOUT log section mismatch %s vs. %s" % (current_section['name'], result.group(1)))
+ current_section['timeout'] = True
continue
+ for t in ['duration', 'exitcode']:
+ result = section_regex[t].search(line)
+ if result:
+ current_section[t] = result.group(1)
+ continue
+
+ current_section['log'] = current_section['log'] + line
+
for t in test_regex:
result = test_regex[t].search(line)
if result:
- self.results.store(current_section, result.group(1), t)
+ self.results.store(current_section['name'], result.group(1), t)
self.results.sort_tests()
- return self.results
+ return self.results, self.sections
class Result(object):