From patchwork Thu Jun 18 20:36:26 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 90460 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 F2A85CD98F2 for ; Thu, 18 Jun 2026 20:36:41 +0000 (UTC) Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.28653.1781814998406190764 for ; Thu, 18 Jun 2026 13:36:38 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=e+JOpCQN; spf=pass (domain: baylibre.com, ip: 209.85.222.196, mailfrom: tgamblin@baylibre.com) Received: by mail-qk1-f196.google.com with SMTP id af79cd13be357-915d64fead9so260050385a.0 for ; Thu, 18 Jun 2026 13:36:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1781814997; x=1782419797; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SnK3cQAkJvSsE9KEoQeN0fuZPQkmRjocwgPx2HsG/ng=; b=e+JOpCQN452CBC9et8kIfweF4AeZ4779quBwoRB1ZYWjeRpkWBqIq7n2lRRdaK4TaX dqJfPvzVhipQwAUrXjRk3v0xJnkTRd44Qf0WDAoD6/hmogQTsvc0hGkN7Y092Nz4FBpC kgzscs2ukA3RlPD41+fu+/Fm0pX5vH3Vk+IydIlzjdoB/5cPwYKFG66tKSChXIf8DAG6 tJjx2WCXJDiJeNT9vTLXNzuTxDa6wB0jf1TS48aeyHSfBFOJFJjCkfrFNWAnnCi07a9d Ddhzt01z0xJXVgmzIIjIQsBBByy4tc9854NamWFzQJaFDC3QUo4cVlcsC297V/KSRhJo +CIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781814997; x=1782419797; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=SnK3cQAkJvSsE9KEoQeN0fuZPQkmRjocwgPx2HsG/ng=; b=bLwvxJslRy22FwxDC1sYbtRIH/s2aKDs8KdpvZCJldw0YAOcy5/sp7SzUwHlTZyhT7 WoSde2tXCmlXmXMekcop/FIy210W0hbskLuolNjTmqTdwBYxN5XsjVrimw0vaFbI3+s+ /gJCA+0LD+vJOEhaJ3Tfv+qa4lUqKD18uBwKxwbZzfJ334QLLpGsTcRWcf+6RkJgW3qB rPC87J0tOK7j1xAbx9hJeM7rGI+8gqffYt7Nj7fy+LNYOLRxTz+0MTjRDK46+dhFKynk 4teuKPAetXmubYZZvAeaeKIYDzrwOSduD1LnCHN0vtfg/3eyt0nsoN7gEOVz7WEjt6N0 uwNA== X-Gm-Message-State: AOJu0YyNYoJ+a2RUWl64uhkxXOe8NGET1uhQ5QBkCNT/UtRIdRMeGlIf 97ZPWx10enFJfm4YYRjAg3hmn/dK16zej2O5N4uL0+Ibl7fkZjhnmaxV8NyLprvKJ5969ibOpNk dMMVFiUrBfwTr X-Gm-Gg: AfdE7cmRiY9U+Ka0NEaxAUSTMFut8yrNLr6jICGs9yosFf3dGu62m1+5uMTAfmurOsr oqfAooKo3lRFwPHDCY/yB9HHFDhmxQplASSBDQr0mm9ejFGaQWifPW7BHq9w2qNXctPYVUk+ooy qDJXuLKvzSVcPdnVOfFl3Mc25v1pwniYVYA3qRKrlsBSEzlrnwl958yJTXxJTAtKO4JgZfcAE+c Rm66UnHxYlBtA9yGLCTb0k7Quagmgy5aOu5jvMvRNnsRFWdrWMW9jNcCmyHmjnkNhw9ejmKKEDp Swp/fsGdkUe8LVQGNWN5/2J4uLLj2JTyQI51o+QBG+w08RAaJkicutMqVF4CWrWO/UAwlxpbkUv Yiw6kofNUt3I2t3Wz1SLk4F6uV/UIXWy8UsY4DCN5vOIl+VlNlaad6rW1T/M+Qjd+/ejqP3vc8h QDga1TaT8j4jmCOkvZ X-Received: by 2002:a05:620a:2611:b0:915:8e2b:e5de with SMTP id af79cd13be357-9208a3d5ebdmr93721285a.7.1781814997149; Thu, 18 Jun 2026 13:36:37 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id af79cd13be357-920a152b7f2sm20696085a.13.2026.06.18.13.36.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2026 13:36:36 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [PATCH 1/7] scripts/patchtest: refactor results methods Date: Thu, 18 Jun 2026 16:36:26 -0400 Message-ID: <20260618203632.131125-2-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260618203632.131125-1-tgamblin@baylibre.com> References: <20260618203632.131125-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 18 Jun 2026 20:36:41 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/239102 The add{Error,Failure,Success,Skip} methods used by the inner PatchTestResult class re-use a lot of nearly-identical code. Encapsulate the logic used into two new functions: 1. _format_test_description(), which includes all of the original syntax/tag cleanup logic 2. _write_patchtest_result(), which formats the actual result lines that patchtest ultimately emits (to console and/or file) selftest: |============================================================================ |Testsuite summary for patchtest |============================================================================ |# TOTAL: 38 |# XPASS: 18 |# XFAIL: 18 |# XSKIP: 2 |# PASS: 0 |# FAIL: 0 |# SKIP: 0 |# ERROR: 0 |============================================================================ Signed-off-by: Trevor Gamblin --- scripts/patchtest | 56 ++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/scripts/patchtest b/scripts/patchtest index 143cf08572..07c3ada6f7 100755 --- a/scripts/patchtest +++ b/scripts/patchtest @@ -33,6 +33,22 @@ logger.setLevel(logging.INFO) info = logger.info error = logger.error +def _format_test_description(test): + return (test.id().split('.')[-1] + .replace('_', ' ') + .replace("cve", "CVE") + .replace("signed off by", "Signed-off-by") + .replace("upstream status", "Upstream-Status") + .replace("non auh", "non-AUH") + .replace("presence format", "presence")) + + +def _write_patchtest_result(line, logfile=None): + print(line) + if logfile: + with open(logfile, "a") as f: + f.write(line + "\n") + def getResult(patch, mergepatch, logfile=None): class PatchTestResult(unittest.TextTestResult): @@ -74,43 +90,19 @@ def getResult(patch, mergepatch, logfile=None): logger.error(traceback.print_exc()) def addFailure(self, test, err): - test_description = test.id().split('.')[-1].replace('_', ' ').replace("cve", "CVE").replace("signed off by", - "Signed-off-by").replace("upstream status", - "Upstream-Status").replace("non auh", - "non-AUH").replace("presence format", "presence") self.test_failure = True - fail_str = '{}: {}: {} ({})'.format(self.fail, - test_description, json.loads(str(err[1]))["issue"], - test.id()) - print(fail_str) - if logfile: - with open(logfile, "a") as f: - f.write(fail_str + "\n") + desc = _format_test_description(test) + issue = json.loads(str(err[1]))["issue"] + _write_patchtest_result('{}: {}: {} ({})'.format(self.fail, desc, issue, test.id()), logfile) def addSuccess(self, test): - test_description = test.id().split('.')[-1].replace('_', ' ').replace("cve", "CVE").replace("signed off by", - "Signed-off-by").replace("upstream status", - "Upstream-Status").replace("non auh", - "non-AUH").replace("presence format", "presence") - success_str = '{}: {} ({})'.format(self.success, - test_description, test.id()) - print(success_str) - if logfile: - with open(logfile, "a") as f: - f.write(success_str + "\n") + desc = _format_test_description(test) + _write_patchtest_result('{}: {} ({})'.format(self.success, desc, test.id()), logfile) def addSkip(self, test, reason): - test_description = test.id().split('.')[-1].replace('_', ' ').replace("cve", "CVE").replace("signed off by", - "Signed-off-by").replace("upstream status", - "Upstream-Status").replace("non auh", - "non-AUH").replace("presence format", "presence") - skip_str = '{}: {}: {} ({})'.format(self.skip, - test_description, json.loads(str(reason))["issue"], - test.id()) - print(skip_str) - if logfile: - with open(logfile, "a") as f: - f.write(skip_str + "\n") + desc = _format_test_description(test) + issue = json.loads(str(reason))["issue"] + _write_patchtest_result('{}: {}: {} ({})'.format(self.skip, desc, issue, test.id()), logfile) def stopTestRun(self): From patchwork Thu Jun 18 20:36:27 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 90459 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 3715DCD98F8 for ; Thu, 18 Jun 2026 20:36:42 +0000 (UTC) Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.28951.1781815000235554379 for ; Thu, 18 Jun 2026 13:36:40 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=MmzUftzj; spf=pass (domain: baylibre.com, ip: 209.85.219.53, mailfrom: tgamblin@baylibre.com) Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-8ccf01ba514so11932326d6.0 for ; Thu, 18 Jun 2026 13:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1781814999; x=1782419799; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RD58iwcPZyb4LNxn/tcCInRALnWhpDqn940da7MF7iY=; b=MmzUftzjfQtNUo7Z55Zbl6eCR3HMGnyoSK4ehv+NmsjVb7zca1gbxVeqQVnrnO+Msu bdbZWxZBsRHLqLgAAqgvREMvf0qxgVIIsVVgWp2HrtbhstnaLVQ55pKJQEAlyhNzzBPX dCG5QoPczzL+d9IOzC6/LzirMj0iHAw2v+chjetuG6ZZE2IfYcHneZCbeYM3GZWRmMbe E0gK2WMojCUjg1FKUsF4Rc/kCzzMgma2DyS8kEyeXP3/XTF9b55CuyHeAue9OqAfa4WD oCGlQhsPjMOpuaFupgwHpiFz/WaEafDRGhd2Io5A/RXOmJQdy+7g5EfOk2vN+Ftacxjv SADg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781814999; x=1782419799; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RD58iwcPZyb4LNxn/tcCInRALnWhpDqn940da7MF7iY=; b=UDb1zgN5JBtnCmPOLy6QfIRSQh4YgVW4b2LaYottH9L+NPSA5FxHgZt9p9uW9D4HDZ LOVqIkS1tkN8FtQ61eqChDGmhr/vp3Lh7u9O55BFEDIfJtSa/rEJU6LKMIIJbYlWjypZ WZeHBydUj98J3Z2VdiQm31d4U4CTlaFnzzPxyqZBLf5EYNs6IOkuF3uFOBeurt7sNBhS Zr+A6L4MjC1KAAI+QCmlbSNVzuYp9tGCHJOwteOe1IqRYNETJEF/TBEbC4U56MRtBEwc 3HEwehdltvi9Q19+ymUUwkvsFxJ7ZMf3C+p/VpD8owXmgmBf61Y1j68wzjw1Ouk1WVuL Gstg== X-Gm-Message-State: AOJu0YwFc6q0fNfky0SYBchzHSsprowyszdWwq2XwhnF9X3O8ZE3QiNg n3VJHAxSyb3OZ9aqgwQ25mjR2jhJrl284XtvcRuzAcE3iKaKxNRWKr7PZ49RJT1848aETGVthn3 xe0Rn1Pp6gA== X-Gm-Gg: AfdE7clySMgM1lfbrg8LAdq4EuXgdELhwDtSqLawps/t/gZYL9B582vT3rbYA+eMIvr L7rUl2JUrswEAzzPgOPdakTAuKc9uZVUtwuF0uCvnG2wbeXM6cFI0JD9Xsr25rEwiPX5UtMvrrB vgK+ZlQvqqGGUX5XDUgkcVSyQTcr/Q7e+6PO8pxeO6nFYsEDf832b+jxAjMzKOjB1otrhgDp8fk 0J5OSvoKeQ7SXtqaipE4xD/H3Q6SeRXrQVztLHDRQpnp7rZr3f8uUqgk3FaiXS2URb/kR1cGFtf yPqqptsxzq74h3NdcXTCxninEaI0NBeTYoUIJCfLZTWzpGwPYiaqueEgtxTkIK1h4S1MZa3rlmj Uv0oXg4JML5Ikv34EFpr2U+JHwifbDlyqwTU+BRp5y3jRySz+F+GE1Je7VC2I4INVvtEL8id5FK ih8rew+wz+1rE961YY4IRjJG7XQKc= X-Received: by 2002:a0c:f6c4:0:b0:8db:3bf7:7aae with SMTP id 6a1803df08f44-8de3e7ef8fdmr11289626d6.35.1781814999047; Thu, 18 Jun 2026 13:36:39 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8de62de5904sm1829036d6.43.2026.06.18.13.36.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2026 13:36:38 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [PATCH 2/7] scripts/patchtest: clean up startTestRun() Date: Thu, 18 Jun 2026 16:36:27 -0400 Message-ID: <20260618203632.131125-3-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260618203632.131125-1-tgamblin@baylibre.com> References: <20260618203632.131125-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 18 Jun 2026 20:36:42 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/239103 - Initialize self.repo directly instead of in two steps - Remove extra whitespace when setting error and failure members Signed-off-by: Trevor Gamblin --- scripts/patchtest | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/scripts/patchtest b/scripts/patchtest index 07c3ada6f7..ff8e8b11bd 100755 --- a/scripts/patchtest +++ b/scripts/patchtest @@ -61,20 +61,17 @@ def getResult(patch, mergepatch, logfile=None): skip = 'SKIP' def startTestRun(self): - # let's create the repo already, it can be used later on - repoargs = { - "repodir": PatchtestParser.repodir, - "commit": PatchtestParser.basecommit, - "branch": PatchtestParser.basebranch, - "patch": patch, - } - - self.repo_error = False - self.test_error = False - self.test_failure = False + self.repo_error = False + self.test_error = False + self.test_failure = False try: - self.repo = PatchtestParser.repo = PatchTestRepo(**repoargs) + self.repo = PatchtestParser.repo = PatchTestRepo( + patch=patch, + repodir=PatchtestParser.repodir, + commit=PatchtestParser.basecommit, + branch=PatchtestParser.basebranch, + ) except: logger.error(traceback.print_exc()) self.repo_error = True From patchwork Thu Jun 18 20:36:28 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 90464 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 4A259CD98F2 for ; Thu, 18 Jun 2026 20:36:52 +0000 (UTC) Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.28659.1781815002075217781 for ; Thu, 18 Jun 2026 13:36:42 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=GL3EJLbr; spf=pass (domain: baylibre.com, ip: 209.85.160.181, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-517b1f2c6adso12965581cf.2 for ; Thu, 18 Jun 2026 13:36:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1781815001; x=1782419801; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h5qM/1zj9yRzMmx8j4swpdTHghzi9mj2VpPGAPaDfo8=; b=GL3EJLbrwyPPbENaPDQMZDXhOjXPyi2Ti85uqtZguwhP/vifQdrO9P4AhqdOCaklaj fNH4/tC/9hWTNms0rOFS8gkMCmmsWlk3N414RCC1jDqsoyXE14f270xLIRokB57bslIZ XWukNFi8Udg8uFYbyRuROymR/B77+jCLNkIG8EJwQTgBeAvMCx9Vqbo6Rwx9qLZyKolS WyxXz4Xc8KWngnso5icOEG/7e2VB+2nVR9cVMxGbcWJiOqlpwknO1xSwDZh55vdB8Lj1 AzCQpZUa0byQW4rsMatlL69w9Iszl7TeF16ksM7SPjAjL8LWImztw9EyP/0tP5GofXfZ CPcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781815001; x=1782419801; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=h5qM/1zj9yRzMmx8j4swpdTHghzi9mj2VpPGAPaDfo8=; b=R1YaoTx50lAb8tgRISdf1zn7C/YoTLsDH4kDO+XkC59Vswu16vCVonwdIkqjkJqwwc bH5QREodpgKTJOaMN4tQnhZeVAmmRYMSKiyx3KyFm8ttyK6TVb3VYnvWWSe0nbD1ta+0 ExgPF1+kA0OntpFNzARgLC6uavv9x7ECz8wkCs34C3bhm1UkYjJYfZAYyVAT+F6BbcV4 49W/hMNCIfY0hpffsjYYbm0L7rOabFHAtA/KVALkyFzJa5BV+mJ1x1X07SDSQkw/0NEn vLa30N3jwp0EEKvJdSzZfuYXkLK952908XmLVahytvChL3dj8cO+SOQICjWXPdP+WA3M x9ow== X-Gm-Message-State: AOJu0Yw56rUzSiaUs0xpZooGiPQTvEvySa8CL8KVx1Afi91dFw7Cz47L A2aHX4GIAxKCPazubK+PwWyZYGf4NMftyzdmxDqf1Ia4/oinihlSeXA5TOtWSe0F1OnuUv1lp+j NN90+rqZwMg== X-Gm-Gg: AfdE7ckPmPOUQewzb8hm0VeUrMjwDDJ9piMGGbZyiqCKjmN0yXyzk6ZJy5uGLNWkns9 ijiCpJalIHINq814idgibtHOMKroV2uaT445zY2qL1tdLrfQXYLsGbwF4yo+Ryqxc1fRmnSHlUT usHeZXbo1dKh3JYQgVPPREss4O2WvxeGd1m/yEvbJwAguEOZGGiHoaKQwPwq1dp85mhthkYIi37 fAamresud/GZwKhQMorlTMkgJvp1BrijR0EqqTr1R00LZSGL1X3UL5gymG4MiRHfhX5syU8Odat Tg/YupD4hK7ydtT2fjQj5VLR1ch4AzggIbWETJG+nbsQkkwCF738iO36hon7A0mcqYWRxKR/zLM ZrB+P7XHRh0tp6I8zatmfBCGlMJ3JJ0e4GdvCBrDiExYR886u9gVuYApefZW/bQxktsffPI2sxm bVhL9zAvkk0ScwvexC5BJ8s/Ky+3w= X-Received: by 2002:a05:622a:4209:b0:517:8315:d6a5 with SMTP id d75a77b69052e-519e4e3b772mr10689121cf.55.1781815000832; Thu, 18 Jun 2026 13:36:40 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8de5e132e31sm2235466d6.5.2026.06.18.13.36.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2026 13:36:40 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [PATCH 3/7] scripts/patchtest: simplify _runner() Date: Thu, 18 Jun 2026 16:36:28 -0400 Message-ID: <20260618203632.131125-4-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260618203632.131125-1-tgamblin@baylibre.com> References: <20260618203632.131125-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 18 Jun 2026 20:36:52 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/239104 - Use the test suite's countTestCases() method directly instead of creating a variable - Simplify return logic - we still want to fail early if there are no test suites to use, but otherwise we can reduce it to a single return value determination based on the result of runner.run() - Add a newline above where the 'runner' variable is initialized Signed-off-by: Trevor Gamblin --- scripts/patchtest | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/patchtest b/scripts/patchtest index ff8e8b11bd..795fad511f 100755 --- a/scripts/patchtest +++ b/scripts/patchtest @@ -123,11 +123,11 @@ def _runner(resultklass, prefix=None): pattern=PatchtestParser.pattern, top_level_dir=PatchtestParser.topdir, ) - ntc = suite.countTestCases() # if there are no test cases, just quit - if not ntc: + if not suite.countTestCases(): return 2 + runner = unittest.TextTestRunner(resultclass=resultklass, verbosity=0) try: @@ -135,11 +135,8 @@ def _runner(resultklass, prefix=None): except: logger.error(traceback.print_exc()) logger.error('patchtest: something went wrong') - return 1 - if result.test_failure or result.test_error: - return 1 - return 0 + return 1 if (result.test_failure or result.test_error) else 0 def run(patch, logfile=None): """ Load, setup and run pre and post-merge tests """ From patchwork Thu Jun 18 20:36:29 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 90462 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 1D7E6CD98ED for ; Thu, 18 Jun 2026 20:36:52 +0000 (UTC) Received: from mail-qt1-f196.google.com (mail-qt1-f196.google.com [209.85.160.196]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.28955.1781815005201212416 for ; Thu, 18 Jun 2026 13:36:45 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=VmA+zW6H; spf=pass (domain: baylibre.com, ip: 209.85.160.196, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f196.google.com with SMTP id d75a77b69052e-51780bbc560so21390811cf.0 for ; Thu, 18 Jun 2026 13:36:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1781815004; x=1782419804; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=opohMB5wD5R/oo/RNx4M3mqJ3UEXwcXWirZEM0oTS0A=; b=VmA+zW6H4SFH1fPl9qWD79TFcK9LeHmFCxZImMtjx41prYQxXf1p/8SKQANzDArq9k Y4c2zhHt+1pTrPE36n7zc+QlQT65fb+Hm26qy57v8J4d0pMxR1GOcrD0Y8G/d8yqDpnL 0iNQ/6VmEdNMiP9awW1iPzmC7B4z7wm+yarVoYOugXFSwEApeac9GTfPm4UtH6nSlniZ LVbspJBEA51OzAaB6x49TRIKekfZIoJ4V4fOcH5PDlvc3n866KxV1bM3JkHcF9SXCg2w /4Npp3BJ/wicOoBo2d2Vvi+c3yxNHOixNDO8VQHDpYFpAwtxCbpHLhmZk+MWYWefel0l w58g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781815004; x=1782419804; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=opohMB5wD5R/oo/RNx4M3mqJ3UEXwcXWirZEM0oTS0A=; b=AK6SatKDkVCrY7VxJAwZp8OlVQTHJvRdwstbd9wDayV+R+Pgn6UxQ/fnoMndV7U97p iZfSY1GIffkdQr/C+BxZ1NOSl76VDCU3Ra/R3wn1IkE8+ePbm9k86GqQmIq7uxThx+Vp yRtM6dujJM+rjPVMaq4UWMegx05zX8HtGEWXNAoMx5KDNaFjGHZrXRE3mO3s5E6SlBiP OhRVc/RQb8HelkmbEghhDb81N+QTr32oODXOiYBBicESPIsMigpYGKq3Ll7OfdfFTF3p DnvcMelPpiUB++rovq8qfBUGGHaVc8H/RD7erwt9/pxlinc+Fe4uXriYPxxf7E4MBhqx g0Ag== X-Gm-Message-State: AOJu0Yz4XqHdINrFZjJT4YEDSx3VvBHvK2mMGfg/Fg0NCRL9uAJMLqhL TQY9JWvLScfb5ZW9n/eVs1gQLbXJOnvx7iqA8YWj1GZILmQdl/9gB03TpuobHcJcZsxgwfAsmf4 nrfQfBb+ZKdOY X-Gm-Gg: AfdE7cnue10cWr/+ZTU9LuDwYnwM6pwvPeIz6hf+usH+cLo2NgGntkE+92fiZUCZOmM 3BwugzPT+4RL5k6GG4N1ByEVT/grHd5DYH7420r8WRE/dFydce+3+58bgV0r4bDKFNio4kVIlcR KMs2F7QdjGGm3WoOJ//HqBd6ya+SiauATSLOrJOPH/mtmbTQTQz+weJVeSBoVFM7mKqwV04AmAe jKxox4flkxD0jKFNVZSZvHAEmMakjhk7kvPMEgUczDaOuVjxUPsSsFwH+8qiDY4MsrGqp2ac7L7 o77EcuaKZ7TdsgL+l7RADIccYP4aThuT8IbMZQHInkY+k7n4+axsal2yHeB0PLlTbXHvOFvTMQg res7DvWcG8lnbnmXvGKQ1NH9f6iRzVruMBMGR/XhoBtgP+uwCM7A1uYqbB8SSGvQUT2Kl9pPuu4 KJP1j0/o2M0G6dj6/y X-Received: by 2002:a05:622a:5c1b:b0:517:70a5:c875 with SMTP id d75a77b69052e-519e67b85aamr7880731cf.14.1781815003885; Thu, 18 Jun 2026 13:36:43 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-519e4e105b4sm4295781cf.5.2026.06.18.13.36.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2026 13:36:42 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [PATCH 4/7] scripts/patchtest: simplify traceback logging, remove whitespace Date: Thu, 18 Jun 2026 16:36:29 -0400 Message-ID: <20260618203632.131125-5-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260618203632.131125-1-tgamblin@baylibre.com> References: <20260618203632.131125-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 18 Jun 2026 20:36:52 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/239105 We currently use the logging module to wrap tracebacks when a failure occurs. The traceback module is sufficient for this task, so use it directly. Also remove a redundant import of the traceback module, and fix some whitespace in the getResult class that was missed previously. Signed-off-by: Trevor Gamblin --- scripts/patchtest | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/scripts/patchtest b/scripts/patchtest index 795fad511f..aef80a86bb 100755 --- a/scripts/patchtest +++ b/scripts/patchtest @@ -30,8 +30,6 @@ loggerhandler = logging.StreamHandler() loggerhandler.setFormatter(logging.Formatter("%(message)s")) logger.addHandler(loggerhandler) logger.setLevel(logging.INFO) -info = logger.info -error = logger.error def _format_test_description(test): return (test.id().split('.')[-1] @@ -56,9 +54,9 @@ def getResult(patch, mergepatch, logfile=None): shouldStop = True longMessage = False - success = 'PASS' - fail = 'FAIL' - skip = 'SKIP' + success = 'PASS' + fail = 'FAIL' + skip = 'SKIP' def startTestRun(self): self.repo_error = False @@ -84,7 +82,7 @@ def getResult(patch, mergepatch, logfile=None): def addError(self, test, err): self.test_error = True (ty, va, trace) = err - logger.error(traceback.print_exc()) + traceback.print_exc() def addFailure(self, test, err): self.test_failure = True @@ -132,8 +130,8 @@ def _runner(resultklass, prefix=None): try: result = runner.run(suite) - except: - logger.error(traceback.print_exc()) + except Exception: + traceback.print_exc() logger.error('patchtest: something went wrong') return 1 if (result.test_failure or result.test_error) else 0 @@ -227,7 +225,6 @@ if __name__ == '__main__': try: ret = main() except Exception: - import traceback traceback.print_exc(5) sys.exit(ret) From patchwork Thu Jun 18 20:36:30 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 90461 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 3CC65CD98F8 for ; Thu, 18 Jun 2026 20:36:52 +0000 (UTC) Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.28663.1781815007886639875 for ; Thu, 18 Jun 2026 13:36:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=K9zJfSNL; spf=pass (domain: baylibre.com, ip: 209.85.219.54, mailfrom: tgamblin@baylibre.com) Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-8ce9df4732cso14503446d6.1 for ; Thu, 18 Jun 2026 13:36:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1781815007; x=1782419807; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Uzfo6XagXiMnoqJUejq1mkjK4k4jq/M+q7PKHC+OHtE=; b=K9zJfSNLLi7MoUggGFhmfgZtHWbZ0VdGYpq5/LAqhdtPyMAqXi5hzHe1stiajaz/ki kFj+BU1+H1aaQKHyR9FkVo7410485G/yxZMDnJFOrMv3qClC6x1aWUgGAx99Ie0Vn4WX jtK2RsT9AZMjePjd6XchyoI9TRpozngH8fUpKFvNKJxl4xNrJcpwqh5P4Q3xvhcCk/+y 9OFsIyxb7y3FrS04Ptp4zToH0M3CS7rKMQ22h3byL/XKpznSNQMR3Bbjhp1v6+dwPa+K yyzX11DMLuhJqWMt04yh6XSx4VpIY/snXOZnMne1a9ygGkt9BnKX2e6Ztw71OG1VYt+P Qttw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781815007; x=1782419807; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Uzfo6XagXiMnoqJUejq1mkjK4k4jq/M+q7PKHC+OHtE=; b=a8xjLb58PAngB2Q6ZlSime6iEQPqnGa1jw3m4yIKBZ56DZJ0HMUIgpbRcuhqxlewd0 kY4xPclIZN7f7zLFMAIC/zckx0kJVFX1mKOscfDC9Vu3JBZbsfLyS8GMR8oFCEFd9fD7 5lRTkp4pNlFcK9pM4SsQsYvnnXHvK9cq6da4E8/SLPmnpmC5EmLWaCHR6WWG6V/QRtbz 8A+d9ygLcOROK4vJT3jspeOdPzwQBc/F3ym9g0urwAoApIO8wFbSTaARD8/3Io67NUZa gyBvF2KjpakaLes0ig5e/yR0Pk+6QwRXiaSskNF1ke8z5wXE937CgZ+8ancWpWH6wIEd 2qsA== X-Gm-Message-State: AOJu0YwaoWUNgE0bw7pcsGK/Sgjrn0M4w1nu8/aT+LcAl07lFIAWxhMG EEmcIkYCNT+go8zLI+fgXoTpUrrXp4jPBMEuZDT2FfIqiHwD8zRypngvs4LvgmJSl5d2+6L2BVs sHCBc3MBalA== X-Gm-Gg: AfdE7ckuevYvyN8FP67lH8511HdWFkYqFOVAV8Zn9QZo8EELLMuFTLDdqwkhF634C/n g/0FO7E+d/XTh3qS01KuyfGYXpjNtsxt8Yz7JC3X2/ksKamoDDdnBTQSn+4DidjrTa8w8EteErQ yHVA/7bLNqW0AZEwPESq+M51YrISf7XIryOAjbVLakenlhF2TH4JBcPRJmw1mvpewsMfohw9QRq 2nDDCNjVAv9NqsQqBm4bPLoNY9JWiItk9oyXdsLMSMlaV9tyoF7Jn9yElKG52Is8zEmx9LlAejM gNpPj//4R1NSxa+IpagNNH2ioDt4eJWJG/vdVirvIjy/VFqxLNT2U2OUvKAtlagBHqhOet+/udH tOZFp0EC0mMVtKarFkkGO2mEqIdnbc7jgC1BSNyeMKc5eQusHwqli7JLNf/+/i9PE9n8UhmsJUX HMbWOxF49O2XVjHDp5 X-Received: by 2002:a05:6214:29ea:b0:8de:4553:7c7a with SMTP id 6a1803df08f44-8de45537cd1mr13422036d6.15.1781815006690; Thu, 18 Jun 2026 13:36:46 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8de5e12ca3asm2163126d6.4.2026.06.18.13.36.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2026 13:36:45 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [PATCH 5/7] scripts/patchtest: simplify run() Date: Thu, 18 Jun 2026 16:36:30 -0400 Message-ID: <20260618203632.131125-6-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260618203632.131125-1-tgamblin@baylibre.com> References: <20260618203632.131125-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 18 Jun 2026 20:36:52 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/239106 Set premerge_result and postmerge_result directly by calling getResult(), instead of doing it in multiple stages with confusing variable names. Signed-off-by: Trevor Gamblin --- scripts/patchtest | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/patchtest b/scripts/patchtest index aef80a86bb..d2f6302743 100755 --- a/scripts/patchtest +++ b/scripts/patchtest @@ -141,13 +141,8 @@ def run(patch, logfile=None): # Get the result class and install the control-c handler unittest.installHandler() - # run pre-merge tests, meaning those methods with 'pretest' as prefix - premerge_resultklass = getResult(patch, False, logfile) - premerge_result = _runner(premerge_resultklass, 'pretest') - - # run post-merge tests, meaning those methods with 'test' as prefix - postmerge_resultklass = getResult(patch, True, logfile) - postmerge_result = _runner(postmerge_resultklass, 'test') + premerge_result = _runner(getResult(patch, False, logfile), 'pretest') + postmerge_result = _runner(getResult(patch, True, logfile), 'test') print_result_message(premerge_result, postmerge_result) return premerge_result or postmerge_result From patchwork Thu Jun 18 20:36:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 90463 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 56C0CCD98F9 for ; Thu, 18 Jun 2026 20:36:52 +0000 (UTC) Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.28958.1781815010562241575 for ; Thu, 18 Jun 2026 13:36:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=l192KUxy; spf=pass (domain: baylibre.com, ip: 209.85.222.196, mailfrom: tgamblin@baylibre.com) Received: by mail-qk1-f196.google.com with SMTP id af79cd13be357-915b5ce94c7so173018785a.2 for ; Thu, 18 Jun 2026 13:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1781815009; x=1782419809; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=y7FYAOoDWipoQKi6AJI7r6DJox4NJtOMo0zf66UmzGw=; b=l192KUxyYguP7SmY1mv6xsccZ9g2aX2bJir50J7K6L6DBQN99Z29bGRAcTAd3nT0MI mX4rMFFGAYPy0oq4oIrB4P+SDfr3My/sE41HSocI2+Ih5kvtWAXEaw2I1pG/qyg2q7/s 3yXnDbSIrVP/m+sN/b8B8IiSIjVuhYZRQkFuV35sVx4Bry7WGk5PqPkw/iuHxSCMtEfW x2nxZ5K3UbIxQOt9EyGUPFTgo736F4F1N9/zQepzfDNqm7dwy1Xt+TS362RZ4INrtSfn D/4kts3j6XMW8wZmiPy/dNJKTRGqWDWloGNhalQvY9u1dh72iDxU6wQQ+eUFyrtxvHv3 y/hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781815009; x=1782419809; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=y7FYAOoDWipoQKi6AJI7r6DJox4NJtOMo0zf66UmzGw=; b=sBdasocOLT7ed84KG4pW4OP1f2zwP9h+fDNtj9xTZFtHiL3sq2MGgpUdbr4Z40XCdb FOs7tCSkBCNcp/i1NMRM2qIRq6F2UTlEmOvGK71VaFQVaEh7PxC8ASNs8EIJtlqNmIqJ selmX7P+jgQwpVc2SU0LaKurKQtvoP3ZfT/SJNKOP+7mJaeQFjQ6Dx6dwamp0jHH4Bpb 9eHNz8qSu955aVKqUv08r4gJIFYyAfsB874HzyYxT333c4bT3x+3MFX0wK3L60U+d5nd NRfEN6VdOZuUfRnAmEyJxj/tuYWEF3RlRGj4P/82q4BLLZeWWcP5yjmbb5YpmA1mu+ET AVHA== X-Gm-Message-State: AOJu0Yw96UD1cEu5dvvWpYewLZrZ4talPBRiY5ued0J2KUOdDOaN+5Kt NY4yggPgHGOm+OMXfvFwoLadtVkIlFlXMz+AFEgBn+PULvREerP2VkMOgVMeYeH3GYwmehGq8qA ns+Od3VQaugho X-Gm-Gg: AfdE7ckaFkai6+mhMDQirvkbH3QamLo5qrpnrlvBdnt5Ndq6ebtV+XKQn/cS3aDwODC SyugF+uYdXK8ErVCLsi2+aZRelfFqZ4tuxQouGH+CmSxk0r141AhmgKlptMRLKMf3Glfx/utHDL TjkfqDw4EhbSXjvavruEWmgI7PTAqoCQ6zvl7T2h8URKrFrytLHdJz+A3h3Pb6Ot/mzFC720tE0 rqyy5CWT3tjDtxkF2NpIcOYDKIIS52dFlt8IjGAhKqbS5v0ppUR1PCKQ5yYX5cHZ04cdIdFbMoo MFppRA3Sn4pZLepGIUtHduaEYqIPXx1+UBJuqquziNssIiZMQBRu8mO6aSGnmwTkbNo28TqfThm S3drrtOwP7274ZBqTvtskDcXiZL1Q0kkRCe5QkWgf5RhpHClJj6cMievQ1RxB5U9Asd0n7iIC/s WQ45OFupZum+ZpvRx56zZrDLtK7JI= X-Received: by 2002:a05:620a:17a5:b0:915:b718:accd with SMTP id af79cd13be357-9208e497f13mr98176785a.6.1781815009409; Thu, 18 Jun 2026 13:36:49 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id af79cd13be357-920a4348cd8sm18387585a.27.2026.06.18.13.36.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2026 13:36:47 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [PATCH 6/7] scripts/patchtest: clean up main() Date: Thu, 18 Jun 2026 16:36:31 -0400 Message-ID: <20260618203632.131125-7-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260618203632.131125-1-tgamblin@baylibre.com> References: <20260618203632.131125-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 18 Jun 2026 20:36:52 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/239107 - Reference PatchtestParser members directly instead of setting local variables - Remove unused variables - Declare 'ret' just before where it gets used - Use subprocess.run() instead of os.popen() for a cleaner 'git status' call - Remove unnecessary square brackets in the status_matches if block - Remove unneeded try-finally block Signed-off-by: Trevor Gamblin --- scripts/patchtest | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/scripts/patchtest b/scripts/patchtest index d2f6302743..592d91dbb0 100755 --- a/scripts/patchtest +++ b/scripts/patchtest @@ -12,6 +12,7 @@ import json import logging import os +import subprocess import sys import traceback import unittest @@ -162,16 +163,14 @@ def print_result_message(preresult, postresult): print("----------------------------------------------------------------------\n") def main(): - ret = 0 - tmp_patch = False patch_path = PatchtestParser.patch_path - log_results = PatchtestParser.log_results - log_path = None - patch_list = None - git_status = os.popen("(cd %s && git status)" % PatchtestParser.repodir).read() + git_status = subprocess.run( + ['git', '-C', PatchtestParser.repodir, 'status'], + capture_output=True, text=True, + ).stdout status_matches = ["Changes not staged for commit", "Changes to be committed"] - if any([match in git_status for match in status_matches]): + if any(match in git_status for match in status_matches): logger.error("patchtest: there are uncommitted changes in the target repo that would be overwritten. Please commit or restore them before running patchtest") return 1 @@ -180,6 +179,7 @@ def main(): else: patch_list = [patch_path] + ret = 0 for patch in patch_list: if os.path.getsize(patch) == 0: logger.error('patchtest: patch is empty') @@ -187,19 +187,13 @@ def main(): logger.info('Testing patch %s' % patch) - if log_results: + log_path = None + if PatchtestParser.log_results: log_path = patch + ".testresult" with open(log_path, "a") as f: f.write("Patchtest results for patch '%s':\n\n" % patch) - try: - if log_path: - ret = run(patch, log_path) - else: - ret = run(patch) - finally: - if tmp_patch: - os.remove(patch) + ret = run(patch, log_path) return ret From patchwork Thu Jun 18 20:36:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 90465 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 532B9CD98F2 for ; Thu, 18 Jun 2026 20:37:02 +0000 (UTC) Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.28962.1781815013508390153 for ; Thu, 18 Jun 2026 13:36:53 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=aSVKRjXr; spf=pass (domain: baylibre.com, ip: 209.85.160.169, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-519e7faecf1so1052861cf.0 for ; Thu, 18 Jun 2026 13:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1781815012; x=1782419812; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9FKO+2b5qBPUqvcsH2GGVveTiFicVBk5WujEYpphcSA=; b=aSVKRjXrEEAqpRYMFh2eU3dU/UUXhpMTc9zFuVRlNIh+gRPoGugjb/uilctBJBhcHl 34Ctmd71WeiLPRPeBtNfvDWMr2NGlpN6T+fY++Jio+Cqa4c0+IIF/gfUFXaUmBYPjFMh 6efngQ3h7sLh+Uwh6rAPRwnj0Tqx3YZ64bJvthI5t8ACjilB05FvLlYs3tvl59U/lG6/ rTZ0F6R04SJ4F6MxFvusgA/JKlCwcSy2KVva77LPgN8npvHCUGbnDQJ0oEvEo0Hzda0b 8rppr2O7plPI3ka+HI77KkrKMO/0NSGoR/mXSY4hiLcBlmKc5KCq6IJmnqPxJW3LvGpT 6gbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781815012; x=1782419812; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=9FKO+2b5qBPUqvcsH2GGVveTiFicVBk5WujEYpphcSA=; b=Lx3cjBzZPlucAl+oJfrWQJv0xyTYSD8NIP1yqPRHDc+gXN9uO6iTw9J9XXQ3WElCVZ kwKnjzZisPX1n3CFguGBGO1IZuUpZh5IXCgaUfwG6CUhcfFI75OyHjnHPw0Qem0TXxi8 3Ye7S9xmJn9CEkLVwPwKesSFKvd+FF/flCGyu/PDtMbF8agCnk3eI7Bm9tYYMqA3XDpJ lXqUQI3CqvRfSLAJLJw48lSxI5brd/xJ4J+0ynh0qBUqpG5reJqnHV5WoTXlQmSfN0On omcOjx6Ogs4Fcr6xXYbs6qcoEl15yR8lxAfs4IDZqsEeiX+DAmH6Yo7t7eYnNkUJlaMG MEfQ== X-Gm-Message-State: AOJu0YyThb6N779iumsnKugmv3K5AeJZtGvxHd637pfb1jGvqLrFbmFn cl+FFz9hoHwhqgIbcWcCEjmTeElVl9hEReiNaKsoKFU9MZEClR1+J1pzh9U2C34FbJLqkdfKPXu 59CwHogTl8Q== X-Gm-Gg: AfdE7cnPz4NwO/e3h4HHF0rIl+5ORI3vcpFaZt5OKnDyZpA9+q44ix6GMxgqub92XNw CNZaBgGc7QcwSVImEBKCuTo11O6iPFVnguH1iN/XlQU78t/GwTqnA3Ng+1grJeVZLXI1PaHplwd e9gW7N0LR+Y+ok5yxSWhEScbPwGXBJ3pKVRn6aMWwmdvzezO2RuUrK1vF0o/x9eqmTM1FdJ8V0x wbCJasqSsmBuFTTPiPrZvMyP7keWt3ZBe5owBTKk/hO/sZJQ6wFpuNfgDL4ruk1GHBJ95+88oJB BV7W0tfk6hCmnky8MSoMoOl+TJiWax8oI1xv5ofd0SoIE+B/+LAodc29hU8Vvpn9QGwstojOgEs Nfg3foevD6zei+D+v2kJdErMMExgjp7/aLtwAPJI78OG/EgtMNdLyGVehLRHTQ8w4SpoY/PJFc7 DJ14QiK4XuOebLX5qM X-Received: by 2002:a05:622a:14d0:b0:517:6665:2a9a with SMTP id d75a77b69052e-519e4e0acdemr11541241cf.50.1781815012371; Thu, 18 Jun 2026 13:36:52 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8de61d3add0sm1908816d6.26.2026.06.18.13.36.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2026 13:36:50 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [PATCH 7/7] scripts/patchtest: check for meta-selftest Date: Thu, 18 Jun 2026 16:36:32 -0400 Message-ID: <20260618203632.131125-8-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260618203632.131125-1-tgamblin@baylibre.com> References: <20260618203632.131125-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 18 Jun 2026 20:37:02 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/239108 The patchtest suite (in particular, the selftests) makes use of the meta-selftest layer for full operation. Make sure that the layer is added to bblayers.conf before kicking off any test runs. Signed-off-by: Trevor Gamblin --- scripts/patchtest | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/patchtest b/scripts/patchtest index 592d91dbb0..b5a9bc2a51 100755 --- a/scripts/patchtest +++ b/scripts/patchtest @@ -174,6 +174,17 @@ def main(): logger.error("patchtest: there are uncommitted changes in the target repo that would be overwritten. Please commit or restore them before running patchtest") return 1 + builddir = os.environ.get('BUILDDIR') + if builddir: + bblayers_conf = os.path.join(builddir, 'conf', 'bblayers.conf') + if os.path.exists(bblayers_conf): + with open(bblayers_conf) as f: + if 'meta-selftest' not in f.read(): + logger.error( + "patchtest: meta-selftest layer not found in %s - add it to BBLAYERS before running patchtest" % bblayers_conf + ) + return 1 + if os.path.isdir(patch_path): patch_list = [os.path.join(patch_path, filename) for filename in sorted(os.listdir(patch_path))] else: