summaryrefslogtreecommitdiffstats
path: root/scripts/lib/resulttool
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/resulttool')
-rw-r--r--scripts/lib/resulttool/log.py33
1 files changed, 30 insertions, 3 deletions
diff --git a/scripts/lib/resulttool/log.py b/scripts/lib/resulttool/log.py
index 25c3396717..2352c767d9 100644
--- a/scripts/lib/resulttool/log.py
+++ b/scripts/lib/resulttool/log.py
@@ -16,6 +16,16 @@ def show_ptest(result, ptest, logger):
16 print("ptest '%s' not found" % ptest) 16 print("ptest '%s' not found" % ptest)
17 return 1 17 return 1
18 18
19def show_reproducible(result, reproducible, logger):
20 try:
21 print(result['reproducible'][reproducible]['diffoscope.text'])
22 return 0
23
24 except KeyError:
25 print("reproducible '%s' not found" % reproducible)
26 return 1
27
28
19def log(args, logger): 29def log(args, logger):
20 results = resultutils.load_resultsdata(args.source) 30 results = resultutils.load_resultsdata(args.source)
21 31
@@ -40,17 +50,28 @@ def log(args, logger):
40 with open(dest, 'w') as f: 50 with open(dest, 'w') as f:
41 f.write(ptest['log']) 51 f.write(ptest['log'])
42 52
43 if args.raw: 53 if args.raw_ptest:
44 if 'ptestresult.rawlogs' in r: 54 if 'ptestresult.rawlogs' in r:
45 print(r['ptestresult.rawlogs']['log']) 55 print(r['ptestresult.rawlogs']['log'])
46 else: 56 else:
47 print('Raw logs not found') 57 print('Raw ptest logs not found')
58 return 1
59
60 if args.raw_reproducible:
61 if 'reproducible.rawlogs' in r:
62 print(r['reproducible.rawlogs']['log'])
63 else:
64 print('Raw reproducible logs not found')
48 return 1 65 return 1
49 66
50 for ptest in args.ptest: 67 for ptest in args.ptest:
51 if not show_ptest(r, ptest, logger): 68 if not show_ptest(r, ptest, logger):
52 return 1 69 return 1
53 70
71 for reproducible in args.reproducible:
72 if not show_reproducible(r, reproducible, logger):
73 return 1
74
54def register_commands(subparsers): 75def register_commands(subparsers):
55 """Register subcommands from this plugin""" 76 """Register subcommands from this plugin"""
56 parser = subparsers.add_parser('log', help='show logs', 77 parser = subparsers.add_parser('log', help='show logs',
@@ -63,9 +84,15 @@ def register_commands(subparsers):
63 help='show logs for a ptest') 84 help='show logs for a ptest')
64 parser.add_argument('--dump-ptest', metavar='DIR', 85 parser.add_argument('--dump-ptest', metavar='DIR',
65 help='Dump all ptest log files to the specified directory.') 86 help='Dump all ptest log files to the specified directory.')
87 parser.add_argument('--reproducible', action='append', default=[],
88 help='show logs for a reproducible test')
66 parser.add_argument('--prepend-run', action='store_true', 89 parser.add_argument('--prepend-run', action='store_true',
67 help='''Dump ptest results to a subdirectory named after the test run when using --dump-ptest. 90 help='''Dump ptest results to a subdirectory named after the test run when using --dump-ptest.
68 Required if more than one test run is present in the result file''') 91 Required if more than one test run is present in the result file''')
69 parser.add_argument('--raw', action='store_true', 92 parser.add_argument('--raw', action='store_true',
70 help='show raw logs') 93 help='show raw (ptest) logs. Deprecated. Alias for "--raw-ptest"', dest='raw_ptest')
94 parser.add_argument('--raw-ptest', action='store_true',
95 help='show raw ptest log')
96 parser.add_argument('--raw-reproducible', action='store_true',
97 help='show raw reproducible build logs')
71 98