summaryrefslogtreecommitdiffstats
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-27 22:54:25 +0000
commit758ac050ffd91524d400c196865b1ed27ece8776 (patch)
tree2c100102c6919ce8bb13333ba8dcdd9b51dd789a
parenta383d0e726011007419dd102cd6484733d80d9f6 (diff)
downloadopenembedded-core-758ac050ffd91524d400c196865b1ed27ece8776.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) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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():
return workdir
def get_sha1(pokydir, revision):
- rev = subprocess.check_output(["git", "rev-list", "-n", "1", revision], cwd=pokydir).decode('utf-8').strip()
- logger.info(f"SHA-1 revision for {revision} in {pokydir} is {rev}")
- return rev
+ try:
+ rev = subprocess.check_output(["git", "rev-list", "-n", "1", revision], cwd=pokydir).decode('utf-8').strip()
+ logger.info(f"SHA-1 revision for {revision} in {pokydir} is {rev}")
+ return rev
+ except subprocess.CalledProcessError:
+ logger.error(f"Can not find SHA-1 for {revision} in {pokydir}")
+ return None
def fetch_testresults(workdir, sha1):
logger.info(f"Fetching test results for {sha1} in {workdir}")
@@ -65,6 +69,11 @@ def regression(args):
try:
baserevision = get_sha1(poky_path, args.base)
targetrevision = get_sha1(poky_path, args.target)
+ if not baserevision or not targetrevision:
+ 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)")
+ 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)