From patchwork Mon Mar 13 14:51:38 2023 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: 20882 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 9324CC7618E for ; Mon, 13 Mar 2023 14:52:05 +0000 (UTC) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by mx.groups.io with SMTP id smtpd.web10.21571.1678719122954571111 for ; Mon, 13 Mar 2023 07:52:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=W8Av6gF8; spf=pass (domain: bootlin.com, ip: 217.70.183.196, mailfrom: alexis.lothore@bootlin.com) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 590CEE0010; Mon, 13 Mar 2023 14:52:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1678719120; 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=FFx35Ein/ZrG2H6qSttSSWg4RskjVbK72VK3p3SZRH0=; b=W8Av6gF8t+sg2bPkeyET9R6Ku2DGky1C6D6lJEdZzfINFSbIDsbwgwg7JoLFEgClJqUThk KwJlQUmUBWCqusGz232DZ8W3HXLg+3Ekxl1OiaSr9WiF39C42ISsJwJNjSsbLMSEUngjhm pNlJdIOtvohogCDiuCnH0WzgN1CFdLjV2HUlpCCCzKNJJ+5R5fPCRkVdf0hKlzCjVV1CBX m32ZNFn07ZYE/VyyFh5Xwk/IAR5zZ+oIuJ5+5jY/Afx3B4QD3x/sZ3u9s+zb3E5EQ5048y wdbWOVep7fTGNGr9q7Rip6fUsmnrVf+V+n/sqwrqQAjK9BTs6goGGhRGKzy7XQ== From: alexis.lothore@bootlin.com To: yocto@lists.yoctoproject.org, alexandre.belloni@bootlin.com Cc: thomas.petazzoni@bootlin.com Subject: [yocto-autobuilder-helper][PATCH 1/8] scripts/utils: add unit tests for getcomparisonbranch Date: Mon, 13 Mar 2023 15:51:38 +0100 Message-Id: <20230313145145.2574842-2-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313145145.2574842-1-alexis.lothore@bootlin.com> References: <20230313145145.2574842-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 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 ; Mon, 13 Mar 2023 14:52:05 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/59412 From: Alexis Lothoré Signed-off-by: Alexis Lothoré --- scripts/test_utils.py | 104 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100755 scripts/test_utils.py diff --git a/scripts/test_utils.py b/scripts/test_utils.py new file mode 100755 index 0000000..ab91e3b --- /dev/null +++ b/scripts/test_utils.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python3 + +import os +import unittest +import utils + + +class TestGetComparisonBranch(unittest.TestCase): + TEST_CONFIG = { + "BUILD_HISTORY_DIRECTPUSH": [ + "poky:morty", + "poky:pyro", + "poky:rocko", + "poky:sumo", + "poky:thud", + "poky:warrior", + "poky:zeus", + "poky:dunfell", + "poky:gatesgarth", + "poky:hardknott", + "poky:honister", + "poky:kirkstone", + "poky:langdale", + "poky:master" + ], "BUILD_HISTORY_FORKPUSH": { + "poky-contrib:ross/mut": "poky:master", + "poky:master-next": "poky:master", + "poky-contrib:abelloni/master-next": "poky:master" + } + } + + def test_release_master(self): + repo = "ssh://git@push.yoctoproject.org/poky" + branch = "master" + basebranch, comparebranch = utils.getcomparisonbranch( + self.TEST_CONFIG, repo, branch) + self.assertEqual( + basebranch, "master", msg="Repo/branch pair present in BUILD_HISTORY_DIRECTPUSH must return corresponding base branch") + self.assertEqual( + comparebranch, None, msg="Repo/branch pair present in BUILD_HISTORY_DIRECTPUSH must return corresponding compare branch") + + def test_release_kirkstone(self): + repo = "ssh://git@push.yoctoproject.org/poky" + branch = "kirkstone" + basebranch, comparebranch = utils.getcomparisonbranch( + self.TEST_CONFIG, repo, branch) + self.assertEqual(basebranch, "kirkstone", + msg="Repo/branch pair present in BUILD_HISTORY_DIRECTPUSH must return corresponding base branch") + self.assertEqual( + comparebranch, None, msg="Repo/branch pair present in BUILD_HISTORY_DIRECTPUSH must return corresponding compare branch") + + def test_release_langdale(self): + repo = "ssh://git@push.yoctoproject.org/poky" + branch = "langdale" + basebranch, comparebranch = utils.getcomparisonbranch( + self.TEST_CONFIG, repo, branch) + self.assertEqual(basebranch, "langdale", + msg="Repo/branch pair present in BUILD_HISTORY_DIRECTPUSH must return corresponding base branch") + self.assertEqual( + comparebranch, None, msg="Repo/branch pair present in BUILD_HISTORY_DIRECTPUSH must return corresponding compare branch") + + def test_master_next(self): + repo = "ssh://git@push.yoctoproject.org/poky" + branch = "master-next" + basebranch, comparebranch = utils.getcomparisonbranch( + self.TEST_CONFIG, repo, branch) + self.assertEqual(basebranch, "master-next", + msg="Repo/branch pair present in BUILD_HISTORY_FORKPUSH must return corresponding base branch") + self.assertEqual(comparebranch, "master", + msg="Repo/branch pair present in BUILD_HISTORY_FORKPUSH must return corresponding compare branch") + + def test_abelloni_master_next(self): + repo = "ssh://git@push.yoctoproject.org/poky-contrib" + branch = "abelloni/master-next" + basebranch, comparebranch = utils.getcomparisonbranch( + self.TEST_CONFIG, repo, branch) + self.assertEqual(basebranch, "abelloni/master-next", + msg="Repo/branch pair present in BUILD_HISTORY_FORKPUSH must return corresponding base branch") + self.assertEqual(comparebranch, "master", + msg="Repo/branch pair present in BUILD_HISTORY_FORKPUSH must return corresponding compare branch") + + def test_ross_master_next(self): + repo = "ssh://git@push.yoctoproject.org/poky-contrib" + branch = "ross/mut" + basebranch, comparebranch = utils.getcomparisonbranch( + self.TEST_CONFIG, repo, branch) + self.assertEqual(basebranch, "ross/mut", + msg="Repo/branch pair present in BUILD_HISTORY_FORKPUSH must return corresponding base branch") + self.assertEqual(comparebranch, "master", + msg="Repo/branch pair present in BUILD_HISTORY_FORKPUSH must return corresponding compare branch") + + def test_arbitrary_branch(self): + repo = "ssh://git@push.yoctoproject.org/poky-contrib" + branch = "akanavin/package-version-updates" + basebranch, comparebranch = utils.getcomparisonbranch( + self.TEST_CONFIG, repo, branch) + self.assertEqual( + basebranch, None, msg="Arbitrary repo/branch should not return any specific basebranch") + self.assertEqual( + comparebranch, None, msg="Arbitrary repo/branch should not return any specific comparebranch") + + +if __name__ == '__main__': + unittest.main() From patchwork Mon Mar 13 14:51:39 2023 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: 20880 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 773E3C6FD1F for ; Mon, 13 Mar 2023 14:52:05 +0000 (UTC) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by mx.groups.io with SMTP id smtpd.web11.22129.1678719122547858177 for ; Mon, 13 Mar 2023 07:52:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=dGGjbcTw; spf=pass (domain: bootlin.com, ip: 217.70.183.196, mailfrom: alexis.lothore@bootlin.com) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id D1FD4E0003; Mon, 13 Mar 2023 14:52:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1678719121; 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=/nnkd+VU2Ocz58gB1r8W73R3FNEEeRHv4VsILsS8LMU=; b=dGGjbcTw1YFeo0JEADjVh/yo/lCnh/jKx+tQ0Z5y9XXUP9UhMj9pMnsQ8KBf3EsFTHJ2yQ t/bt2JXI8RMFFjTJlSRUZ0JR+clDtS1JPt8g3r6epaYB1YuLiPWJZsI3teydn8lvlsnn5n RLyVESYLztSAn/KW44i6iI+MFh9xXvhTXfUn9k9ual3poDQdYiX+I2v7WjCNj+4VTo17kS SlPfq3uVRHPupVyCMcqft6JNKHo2oXTt+ILaDiKg0S8DAllXTJ+hsDD5JQRBEB7uEz8LPR qXTXtbcC8tUtfeYzZhHWZ9iLCPeJzFKvS02Wm0w0gFLL+B84U9VT4EVMtIf4DQ== From: alexis.lothore@bootlin.com To: yocto@lists.yoctoproject.org, alexandre.belloni@bootlin.com Cc: thomas.petazzoni@bootlin.com Subject: [yocto-autobuilder-helper][PATCH 2/8] scripts/send-qa-email: remove unused variable Date: Mon, 13 Mar 2023 15:51:39 +0100 Message-Id: <20230313145145.2574842-3-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313145145.2574842-1-alexis.lothore@bootlin.com> References: <20230313145145.2574842-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 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 ; Mon, 13 Mar 2023 14:52:05 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/59409 From: Alexis Lothoré Signed-off-by: Alexis Lothoré --- scripts/send_qa_email.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/send_qa_email.py b/scripts/send_qa_email.py index 7999c1b..96225a8 100755 --- a/scripts/send_qa_email.py +++ b/scripts/send_qa_email.py @@ -83,7 +83,6 @@ def send_qa_email(): args = parser.parse_args() - scriptsdir = os.path.dirname(os.path.realpath(__file__)) ourconfig = utils.loadconfig() with open(args.repojson) as f: From patchwork Mon Mar 13 14:51:40 2023 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: 20881 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 90836C7618D for ; Mon, 13 Mar 2023 14:52:05 +0000 (UTC) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by mx.groups.io with SMTP id smtpd.web11.22130.1678719123005430200 for ; Mon, 13 Mar 2023 07:52:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=mlC2HXJg; spf=pass (domain: bootlin.com, ip: 217.70.183.196, mailfrom: alexis.lothore@bootlin.com) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 5A7ADE0011; Mon, 13 Mar 2023 14:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1678719121; 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=eTgYnEsjs6YaiFQcT3YY8tq2bgLa2InxQAlOikxZKQ0=; b=mlC2HXJg7FkFmHM0fooCsPH7bW1yrdWsJNW/Xn2hxuRuDzRIKFC0ioITT0LyduyrVhJqn1 7cplEWph0SU95WQbVoi7yas16geLhqphYn68A6wgAohiEK0t08HAz+R+BDuMrbbQkSogtX HZvDWotb6n93Ey42rUrwwjErHiNgiQKGPK2IxGYb7dUKdw1a7PK5xhd37/f6Djg4wxU+3U mC/6PaMsL+dChM597kLkYHywnW/leVaLJlfZuhDcrfDFQ90IqeQxOM72kqH7f1LeBSP4xO /CI9Xpm8QybaOu0IukhpMrgMCC8mIFvF+e3hAcB4bgh/8QPXAIaFhHS047WtMA== From: alexis.lothore@bootlin.com To: yocto@lists.yoctoproject.org, alexandre.belloni@bootlin.com Cc: thomas.petazzoni@bootlin.com Subject: [yocto-autobuilder-helper][PATCH 3/8] scripts/send-qa-email: invert boolean logic for release check Date: Mon, 13 Mar 2023 15:51:40 +0100 Message-Id: <20230313145145.2574842-4-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313145145.2574842-1-alexis.lothore@bootlin.com> References: <20230313145145.2574842-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 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 ; Mon, 13 Mar 2023 14:52:05 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/59411 From: Alexis Lothoré is_non_release_version has an inverted logic which makes its reuse quite confusing Transform it as is_release_version and let caller do the negation if needed Signed-off-by: Alexis Lothoré --- scripts/send_qa_email.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/send_qa_email.py b/scripts/send_qa_email.py index 96225a8..320ff24 100755 --- a/scripts/send_qa_email.py +++ b/scripts/send_qa_email.py @@ -14,15 +14,15 @@ import re import utils -def is_non_release_version(version): +def is_release_version(version): p = re.compile('\d{8}-\d+') - return p.match(version) is not None + return p.match(version) is None def get_previous_tag(targetrepodir, version): previousversion = None previousmilestone = None if version: - if is_non_release_version(version): + if not is_release_version(version): return subprocess.check_output(["git", "describe", "--abbrev=0"], cwd=targetrepodir).decode('utf-8').strip() compareversion, comparemilestone, _ = utils.get_version_from_string(version) compareversionminor = compareversion[-1] From patchwork Mon Mar 13 14:51:41 2023 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: 20879 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 8FAA6C74A4B for ; Mon, 13 Mar 2023 14:52:05 +0000 (UTC) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by mx.groups.io with SMTP id smtpd.web11.22131.1678719123494939060 for ; Mon, 13 Mar 2023 07:52:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=jhcjqRzE; spf=pass (domain: bootlin.com, ip: 217.70.183.196, mailfrom: alexis.lothore@bootlin.com) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id C67D5E0009; Mon, 13 Mar 2023 14:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1678719122; 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=ijyLnF1OF0IkyaKwouD5l1cEiwjpfraxCgULVans/EU=; b=jhcjqRzEO/asrPkA13GoNWySA2C0VlgmtHB4fIo78qnomXsLIBHS4QKEeFs0/4xY+EcyO3 /wPr89yKboWph3hg2XkARWfZUVbunZqWMFfDk46uRGtszi80zgkwa0af6RQz2eM3JSAVnu WZn9Y6Htmz1R0bq4KZrUiolcTBIv6tQxZ1FKCAUIsDzrVQ0oRXxzvLEXy2msvPJy8Rod8t 1mJhKWNd/JLlSqkSxtqSt8O5KXzKgNJbfHU8YvHs0oOXeH4t0JfSJzrbgS+nu8UYigcJnG ddtriD9AIOqXLVhm9IMGkyQeSZEIJjlbha3LnGKRuiT8dlkQlI3DXUPpyPuJuQ== From: alexis.lothore@bootlin.com To: yocto@lists.yoctoproject.org, alexandre.belloni@bootlin.com Cc: thomas.petazzoni@bootlin.com Subject: [yocto-autobuilder-helper][PATCH 4/8] scripts/send-qa-email: protect is_release_version from None value Date: Mon, 13 Mar 2023 15:51:41 +0100 Message-Id: <20230313145145.2574842-5-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313145145.2574842-1-alexis.lothore@bootlin.com> References: <20230313145145.2574842-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 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 ; Mon, 13 Mar 2023 14:52:05 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/59413 From: Alexis Lothoré Signed-off-by: Alexis Lothoré --- scripts/send_qa_email.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/send_qa_email.py b/scripts/send_qa_email.py index 320ff24..540eb94 100755 --- a/scripts/send_qa_email.py +++ b/scripts/send_qa_email.py @@ -16,7 +16,7 @@ import utils def is_release_version(version): p = re.compile('\d{8}-\d+') - return p.match(version) is None + return version is not None and p.match(version) is None def get_previous_tag(targetrepodir, version): previousversion = None From patchwork Mon Mar 13 14:51:42 2023 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: 20878 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 75E59C6FD19 for ; Mon, 13 Mar 2023 14:52:05 +0000 (UTC) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by mx.groups.io with SMTP id smtpd.web10.21572.1678719124021563622 for ; Mon, 13 Mar 2023 07:52:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=fVTWcJ8B; spf=pass (domain: bootlin.com, ip: 217.70.183.196, mailfrom: alexis.lothore@bootlin.com) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 4B58BE000B; Mon, 13 Mar 2023 14:52:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1678719122; 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=CJUdGhsJnO45G5N9HX75yb+OALyKko9NAW5YklwyaXk=; b=fVTWcJ8BAQQzb0BBXMmtd8LLNgqYeaxt6A/Emgf7b8/JtFVOoMrZglEhl5jMX1lpkXSZe1 fllkIDULbrQpnhHX/7ulKhg8/kfDfdjbaPzy7e6B0bvrMFSbvzgKcs7h6damoqbYAF5aSR djAr/QQFC2TquN1P999NSAxuOdlHj7Rfu7knkzqN2vLOxolw5Unddcopp8aI1Elr4esepo 8sMGtVowaauGRXc5sXAcRdmVTlMGuWEHQeDfut47LQj55xK85Pf7L+ynl0ZqaPe9rL1s2P /NIecyF95fI58BL/Ze6tQEepHZFcZvjnbBdDe3FN3utXsZa8Q92OU4IJ03l4Pg== From: alexis.lothore@bootlin.com To: yocto@lists.yoctoproject.org, alexandre.belloni@bootlin.com Cc: thomas.petazzoni@bootlin.com Subject: [yocto-autobuilder-helper][PATCH 5/8] scripts/send-qa-email: add tests for is_release_version Date: Mon, 13 Mar 2023 15:51:42 +0100 Message-Id: <20230313145145.2574842-6-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313145145.2574842-1-alexis.lothore@bootlin.com> References: <20230313145145.2574842-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 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 ; Mon, 13 Mar 2023 14:52:05 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/59414 From: Alexis Lothoré Signed-off-by: Alexis Lothoré --- scripts/test_send_qa_email.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/test_send_qa_email.py b/scripts/test_send_qa_email.py index c1347fb..48bca98 100755 --- a/scripts/test_send_qa_email.py +++ b/scripts/test_send_qa_email.py @@ -29,6 +29,12 @@ class TestVersion(unittest.TestCase): {"input": {"version": "4.1.rc4"}, "expected": "yocto-4.0"} ] + test_data_is_release_version = [ + {"input": "yocto-4.2", "expected":True}, + {"input": "20230313-15", "expected":False}, + {"input": None, "expected":False} + ] + def test_versions(self): for data in self.test_data_get_version: test_name = data["input"]["version"] @@ -36,6 +42,10 @@ class TestVersion(unittest.TestCase): self.assertEqual(send_qa_email.get_previous_tag(os.environ.get( "POKY_PATH"), data["input"]["version"]), data["expected"]) + def test_is_release_version(self): + for data in self.test_data_is_release_version: + with self.subTest(f"{data['input']}"): + self.assertEqual(send_qa_email.is_release_version(data['input']), data['expected']) if __name__ == '__main__': if os.environ.get("POKY_PATH") is None: From patchwork Mon Mar 13 14:51:43 2023 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: 20877 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 79B55C61DA4 for ; Mon, 13 Mar 2023 14:52:05 +0000 (UTC) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by mx.groups.io with SMTP id smtpd.web11.22132.1678719124465404829 for ; Mon, 13 Mar 2023 07:52:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=RG6evm43; spf=pass (domain: bootlin.com, ip: 217.70.183.196, mailfrom: alexis.lothore@bootlin.com) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id D07CDE000F; Mon, 13 Mar 2023 14:52:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1678719123; 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=NgHgdFvFMnDZq/Igt7oZ45kVbZC117n5yb0c2tGOwMo=; b=RG6evm43HV8VbnkBkjsK5g4lOBSuQD0zVV4ou/LTxsBkfI1UVaqmb+EGqVPTM2dhwwLFek PeDghKlMHivBFBgrLQGhFLgvNuOknJq+/njIXuSE9iHiVvBdDpixg1ORVKg3sEUc4Nxf0O ghKcbXldh2Qwa4esed0e6McYtcFpHyQVQJpMoh6Diu+PZNWBHSLYsMcDsKVJz7+fl5NDCO /dnbjd6P36J0bu3K/GL07K64j2XLQtrW2IEDf2uapkSY1wqiDiDf6aG32MNjoxPwBQU4n/ sxztspD+ffqaQa+uIkA0FozRNS7sPQJ33QjLqswGUwzE5XybqPOXHSdB394OTw== From: alexis.lothore@bootlin.com To: yocto@lists.yoctoproject.org, alexandre.belloni@bootlin.com Cc: thomas.petazzoni@bootlin.com Subject: [yocto-autobuilder-helper][PATCH 6/8] scripts/send-qa-email: fix testing branches regression reporting Date: Mon, 13 Mar 2023 15:51:43 +0100 Message-Id: <20230313145145.2574842-7-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313145145.2574842-1-alexis.lothore@bootlin.com> References: <20230313145145.2574842-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 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 ; Mon, 13 Mar 2023 14:52:05 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/59415 From: Alexis Lothoré d6018b891a3b7c62c7a2883c7fb9ae55e66f1363 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é --- scripts/send_qa_email.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/scripts/send_qa_email.py b/scripts/send_qa_email.py index 540eb94..78e051a 100755 --- a/scripts/send_qa_email.py +++ b/scripts/send_qa_email.py @@ -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]) From patchwork Mon Mar 13 14:51:44 2023 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: 20883 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 8AC09C6FD1F for ; Mon, 13 Mar 2023 14:52:15 +0000 (UTC) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by mx.groups.io with SMTP id smtpd.web11.22134.1678719125020447466 for ; Mon, 13 Mar 2023 07:52:05 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=m/gPOokc; spf=pass (domain: bootlin.com, ip: 217.70.183.196, mailfrom: alexis.lothore@bootlin.com) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 5C5E2E0003; Mon, 13 Mar 2023 14:52:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1678719123; 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=lV/NjGuaFRKNnStf2dhyVYFbBvQQKmoCqsmZKd+iYFE=; b=m/gPOokc81Y7X5fe/AH0V96i7X4oLje8ML4oeSHwBDGcycVMl4nI8b1OH4P+8frL6B9SWw Oy0zawf/XJaoVcm4KVOwwCQoHS65AC653YetrQjRc9b25jnbFeozv5iwpkuSiarVisVTa0 DXhBFKxUUgnUQ423cWSspYBHC762DCNR04IezZb3Rnna0GAh2lYlbvuQtUsNh3i9oxEkDO Us41+v+uH79v1ufmAIb9lZgFAUhN7UQ7OQaG7nhWOT4C104EAHfeejRsHECWqgkcEEPqeN g1XWU4tcLlbvolIcX7eENczPila5WzT2Kh9BtQC/wQRTE75RmxHwi/Ncg4Krsw== From: alexis.lothore@bootlin.com To: yocto@lists.yoctoproject.org, alexandre.belloni@bootlin.com Cc: thomas.petazzoni@bootlin.com Subject: [yocto-autobuilder-helper][PATCH 7/8] scripts/test_send_qa_email.py: add tests for base/target pair guessing Date: Mon, 13 Mar 2023 15:51:44 +0100 Message-Id: <20230313145145.2574842-8-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313145145.2574842-1-alexis.lothore@bootlin.com> References: <20230313145145.2574842-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 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 ; Mon, 13 Mar 2023 14:52:15 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/59416 From: Alexis Lothoré Signed-off-by: Alexis Lothoré --- scripts/test_send_qa_email.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scripts/test_send_qa_email.py b/scripts/test_send_qa_email.py index 48bca98..ccdcba6 100755 --- a/scripts/test_send_qa_email.py +++ b/scripts/test_send_qa_email.py @@ -35,6 +35,21 @@ class TestVersion(unittest.TestCase): {"input": None, "expected":False} ] + # This data represent real data returned by utils.getcomparisonbranch + # and the release argument passed to send-qa-email script + regression_inputs = [ + {"name": "Arbitrary branch", "input": {"basebranch": None, + "comparebranch": None, "release": None}, "expected": (None, None)}, + {"name": "Master release", "input": {"basebranch": "master", + "comparebranch": None, "release": "yocto-4.2_M3.rc1"}, "expected": ("4.2_M2", "master")}, + {"name": "Older release", "input": {"basebranch": "kirkstone", + "comparebranch": None, "release": "yocto-4.0.8.rc2"}, "expected": ("yocto-4.0.7", "kirkstone")}, + {"name": "Master Next", "input": {"basebranch": "master-next", + "comparebranch": "master", "release": None}, "expected": ("master", "master-next")}, + {"name": "Fork Master Next", "input": {"basebranch": "ross/mut", + "comparebranch": "master", "release": None}, "expected": ("master", "ross/mut")}, + ] + def test_versions(self): for data in self.test_data_get_version: test_name = data["input"]["version"] @@ -47,6 +62,12 @@ class TestVersion(unittest.TestCase): with self.subTest(f"{data['input']}"): self.assertEqual(send_qa_email.is_release_version(data['input']), data['expected']) + def test_get_regression_base_and_target(self): + for data in self.regression_inputs: + with self.subTest(data['name']): + self.assertEqual(send_qa_email.get_regression_base_and_target( + data['input']['basebranch'], data['input']['comparebranch'], data['input']['release'], os.environ.get("POKY_PATH")), data['expected']) + if __name__ == '__main__': if os.environ.get("POKY_PATH") is None: print("Please set POKY_PATH to proper poky clone location before running tests") From patchwork Mon Mar 13 14:51:45 2023 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: 20884 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 8AC76C7618B for ; Mon, 13 Mar 2023 14:52:15 +0000 (UTC) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by mx.groups.io with SMTP id smtpd.web11.22135.1678719125498860603 for ; Mon, 13 Mar 2023 07:52:05 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=oYpgLVLe; spf=pass (domain: bootlin.com, ip: 217.70.183.196, mailfrom: alexis.lothore@bootlin.com) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id D3786E0004; Mon, 13 Mar 2023 14:52:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1678719124; 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=McNBS5S7FQpM2UJYirChae4xxGlYGlofsNw5j5lG53Q=; b=oYpgLVLeNyQk0TAxJWbIQPiAKYPYqvaZt0x8gC3EtlDmGt49psu5zOuDl2MYekBuVRrRhH RMye0oRS+168vFA1Js+kvXa1OQje/AwbZ+VxbS8zhh6wGtMgCvl5j43ySZL8cWPEaOS8kt CL8hI5YuU3YxXzn6RsgsYV9QgewCcZkIctnjqoclqFxI8Vj1M4q9gZ3iBSBTzNSjPAcz93 MKql4DFNMi4J3BBYeFIiESuIYKV2y9hWGNyEfjTnQR1+sICdCWu9wpt5MUx3GpF+vsjTOO oCywLr728a/4XXzb3+U+D0iGldwIxlWIIULgExirAJOCC2Um3GTgkfyksloRSw== From: alexis.lothore@bootlin.com To: yocto@lists.yoctoproject.org, alexandre.belloni@bootlin.com Cc: thomas.petazzoni@bootlin.com Subject: [yocto-autobuilder-helper][PATCH 8/8] config: flag A. Belloni master-next branch as testing branch Date: Mon, 13 Mar 2023 15:51:45 +0100 Message-Id: <20230313145145.2574842-9-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313145145.2574842-1-alexis.lothore@bootlin.com> References: <20230313145145.2574842-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 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 ; Mon, 13 Mar 2023 14:52:15 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/59417 From: Alexis Lothoré Add "abelloni/master-next" branch from poky-contrib in configuration so that regression reports are generated when testing for patches Signed-off-by: Alexis Lothoré --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index 687608d..fcd0588 100644 --- a/config.json +++ b/config.json @@ -6,7 +6,7 @@ "BUILD_HISTORY_DIR" : "buildhistory", "BUILD_HISTORY_REPO" : "ssh://git@push.yoctoproject.org/poky-buildhistory", "BUILD_HISTORY_DIRECTPUSH" : ["poky:morty", "poky:pyro", "poky:rocko", "poky:sumo", "poky:thud", "poky:warrior", "poky:zeus", "poky:dunfell", "poky:gatesgarth", "poky:hardknott", "poky:honister", "poky:kirkstone", "poky:langdale", "poky:master"], - "BUILD_HISTORY_FORKPUSH" : {"poky-contrib:ross/mut" : "poky:master", "poky:master-next" : "poky:master"}, + "BUILD_HISTORY_FORKPUSH" : {"poky-contrib:ross/mut" : "poky:master", "poky-contrib:abelloni/master-next": "poky/master", "poky:master-next" : "poky:master"}, "BUILDTOOLS_URL_TEMPLOCAL" : "/srv/autobuilder/autobuilder.yocto.io/pub/non-release/20210214-8/buildtools/x86_64-buildtools-extended-nativesdk-standalone-3.2+snapshot-7d38cc8e749aedb8435ee71847e04b353cca541d.sh", "BUILDTOOLS_URL_TEMPLOCAL2" : "https://downloads.yoctoproject.org/releases/yocto/milestones/yocto-3.1_M3/buildtools/x86_64-buildtools-extended-nativesdk-standalone-3.0+snapshot-20200315.sh",