summaryrefslogtreecommitdiffstats
path: root/scripts/lib/resulttool/log.py
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2019-09-11 14:13:07 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-11 15:28:55 +0100
commit06cba9883a5964320969301fd05eeb6bec3e786d (patch)
treecd2d2a16ff3f3a75c4e51a55db997e37879d3a30 /scripts/lib/resulttool/log.py
parent34d9f60a8c2e98fdacbb799af11ec015bc5700f4 (diff)
downloadopenembedded-core-contrib-06cba9883a5964320969301fd05eeb6bec3e786d.tar.gz
oeqa/core/case.py: Add OEPTestResultTestCase for ptestresult helpers
Add the OEPTestResultTestCase class as a mix-in class to provide helper functions for interacting with ptestresults within the extraresults object generated by the test case. This class also provides default compression of log text and log files. Also add support to resulttool for decoding/decompressing log files embedded in the test results. Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/resulttool/log.py')
-rw-r--r--scripts/lib/resulttool/log.py43
1 files changed, 21 insertions, 22 deletions
diff --git a/scripts/lib/resulttool/log.py b/scripts/lib/resulttool/log.py
index 2352c767d9..f1bfd99500 100644
--- a/scripts/lib/resulttool/log.py
+++ b/scripts/lib/resulttool/log.py
@@ -8,12 +8,12 @@ import os
import resulttool.resultutils as resultutils
def show_ptest(result, ptest, logger):
- if 'ptestresult.sections' in result:
- if ptest in result['ptestresult.sections'] and 'log' in result['ptestresult.sections'][ptest]:
- print(result['ptestresult.sections'][ptest]['log'])
- return 0
+ logdata = resultutils.ptestresult_get_log(result, ptest)
+ if logdata is not None:
+ print(logdata)
+ return 0
- print("ptest '%s' not found" % ptest)
+ print("ptest '%s' log not found" % ptest)
return 1
def show_reproducible(result, reproducible, logger):
@@ -25,7 +25,6 @@ def show_reproducible(result, reproducible, logger):
print("reproducible '%s' not found" % reproducible)
return 1
-
def log(args, logger):
results = resultutils.load_resultsdata(args.source)
@@ -35,24 +34,24 @@ def log(args, logger):
return 1
for _, run_name, _, r in resultutils.test_run_results(results):
- if args.dump_ptest:
- if 'ptestresult.sections' in r:
- for name, ptest in r['ptestresult.sections'].items():
- if 'log' in ptest:
- dest_dir = args.dump_ptest
- if args.prepend_run:
- dest_dir = os.path.join(dest_dir, run_name)
-
- os.makedirs(dest_dir, exist_ok=True)
-
- dest = os.path.join(dest_dir, '%s.log' % name)
- print(dest)
- with open(dest, 'w') as f:
- f.write(ptest['log'])
+ if args.dump_ptest and 'ptestresult.sections' in r:
+ for name, ptest in r['ptestresult.sections'].items():
+ logdata = resultutils.ptestresult_get_log(r, name)
+ if logdata is not None:
+ dest_dir = args.dump_ptest
+ if args.prepend_run:
+ dest_dir = os.path.join(dest_dir, run_name)
+
+ os.makedirs(dest_dir, exist_ok=True)
+ dest = os.path.join(dest_dir, '%s.log' % name)
+ print(dest)
+ with open(dest, 'w') as f:
+ f.write(logdata)
if args.raw_ptest:
- if 'ptestresult.rawlogs' in r:
- print(r['ptestresult.rawlogs']['log'])
+ rawlog = resultutils.ptestresult_get_rawlogs(r)
+ if rawlog is not None:
+ print(rawlog)
else:
print('Raw ptest logs not found')
return 1