diff options
| -rw-r--r-- | scripts/lib/resulttool/log.py | 56 | ||||
| -rw-r--r-- | scripts/lib/resulttool/regression.py | 2 | ||||
| -rwxr-xr-x | scripts/resulttool | 2 |
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 | # | ||
| 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(): |
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 | |||
| 49 | import resulttool.regression | 49 | import resulttool.regression |
| 50 | import resulttool.report | 50 | import resulttool.report |
| 51 | import resulttool.manualexecution | 51 | import resulttool.manualexecution |
| 52 | import resulttool.log | ||
| 52 | logger = scriptutils.logger_create('resulttool') | 53 | logger = scriptutils.logger_create('resulttool') |
| 53 | 54 | ||
| 54 | def main(): | 55 | def 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: |
