diff options
author | Alexis Lothoré <alexis.lothore@bootlin.com> | 2023-10-22 19:49:38 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-10-23 10:49:19 +0100 |
commit | ea09071364a45559d15bf39db8e2848c7ce7cd22 (patch) | |
tree | 2774402bdb33bd899995a6e5940ed4dfa3d34d58 /scripts/yocto_testresults_query.py | |
parent | 198110b1b954ae6fbd6b2d648c3a5bcc71c412a5 (diff) | |
download | poky-ea09071364a45559d15bf39db8e2848c7ce7cd22.tar.gz |
scripts/yocto_testresults_query: add option to change display limit
Add a "-l"/"--limit" option to allow changing the display limit in
resulttool.
- If no value is passed, resulttool uses its default value.
- If 0 is passed, the display limit is removed and every regression will be
displayed
- If a custom value is passed, this value overrides the vlaue configured in
resulttool
(From OE-Core rev: d3f536b3fc3f7027f6f5cf8bdaf5d7c050c7974b)
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/yocto_testresults_query.py')
-rwxr-xr-x | scripts/yocto_testresults_query.py | 13 |
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 | ||
59 | def compute_regression_report(workdir, basebranch, baserevision, targetbranch, targetrevision): | 59 | def 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 | ||
64 | def print_report_with_header(report, baseversion, baserevision, targetversion, targetrevision): | 67 | def 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() |