summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/yocto_testresults_query.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/yocto_testresults_query.py b/scripts/yocto_testresults_query.py
index a5073736aa..521ead8473 100755
--- a/scripts/yocto_testresults_query.py
+++ b/scripts/yocto_testresults_query.py
@@ -56,9 +56,12 @@ def fetch_testresults(workdir, sha1):
56 subprocess.check_call(["git", "fetch", "--depth", "1", "origin", f"{rev}:{rev}"], cwd=workdir) 56 subprocess.check_call(["git", "fetch", "--depth", "1", "origin", f"{rev}:{rev}"], cwd=workdir)
57 return branch 57 return branch
58 58
59def compute_regression_report(workdir, basebranch, baserevision, targetbranch, targetrevision): 59def compute_regression_report(workdir, basebranch, baserevision, targetbranch, targetrevision, args):
60 logger.info(f"Running resulttool regression between SHA1 {baserevision} and {targetrevision}") 60 logger.info(f"Running resulttool regression between SHA1 {baserevision} and {targetrevision}")
61 report = subprocess.check_output([resulttool, "regression-git", "--branch", basebranch, "--commit", baserevision, "--branch2", targetbranch, "--commit2", targetrevision, workdir]).decode("utf-8") 61 command = [resulttool, "regression-git", "--branch", basebranch, "--commit", baserevision, "--branch2", targetbranch, "--commit2", targetrevision, workdir]
62 if args.limit:
63 command.extend(["-l", args.limit])
64 report = subprocess.check_output(command).decode("utf-8")
62 return report 65 return report
63 66
64def print_report_with_header(report, baseversion, baserevision, targetversion, targetrevision): 67def print_report_with_header(report, baseversion, baserevision, targetversion, targetrevision):
@@ -85,7 +88,7 @@ def regression(args):
85 sys.exit(1) 88 sys.exit(1)
86 basebranch = fetch_testresults(workdir, baserevision) 89 basebranch = fetch_testresults(workdir, baserevision)
87 targetbranch = fetch_testresults(workdir, targetrevision) 90 targetbranch = fetch_testresults(workdir, targetrevision)
88 report = compute_regression_report(workdir, basebranch, baserevision, targetbranch, targetrevision) 91 report = compute_regression_report(workdir, basebranch, baserevision, targetbranch, targetrevision, args)
89 print_report_with_header(report, args.base, baserevision, args.target, targetrevision) 92 print_report_with_header(report, args.base, baserevision, args.target, targetrevision)
90 finally: 93 finally:
91 if not args.testresultsdir: 94 if not args.testresultsdir:
@@ -109,6 +112,10 @@ def main():
109 '-t', 112 '-t',
110 '--testresultsdir', 113 '--testresultsdir',
111 help=f"An existing test results directory. {sys.argv[0]} will automatically clone it and use default branch if not provided") 114 help=f"An existing test results directory. {sys.argv[0]} will automatically clone it and use default branch if not provided")
115 parser_regression_report.add_argument(
116 '-l',
117 '--limit',
118 help=f"Maximum number of changes to display per test. Can be set to 0 to print all changes")
112 parser_regression_report.set_defaults(func=regression) 119 parser_regression_report.set_defaults(func=regression)
113 120
114 args = parser.parse_args() 121 args = parser.parse_args()