mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 12:59:02 +02:00
scripts/yocto_testresults_query.py: set proper branches when using resulttool
The script currently only works if base and target can be found on default branches. It breaks if we try to generate a regression report between revisions that live on different branches (as needed on integration and testing branches). For example, the following command: ./scripts/yocto_testresults_query.py regression-report yocto-4.0.6 yocto-4.0.7 ends with the follwing error: [...] ERROR: Only 1 tester revisions found, unable to generate report [...] Read branches from tags names in test results repository, and pass those branches to resulttool when generating the report (From OE-Core rev: 6c472b326bcc718459483cc29b310b884742df86) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
1eae53e277
commit
4617ef6abf
|
@ -38,18 +38,27 @@ def get_sha1(pokydir, revision):
|
|||
logger.error(f"Can not find SHA-1 for {revision} in {pokydir}")
|
||||
return None
|
||||
|
||||
def get_branch(tag):
|
||||
# The tags in test results repository, as returned by git rev-list, have the following form:
|
||||
# refs/tags/<branch>/<count>-g<sha1>/<num>
|
||||
return tag.split("/")[2]
|
||||
|
||||
def fetch_testresults(workdir, sha1):
|
||||
logger.info(f"Fetching test results for {sha1} in {workdir}")
|
||||
rawtags = subprocess.check_output(["git", "ls-remote", "--refs", "--tags", "origin", f"*{sha1}*"], cwd=workdir).decode('utf-8').strip()
|
||||
if not rawtags:
|
||||
raise Exception(f"No reference found for commit {sha1} in {workdir}")
|
||||
branch = ""
|
||||
for rev in [rawtag.split()[1] for rawtag in rawtags.splitlines()]:
|
||||
logger.info(f"Fetching matching revisions: {rev}")
|
||||
if not branch:
|
||||
branch = get_branch(rev)
|
||||
logger.info(f"Fetching matching revision: {rev}")
|
||||
subprocess.check_call(["git", "fetch", "--depth", "1", "origin", f"{rev}:{rev}"], cwd=workdir)
|
||||
return branch
|
||||
|
||||
def compute_regression_report(workdir, baserevision, targetrevision):
|
||||
def compute_regression_report(workdir, basebranch, baserevision, targetbranch, targetrevision):
|
||||
logger.info(f"Running resulttool regression between SHA1 {baserevision} and {targetrevision}")
|
||||
report = subprocess.check_output([resulttool, "regression-git", "--commit", baserevision, "--commit2", targetrevision, workdir]).decode("utf-8")
|
||||
report = subprocess.check_output([resulttool, "regression-git", "--branch", basebranch, "--commit", baserevision, "--branch2", targetbranch, "--commit2", targetrevision, workdir]).decode("utf-8")
|
||||
return report
|
||||
|
||||
def print_report_with_header(report, baseversion, baserevision, targetversion, targetrevision):
|
||||
|
@ -74,9 +83,9 @@ def regression(args):
|
|||
if not args.testresultsdir:
|
||||
subprocess.check_call(["rm", "-rf", workdir])
|
||||
sys.exit(1)
|
||||
fetch_testresults(workdir, baserevision)
|
||||
fetch_testresults(workdir, targetrevision)
|
||||
report = compute_regression_report(workdir, baserevision, targetrevision)
|
||||
basebranch = fetch_testresults(workdir, baserevision)
|
||||
targetbranch = fetch_testresults(workdir, targetrevision)
|
||||
report = compute_regression_report(workdir, basebranch, baserevision, targetbranch, targetrevision)
|
||||
print_report_with_header(report, args.base, baserevision, args.target, targetrevision)
|
||||
finally:
|
||||
if not args.testresultsdir:
|
||||
|
|
Loading…
Reference in New Issue
Block a user