diff options
author | Joshua Watt <jpewhacker@gmail.com> | 2019-04-18 21:57:18 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-04-25 00:05:20 +0100 |
commit | e567c3761b697e09ed0c9806c0a7b8e57419a17f (patch) | |
tree | 2d8086288130610c6f4401d1a8fcee3c73d4846d /scripts/lib | |
parent | 3326a902dbccfa5f50afce132ded138b3253f7a8 (diff) | |
download | poky-e567c3761b697e09ed0c9806c0a7b8e57419a17f.tar.gz |
resulttool: Add log subcommand
Adds a subcommand for dumping various logs from test results
(From OE-Core rev: 454b8d2cdc6f79a51e610dae92c22352850c3f7c)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/resulttool/log.py | 56 | ||||
-rw-r--r-- | scripts/lib/resulttool/regression.py | 2 |
2 files changed, 57 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 | # | ||
14 | import resulttool.resultutils as resultutils | ||
15 | |||
16 | def 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 | |||
25 | def 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 | |||
44 | def 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(): |