From patchwork Fri Jun 21 15:57:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 45488 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2577C2BD09 for ; Fri, 21 Jun 2024 15:57:41 +0000 (UTC) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by mx.groups.io with SMTP id smtpd.web10.76933.1718985455872376879 for ; Fri, 21 Jun 2024 08:57:36 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=N/E7V6ty; spf=pass (domain: bootlin.com, ip: 217.70.183.197, mailfrom: alexis.lothore@bootlin.com) Received: by mail.gandi.net (Postfix) with ESMTPSA id 3DC1C1C0003; Fri, 21 Jun 2024 15:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1718985454; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ev9OeDLGskgXxvgrLClMsoxkzoex16MFvO0CMZ1RcKw=; b=N/E7V6tyENy8Ewb5wpSelMRMuud+6sCP1sSA29OSV8mWXG6FP0V6OGsZO5g++EMpjtbtV6 Insk6wcuvGvD5GDeXfhLpIqqvAfph1ZrYpApoU/KZfkrhN1qCDaEqToNoCS9zf/iCvA5cK DNy4O1tiAem50R1kZVbYlkCZnf+SialFRhb+8umSqYbnoWgBU5vXsgzbP1kMCL5l+VRgcw BEZYbrdJi4+NDMxxZ2AHmLGRdWwceV6LB5z0gDbCU2Q+PYkUJBzv5juO7y/3wZG0ydMLmT ZETC57rUUMj6FlM/0ukacsYU3fp1XMAOAFOyutfz8wf6vNpFwfjIPKpL4baAYA== From: =?utf-8?q?Alexis_Lothor=C3=A9?= To: yocto-patches@lists.yoctoproject.org Cc: Thomas Petazzoni , Alexandre Belloni Subject: [yocto-autobuilder-helper][PATCH 1/3] scripts: send_qa_email: fix invalid regex syntax warning Date: Fri, 21 Jun 2024 16:57:21 +0100 Message-ID: <20240621155723.33600-2-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240621155723.33600-1-alexis.lothore@bootlin.com> References: <20240621155723.33600-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: alexis.lothore@bootlin.com List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 21 Jun 2024 15:57:41 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/366 From: Alexis Lothoré When send_qa_email is executed with python >= 3.12, the following warnings are emitted: /home/alexis/src/yocto_ci/yocto-autobuilder-helper/./scripts/send_qa_email.py:22: SyntaxWarning: invalid escape sequence '\d' p = re.compile('\d{8}-\d+') /home/alexis/src/yocto_ci/yocto-autobuilder-helper/./scripts/send_qa_email.py:67: SyntaxWarning: invalid escape sequence '\/' tested_revision = re.match('refs\/tags\/.*\/\d+-g([a-f0-9]+)\/\d', latest_test_tag).group(1) This warning has been introduced to replace the DeprecationWarning initially raised on such escape code in string regex. Python 3.12 changelog ([1]) states that raw string must be used in this case. Update both send_qa_email and its tests file. [1] https://docs.python.org/dev/whatsnew/3.12.html#other-language-changes Signed-off-by: Alexis Lothoré --- scripts/send_qa_email.py | 4 ++-- scripts/test_send_qa_email.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/send_qa_email.py b/scripts/send_qa_email.py index 8d9250d555d4..e258fa131fcb 100755 --- a/scripts/send_qa_email.py +++ b/scripts/send_qa_email.py @@ -19,7 +19,7 @@ TEST_RESULTS_REPOSITORY_URL="git@push.yoctoproject.org:yocto-testresults" TEST_RESULTS_DRY_RUN_REPOSITORY_URL="git://git.yoctoproject.org/yocto-testresults" def is_release_version(version): - p = re.compile('\d{8}-\d+') + p = re.compile(r'\d{8}-\d+') return version is not None and p.match(version) is None def get_previous_tag(targetrepodir, version): @@ -64,7 +64,7 @@ def get_last_tested_rev_on_branch(branch, test_results_url, log): tags_list = subprocess.check_output(["git", "ls-remote", "--refs", "-t", test_results_url, "refs/tags/" + branch + "/*"]).decode('utf-8').strip() latest_test_tag=tags_list.splitlines()[-1].split()[1] # From test results tag, extract Poky revision - tested_revision = re.match('refs\/tags\/.*\/\d+-g([a-f0-9]+)\/\d', latest_test_tag).group(1) + tested_revision = re.match(r'refs\/tags\/.*\/\d+-g([a-f0-9]+)\/\d', latest_test_tag).group(1) log.info(f"Last tested revision on branch {branch} is {tested_revision}") return tested_revision diff --git a/scripts/test_send_qa_email.py b/scripts/test_send_qa_email.py index 415d8cbbbccd..64ae80a1852d 100755 --- a/scripts/test_send_qa_email.py +++ b/scripts/test_send_qa_email.py @@ -31,8 +31,8 @@ class TestVersion(unittest.TestCase): {"input": {"version": "4.1_M1.rc1"}, "expected": "yocto-4.0"}, {"input": {"version": "4.1_M1.rc4"}, "expected": "yocto-4.0"}, {"input": {"version": "4.1.rc4"}, "expected": "yocto-4.0"}, - {"input": {"version": "yocto-5.0_M1.rc1"}, "expected": "yocto-4.3(\.\d)?"}, - {"input": {"version": "yocto-5.0_M1.rc2"}, "expected": "yocto-4.3(\.\d)?"}, + {"input": {"version": "yocto-5.0_M1.rc1"}, "expected": r"yocto-4.3(\.\d)?"}, + {"input": {"version": "yocto-5.0_M1.rc2"}, "expected": r"yocto-4.3(\.\d)?"}, {"input": {"version": "yocto-5.0_M2.rc1"}, "expected": "5.0_M1"}, ] From patchwork Fri Jun 21 15:57:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 45487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5AEFC41513 for ; Fri, 21 Jun 2024 15:57:41 +0000 (UTC) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by mx.groups.io with SMTP id smtpd.web10.76934.1718985456422545299 for ; Fri, 21 Jun 2024 08:57:36 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=jkVlrhsG; spf=pass (domain: bootlin.com, ip: 217.70.183.197, mailfrom: alexis.lothore@bootlin.com) Received: by mail.gandi.net (Postfix) with ESMTPSA id BD2061C0005; Fri, 21 Jun 2024 15:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1718985455; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MmfSQ+IhhXL1sCwO+dYKFluyXTo124eeHvHM0i8I+FQ=; b=jkVlrhsGBLPpm2qzyNG4Xec1in04aGXYt+bXVsL5ovAnQYub2LkXAuPZ6+CoiX4aEsfNZ0 hYiFcb1F2Up7tmPHVNmNdyOZrW8LoxxU9qH2uJ+RsqDQM0IGqc3tIMmu/TeK2Hkb/oGnkg FzbmzdR8H4l7zewsSd4EcgOXZWjmk+GdxMft0xlNVvwiFf3Fo90uSYj23iqyt6boylijtk t8usolia8AU1PTTqiiNk32L3uD8VuiiGEXq3CT7obkyrIKY95ZN7XJjncv8j90LhHv/mjr Ip/RHOqeTDbzB82uoZ9iesC5/Ry7MQ3RAZX1EolibBbI3Efk2VtFgVCedSX8DQ== From: =?utf-8?q?Alexis_Lothor=C3=A9?= To: yocto-patches@lists.yoctoproject.org Cc: Thomas Petazzoni , Alexandre Belloni Subject: [yocto-autobuilder-helper][PATCH 2/3] scripts: test_send_qa_email: fix broken tests Date: Fri, 21 Jun 2024 16:57:22 +0100 Message-ID: <20240621155723.33600-3-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240621155723.33600-1-alexis.lothore@bootlin.com> References: <20240621155723.33600-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: alexis.lothore@bootlin.com List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 21 Jun 2024 15:57:41 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/367 From: Alexis Lothoré Commit 1dc77f590875 ("scripts: send_qa_email: add dry-run mode") updated the get_regression_base_and_target to allow it to receive a test result url. Unfortunately, this function's tests have not been updated accordingly, so they currently fail because of the missing parameter. Add a default url in test case and update the function call with this default value. Signed-off-by: Alexis Lothoré --- scripts/test_send_qa_email.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/test_send_qa_email.py b/scripts/test_send_qa_email.py index 64ae80a1852d..8b19975c31d5 100755 --- a/scripts/test_send_qa_email.py +++ b/scripts/test_send_qa_email.py @@ -42,6 +42,8 @@ class TestVersion(unittest.TestCase): {"input": None, "expected":False} ] + test_results_url = "git://git.yoctoproject.org/yocto-testresults" + # This data represent real data returned by utils.getcomparisonbranch # and the release argument passed to send-qa-email script regression_inputs = [ @@ -76,7 +78,12 @@ class TestVersion(unittest.TestCase): for data in self.regression_inputs: with self.subTest(data['name']): base, target = send_qa_email.get_regression_base_and_target( - data['input']['targetbranch'], data['input']['basebranch'], data['input']['release'], os.environ.get("POKY_PATH"), log) + data['input']['targetbranch'], + data['input']['basebranch'], + data['input']['release'], + os.environ.get("POKY_PATH"), + self.test_results_url, + log) expected_base, expected_target = data["expected"] # The comparison base can not be set statically in tests when it is supposed to be the previous tag, # since the result will depend on current tags From patchwork Fri Jun 21 15:57:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 45486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7934BC2BD05 for ; Fri, 21 Jun 2024 15:57:41 +0000 (UTC) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by mx.groups.io with SMTP id smtpd.web11.77006.1718985456936707775 for ; Fri, 21 Jun 2024 08:57:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=C2cI8IiJ; spf=pass (domain: bootlin.com, ip: 217.70.183.197, mailfrom: alexis.lothore@bootlin.com) Received: by mail.gandi.net (Postfix) with ESMTPSA id 467801C0006; Fri, 21 Jun 2024 15:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1718985455; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Uu3rvoO7MkUkoL1qDIG05FjV5u1vlcU6YdBwbjdyKHw=; b=C2cI8IiJOsq4MeWqrZ9Is40ycJWqCcBN5IUpePS7ENo2UcBr6O45B7VRKZwK44/Hjg51hC 10AZzDOo2KK4VkCbpmrCoeINpwgs7ABqQQrvV8ZgELundyaiuVqJyafQ2P+dXf41baLZJe fRDhKiz8dka1n6F/zGe8/aeahEfr0UQXiCxBZ7YmsYg2C+sqE9RuYQrJillROxwVLUWX64 rsVWEBU/0+3DhHTri1EGRHEdjizEm7d7YiiikUKMMTkcQuepnDElwa7xn1LhYqZGW72sWA oYmQOEkwstety0GJ2HG6O9k+9pAmf1/k2ss+qY6G7xaMnPdIlxw8CuRLnrS5Pg== From: =?utf-8?q?Alexis_Lothor=C3=A9?= To: yocto-patches@lists.yoctoproject.org Cc: Thomas Petazzoni , Alexandre Belloni Subject: [yocto-autobuilder-helper][PATCH 3/3] scripts: send_qa_email: do not try to generate a regression report when missing base and/or target Date: Fri, 21 Jun 2024 16:57:23 +0100 Message-ID: <20240621155723.33600-4-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240621155723.33600-1-alexis.lothore@bootlin.com> References: <20240621155723.33600-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: alexis.lothore@bootlin.com List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 21 Jun 2024 15:57:41 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/368 From: Alexis Lothoré Fixes [YOCTO 15503] When running autobuilder onm a testing or stable branch, the following exception may occur: Traceback (most recent call last): File "/home/pokybuild/yocto-worker/a-full/yocto-autobuilder-helper/scripts/send_qa_email.py", line 278, in send_qa_email() File "/home/pokybuild/yocto-worker/a-full/yocto-autobuilder-helper/scripts/send_qa_email.py", line 207, in send_qa_email generate_regression_report(querytool, targetrepodir, regression_base, regression_target, tempdir, args.results_dir, log) File "/home/pokybuild/yocto-worker/a-full/yocto-autobuilder-helper/scripts/send_qa_email.py", line 93, in generate_regression_report regreport = subprocess.check_output([querytool, "regression-report", base, target, '-t', resultdir]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.11/subprocess.py", line 466, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.11/subprocess.py", line 548, in run with Popen(*popenargs, **kwargs) as process: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.11/subprocess.py", line 1026, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib64/python3.11/subprocess.py", line 1883, in _execute_child self.pid = _fork_exec( ^^^^^^^^^^^ TypeError: expected str, bytes or os.PathLike object, not NoneType This issue is due to base and target revision being None, but subprocess module do not tolerate arguments being None, Prevent the script from even trying to generate a regression report if we are missing some info about revisions to compare. Cc: Steve Sakoman Signed-off-by: Alexis Lothoré --- scripts/send_qa_email.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/send_qa_email.py b/scripts/send_qa_email.py index e258fa131fcb..39e938284972 100755 --- a/scripts/send_qa_email.py +++ b/scripts/send_qa_email.py @@ -203,8 +203,11 @@ def send_qa_email(): utils.printheader("Processing regression report") try: regression_base, regression_target = get_regression_base_and_target(targetbranch, basebranch, args.release, targetrepodir, test_results_url, log) - log.info(f"Generating regression report between {regression_base} and {regression_target}") - generate_regression_report(querytool, targetrepodir, regression_base, regression_target, tempdir, args.results_dir, log) + if regression_base and regression_target: + log.info(f"Generating regression report between {regression_base} and {regression_target}") + generate_regression_report(querytool, targetrepodir, regression_base, regression_target, tempdir, args.results_dir, log) + else: + log.info("Can not guess regression base and/or target, skip regression report") except subprocess.CalledProcessError as e: error = str(e) exitcode = 1