mirror of
git://git.yoctoproject.org/yocto-autobuilder-helper.git
synced 2025-07-19 20:59:02 +02:00
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:
parent
11409d7fea
commit
35af879d51
|
@ -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())
|
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)
|
return utils.get_tag_from_version(defaultbaseversion, None)
|
||||||
|
|
||||||
def generate_regression_report(querytool, targetrepodir, basebranch, resultdir, outputdir, yoctoversion):
|
def get_regression_base_and_target(basebranch, comparebranch, release, targetrepodir):
|
||||||
baseversion = get_previous_tag(targetrepodir, yoctoversion)
|
if not basebranch:
|
||||||
print(f"Comparing {basebranch} to {baseversion}")
|
# 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:
|
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:
|
with open(outputdir + "/testresult-regressions-report.txt", "wb") as f:
|
||||||
f.write(regreport)
|
f.write(regreport)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
error = str(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():
|
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.')
|
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", "--all"], cwd=tempdir)
|
||||||
subprocess.check_call(["git", "push", "--tags"], cwd=tempdir)
|
subprocess.check_call(["git", "push", "--tags"], cwd=tempdir)
|
||||||
|
|
||||||
if basebranch:
|
regression_base, regression_target = get_regression_base_and_target(basebranch, comparebranch, args.release, targetrepodir)
|
||||||
generate_regression_report(querytool, targetrepodir, basebranch, tempdir, args.results_dir, args.release)
|
if regression_base and regression_target:
|
||||||
|
generate_regression_report(querytool, targetrepodir, regression_base, regression_target, tempdir, args.results_dir)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
subprocess.check_call(["rm", "-rf", tempdir])
|
subprocess.check_call(["rm", "-rf", tempdir])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user