summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2019-04-18 21:57:18 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-05-12 09:13:38 +0100
commitcae42b5ac8897a5abaf48858d24ad1d61bb2324d (patch)
tree29a6ce48a0e241ba58321f2bab73cddd185a44ad /scripts
parent2a81631d563015905915b8c6fff4729f74369896 (diff)
downloadpoky-cae42b5ac8897a5abaf48858d24ad1d61bb2324d.tar.gz
resulttool: Add log subcommand
Adds a subcommand for dumping various logs from test results (From OE-Core rev: 2f6a02b0d0909b94e753ff00faae540fd0f85ba4) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/resulttool/log.py56
-rw-r--r--scripts/lib/resulttool/regression.py2
-rwxr-xr-xscripts/resulttool2
3 files changed, 59 insertions, 1 deletions
diff --git a/scripts/lib/resulttool/log.py b/scripts/lib/resulttool/log.py
new file mode 100644
index 0000000000..5584f2d0a9
--- /dev/null
+++ b/scripts/lib/resulttool/log.py
@@ -0,0 +1,56 @@
1# resulttool - Show logs
2#
3# Copyright (c) 2019 Garmin International
4#
5# This program is free software; you can redistribute it and/or modify it
6# under the terms and conditions of the GNU General Public License,
7# version 2, as published by the Free Software Foundation.
8#
9# This program is distributed in the hope it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12# more details.
13#
14import resulttool.resultutils as resultutils
15
16def show_ptest(result, ptest, logger):
17 if 'ptestresult.sections' in result:
18 if ptest in result['ptestresult.sections'] and 'log' in result['ptestresult.sections'][ptest]:
19 print(result['ptestresult.sections'][ptest]['log'])
20 return 0
21
22 print("ptest '%s' not found" % ptest)
23 return 1
24
25def log(args, logger):
26 results = resultutils.load_resultsdata(args.source)
27 for path in results:
28 for res in results[path]:
29 if 'result' not in results[path][res]:
30 continue
31 r = results[path][res]['result']
32
33 if args.raw:
34 if 'ptestresult.rawlogs' in r:
35 print(r['ptestresult.rawlogs']['log'])
36 else:
37 print('Raw logs not found')
38 return 1
39
40 for ptest in args.ptest:
41 if not show_ptest(r, ptest, logger):
42 return 1
43
44def register_commands(subparsers):
45 """Register subcommands from this plugin"""
46 parser = subparsers.add_parser('log', help='show logs',
47 description='show the logs from test results',
48 group='analysis')
49 parser.set_defaults(func=log)
50 parser.add_argument('source',
51 help='the results file/directory/URL to import')
52 parser.add_argument('--ptest', action='append', default=[],
53 help='show logs for a ptest')
54 parser.add_argument('--raw', action='store_true',
55 help='show raw logs')
56
diff --git a/scripts/lib/resulttool/regression.py b/scripts/lib/resulttool/regression.py
index aecb9da9ce..fa90ab1e52 100644
--- a/scripts/lib/resulttool/regression.py
+++ b/scripts/lib/resulttool/regression.py
@@ -64,7 +64,7 @@ def regression_common(args, logger, base_results, target_results):
64 if a in target_results: 64 if a in target_results:
65 base = list(base_results[a].keys()) 65 base = list(base_results[a].keys())
66 target = list(target_results[a].keys()) 66 target = list(target_results[a].keys())
67 # We may have multiple base/targets which are for different configurations. Start by 67 # We may have multiple base/targets which are for different configurations. Start by
68 # removing any pairs which match 68 # removing any pairs which match
69 for c in base.copy(): 69 for c in base.copy():
70 for b in target.copy(): 70 for b in target.copy():
diff --git a/scripts/resulttool b/scripts/resulttool
index 18ac101923..9477667a87 100755
--- a/scripts/resulttool
+++ b/scripts/resulttool
@@ -49,6 +49,7 @@ import resulttool.store
49import resulttool.regression 49import resulttool.regression
50import resulttool.report 50import resulttool.report
51import resulttool.manualexecution 51import resulttool.manualexecution
52import resulttool.log
52logger = scriptutils.logger_create('resulttool') 53logger = scriptutils.logger_create('resulttool')
53 54
54def main(): 55def main():
@@ -66,6 +67,7 @@ def main():
66 subparsers.add_subparser_group('analysis', 'analysis', 100) 67 subparsers.add_subparser_group('analysis', 'analysis', 100)
67 resulttool.regression.register_commands(subparsers) 68 resulttool.regression.register_commands(subparsers)
68 resulttool.report.register_commands(subparsers) 69 resulttool.report.register_commands(subparsers)
70 resulttool.log.register_commands(subparsers)
69 71
70 args = parser.parse_args() 72 args = parser.parse_args()
71 if args.debug: 73 if args.debug: