scripts/send-qa-email: fix testing branches regression reporting

d6018b891a broke regression reporting for testing
branches (e.g: master-next in poky, ross/mut in poky-contrib) by ignoring the comparebranch returned by
utils.getcomparison branch

Fix regression reporting for those branches by using comparebranch again. The
fix also refactor/add a intermediary step to guess base and target for
regression reporting, to isolate a bit the logic and make it easier later to add
multiple base/target couples

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-03-13 15:51:43 +01:00 committed by Richard Purdie
parent 11409d7fea
commit 35af879d51

View File

@ -49,18 +49,28 @@ def get_previous_tag(targetrepodir, version):
defaultbaseversion, _, _ = utils.get_version_from_string(subprocess.check_output(["git", "describe", "--abbrev=0"], cwd=targetrepodir).decode('utf-8').strip())
return utils.get_tag_from_version(defaultbaseversion, None)
def generate_regression_report(querytool, targetrepodir, basebranch, resultdir, outputdir, yoctoversion):
baseversion = get_previous_tag(targetrepodir, yoctoversion)
print(f"Comparing {basebranch} to {baseversion}")
def get_regression_base_and_target(basebranch, comparebranch, release, targetrepodir):
if not basebranch:
# Basebranch/comparebranch is an arbitrary configuration (not defined in config.json): do not run regression reporting
return None, None
if is_release_version(release):
# We are on a release: ignore comparebranch (which is very likely None), regression reporting must be done against previous tag
return get_previous_tag(targetrepodir, release), basebranch
elif comparebranch:
# Basebranch/comparebranch is defined in config.json: regression reporting must be done against branches as defined in config.json
return comparebranch, basebranch
def generate_regression_report(querytool, targetrepodir, base, target, resultdir, outputdir):
print(f"Comparing {target} to {base}")
try:
regreport = subprocess.check_output([querytool, "regression-report", baseversion, basebranch, '-t', resultdir])
regreport = subprocess.check_output([querytool, "regression-report", base, target, '-t', resultdir])
with open(outputdir + "/testresult-regressions-report.txt", "wb") as f:
f.write(regreport)
except subprocess.CalledProcessError as e:
error = str(e)
print(f"Error while generating report between {basebranch} and {baseversion} : {error}")
print(f"Error while generating report between {target} and {base} : {error}")
def send_qa_email():
parser = utils.ArgParser(description='Process test results and optionally send an email about the build to prompt QA to begin testing.')
@ -142,8 +152,9 @@ def send_qa_email():
subprocess.check_call(["git", "push", "--all"], cwd=tempdir)
subprocess.check_call(["git", "push", "--tags"], cwd=tempdir)
if basebranch:
generate_regression_report(querytool, targetrepodir, basebranch, tempdir, args.results_dir, args.release)
regression_base, regression_target = get_regression_base_and_target(basebranch, comparebranch, args.release, targetrepodir)
if regression_base and regression_target:
generate_regression_report(querytool, targetrepodir, regression_base, regression_target, tempdir, args.results_dir)
finally:
subprocess.check_call(["rm", "-rf", tempdir])