summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2019-09-05 08:54:44 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-06 14:58:10 +0100
commitbff47225c6dca9465146aced6119670cf1152e1c (patch)
tree134a85c6c48c965fe79008bed37e482276541922 /scripts/lib
parent921d669f0f5e17a56d5ac653eb2192d3da2e96d9 (diff)
downloadpoky-bff47225c6dca9465146aced6119670cf1152e1c.tar.gz
resulttool: Add reproducible log extraction
Adds an argument to the log subcommand to extract the raw logs from the reproducible selftest. To prevent ambiguity, the "--raw" argument has been renamed "--raw-ptest", although the old "--raw" argument is kept around for compatibility. [YOCTO #13324] (From OE-Core rev: 7a4ebb361ff1efc22e7dafadfa60c98bc8a79ed4) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-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