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>
This commit is contained in:
Alexis Lothoré 2023-10-22 19:49:38 +02:00 committed by Richard Purdie
parent 198110b1b9
commit ea09071364

View File

@ -56,9 +56,12 @@ def fetch_testresults(workdir, sha1):
subprocess.check_call(["git", "fetch", "--depth", "1", "origin", f"{rev}:{rev}"], cwd=workdir)
return branch
def compute_regression_report(workdir, basebranch, baserevision, targetbranch, targetrevision):
def compute_regression_report(workdir, basebranch, baserevision, targetbranch, targetrevision, args):
logger.info(f"Running resulttool regression between SHA1 {baserevision} and {targetrevision}")
report = subprocess.check_output([resulttool, "regression-git", "--branch", basebranch, "--commit", baserevision, "--branch2", targetbranch, "--commit2", targetrevision, workdir]).decode("utf-8")
command = [resulttool, "regression-git", "--branch", basebranch, "--commit", baserevision, "--branch2", targetbranch, "--commit2", targetrevision, workdir]
if args.limit:
command.extend(["-l", args.limit])
report = subprocess.check_output(command).decode("utf-8")
return report
def print_report_with_header(report, baseversion, baserevision, targetversion, targetrevision):
@ -85,7 +88,7 @@ def regression(args):
sys.exit(1)
basebranch = fetch_testresults(workdir, baserevision)
targetbranch = fetch_testresults(workdir, targetrevision)
report = compute_regression_report(workdir, basebranch, baserevision, targetbranch, targetrevision)
report = compute_regression_report(workdir, basebranch, baserevision, targetbranch, targetrevision, args)
print_report_with_header(report, args.base, baserevision, args.target, targetrevision)
finally:
if not args.testresultsdir:
@ -109,6 +112,10 @@ def main():
'-t',
'--testresultsdir',
help=f"An existing test results directory. {sys.argv[0]} will automatically clone it and use default branch if not provided")
parser_regression_report.add_argument(
'-l',
'--limit',
help=f"Maximum number of changes to display per test. Can be set to 0 to print all changes")
parser_regression_report.set_defaults(func=regression)
args = parser.parse_args()