[OE-core] [PATCH] resulttool: Add option to dump all ptest logs

Joshua Watt jpewhacker at gmail.com
Sat May 4 03:17:52 UTC 2019


Adds an option to dump all the ptest logs to individual files to a
specified directory.

[YOCTO #13331]

Signed-off-by: Joshua Watt <JPEWhacker at gmail.com>
---
 scripts/lib/resulttool/log.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/scripts/lib/resulttool/log.py b/scripts/lib/resulttool/log.py
index 5584f2d0a99..18830409035 100644
--- a/scripts/lib/resulttool/log.py
+++ b/scripts/lib/resulttool/log.py
@@ -30,6 +30,15 @@ def log(args, logger):
                 continue
             r = results[path][res]['result']
 
+            if args.dump_ptest:
+                if 'ptestresult.sections' in r:
+                    for name, ptest in r['ptestresult.sections'].items():
+                        if 'log' in ptest:
+                            dest = os.path.join(args.dump_ptest, '%s.log' % name)
+                            print(dest)
+                            with open(dest, 'w') as f:
+                                f.write(ptest['log'])
+
             if args.raw:
                 if 'ptestresult.rawlogs' in r:
                     print(r['ptestresult.rawlogs']['log'])
@@ -51,6 +60,8 @@ def register_commands(subparsers):
             help='the results file/directory/URL to import')
     parser.add_argument('--ptest', action='append', default=[],
             help='show logs for a ptest')
+    parser.add_argument('--dump-ptest', metavar='DIR',
+            help='Dump all ptest log files to the specified directory.')
     parser.add_argument('--raw', action='store_true',
             help='show raw logs')
 
-- 
2.20.1



More information about the Openembedded-core mailing list