summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/resulttool/report.py16
-rw-r--r--scripts/lib/resulttool/resultutils.py4
2 files changed, 13 insertions, 7 deletions
diff --git a/scripts/lib/resulttool/report.py b/scripts/lib/resulttool/report.py
index 883b52517b..d2d4d1b59d 100644
--- a/scripts/lib/resulttool/report.py
+++ b/scripts/lib/resulttool/report.py
@@ -207,8 +207,11 @@ class ResultsTextReport(object):
207 maxlen=maxlen) 207 maxlen=maxlen)
208 print(output) 208 print(output)
209 209
210 def view_test_report(self, logger, source_dir, branch, commit, tag): 210 def view_test_report(self, logger, source_dir, branch, commit, tag, use_regression_map):
211 test_count_reports = [] 211 test_count_reports = []
212 configmap = resultutils.store_map
213 if use_regression_map:
214 configmap = resultutils.regression_map
212 if commit: 215 if commit:
213 if tag: 216 if tag:
214 logger.warning("Ignoring --tag as --commit was specified") 217 logger.warning("Ignoring --tag as --commit was specified")
@@ -216,12 +219,12 @@ class ResultsTextReport(object):
216 repo = GitRepo(source_dir) 219 repo = GitRepo(source_dir)
217 revs = gitarchive.get_test_revs(logger, repo, tag_name, branch=branch) 220 revs = gitarchive.get_test_revs(logger, repo, tag_name, branch=branch)
218 rev_index = gitarchive.rev_find(revs, 'commit', commit) 221 rev_index = gitarchive.rev_find(revs, 'commit', commit)
219 testresults = resultutils.git_get_result(repo, revs[rev_index][2]) 222 testresults = resultutils.git_get_result(repo, revs[rev_index][2], configmap=configmap)
220 elif tag: 223 elif tag:
221 repo = GitRepo(source_dir) 224 repo = GitRepo(source_dir)
222 testresults = resultutils.git_get_result(repo, [tag]) 225 testresults = resultutils.git_get_result(repo, [tag], configmap=configmap)
223 else: 226 else:
224 testresults = resultutils.load_resultsdata(source_dir) 227 testresults = resultutils.load_resultsdata(source_dir, configmap=configmap)
225 for testsuite in testresults: 228 for testsuite in testresults:
226 for resultid in testresults[testsuite]: 229 for resultid in testresults[testsuite]:
227 skip = False 230 skip = False
@@ -248,7 +251,7 @@ class ResultsTextReport(object):
248 251
249def report(args, logger): 252def report(args, logger):
250 report = ResultsTextReport() 253 report = ResultsTextReport()
251 report.view_test_report(logger, args.source_dir, args.branch, args.commit, args.tag) 254 report.view_test_report(logger, args.source_dir, args.branch, args.commit, args.tag, args.use_regression_map)
252 return 0 255 return 0
253 256
254def register_commands(subparsers): 257def register_commands(subparsers):
@@ -263,3 +266,6 @@ def register_commands(subparsers):
263 parser_build.add_argument('--commit', help="Revision to report") 266 parser_build.add_argument('--commit', help="Revision to report")
264 parser_build.add_argument('-t', '--tag', default='', 267 parser_build.add_argument('-t', '--tag', default='',
265 help='source_dir is a git repository, report on the tag specified from that repository') 268 help='source_dir is a git repository, report on the tag specified from that repository')
269 parser_build.add_argument('-m', '--use_regression_map', action='store_true',
270 help='instead of the default "store_map", use the "regression_map" for report')
271
diff --git a/scripts/lib/resulttool/resultutils.py b/scripts/lib/resulttool/resultutils.py
index 7cb85a6aa9..f0ae8ec1c5 100644
--- a/scripts/lib/resulttool/resultutils.py
+++ b/scripts/lib/resulttool/resultutils.py
@@ -177,7 +177,7 @@ def save_resultsdata(results, destdir, fn="testresults.json", ptestjson=False, p
177 with open(dst.replace(fn, "ptest-%s.log" % i), "w+") as f: 177 with open(dst.replace(fn, "ptest-%s.log" % i), "w+") as f:
178 f.write(sectionlog) 178 f.write(sectionlog)
179 179
180def git_get_result(repo, tags): 180def git_get_result(repo, tags, configmap=store_map):
181 git_objs = [] 181 git_objs = []
182 for tag in tags: 182 for tag in tags:
183 files = repo.run_cmd(['ls-tree', "--name-only", "-r", tag]).splitlines() 183 files = repo.run_cmd(['ls-tree', "--name-only", "-r", tag]).splitlines()
@@ -200,7 +200,7 @@ def git_get_result(repo, tags):
200 # Optimize by reading all data with one git command 200 # Optimize by reading all data with one git command
201 results = {} 201 results = {}
202 for obj in parse_json_stream(repo.run_cmd(['show'] + git_objs + ['--'])): 202 for obj in parse_json_stream(repo.run_cmd(['show'] + git_objs + ['--'])):
203 append_resultsdata(results, obj) 203 append_resultsdata(results, obj, configmap=configmap)
204 204
205 return results 205 return results
206 206