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>
This commit is contained in:
Alexis Lothoré 2023-02-27 20:42:22 +01:00 committed by Richard Purdie
parent aa0682447f
commit d0f32772bb

View File

@ -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)