diff options
Diffstat (limited to 'scripts/lib/resulttool/log.py')
| -rw-r--r-- | scripts/lib/resulttool/log.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/lib/resulttool/log.py b/scripts/lib/resulttool/log.py index eb3927ec82..15148ca288 100644 --- a/scripts/lib/resulttool/log.py +++ b/scripts/lib/resulttool/log.py | |||
| @@ -28,12 +28,10 @@ def show_reproducible(result, reproducible, logger): | |||
| 28 | def log(args, logger): | 28 | def log(args, logger): |
| 29 | results = resultutils.load_resultsdata(args.source) | 29 | results = resultutils.load_resultsdata(args.source) |
| 30 | 30 | ||
| 31 | ptest_count = sum(1 for _, _, _, r in resultutils.test_run_results(results) if 'ptestresult.sections' in r) | ||
| 32 | if ptest_count > 1 and not args.prepend_run: | ||
| 33 | print("%i ptest sections found. '--prepend-run' is required" % ptest_count) | ||
| 34 | return 1 | ||
| 35 | |||
| 36 | for _, run_name, _, r in resultutils.test_run_results(results): | 31 | for _, run_name, _, r in resultutils.test_run_results(results): |
| 32 | if args.list_ptest: | ||
| 33 | print('\n'.join(sorted(r['ptestresult.sections'].keys()))) | ||
| 34 | |||
| 37 | if args.dump_ptest: | 35 | if args.dump_ptest: |
| 38 | for sectname in ['ptestresult.sections', 'ltpposixresult.sections', 'ltpresult.sections']: | 36 | for sectname in ['ptestresult.sections', 'ltpposixresult.sections', 'ltpresult.sections']: |
| 39 | if sectname in r: | 37 | if sectname in r: |
| @@ -48,6 +46,9 @@ def log(args, logger): | |||
| 48 | 46 | ||
| 49 | os.makedirs(dest_dir, exist_ok=True) | 47 | os.makedirs(dest_dir, exist_ok=True) |
| 50 | dest = os.path.join(dest_dir, '%s.log' % name) | 48 | dest = os.path.join(dest_dir, '%s.log' % name) |
| 49 | if os.path.exists(dest): | ||
| 50 | print("Overlapping ptest logs found, skipping %s. The '--prepend-run' option would avoid this" % name) | ||
| 51 | continue | ||
| 51 | print(dest) | 52 | print(dest) |
| 52 | with open(dest, 'w') as f: | 53 | with open(dest, 'w') as f: |
| 53 | f.write(logdata) | 54 | f.write(logdata) |
| @@ -86,6 +87,8 @@ def register_commands(subparsers): | |||
| 86 | parser.set_defaults(func=log) | 87 | parser.set_defaults(func=log) |
| 87 | parser.add_argument('source', | 88 | parser.add_argument('source', |
| 88 | help='the results file/directory/URL to import') | 89 | help='the results file/directory/URL to import') |
| 90 | parser.add_argument('--list-ptest', action='store_true', | ||
| 91 | help='list the ptest test names') | ||
| 89 | parser.add_argument('--ptest', action='append', default=[], | 92 | parser.add_argument('--ptest', action='append', default=[], |
| 90 | help='show logs for a ptest') | 93 | help='show logs for a ptest') |
| 91 | parser.add_argument('--dump-ptest', metavar='DIR', | 94 | parser.add_argument('--dump-ptest', metavar='DIR', |
