summaryrefslogtreecommitdiffstats
path: root/scripts/yocto_testresults_query.py
diff options
context:
space:
mode:
authorAlexis Lothoré <alexis.lothore@bootlin.com>2023-02-27 20:42:22 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-02-28 07:53:54 +0000
commitd0f32772bb412837028623808a4df3cd16f8780a (patch)
treef1314bfc268a4c8235bf54a53dd76642dcd5a53b /scripts/yocto_testresults_query.py
parentaa0682447f4bf5ac9c5486a1d41bb1140d904361 (diff)
downloadpoky-d0f32772bb412837028623808a4df3cd16f8780a.tar.gz
scripts/yoct_testresults_query: manage base/target revision not found
If yocto_testresults_query.py is run from oe-core instead of poky, the script will very likely fail since poky tags do no exist in oe-core. If one or both revisions are not found, log the error and a suggestion about the reason (the script being run in oe-core instead of poky) (From OE-Core rev: 758ac050ffd91524d400c196865b1ed27ece8776) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/yocto_testresults_query.py')
-rwxr-xr-xscripts/yocto_testresults_query.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/yocto_testresults_query.py b/scripts/yocto_testresults_query.py
index 3b478822dc..3df9d6015f 100755
--- a/scripts/yocto_testresults_query.py
+++ b/scripts/yocto_testresults_query.py
@@ -30,9 +30,13 @@ def create_workdir():
30 return workdir 30 return workdir
31 31
32def get_sha1(pokydir, revision): 32def get_sha1(pokydir, revision):
33 rev = subprocess.check_output(["git", "rev-list", "-n", "1", revision], cwd=pokydir).decode('utf-8').strip() 33 try:
34 logger.info(f"SHA-1 revision for {revision} in {pokydir} is {rev}") 34 rev = subprocess.check_output(["git", "rev-list", "-n", "1", revision], cwd=pokydir).decode('utf-8').strip()
35 return rev 35 logger.info(f"SHA-1 revision for {revision} in {pokydir} is {rev}")
36 return rev
37 except subprocess.CalledProcessError:
38 logger.error(f"Can not find SHA-1 for {revision} in {pokydir}")
39 return None
36 40
37def fetch_testresults(workdir, sha1): 41def fetch_testresults(workdir, sha1):
38 logger.info(f"Fetching test results for {sha1} in {workdir}") 42 logger.info(f"Fetching test results for {sha1} in {workdir}")
@@ -65,6 +69,11 @@ def regression(args):
65 try: 69 try:
66 baserevision = get_sha1(poky_path, args.base) 70 baserevision = get_sha1(poky_path, args.base)
67 targetrevision = get_sha1(poky_path, args.target) 71 targetrevision = get_sha1(poky_path, args.target)
72 if not baserevision or not targetrevision:
73 logger.error("One or more revision(s) missing. You might be targeting nonexistant tags/branches, or are in wrong repository (you must use Poky and not oe-core)")
74 if not args.testresultsdir:
75 subprocess.check_call(["rm", "-rf", workdir])
76 sys.exit(1)
68 fetch_testresults(workdir, baserevision) 77 fetch_testresults(workdir, baserevision)
69 fetch_testresults(workdir, targetrevision) 78 fetch_testresults(workdir, targetrevision)
70 report = compute_regression_report(workdir, baserevision, targetrevision) 79 report = compute_regression_report(workdir, baserevision, targetrevision)