diff options
Diffstat (limited to 'scripts/yocto_testresults_query.py')
-rwxr-xr-x | scripts/yocto_testresults_query.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/yocto_testresults_query.py b/scripts/yocto_testresults_query.py index 3df9d6015f..4df339c92e 100755 --- a/scripts/yocto_testresults_query.py +++ b/scripts/yocto_testresults_query.py | |||
@@ -38,18 +38,27 @@ def get_sha1(pokydir, revision): | |||
38 | logger.error(f"Can not find SHA-1 for {revision} in {pokydir}") | 38 | logger.error(f"Can not find SHA-1 for {revision} in {pokydir}") |
39 | return None | 39 | return None |
40 | 40 | ||
41 | def get_branch(tag): | ||
42 | # The tags in test results repository, as returned by git rev-list, have the following form: | ||
43 | # refs/tags/<branch>/<count>-g<sha1>/<num> | ||
44 | return tag.split("/")[2] | ||
45 | |||
41 | def fetch_testresults(workdir, sha1): | 46 | def fetch_testresults(workdir, sha1): |
42 | logger.info(f"Fetching test results for {sha1} in {workdir}") | 47 | logger.info(f"Fetching test results for {sha1} in {workdir}") |
43 | rawtags = subprocess.check_output(["git", "ls-remote", "--refs", "--tags", "origin", f"*{sha1}*"], cwd=workdir).decode('utf-8').strip() | 48 | rawtags = subprocess.check_output(["git", "ls-remote", "--refs", "--tags", "origin", f"*{sha1}*"], cwd=workdir).decode('utf-8').strip() |
44 | if not rawtags: | 49 | if not rawtags: |
45 | raise Exception(f"No reference found for commit {sha1} in {workdir}") | 50 | raise Exception(f"No reference found for commit {sha1} in {workdir}") |
51 | branch = "" | ||
46 | for rev in [rawtag.split()[1] for rawtag in rawtags.splitlines()]: | 52 | for rev in [rawtag.split()[1] for rawtag in rawtags.splitlines()]: |
47 | logger.info(f"Fetching matching revisions: {rev}") | 53 | if not branch: |
54 | branch = get_branch(rev) | ||
55 | logger.info(f"Fetching matching revision: {rev}") | ||
48 | 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 | ||
49 | 58 | ||
50 | def compute_regression_report(workdir, baserevision, targetrevision): | 59 | def compute_regression_report(workdir, basebranch, baserevision, targetbranch, targetrevision): |
51 | logger.info(f"Running resulttool regression between SHA1 {baserevision} and {targetrevision}") | 60 | logger.info(f"Running resulttool regression between SHA1 {baserevision} and {targetrevision}") |
52 | report = subprocess.check_output([resulttool, "regression-git", "--commit", baserevision, "--commit2", targetrevision, workdir]).decode("utf-8") | 61 | report = subprocess.check_output([resulttool, "regression-git", "--branch", basebranch, "--commit", baserevision, "--branch2", targetbranch, "--commit2", targetrevision, workdir]).decode("utf-8") |
53 | return report | 62 | return report |
54 | 63 | ||
55 | def print_report_with_header(report, baseversion, baserevision, targetversion, targetrevision): | 64 | def print_report_with_header(report, baseversion, baserevision, targetversion, targetrevision): |
@@ -74,9 +83,9 @@ def regression(args): | |||
74 | if not args.testresultsdir: | 83 | if not args.testresultsdir: |
75 | subprocess.check_call(["rm", "-rf", workdir]) | 84 | subprocess.check_call(["rm", "-rf", workdir]) |
76 | sys.exit(1) | 85 | sys.exit(1) |
77 | fetch_testresults(workdir, baserevision) | 86 | basebranch = fetch_testresults(workdir, baserevision) |
78 | fetch_testresults(workdir, targetrevision) | 87 | targetbranch = fetch_testresults(workdir, targetrevision) |
79 | report = compute_regression_report(workdir, baserevision, targetrevision) | 88 | report = compute_regression_report(workdir, basebranch, baserevision, targetbranch, targetrevision) |
80 | print_report_with_header(report, args.base, baserevision, args.target, targetrevision) | 89 | print_report_with_header(report, args.base, baserevision, args.target, targetrevision) |
81 | finally: | 90 | finally: |
82 | if not args.testresultsdir: | 91 | if not args.testresultsdir: |