From patchwork Thu May 14 19:41:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 88120 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 816FCCD4F39 for ; Thu, 14 May 2026 19:42:17 +0000 (UTC) Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.19885.1778787733082468346 for ; Thu, 14 May 2026 12:42:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20251104.gappssmtp.com header.s=20251104 header.b=KQmRdOp2; spf=pass (domain: baylibre.com, ip: 209.85.219.42, mailfrom: tgamblin@baylibre.com) Received: by mail-qv1-f42.google.com with SMTP id 6a1803df08f44-8b98482b253so111529956d6.1 for ; Thu, 14 May 2026 12:42:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1778787732; x=1779392532; 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=oVoUZiRJ0gsx1vHCooFoI5IwMpQUoj/9ia9BAu/KPBs=; b=KQmRdOp2WEf1ImoPL4cIvySsV5jv115MXfFpNn00UJjK7j3L1JK5g+IVAWshsB0BJk X1Xa3VprrAgSM4Rdzj0ev3PSkmyttQKDER/t5Dm9fSHQEL0jLGlLLss/mN5CC8rGQOp1 7kWzcwYXxGkLgxgH6TRKOqTVwZCa24O4+c0bOKOPa2X1wpcTF46YtxBHtoTv29wI9O+W +NMgQMTgBFhL+41jVTPEe/ALQoY7Vr0zDvjYH0D4crRcxvfgfkhLGTNJN0NO6oY7ZV7w HWOMVf+k5XNp6aJUizAa8sOpchXpO91RTyXtEJEcIZjEERjvAGyEPFiRULx7tKEytPDM NLVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778787732; x=1779392532; 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=oVoUZiRJ0gsx1vHCooFoI5IwMpQUoj/9ia9BAu/KPBs=; b=qSA18j2q+KshlEnrN85EtDXMiu+UdpxkwyLtD7DJa5C7lASN5eLv7k5PKHkHkzDY9B nuVHMmTod+pokSWENDTKCvQYBkA5qMogn7IjxlOXZlbj9kvt5KdnuM0aq8jKeJPtKJTJ wR7AET967+TxGr5A7HfGpUt3/apAebMrVTcyIUObXUXun6+yIzLqPyi9Hmi7KCh8UuGZ cRhZ7e/emFdptimp7/HiNMO+xOz+fFYXxJt263e9x4J7pP+VpTEf0D/jClf1OYLDPbKV 3Xoaieu4frVv0v24ZGdKWcHIvEl9HObtgytn/k5xrxbFPHWh1RCEGxesEthd/0gPnGED hKVg== X-Gm-Message-State: AOJu0YxcnAws940L4qYSRnkJo8hgrsGTDTvvbKwpeIgWos4aGBmqdcka 9u0RIEh/PYLeavwam5mgIiyiltcB3PJcPye1EFB8RQ/ZU+EVNAL1AcF+GvoCR1du/chEgkcWx7V pIJdscwM= X-Gm-Gg: Acq92OG8jfQduGi3majFF41Tn084lX9XvsFLOiwjPBkdCNmSShleAkyOJtZG3xME/Av i1iHPrAu5NSZQyokjLryKbTX2qFSz24aaGgqZ4tLeHa/lfuVfY9Mv2x512AadotcT/D9Qc7ii6A q7Osm92J3P+vSEm2O3M2/faFrB5+c+P9vRg5S678Oy/Ctinx7Pqf2bwiVa/VYwt6TqzKYEL185M ytIjAuz+C1j6yg8Oeg4SiRWM5s9qZoskDwNiligQtgcuEe/FptS0QTnNOkMk+dq4fAp4zpOKNcT AinmRavUc+V5qjvizYHal2YUa0n75YzbYHpLtazJDxJuCUT+bwIDTb0/tH8XoKVsi/Nh5QU6D5s gcp/qFtXHGGGrJPs74nMdf8KIcevVUzMlx0CNEbl32yX2hDCKQPUtNIsoSyT9WRnC3XKCOc7Cl9 nhlQlqOUsKykhnAy7XGeh1hUMYTA== X-Received: by 2002:a05:6214:398a:b0:8ac:ae56:b493 with SMTP id 6a1803df08f44-8ca0f6c434dmr16292186d6.40.1778787731840; Thu, 14 May 2026 12:42:11 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:537:a9f7:1a84:f246]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8c908f0601asm33511106d6.17.2026.05.14.12.42.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 12:42:11 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [OE-core][PATCH 01/11] patchtest: check for meta-selftest, cleanup script Date: Thu, 14 May 2026 15:41:57 -0400 Message-ID: <20260514194207.1958325-2-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260514194207.1958325-1-tgamblin@baylibre.com> References: <20260514194207.1958325-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, 14 May 2026 19:42:17 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/237048 - Stop immediately and print a warning if meta-selftest isn't in bblayers.conf: |patchtest: meta-selftest layer not found in /home/tgamblin/workspace/yocto/openembedded-core/build/conf/bblayers.conf - add it to BBLAYERS before running patchtest - Remove a variety of unused code blocks and inconsistent formatting, then simplify the results-generation logic. This includes removing the 'finally:' block which was never actually reached. AI-Generated: Uses Claude Code Signed-off-by: Trevor Gamblin --- scripts/patchtest | 170 ++++++++++++++++++++-------------------------- 1 file changed, 73 insertions(+), 97 deletions(-) diff --git a/scripts/patchtest b/scripts/patchtest index 143cf08572..e8ace03905 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 @@ -30,37 +31,50 @@ loggerhandler = logging.StreamHandler() loggerhandler.setFormatter(logging.Formatter("%(message)s")) logger.addHandler(loggerhandler) logger.setLevel(logging.INFO) -info = logger.info -error = logger.error -def getResult(patch, mergepatch, logfile=None): + +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 _emit(line, logfile=None): + print(line) + if logfile: + with open(logfile, "a") as f: + f.write(line + "\n") + + +def make_result_class(patch, mergepatch, logfile=None): class PatchTestResult(unittest.TextTestResult): """ Patchtest TextTestResult """ shouldStop = True longMessage = False - success = 'PASS' - fail = 'FAIL' - skip = 'SKIP' + success = 'PASS' + fail = 'FAIL' + 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) - except: - logger.error(traceback.print_exc()) + self.repo = PatchtestParser.repo = PatchTestRepo( + patch=patch, + repodir=PatchtestParser.repodir, + commit=PatchtestParser.basecommit, + branch=PatchtestParser.basebranch, + ) + except Exception: + traceback.print_exc() self.repo_error = True self.stop() return @@ -70,100 +84,59 @@ 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): - 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"] + _emit('{}: {}: {} ({})'.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) + _emit('{}: {} ({})'.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"] + _emit('{}: {}: {} ({})'.format(self.skip, desc, issue, test.id()), logfile) def stopTestRun(self): - - # in case there was an error on repo object creation, just return - if self.repo_error: - return - - self.repo.clean() + if not self.repo_error: + self.repo.clean() return PatchTestResult def _runner(resultklass, prefix=None): - # load test with the corresponding prefix loader = unittest.TestLoader() if prefix: loader.testMethodPrefix = prefix - # create the suite with discovered tests and the corresponding runner suite = loader.discover( start_dir=PatchtestParser.testdir, 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) + runner = unittest.TextTestRunner(resultclass=resultklass, verbosity=0) 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: - 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 """ - # 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(make_result_class(patch, False, logfile), 'pretest') + postmerge_result = _runner(make_result_class(patch, True, logfile), 'test') print_result_message(premerge_result, postmerge_result) return premerge_result or postmerge_result @@ -183,24 +156,34 @@ 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 + 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))] + patch_list = [os.path.join(patch_path, f) for f in sorted(os.listdir(patch_path))] else: patch_list = [patch_path] + ret = 0 for patch in patch_list: if os.path.getsize(patch) == 0: logger.error('patchtest: patch is empty') @@ -208,19 +191,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 @@ -241,7 +218,6 @@ if __name__ == '__main__': try: ret = main() except Exception: - import traceback traceback.print_exc(5) sys.exit(ret) From patchwork Thu May 14 19:41:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 88118 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 64105CD37AC for ; Thu, 14 May 2026 19:42:17 +0000 (UTC) Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.19887.1778787735159201468 for ; Thu, 14 May 2026 12:42:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20251104.gappssmtp.com header.s=20251104 header.b=h1xZ98LP; spf=pass (domain: baylibre.com, ip: 209.85.160.176, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-5165195c8b0so5993181cf.0 for ; Thu, 14 May 2026 12:42:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1778787734; x=1779392534; 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=xaEuO4vB9fvomnwny9ZoxO00vZdTDe9DV+z/H/23T+w=; b=h1xZ98LPx5Yuzb3fKRlCVd3zYOQx2Z8PIt+O6grtqIQXsMIK5YUD5i0J2omCqFnX2Y rVRF+XIhFPmzC4lRB0stO8h7FWgde4IBtkgF6gdu/f2Mbzrlim9AAMe6OeP5kj3nHFj8 pNbuXfx0DnHu3txPOXt5W61BY0GHmx8gXoEHV0wpwtpFi8kL6bYPpl+lSOonc+faht1e gRoYi1hDVb0QIBnCWyRr/Otax+ect4Tm7FAdfSqsJSfL6qMLd8AXWCaSBfoh5kdZ3yBo doD8N8kJQBfKUCcO8PBE7Uw81CW9XM+C2RG0zlxZdf50Vp1lf3P9VmNdxYgr3g1Tj0Yo jtlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778787734; x=1779392534; 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=xaEuO4vB9fvomnwny9ZoxO00vZdTDe9DV+z/H/23T+w=; b=a7Yo8Zcquc9t2MxzJNGGIerbFMCxog0lHyTPbX7c4rt1TEimt7noxtSGx+xEnAaNly R3CRfnsF3nXIiq5fvlntXS+yEvbGunnVfm7aYyCByWDfZxA4EFR46O4Abt7kJ7OyK0py ze+bMvmKJ9Qk3XxtMJr/8cmGq2rjJ4WeWUjX0iAKbhdxBPbJ+Pwb1nMKvzFlycr213ct BCFGOA6QiVJgjFqh8hfAtEhNpZoNxYB7E3sTqBhMU0nczaRiCK0n+mcS16lCnaVTTRZv fze8efDoogkTeeJndHByrAfm8NPMd9vXQh2Jj/6sdgo55VXUdF2R2jBfTm/UlWDoGp6C nEXg== X-Gm-Message-State: AOJu0Yyobkr2kOsDcn6rJNveo6Pll/OmIZTtwoRxVVNlfMcb3rW0IiH8 xH/Q6sNw0ZG/imoW5FxJwPXNkrYwYm8s10uAELQktYm9HnaZCD1yTLzwzgb2VnrSWGwUpStDqRD dtKLdN7g= X-Gm-Gg: Acq92OErKlq4pi7S6CzoekIrmW64e6EQaqt6sbmx1c7ExPunLDpio0EGnjvpGh+Jk+6 1GcFx9xUkdzi0NPU3BLzMNT76ksf0y8YDhXlUjJxCNDA3js1Zva48M1eW3y+dfIrD0bgfsAsw+P dUO1+tPizsOldb8iqLPeUEaTmovGkKgRwhqVFP1HB2+IDze47KBldOxaFrhH+leeUzuauHISNpi Z6ridUFP0bpgzfu/1vdqWE7E4FLR3Lu67N/CDOmhgkepeMzW+kAtEO6uNpA0DN9mJpz4pnxJnS9 C4ePbK2lm2v/mlM7NO4pUlcktI5cy5ri/8TtuNGYK2OyubdS3BVD64TWkCAJI/XpKiizScbfgtI mR9jzKDNSnjlXiMQz08dL2TrTgLfKCPlpR2BXVvf75iYQZpbPCmdeMCL6eVulWa/8zK0mDqda+W GWlPahIRAt63ncVSkDPR6oZwgYag== X-Received: by 2002:a05:622a:1b90:b0:510:1543:31eb with SMTP id d75a77b69052e-5165a2674a2mr10530221cf.53.1778787733504; Thu, 14 May 2026 12:42:13 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:537:a9f7:1a84:f246]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-51645d51f06sm23789471cf.19.2026.05.14.12.42.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 12:42:12 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [OE-core][PATCH 02/11] patchtest: test series mergeability Date: Thu, 14 May 2026 15:41:58 -0400 Message-ID: <20260514194207.1958325-3-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260514194207.1958325-1-tgamblin@baylibre.com> References: <20260514194207.1958325-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, 14 May 2026 19:42:17 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/237049 Reintroduce mergeability (or, more technically, applicability) testing of mbox files. This requires several changes mbox.py: - Store the raw mbox data as a variable in the Patch class - Simplify get_branch() so that it parses each tag in the patch subject line individually - Rework the invalid tag list to help avoid incorrect interpretation of project/repo names as branches repo.py: - Add check_patches() to step through each patch in the series and test whether it applies (using a temporary branch) test_mbox.py: - Fix the branch comparison logic in TestMbox so that we don't automatically skip patches lacking a branch tag (which is the case for the selftest patches). This also adds some flexibility for when testing against other branches is desired. - Add pretest_series_applies_on_branch(), which runs before all other tests - Report the subject line for any patches which fail to merge - Skip the branch check for detached HEAD case so it still works with CI systems - Remove the unused headlog() function AI-Generated: Uses Claude Code Signed-off-by: Trevor Gamblin --- meta/lib/patchtest/mbox.py | 50 ++++++++++----------------- meta/lib/patchtest/repo.py | 44 +++++++++++++++++++++++ meta/lib/patchtest/tests/test_mbox.py | 40 ++++++++------------- 3 files changed, 76 insertions(+), 58 deletions(-) diff --git a/meta/lib/patchtest/mbox.py b/meta/lib/patchtest/mbox.py index 1d95819b7a..400d73f19f 100644 --- a/meta/lib/patchtest/mbox.py +++ b/meta/lib/patchtest/mbox.py @@ -42,6 +42,7 @@ class MboxReader: class Patch: def __init__(self, data): + self._raw = data self.author = data['From'] self.to = data['To'] self.cc = data['Cc'] @@ -66,43 +67,28 @@ class PatchSeries: self.branch = self.get_branch() def get_branch(self): - fullprefix = "" - pattern = re.compile(r"(\[.*\])", re.DOTALL) - - # There should be at least one patch in the series and it should - # include the branch name in the subject, so parse that - match = pattern.search(self.patches[0].subject) - if match: - fullprefix = match.group(1) - - branch, branches, valid_branches = None, [], [] - - if fullprefix: - prefix = fullprefix.strip('[]') - branches = [ b.strip() for b in prefix.split(',')] - valid_branches = [b for b in branches if PatchSeries.valid_branch(b)] - - if len(valid_branches): - branch = valid_branches[0] - - # Get the branch name excluding any brackets. If nothing was - # found, then assume there was no branch tag in the subject line - # and that the patch targets master - if branch is not None: - return branch.split(']')[0] - else: - return "master" + # Parse each [tag] in the subject individually + tags = re.findall(r'\[([^\[\]]*)\]', self.patches[0].subject) + valid_branches = [t.strip() for t in tags if PatchSeries.valid_branch(t.strip())] + return valid_branches[0] if valid_branches else None @staticmethod def valid_branch(branch): - """ Check if branch is valid name """ + """ Check if branch is a valid branch name (not a patch/project tag) """ lbranch = branch.lower() - invalid = lbranch.startswith('patch') or \ - lbranch.startswith('rfc') or \ - lbranch.startswith('resend') or \ - re.search(r'^v\d+', lbranch) or \ - re.search(r'^\d+/\d+', lbranch) + # Known project/list identifiers that appear in subject prefixes + known_projects = {'oe-core', 'bitbake', 'yocto', 'poky'} + + invalid = ( + lbranch.startswith('patch') or + lbranch.startswith('rfc') or + lbranch.startswith('resend') or + re.search(r'^v\d+', lbranch) or + re.search(r'^\d+/\d+', lbranch) or + lbranch in known_projects or + lbranch.startswith('meta-') + ) return not invalid diff --git a/meta/lib/patchtest/repo.py b/meta/lib/patchtest/repo.py index 6a7d7d2d3b..29ce9062a4 100644 --- a/meta/lib/patchtest/repo.py +++ b/meta/lib/patchtest/repo.py @@ -10,6 +10,8 @@ import git import os +import tempfile +import time import mbox class PatchTestRepo(object): @@ -79,6 +81,48 @@ class PatchTestRepo(object): return None + def check_patches(self): + """Try applying each patch in the series sequentially on a temporary branch. + + Returns a list of (subject, applied, error_message) tuples, one per patch. + Patches are applied in order so that each result reflects the cumulative + state, matching how the series would land in the real repository. + """ + results = [] + temp_branch = '%s_check' % self._workingbranch + self.repo.git.execute(['git', 'checkout', '-B', temp_branch, self._commit]) + try: + for patch in self.patch.patches: + # Prepend a From_ separator so git-am recognises the file as mbox + from_line = ( + b'From patchtest@patchtest ' + + time.strftime('%a %b %d %H:%M:%S %Y', time.gmtime()).encode() + + b'\n' + ) + with tempfile.NamedTemporaryFile(mode='wb', suffix='.patch', delete=False) as f: + f.write(from_line + patch._raw.as_bytes()) + tmpfile = f.name + try: + self.repo.git.execute( + ['git', 'am', '--keep-cr', tmpfile], with_exceptions=True + ) + results.append((patch.subject, True, None)) + except git.exc.GitCommandError as e: + results.append((patch.subject, False, str(e))) + try: + self.repo.git.execute(['git', 'am', '--abort']) + except git.exc.GitCommandError: + pass + finally: + os.remove(tmpfile) + finally: + self.repo.git.execute(['git', 'checkout', self._workingbranch]) + try: + self.repo.git.execute(['git', 'branch', '-D', temp_branch]) + except git.exc.GitCommandError: + pass + return results + def merge(self): if self._patchcanbemerged: self.repo.git.execute(['git', '-C', self.repodir, 'am', '--keep-cr', os.path.abspath(self.patch.path)]) diff --git a/meta/lib/patchtest/tests/test_mbox.py b/meta/lib/patchtest/tests/test_mbox.py index 5cf02af7bd..55d1068df3 100644 --- a/meta/lib/patchtest/tests/test_mbox.py +++ b/meta/lib/patchtest/tests/test_mbox.py @@ -9,17 +9,8 @@ import collections import patchtest_patterns import pyparsing import re -import subprocess from patchtest_parser import PatchtestParser -def headlog(): - output = subprocess.check_output( - "cd %s; git log --pretty='%%h#%%aN#%%cD:#%%s' -1" % PatchtestParser.repodir, - universal_newlines=True, - shell=True - ) - return output.split('#') - class TestMbox(base.Base): # base paths of main yocto project sub-projects @@ -82,26 +73,23 @@ class TestMbox(base.Base): commit=commit, ) - def test_series_merge_on_head(self): - self.skip("Merge test is disabled for now") - if PatchtestParser.repo.patch.branch != "master": + def pretest_series_applies_on_branch(self): + repo = PatchtestParser.repo + target_branch = repo.patch.branch + current_branch = repo.current_branch + + if target_branch is not None and current_branch and target_branch != current_branch: self.skip( - "Skipping merge test since patch is not intended" - " for master branch. Target detected is %s" - % PatchtestParser.repo.patch.branch + "Patch targets branch '%s' but testing against '%s'" + % (target_branch, current_branch) ) - if not PatchtestParser.repo.canbemerged(): - commithash, author, date, shortlog = headlog() + + results = repo.check_patches() + failures = [(subject, err) for subject, applied, err in results if not applied] + if failures: self.fail( - "Series does not apply on top of target branch %s" - % PatchtestParser.repo.patch.branch, - data=[ - ( - "Targeted branch", - "%s (currently at %s)" - % (PatchtestParser.repo.patch.branch, commithash), - ) - ], + 'One or more patches in the series do not apply cleanly', + data=[('Patch', subject) for subject, _ in failures], ) def test_target_mailing_list(self): From patchwork Thu May 14 19:41:59 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 88119 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 70ED9CD4F3D for ; Thu, 14 May 2026 19:42:17 +0000 (UTC) Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.19889.1778787736324363983 for ; Thu, 14 May 2026 12:42:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20251104.gappssmtp.com header.s=20251104 header.b=hzLcnpUd; spf=pass (domain: baylibre.com, ip: 209.85.222.181, mailfrom: tgamblin@baylibre.com) Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-9118b952e2bso55631085a.0 for ; Thu, 14 May 2026 12:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1778787735; x=1779392535; 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=uh6A7zFEEVc6hTgr/8OGaMISApWBsqt1mCd8bT9FTOI=; b=hzLcnpUd431lWw3RRmCSR2bfxGabtJZT4rU3tv5UWyggsOQ7nSe0LFIMvxz41gxeh7 YaJ50Aeq2TV/iJ9hGUATTe2dF3DO9qoscyD7Qb1tPouOdFpdgyXj+4/UPMwXbHZj5Ko7 dcsG75cc+vSFXQ+v3YwFRRqLV1EIyyhkOiZVoCsIH3iaChQseEkJWG8SfK0NvlknrKIh APWp85vXtnSmWCGX40i5KYItklFzTbE4aJVLVq2jPLTfjliAfquUbRJ+ADmeaiC6f5r/ HSukvI5pFxDGkBbyPjvi70yHtJ5xBtPH2Z4BjRzV+XosM9mjCQ8ROoHoMAgqypmzGrLu XhWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778787735; x=1779392535; 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=uh6A7zFEEVc6hTgr/8OGaMISApWBsqt1mCd8bT9FTOI=; b=qQri+kXNVXhbJci+4sVVdnrzU8OX4HMGY6cbMCHbx69oRhUcnNvNrRmWQjMiS8Y5ff RI7m4482YuWhc5EMjQcXJC2ToRjLB9/yCVG+01aIBivtfYutPIIMLoq0vpapLFIet9nw l6krfYLMeNW9uUC9SsfAVjScbxuF8FYupATsF/aIu4ZhK3kUPyNTFr9OnuqdOVaQvK9q /Lg3zMIk8uRH9lydMjsvpYObkikOGuCLLag57naZC3nipMf9q5Deo/Ir8m3oeyxwkwNI aPI+5NUlkJB54svg1YAZ6OZHia1pa3OdjNZaMtt4gtkuP9JldJ6OCdUlbJFgnSqy9MOe mZRA== X-Gm-Message-State: AOJu0Yz9gONbZl6j45EQY7lvi/N3MrbemHv77K2tVnP3RLDSWAVmZpkH kF4tofLRcDyK+Cbomopx1y7sFn1PE80nlI8f86HFlfvJIffvMFQTTDczPlJ/AqQnPRh/LjEOVIW XzZRpXUE= X-Gm-Gg: Acq92OEk8JCix4QxnJWdQpTAbEopXcsIUS7n+ae/xuAqmH3+ky6LsKYn6A6LvBcHuWO DTlEVXZ+axNiYMvda6l/+8hJmXtlS90HPPmhnsDLcoFSVbn4uDeLGutLpG1CQEkyvFPgEAfa1AM nMgF5T+cozufmh0TubgiWyCvDYBi42udin+9plDDKH/+qNK0cmSs7dh8RyZDCqZgJTTcpHH6wD9 RiUYocVfP0k5Rq29lv/tc6K5w3d5GInHo/0SnIUkToUfDNIfqd8Tm3B8wuoWlZVj9886k0A/zAP ri3bgeW3LR+nA6AmxBQXXP+QkJH8FcHasxWtsNsp15z4sfFqz0XfN+IDHwtVqy4C4UnVESPR7Al JqR5nCUumSZ4qlaSEUO21JRTD8OUYdtUKsPstbh/+MOck6fyeyrQNvyLgS3hv6bz/kky+WKOO8m jnS682af38mLjiQjG0IoQzLDSt+w== X-Received: by 2002:a05:620a:1985:b0:90f:9cde:978c with SMTP id af79cd13be357-911cc3c3540mr180593785a.14.1778787735271; Thu, 14 May 2026 12:42:15 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:537:a9f7:1a84:f246]) by smtp.gmail.com with ESMTPSA id af79cd13be357-910ba36e638sm329031885a.9.2026.05.14.12.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 12:42:14 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [OE-core][PATCH 03/11] patchtest: tests: cleanup test suites Date: Thu, 14 May 2026 15:41:59 -0400 Message-ID: <20260514194207.1958325-4-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260514194207.1958325-1-tgamblin@baylibre.com> References: <20260514194207.1958325-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, 14 May 2026 19:42:17 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/237050 Do a sweep of the test suites to remove redundant code, make variable names more explicit, and fix some formatting. Some logic (such as the bits for checking valid Upstream-Status tags) are also moved directly to the relevant functions, instead of being left in the setup stage. This should make maintenance easier going forward. AI-Generated: Uses Claude Code Signed-off-by: Trevor Gamblin --- meta/lib/patchtest/tests/base.py | 4 --- meta/lib/patchtest/tests/test_mbox.py | 10 +++--- meta/lib/patchtest/tests/test_metadata.py | 32 ++++++------------ meta/lib/patchtest/tests/test_patch.py | 33 ++++++++----------- .../lib/patchtest/tests/test_python_pylint.py | 8 ++--- 5 files changed, 33 insertions(+), 54 deletions(-) diff --git a/meta/lib/patchtest/tests/base.py b/meta/lib/patchtest/tests/base.py index 919ca136bb..8263932dda 100644 --- a/meta/lib/patchtest/tests/base.py +++ b/meta/lib/patchtest/tests/base.py @@ -22,10 +22,6 @@ info = logger.info warn = logger.warn error = logger.error -Commit = collections.namedtuple( - "Commit", ["author", "subject", "commit_message", "shortlog", "payload"] -) - Commit = collections.namedtuple('Commit', ['author', 'subject', 'commit_message', 'shortlog', 'payload']) class PatchtestOEError(Exception): diff --git a/meta/lib/patchtest/tests/test_mbox.py b/meta/lib/patchtest/tests/test_mbox.py index 55d1068df3..f158f4472c 100644 --- a/meta/lib/patchtest/tests/test_mbox.py +++ b/meta/lib/patchtest/tests/test_mbox.py @@ -65,11 +65,11 @@ class TestMbox(base.Base): shortlog = re.sub(r'^(\[.*?\])+ ', '', commit.shortlog) if shortlog.startswith('Revert "'): continue - l = len(shortlog) - if l > patchtest_patterns.mbox_shortlog_maxlength: + length = len(shortlog) + if length > patchtest_patterns.mbox_shortlog_maxlength: self.fail( "Edit shortlog so that it is %d characters or less (currently %d characters)" - % (patchtest_patterns.mbox_shortlog_maxlength, l), + % (patchtest_patterns.mbox_shortlog_maxlength, length), commit=commit, ) @@ -108,7 +108,7 @@ class TestMbox(base.Base): folders = patch.path.split('/') base_path = folders[0] for project in [self.bitbake, self.doc, self.oe, self.poky]: - if base_path in project.paths: + if base_path in project.paths: self.fail('Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists', data=[('Suggested ML', '%s [%s]' % (project.listemail, project.gitrepo)), ('Patch\'s path:', patch.path)]) @@ -161,7 +161,7 @@ class TestMbox(base.Base): for commit in self.commits: if patchtest_patterns.auh_email in commit.commit_message: self.fail( - "Invalid author %s. Resend the series with a valid patch author" + "Commit message contains AUH email address %s. Resend the series with a valid patch author" % patchtest_patterns.auh_email, commit=commit, ) diff --git a/meta/lib/patchtest/tests/test_metadata.py b/meta/lib/patchtest/tests/test_metadata.py index 30da8dbe60..442e80973d 100644 --- a/meta/lib/patchtest/tests/test_metadata.py +++ b/meta/lib/patchtest/tests/test_metadata.py @@ -8,7 +8,6 @@ import base import collections import os import patchtest_patterns -import pyparsing from patchtest_parser import PatchtestParser # Data store commonly used to share values between pre and post-merge tests @@ -108,39 +107,28 @@ class TestMetadata(base.Metadata): ], ) - def pretest_src_uri_left_files(self): - # these tests just make sense on patches that can be merged - if not PatchtestParser.repo.canbemerged(): - self.skip("Patch cannot be merged") - if not self.modified: - self.skip('No modified recipes, skipping pretest') - - # get the proper metadata values + def _collect_src_uri(self, key_prefix): for pn in self.modified: - # we are not interested in images if 'core-image' in pn: continue rd = self.tinfoil.parse_recipe(pn) PatchTestDataStore[ - "%s-%s-%s" % (self.shortid(), patchtest_patterns.metadata_src_uri, pn) + "%s-%s-%s" % (key_prefix, patchtest_patterns.metadata_src_uri, pn) ] = rd.getVar(patchtest_patterns.metadata_src_uri) - def test_src_uri_left_files(self): - # these tests just make sense on patches that can be merged + def pretest_src_uri_left_files(self): if not PatchtestParser.repo.canbemerged(): self.skip("Patch cannot be merged") if not self.modified: self.skip('No modified recipes, skipping pretest') + self._collect_src_uri(self.shortid()) - # get the proper metadata values - for pn in self.modified: - # we are not interested in images - if 'core-image' in pn: - continue - rd = self.tinfoil.parse_recipe(pn) - PatchTestDataStore[ - "%s-%s-%s" % (self.shortid(), patchtest_patterns.metadata_src_uri, pn) - ] = rd.getVar(patchtest_patterns.metadata_src_uri) + def test_src_uri_left_files(self): + if not PatchtestParser.repo.canbemerged(): + self.skip("Patch cannot be merged") + if not self.modified: + self.skip('No modified recipes, skipping test') + self._collect_src_uri(self.shortid()) for pn in self.modified: pretest_src_uri = PatchTestDataStore[ diff --git a/meta/lib/patchtest/tests/test_patch.py b/meta/lib/patchtest/tests/test_patch.py index 3b33b5a199..9f1d7d2c8f 100644 --- a/meta/lib/patchtest/tests/test_patch.py +++ b/meta/lib/patchtest/tests/test_patch.py @@ -28,21 +28,16 @@ class TestPatch(base.Base): def setUp(self): if self.unidiff_parse_error: self.skip('Parse error %s' % self.unidiff_parse_error) - - self.valid_status = ", ".join(patchtest_patterns.upstream_status_nonliteral_valid_status) - self.standard_format = "Upstream-Status: " - - # we are just interested in series that introduce CVE patches, thus discard other - # possibilities: modification to current CVEs, patch directly introduced into the - # recipe, upgrades already including the CVE, etc. - new_cves = [p for p in self.patchset if p.path.endswith('.patch') and p.is_added_file] - if not new_cves: + if not TestPatch.newpatches: self.skip('No new CVE patches introduced') def test_upstream_status_presence_format(self): if not TestPatch.newpatches: self.skip("There are no new software patches, no reason to test Upstream-Status presence/format") + valid_status = ", ".join(patchtest_patterns.upstream_status_nonliteral_valid_status) + standard_format = "Upstream-Status: " + for newpatch in TestPatch.newpatches: payload = newpatch.__str__() lines = payload.splitlines() @@ -71,16 +66,16 @@ class TestPatch(base.Base): 'Upstream-Status is present only after the patch scissors. ' "It must be placed in the patch header before the scissors line.", data=[ - ("Standard format", self.standard_format), - ("Valid status", self.valid_status), + ("Standard format", standard_format), + ("Valid status", valid_status), ], ) else: self.fail( "Added patch file is missing Upstream-Status: in the commit message", data=[ - ("Standard format", self.standard_format), - ("Valid status", self.valid_status), + ("Standard format", standard_format), + ("Valid status", valid_status), ], ) @@ -97,8 +92,8 @@ class TestPatch(base.Base): "but was found afterwards.", data=[ ("Current", line.lstrip("+")), - ("Standard format", self.standard_format), - ("Valid status", self.valid_status), + ("Standard format", standard_format), + ("Valid status", valid_status), ], ) @@ -142,14 +137,14 @@ class TestPatch(base.Base): "Upstream-Status is in incorrect format", data=[ ("Current", pe.pstr), - ("Standard format", self.standard_format), - ("Valid status", self.valid_status), + ("Standard format", standard_format), + ("Valid status", valid_status), ], ) def test_signed_off_by_presence(self): if not TestPatch.newpatches: - self.skip("There are no new software patches, no reason to test %s presence" % PatchSignedOffBy.mark) + self.skip("There are no new software patches, no reason to test %s presence" % TestPatch.mark) for newpatch in TestPatch.newpatches: payload = newpatch.__str__() @@ -162,7 +157,7 @@ class TestPatch(base.Base): self.fail('A patch file has been added without a Signed-off-by tag: \'%s\'' % os.path.basename(newpatch.path)) def test_cve_tag_format(self): - for commit in TestPatch.commits: + for commit in self.commits: if patchtest_patterns.cve.search_string( commit.shortlog ) or patchtest_patterns.cve.search_string(commit.commit_message): diff --git a/meta/lib/patchtest/tests/test_python_pylint.py b/meta/lib/patchtest/tests/test_python_pylint.py index ec9129bc79..37d1de9436 100644 --- a/meta/lib/patchtest/tests/test_python_pylint.py +++ b/meta/lib/patchtest/tests/test_python_pylint.py @@ -47,7 +47,7 @@ class PyLint(base.Base): for pythonpatch in self.pythonpatches: # a condition checking whether a file is renamed or not # unidiff doesn't support this yet - if pythonpatch.target_file is not pythonpatch.path: + if pythonpatch.target_file != pythonpatch.path: path = pythonpatch.target_file[2:] else: path = pythonpatch.path @@ -55,9 +55,9 @@ class PyLint(base.Base): reporter = TextReporter(pylint_output) lint.Run([self.pylint_options, pythonpatch.path], reporter=reporter, exit=False) for line in pylint_output.readlines(): - if not '*' in line: - if line.strip(): - self.pylint_test[line.strip().split(' ',1)[0]] = line.strip().split(' ',1)[1] + if not '*' in line: + if line.strip(): + self.pylint_test[line.strip().split(' ',1)[0]] = line.strip().split(' ',1)[1] for issue in self.pylint_test: if self.pylint_test[issue] not in self.pylint_pretest.values(): From patchwork Thu May 14 19:42:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 88124 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 B9315CD4F39 for ; Thu, 14 May 2026 19:42:27 +0000 (UTC) Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.19910.1778787740533896909 for ; Thu, 14 May 2026 12:42:20 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20251104.gappssmtp.com header.s=20251104 header.b=SQw92gSS; spf=pass (domain: baylibre.com, ip: 209.85.219.50, mailfrom: tgamblin@baylibre.com) Received: by mail-qv1-f50.google.com with SMTP id 6a1803df08f44-8b59772d441so84212526d6.0 for ; Thu, 14 May 2026 12:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1778787738; x=1779392538; 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=xQ6YgJq7Am3LGMdC6qXsgssZftIPZAAczC59p8UQ8Wk=; b=SQw92gSSZ6SHODdHgtyoTyRqTHm1u91er5E+JvFaz0OeuHTDaJtTOEmBbi1UYne42D JqP7dIxsMFFNb4x5sdSTp4uWT0gmW41R/YePJ5beXFgfPsmR7yfl7rao/AWubHwgxCGH 83oxdns8kWW+Sd3UiMsFNozqH++68XB0tq/SnXrF8OPhkyg/xqkC6sSSIphHjw+uNMfw b9z3MaeGvVyHekv2dSCMOFgHpUWVH+GVPg0kNz9/u02NTccl4TpVNouOQ8I2A6tyvy07 HIV7cR3YPTMMvyQtfSLkWcyO1MUhaWkO3BD44g6S+p20pAiztR/VtKKxBX1vTh3wYX+N 7AWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778787738; x=1779392538; 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=xQ6YgJq7Am3LGMdC6qXsgssZftIPZAAczC59p8UQ8Wk=; b=FwLAvD45RjayMkZg3CiiDQuop+2ljxipIy/z1+ychF638c956VY5bm1Ht2Y8s1kSun 6vwxRB8ETm+Le9xe/jnm+nffXGxo7FmelwB7ItftukpENKrsftkcAKverDZpaMvuzwq8 +Tm+9dv1XWqLIaFGkd816KVFb41FnD9P6mM4UNS3FByg9os0Z1h/aJ7AfVaiKR3Aa81C vvee+OfJEj9YTPYIdDdo3/jjytBGezyxUl0RHhl5zRCz92plToi2V3JbgNGu1ipDSTha 0G3EugyJNcBD53UmjgaM9rEGRAZoZxuyviO1ClF4bZbGs4Qduf2Od3EEYk3ZLDtNipUG pX2Q== X-Gm-Message-State: AOJu0Yz09A8c1DtZl8yBAwz/iXwvjTLNVaRHHX6i86JQ0gjkp4U+3Vw5 3k+T9sOwDWJGQqcESnYkwQUdJy+eAuRgcl1ERwMgSpoax/NgSactPD8xSk8TRQs1gLPf7bi/SCj 4I1//hAk= X-Gm-Gg: Acq92OGFY0rbkS6b3byzd+Fw+zsJYzAVhggVWwM+58c9Q4hQbytsCBwbrsqk1CBWnFT itN1LU7dxuAi2Jyc64JBlRkxGM8XT3eG/7uJ8vcd3D9bh7+E2RAi/dmluq21H9D81iAqMgPN4r+ eVJ9GH0rldUexy6eehvZ7r177Kyfeg4dQIjS7ZsZ3zJ6jHVt4c751M7Zi+rVKYVN1EpbfuBKrqh al4QlcDne0XYmrdPvwYhqF48a4Or/zlTjk9eo/O9rEBVU/6qGfX4LvfQUdnwsTAO1dfc86jvthb Ou9+9IL8u9rkdxCeXBjFRORGwQIrVaIF6EevDZWnHT4COnXPe/KVvAjHyn0P039CXPuDN82A0Pc BfASSOy+aqh/KQzA/T3eszaV08S69N40AzdgF/FcJfZynxRt7XwBBS00OlVNesNFE6IKdxnTGdN 1RJdDayntlx6G3nAQArTeF+1vh+Q== X-Received: by 2002:a05:6214:55c6:b0:8ca:e41:ab8 with SMTP id 6a1803df08f44-8ca0f63466bmr15865286d6.7.1778787738527; Thu, 14 May 2026 12:42:18 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:537:a9f7:1a84:f246]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8c90bb82a92sm31452886d6.36.2026.05.14.12.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 12:42:17 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [OE-core][PATCH 04/11] patchtest: correctly abort --directory test Date: Thu, 14 May 2026 15:42:00 -0400 Message-ID: <20260514194207.1958325-5-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260514194207.1958325-1-tgamblin@baylibre.com> References: <20260514194207.1958325-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, 14 May 2026 19:42:27 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/237051 Currently, patchtest run with --directory responds to a CTRL+C press by aborting only the current patch being tested, and moves onto the next. Instead, this key press should stop the test entirely. Remove usage of the unittest.installHandler() function (which intercepts the signal) and handle it ourselves. Also make sure that the branch is properly reset with git am --abort afterwards, and that the return code is properly set in the sigint handler function. AI-Generated: Uses Claude Code Signed-off-by: Trevor Gamblin --- meta/lib/patchtest/patchtest_parser.py | 2 +- meta/lib/patchtest/repo.py | 4 + meta/lib/patchtest/tests/base.py | 113 +++++++++------------- meta/lib/patchtest/tests/test_metadata.py | 86 ++++++++-------- scripts/patchtest | 31 +++++- 5 files changed, 119 insertions(+), 117 deletions(-) diff --git a/meta/lib/patchtest/patchtest_parser.py b/meta/lib/patchtest/patchtest_parser.py index 2a11cb76c2..69bcb4b8e5 100644 --- a/meta/lib/patchtest/patchtest_parser.py +++ b/meta/lib/patchtest/patchtest_parser.py @@ -37,7 +37,7 @@ class PatchtestParser(object): help='The patch to be tested') target_patch_group.add_argument('--directory', metavar='DIRECTORY', dest='patch_path', - help='The directory containing patches to be tested') + help='The directory containing patches to be tested. CTRL+C aborts the entire directory test.') parser.add_argument('--repodir', metavar='REPO', default=default_repodir, diff --git a/meta/lib/patchtest/repo.py b/meta/lib/patchtest/repo.py index 29ce9062a4..cb68b32cdf 100644 --- a/meta/lib/patchtest/repo.py +++ b/meta/lib/patchtest/repo.py @@ -129,6 +129,10 @@ class PatchTestRepo(object): self._patchmerged = True def clean(self): + try: + self.repo.git.execute(['git', 'am', '--abort']) + except git.exc.GitCommandError: + pass self.repo.git.execute(['git', 'checkout', self.current_branch if self.current_branch else self.current_commit]) self.repo.git.execute(['git', 'branch', '-D', self._workingbranch]) self._patchmerged = False diff --git a/meta/lib/patchtest/tests/base.py b/meta/lib/patchtest/tests/base.py index 8263932dda..a7f5e79a54 100644 --- a/meta/lib/patchtest/tests/base.py +++ b/meta/lib/patchtest/tests/base.py @@ -133,18 +133,17 @@ class Metadata(Base): def setUpClassLocal(cls): cls.tinfoil = cls.setup_tinfoil() - # get info about added/modified/remove recipes + # get info about added/modified/removed recipes (as absolute paths) cls.added, cls.modified, cls.removed = cls.get_metadata_stats(cls.patchset) @classmethod def tearDownClassLocal(cls): - cls.tinfoil.shutdown() + if cls.tinfoil: + cls.tinfoil.shutdown() @classmethod def setup_tinfoil(cls, config_only=False): - """Initialize tinfoil api from bitbake""" - - # import relevant libraries + """Initialize tinfoil api from bitbake, or return None if unavailable.""" try: scripts_path = os.path.join(PatchtestParser.repodir, "scripts", "lib") if scripts_path not in sys.path: @@ -153,21 +152,20 @@ class Metadata(Base): scriptpath.add_bitbake_lib_path() import bb.tinfoil except ImportError: - raise PatchtestOEError('Could not import tinfoil module') + logger.warn('patchtest: bitbake not available, metadata checks will use fallback parser') + return None orig_cwd = os.path.abspath(os.curdir) - - # Load tinfoil tinfoil = None try: builddir = os.environ.get('BUILDDIR') if not builddir: logger.warn('Bitbake environment not loaded?') - return tinfoil + return None os.chdir(builddir) tinfoil = bb.tinfoil.Tinfoil() tinfoil.prepare(config_only=config_only) - except bb.tinfoil.TinfoilUIException as te: + except bb.tinfoil.TinfoilUIException: if tinfoil: tinfoil.shutdown() raise PatchtestOEError('Could not prepare properly tinfoil (TinfoilUIException)') @@ -180,69 +178,48 @@ class Metadata(Base): return tinfoil + @staticmethod + def _find_pn(data, path): + """Find the PN from tinfoil recipe cache data for a given file path.""" + pn = None + pn_native = None + for _path, _pn in data: + if path in _path: + if 'native' in _pn: + pn_native = _pn + else: + pn = _pn + break + else: + if pn_native: + return pn_native + path_basename = path.split('_')[0] + for _path, _pn in data: + _path_basename = _path.split('_')[0] + if path_basename == _path_basename: + pn = _pn + return pn + @classmethod - def get_metadata_stats(cls, patchset): - """Get lists of added, modified and removed metadata files""" + def _getvar(cls, path, varname): + """Return a recipe variable value via tinfoil if available, else the fallback parser.""" + if cls.tinfoil: + data = list(cls.tinfoil.cooker.recipecaches[''].pkg_fn.items()) + pn = cls._find_pn(data, path) + rd = cls.tinfoil.parse_recipe(pn) + return rd.getVar(varname) - def find_pn(data, path): - """Find the PN from data""" - pn = None - pn_native = None - for _path, _pn in data: - if path in _path: - if 'native' in _pn: - # store the native PN but look for the non-native one first - pn_native = _pn - else: - pn = _pn - break - else: - # sent the native PN if found previously - if pn_native: - return pn_native - - # on renames (usually upgrades), we need to check (FILE) base names - # because the unidiff library does not provided the new filename, just the modified one - # and tinfoil datastore, once the patch is merged, will contain the new filename - path_basename = path.split('_')[0] - for _path, _pn in data: - _path_basename = _path.split('_')[0] - if path_basename == _path_basename: - pn = _pn - return pn - - if not cls.tinfoil: - cls.tinfoil = cls.setup_tinfoil() - - added_paths, modified_paths, removed_paths = [], [], [] + @classmethod + def get_metadata_stats(cls, patchset): + """Return lists of absolute paths for added, modified and removed recipe files.""" added, modified, removed = [], [], [] - - # get metadata filename additions, modification and removals for patch in patchset: if patch.path.endswith('.bb') or patch.path.endswith('.bbappend') or patch.path.endswith('.inc'): + abspath = os.path.join(os.path.abspath(PatchtestParser.repodir), patch.path) if patch.is_added_file: - added_paths.append( - os.path.join( - os.path.abspath(PatchtestParser.repodir), patch.path - ) - ) + added.append(abspath) elif patch.is_modified_file: - modified_paths.append( - os.path.join( - os.path.abspath(PatchtestParser.repodir), patch.path - ) - ) + modified.append(abspath) elif patch.is_removed_file: - removed_paths.append( - os.path.join( - os.path.abspath(PatchtestParser.repodir), patch.path - ) - ) - - data = cls.tinfoil.cooker.recipecaches[''].pkg_fn.items() - - added = [find_pn(data,path) for path in added_paths] - modified = [find_pn(data,path) for path in modified_paths] - removed = [find_pn(data,path) for path in removed_paths] - - return [a for a in added if a], [m for m in modified if m], [r for r in removed if r] + removed.append(abspath) + return added, modified, removed diff --git a/meta/lib/patchtest/tests/test_metadata.py b/meta/lib/patchtest/tests/test_metadata.py index 442e80973d..8c77921af5 100644 --- a/meta/lib/patchtest/tests/test_metadata.py +++ b/meta/lib/patchtest/tests/test_metadata.py @@ -19,34 +19,32 @@ class TestMetadata(base.Metadata): if not self.added: self.skip('No added recipes, skipping test') - # TODO: this is a workaround so we can parse the recipe not - # containing the LICENSE var: add some default license instead - # of INVALID into auto.conf, then remove this line at the end - auto_conf = os.path.join(os.environ.get('BUILDDIR'), 'conf', 'auto.conf') - open_flag = 'w' - if os.path.exists(auto_conf): - open_flag = 'a' - with open(auto_conf, open_flag) as fd: - for pn in self.added: - fd.write('LICENSE ??= "%s"\n' % patchtest_patterns.invalid_license) + if self.tinfoil: + # workaround: set a default license so tinfoil can parse recipes + # that don't have LICENSE set yet + auto_conf = os.path.join(os.environ.get('BUILDDIR'), 'conf', 'auto.conf') + open_flag = 'w' + if os.path.exists(auto_conf): + open_flag = 'a' + with open(auto_conf, open_flag) as fd: + for path in self.added: + fd.write('LICENSE ??= "%s"\n' % patchtest_patterns.invalid_license) no_license = False - for pn in self.added: - rd = self.tinfoil.parse_recipe(pn) - license = rd.getVar(patchtest_patterns.metadata_lic) - if license == patchtest_patterns.invalid_license: + for path in self.added: + license = self._getvar(path, patchtest_patterns.metadata_lic) + if not license or license == patchtest_patterns.invalid_license: no_license = True break - # remove auto.conf line or the file itself - if open_flag == 'w': - os.remove(auto_conf) - else: - fd = open(auto_conf, 'r') - lines = fd.readlines() - fd.close() - with open(auto_conf, 'w') as fd: - fd.write(''.join(lines[:-1])) + if self.tinfoil: + if open_flag == 'w': + os.remove(auto_conf) + else: + with open(auto_conf, 'r') as fd: + lines = fd.readlines() + with open(auto_conf, 'w') as fd: + fd.write(''.join(lines[:-1])) if no_license: self.fail('Recipe does not have the LICENSE field set.') @@ -55,14 +53,13 @@ class TestMetadata(base.Metadata): if not self.added: self.skip('No added recipes, skipping test') - for pn in self.added: - rd = self.tinfoil.parse_recipe(pn) - pathname = rd.getVar('FILE') + for path in self.added: + pathname = self._getvar(path, 'FILE') or path # we are not interested in images if '/images/' in pathname: continue - lic_files_chksum = rd.getVar(patchtest_patterns.metadata_chksum) - if rd.getVar(patchtest_patterns.license_var) == patchtest_patterns.closed: + lic_files_chksum = self._getvar(path, patchtest_patterns.metadata_chksum) + if self._getvar(path, patchtest_patterns.license_var) == patchtest_patterns.closed: continue if not lic_files_chksum: self.fail( @@ -108,13 +105,13 @@ class TestMetadata(base.Metadata): ) def _collect_src_uri(self, key_prefix): - for pn in self.modified: - if 'core-image' in pn: + for path in self.modified: + if 'core-image' in os.path.basename(path): continue - rd = self.tinfoil.parse_recipe(pn) + src_uri = self._getvar(path, patchtest_patterns.metadata_src_uri) PatchTestDataStore[ - "%s-%s-%s" % (key_prefix, patchtest_patterns.metadata_src_uri, pn) - ] = rd.getVar(patchtest_patterns.metadata_src_uri) + "%s-%s-%s" % (key_prefix, patchtest_patterns.metadata_src_uri, path) + ] = src_uri or '' def pretest_src_uri_left_files(self): if not PatchtestParser.repo.canbemerged(): @@ -130,12 +127,12 @@ class TestMetadata(base.Metadata): self.skip('No modified recipes, skipping test') self._collect_src_uri(self.shortid()) - for pn in self.modified: + for path in self.modified: pretest_src_uri = PatchTestDataStore[ - "pre%s-%s-%s" % (self.shortid(), patchtest_patterns.metadata_src_uri, pn) + "pre%s-%s-%s" % (self.shortid(), patchtest_patterns.metadata_src_uri, path) ].split() test_src_uri = PatchTestDataStore[ - "%s-%s-%s" % (self.shortid(), patchtest_patterns.metadata_src_uri, pn) + "%s-%s-%s" % (self.shortid(), patchtest_patterns.metadata_src_uri, path) ].split() pretest_files = set([os.path.basename(patch.split(';')[0]) for patch in pretest_src_uri if patch.startswith('file://')]) @@ -154,7 +151,7 @@ class TestMetadata(base.Metadata): filesremoved_from_usr_uri = pretest_files - test_files # finally, get those patches removed at SRC_URI and not removed from the patchset - # TODO: we are not taking into account renames, so test may raise false positives + # TODO: we are not taking into account renames, so test may raise false positives not_removed = filesremoved_from_usr_uri - filesremoved_from_patchset if not_removed: self.fail('Patches not removed from tree. Remove them and amend the submitted mbox', @@ -164,15 +161,15 @@ class TestMetadata(base.Metadata): if not self.added: self.skip('No added recipes, skipping test') - for pn in self.added: + for path in self.added: + pn = os.path.basename(path).split('_')[0] # we are not interested in images if 'core-image' in pn: continue - rd = self.tinfoil.parse_recipe(pn) - summary = rd.getVar(patchtest_patterns.metadata_summary) + summary = self._getvar(path, patchtest_patterns.metadata_summary) # "${PN} version ${PN}-${PR}" is the default, so fail if default - if summary.startswith("%s version" % pn): + if not summary or summary.startswith("%s version" % pn): self.fail( "%s is missing in newly added recipe" % patchtest_patterns.metadata_summary ) @@ -186,12 +183,11 @@ class TestMetadata(base.Metadata): or PatchtestParser.repo.patch.branch == "dunfell" ): self.skip("No modified recipes or older target branch, skipping test") - for pn in self.modified: + for path in self.modified: # we are not interested in images - if 'core-image' in pn: + if 'core-image' in os.path.basename(path): continue - rd = self.tinfoil.parse_recipe(pn) - cve_check_ignore = rd.getVar(patchtest_patterns.cve_check_ignore_var) + cve_check_ignore = self._getvar(path, patchtest_patterns.cve_check_ignore_var) if cve_check_ignore is not None: self.fail( diff --git a/scripts/patchtest b/scripts/patchtest index e8ace03905..435610b54f 100755 --- a/scripts/patchtest +++ b/scripts/patchtest @@ -12,6 +12,7 @@ import json import logging import os +import signal import subprocess import sys import traceback @@ -133,8 +134,6 @@ def _runner(resultklass, prefix=None): def run(patch, logfile=None): """ Load, setup and run pre and post-merge tests """ - unittest.installHandler() - premerge_result = _runner(make_result_class(patch, False, logfile), 'pretest') postmerge_result = _runner(make_result_class(patch, True, logfile), 'test') @@ -183,10 +182,26 @@ def main(): else: patch_list = [patch_path] + interrupted = False + previous_sigint = signal.getsignal(signal.SIGINT) + + def _sigint_handler(signum, frame): + nonlocal interrupted + interrupted = True + # Restore previous handler so a second CTRL+C exits immediately + signal.signal(signal.SIGINT, previous_sigint) + signal.default_int_handler(signum, frame) + + signal.signal(signal.SIGINT, _sigint_handler) + ret = 0 for patch in patch_list: + if interrupted: + break + if os.path.getsize(patch) == 0: logger.error('patchtest: patch is empty') + signal.signal(signal.SIGINT, previous_sigint) return 1 logger.info('Testing patch %s' % patch) @@ -197,8 +212,18 @@ def main(): with open(log_path, "a") as f: f.write("Patchtest results for patch '%s':\n\n" % patch) - ret = run(patch, log_path) + try: + result = run(patch, log_path) + ret = ret or result + except KeyboardInterrupt: + interrupted = True + + if interrupted: + logger.error('\npatchtest: interrupted') + signal.signal(signal.SIGINT, previous_sigint) + return 1 + signal.signal(signal.SIGINT, previous_sigint) return ret if __name__ == '__main__': From patchwork Thu May 14 19:42:01 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 88123 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 BE7C5CD4F42 for ; Thu, 14 May 2026 19:42:27 +0000 (UTC) Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.19891.1778787741995680451 for ; Thu, 14 May 2026 12:42:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20251104.gappssmtp.com header.s=20251104 header.b=etI3c2ZV; spf=pass (domain: baylibre.com, ip: 209.85.219.48, mailfrom: tgamblin@baylibre.com) Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-8acb09ddbf6so127235426d6.2 for ; Thu, 14 May 2026 12:42:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1778787740; x=1779392540; 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=9nkeeLbqRVoHNO0OGqbIdgMRYgQNLcDrWm7X/mzEJ1o=; b=etI3c2ZVpEIDbi5bESUCGv7d0vSIlACgPA+unaThQvKscblZMeU72HcOYPW2GtqK1N 5/4cnu7FgiGsFac12wVGwP1PrTK8+YNcxpMWtmpQ67rjdqMPALzPD3e/Cnn9rxzbqdLs lCKY3Rg+8r7+amWjHSvUmhd3uD+GMvUmeKQzvMrzXlhdhUrzfA77J73X5g6vpPcD6GlV bzaRgWZNoHqsLEpVvYYaWfdBjM467eD6mqURzWxRfxq7CVss12Abx9mcua5dZbnG8yqO ZuCdNn0XAswGrLKqP8maPV4psRJwBo0O8Y9k4qHYuai4Nq2KkBmoM9X4k+koUQJCzb7E vDzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778787740; x=1779392540; 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=9nkeeLbqRVoHNO0OGqbIdgMRYgQNLcDrWm7X/mzEJ1o=; b=frxUpFZSmIexYy7fbmcEX1468hlFMWRBVT40IWhhrZWBF7Sbdap6kqEYrMyEQLS862 T+tg57PE2G/tWg/sbpT0qilaf9pLy+KYR2s6HyWPR+6pFvO7EgNK1LW5exHRnG+GKj61 36ErIsXuu5UuaY6Fr+gI/z/N+DkfBGTG9IXVG3U2LGW0AwRe+QeEtKhk7hzV3TwhOZx1 +umBYRDTlU3cnYUu9xryToit5/8YvhPtPL44TxDU6wZhLGyyls52004rrz1IBdplMJTf t9VkFW2aIXEZsnLzZryVy8tV1t3g04miRrnzOBH+xPJJIBWbh8nJFTnouzzSVBYe0hzm 0yBA== X-Gm-Message-State: AOJu0Ywdvs5FxGhOTKg7940+8Mvy++b/0giZmJ48KD0+Ut3czXI81zHD N1E3iJwXOcZDY9uUugJ+qdS1w8+tP08+lRwfEKUyJuAniSz6vNEZYPetKPBusrNyWTGhRmTvmFA UURKP3sI= X-Gm-Gg: Acq92OF2HHlfas1vG0/g0ClrbXtzLzxgDLmg1oMCjBgcuZt9vgItO7I6z+rqCtc/ypH 8LEmB7uRPee9Rfu/snhU9ZUpDRoMsjdxuR6SuRtBcGt+Ww2xSF5bi3A8imbyXjbNPP5Dwt0bc5f T4zfE6/G2kleYDvBvA0x6WxLZoZvV60u9K/wrwkxjntL+vrEABvo5zTNqoegvZkQQmbwNWiruz8 lZRRQuxQi0xrPHE7SbciposyeHqDgGzKY3xSa8WDpKHcDTZuVJ1VCRC0MA8dpu/YWGSuK+WG0MK zoy12ds23853GyMQ1eZyzOep3KXwbQC7hV4sMiJuSBfIM27Prja5xs5ztp1cVrbz+YYoJlN0g6m nuLX7oJL0MpNLeBVkCBARZJIpe8rAeYplGGpM+zVVHA1rolAqcIlZv6Ra+Kkt0zSscMdQnNkRwv +j2VdEZf5aTAnbPUmpF8lWc7n3qp0x7s3Jt7zO X-Received: by 2002:a05:6214:5a05:b0:8b1:f784:7ec8 with SMTP id 6a1803df08f44-8ca0f6fcd58mr19874696d6.47.1778787740483; Thu, 14 May 2026 12:42:20 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:537:a9f7:1a84:f246]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8c90b2dc42csm31548366d6.26.2026.05.14.12.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 12:42:19 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [OE-core][PATCH 05/11] patchtest: fix branch applicability reporting Date: Thu, 14 May 2026 15:42:01 -0400 Message-ID: <20260514194207.1958325-6-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260514194207.1958325-1-tgamblin@baylibre.com> References: <20260514194207.1958325-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, 14 May 2026 19:42:27 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/237052 There are two issues with how patchtest reports results for testing a patch series: 1. When a target branch mismatch is detected, it reports (for example) "scarthgap 50/71" as the target branch instead of just "scarthgap"; 2. It doesn't report the full shortlog for a commit which fails to apply, as expected. Fix both issues, but make sure that we only print shortlogs for patches which fail to apply if there's more than one actual commit being tested, as otherwise the patch failing to merge is obvious. AI-Generated: Uses Claude Code Signed-off-by: Trevor Gamblin --- meta/lib/patchtest/mbox.py | 5 ++++- meta/lib/patchtest/tests/test_mbox.py | 2 +- scripts/patchtest | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/meta/lib/patchtest/mbox.py b/meta/lib/patchtest/mbox.py index 400d73f19f..2342fbda65 100644 --- a/meta/lib/patchtest/mbox.py +++ b/meta/lib/patchtest/mbox.py @@ -70,7 +70,10 @@ class PatchSeries: # Parse each [tag] in the subject individually tags = re.findall(r'\[([^\[\]]*)\]', self.patches[0].subject) valid_branches = [t.strip() for t in tags if PatchSeries.valid_branch(t.strip())] - return valid_branches[0] if valid_branches else None + if not valid_branches: + return None + # Strip trailing series position, e.g. "scarthgap 50/71" -> "scarthgap" + return re.sub(r'\s+\d+/\d+$', '', valid_branches[0]) @staticmethod def valid_branch(branch): diff --git a/meta/lib/patchtest/tests/test_mbox.py b/meta/lib/patchtest/tests/test_mbox.py index f158f4472c..a216028250 100644 --- a/meta/lib/patchtest/tests/test_mbox.py +++ b/meta/lib/patchtest/tests/test_mbox.py @@ -89,7 +89,7 @@ class TestMbox(base.Base): if failures: self.fail( 'One or more patches in the series do not apply cleanly', - data=[('Patch', subject) for subject, _ in failures], + data=[('Patch', subject) for subject, _ in failures] if len(results) > 1 else None, ) def test_target_mailing_list(self): diff --git a/scripts/patchtest b/scripts/patchtest index 435610b54f..f359a6a96d 100755 --- a/scripts/patchtest +++ b/scripts/patchtest @@ -90,8 +90,11 @@ def make_result_class(patch, mergepatch, logfile=None): def addFailure(self, test, err): self.test_failure = True desc = _format_test_description(test) - issue = json.loads(str(err[1]))["issue"] + parsed = json.loads(str(err[1])) + issue = parsed["issue"] _emit('{}: {}: {} ({})'.format(self.fail, desc, issue, test.id()), logfile) + for key, val in parsed.get('data') or []: + _emit(' {}: {}'.format(key, val), logfile) def addSuccess(self, test): desc = _format_test_description(test) From patchwork Thu May 14 19:42:02 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 88122 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 96CC8CD37AC for ; Thu, 14 May 2026 19:42:27 +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.19915.1778787743955530690 for ; Thu, 14 May 2026 12:42:24 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20251104.gappssmtp.com header.s=20251104 header.b=EAJHTmw2; 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-8b3d6b215cfso125261196d6.3 for ; Thu, 14 May 2026 12:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1778787742; x=1779392542; 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=03sLf7GZ43UAXBy/c8TQkTofSGXJSiF8liOGS0PQ/GQ=; b=EAJHTmw2cqhVZImZuuW9UXmRKqOMMIE9Rbh5bakaFiw/D3V9pF0UM2dPaJzeoM9PMt NSHjK8MTGqTpjMWXAKyBA+Ixg5aE9o+Ut5JwrMhUs+P2+GrXteTpfO6l7PnqwMvYJEoI cAn3WRfWiaj//WmWBhi+VQjSgv844AqscSlsNZNPIT7TztAfP015om7nlA6ladpIUm9H pX66ryKVps33RhWJQVUv4po3jp8cAEE7kZABUr5BLCGdeooJN4KCzKY00070ArE9JsbY Z64wKzY6FVIhTTFbq2kjNqA3/vOzJHNrKOnpygaE6d63enuT28R1PAg3SZfC7V+E1vLh gQhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778787742; x=1779392542; 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=03sLf7GZ43UAXBy/c8TQkTofSGXJSiF8liOGS0PQ/GQ=; b=sInVERrwBIbuJW4PCewNT0sq2WiTTAxiqP9pNCHUMxWx6eWwvAL7H8NWX4qRmkDQSh i0rSpnAfNEH02zgnYewuisvlf6isKisghoN0R6FPQ/GlsY8D06OAelrI9+g2YRRjmaCb 7FJkgv1E8853vIQIyXQToYZ6TS984xSJ2Q01RSr9hIaj1/s625szK3gzYsJEIdlyoLOC LorDcMb8+rW4FPW70nmxpuswPH+J8kT6gtRY+E8y3gly8JqkUKz0l8MKEUPikN6TMY74 MEjM7CVVtwTQN5eltte9KQDy832gMV3bkHxNRMdb4vprnk0dEtga9S49x9VoX1rFnhuj zcSg== X-Gm-Message-State: AOJu0YzTqYIjFZgHptzJZEoJh9iV9fnvwQUJEdo6U9zlMW7/gK17pAXn i/AgGcNWRn3rh/BQs2+DfnVAS1FAHEl5dQzOYbv44J4pMfabl9wJzR6zpxuIhr2upyc9VrfTq8o oLAU3lsc= X-Gm-Gg: Acq92OF0WKyLHWCi4rUQzmtv9mK9tesMz/a9o2yV97OezthwcdQcy8I4vhn90m5lFHK u9NxQenNh5W6zrFwJH1xg40hML8JsEexmjAw3AEj/gpDsmKTYgphiaaWBBxa+NH4E/BLLpevZ1e ROs4KHI2Nz8laBMENnwWxzaI13Jire30zVTMQBwOgPxXpNbKxmEPiBpXSg5YdRxEIIpzO7x3Wxc bEIhFG4iYkF3HmYGXdnoGIg4qRmeVsPijacANK42WcLUiDyu7j1RfvoMJyDW/ugnDIFCjzIhbuO ZQmHyplKeaBAdUaY766EgmwkL8EFf/1NX7z6RZ4Ejpmwl889l3qiHXvav52xLQEZEjdeCH8g4q1 5sDoLNyveDFZS6PC46DWQYEOGJPvHb5IWKxW8xOT7vAvCIY6tfJtT90Zpjox8fDHp8OfHYuh30s tSl10CQ7rSAr1tsP+AcPAi1C/ILQ== X-Received: by 2002:a05:622a:544c:b0:50f:b260:cad7 with SMTP id d75a77b69052e-5165a1ec980mr10712821cf.41.1778787742375; Thu, 14 May 2026 12:42:22 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:537:a9f7:1a84:f246]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-516457d630csm23862571cf.14.2026.05.14.12.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 12:42:21 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [OE-core][PATCH 06/11] patchtest: test_patch: improve patch-specific tests Date: Thu, 14 May 2026 15:42:02 -0400 Message-ID: <20260514194207.1958325-7-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260514194207.1958325-1-tgamblin@baylibre.com> References: <20260514194207.1958325-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, 14 May 2026 19:42:27 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/237053 [YOCTO #16247] - Create two new tests: 1. test_patch_malformed_context, for catching empty lines which might be treated as context lines (and ensuring they begin with proper diff characters); 2. test_patch_trailing_whitespace, for catching trailing spaces/tabs on new lines. - Be explicit about line numbers when a patch has one or more malformed lines. To do this correctly, we actually have to rework the test a bit and extract the inner patch hunks for checking, otherwise we are functionally testing the entire diff and reporting malformed lines for the whole commit. This means, for example, that we could see something like this for an mbox adding a patch with only 29 lines: |FAIL: test patch malformed context: Malformed patch line: context line is missing its leading space prefix (test_patch.TestPatch.test_patch_malformed_context) | Patch: 174c24d6e87aeae631bc0a7bb1ba983cf8def4de.patch | Lines: 23, 36 - When no new patches are introduced, patchtest reports that there are no *CVE* patches introduced, but this is not the only type we potentially carry. Remove that acronym from the message so the warning doesn't mislead users. - When running test_signed_off_by_presence() and test_upstream_status_presence_format(), don't test the existing tags if the patch has only been modified to carry forward. This way we avoid sending false positive emails out during some upgrades and patch refreshes. AI-Generated: Uses Claude Code Signed-off-by: Trevor Gamblin --- meta/lib/patchtest/tests/test_patch.py | 80 +++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/meta/lib/patchtest/tests/test_patch.py b/meta/lib/patchtest/tests/test_patch.py index 9f1d7d2c8f..42a4f7f9ac 100644 --- a/meta/lib/patchtest/tests/test_patch.py +++ b/meta/lib/patchtest/tests/test_patch.py @@ -10,6 +10,23 @@ import os import patchtest_patterns import pyparsing + +def _format_line_numbers(nums): + """Format a sorted list of line numbers as compact ranges, e.g. [1,2,3,7] -> '1-3, 7'.""" + if not nums: + return '' + nums = sorted(set(nums)) + parts = [] + start = end = nums[0] + for n in nums[1:]: + if n == end + 1: + end = n + else: + parts.append(str(start) if start == end else '%d-%d' % (start, end)) + start = end = n + parts.append(str(start) if start == end else '%d-%d' % (start, end)) + return ', '.join(parts) + class TestPatch(base.Base): @classmethod @@ -17,7 +34,7 @@ class TestPatch(base.Base): cls.newpatches = [] # get just those relevant patches: new software patches for patch in cls.patchset: - if patch.path.endswith('.patch') and patch.is_added_file: + if patch.path.endswith('.patch') and (patch.is_added_file or patch.is_modified_file): cls.newpatches.append(patch) cls.mark = str(patchtest_patterns.signed_off_by_prefix).strip('"') @@ -29,7 +46,7 @@ class TestPatch(base.Base): if self.unidiff_parse_error: self.skip('Parse error %s' % self.unidiff_parse_error) if not TestPatch.newpatches: - self.skip('No new CVE patches introduced') + self.skip('No new patches introduced') def test_upstream_status_presence_format(self): if not TestPatch.newpatches: @@ -39,6 +56,8 @@ class TestPatch(base.Base): standard_format = "Upstream-Status: " for newpatch in TestPatch.newpatches: + if not newpatch.is_added_file: + continue payload = newpatch.__str__() lines = payload.splitlines() @@ -147,6 +166,8 @@ class TestPatch(base.Base): self.skip("There are no new software patches, no reason to test %s presence" % TestPatch.mark) for newpatch in TestPatch.newpatches: + if not newpatch.is_added_file: + continue payload = newpatch.__str__() for line in payload.splitlines(): if patchtest_patterns.patchmetadata_regex.match(line): @@ -169,3 +190,58 @@ class TestPatch(base.Base): if not tag_found: self.fail('Missing or incorrectly formatted CVE tag in patch file. Correct or include the CVE tag in the patch with format: "CVE: CVE-YYYY-XXXX"', commit=commit) + + def _iter_inner_patch_hunk_lines(self, newpatch): + """Yield (lineno, raw) for each newly introduced hunk content line in a .patch file. + + Reads from the outer diff's added lines so we check exactly what the + submission introduces, regardless of what may already exist on disk. + lineno is 1-based among the added lines of the inner patch content. + """ + # Collect inner patch lines from the outer diff's '+' lines. + # '++++ b/file' (outer '+' + inner '+++ b/file') starts with '+++' and is + # excluded, but in_hunk will already be False from the preceding '--- ' line. + inner_lines = [] + for line in str(newpatch).splitlines(keepends=True): + if line.startswith('+') and not line.startswith('+++ '): + inner_lines.append(line[1:]) + + in_hunk = False + for lineno, raw in enumerate(inner_lines, start=1): + if raw.startswith('diff --git') or raw.startswith('--- ') or raw.startswith('+++ ') or raw.startswith('index '): + in_hunk = False + elif raw.rstrip('\n\r') in ('-- ', '--'): + # git format-patch email signature separator; nothing after this is hunk content + in_hunk = False + elif raw.startswith('@@ '): + in_hunk = True + elif in_hunk: + yield lineno, raw + + def test_patch_malformed_context(self): + for newpatch in TestPatch.newpatches: + bad_linenos = [] + for lineno, raw in self._iter_inner_patch_hunk_lines(newpatch): + # git strips trailing whitespace from blank context lines, leaving bare '\n' + if raw.rstrip('\n\r') and not raw.startswith((' ', '+', '-', '\\')): + bad_linenos.append(lineno) + if bad_linenos: + self.fail( + 'Malformed patch line: context line is missing its leading space prefix', + data=[ + ('Patch', os.path.basename(newpatch.path)), + ('Lines', _format_line_numbers(bad_linenos)), + ], + ) + + def test_patch_trailing_whitespace(self): + for newpatch in TestPatch.newpatches: + for lineno, raw in self._iter_inner_patch_hunk_lines(newpatch): + if raw.startswith('+') and raw.rstrip('\n\r') != raw.rstrip(): + self.fail( + 'Trailing whitespace in added line', + data=[ + ('Patch', os.path.basename(newpatch.path)), + ('Line', repr(raw)), + ], + ) From patchwork Thu May 14 19:42:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 88121 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 AC25FCD4F3D for ; Thu, 14 May 2026 19:42:27 +0000 (UTC) Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.19895.1778787745495958963 for ; Thu, 14 May 2026 12:42:25 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20251104.gappssmtp.com header.s=20251104 header.b=QOrUE41d; spf=pass (domain: baylibre.com, ip: 209.85.160.170, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-51306c9f2a8so84503541cf.1 for ; Thu, 14 May 2026 12:42:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1778787744; x=1779392544; 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=0g8pRkFjT+ycbumVbGtRWk9XgYLZIZDAXILTzHJKB7o=; b=QOrUE41dop/9JMzrrfNT++3fa4QxrxUlLQeWV1AO01IP58VbFWxdNn/rTCeqDYutrZ ADYbP8udtNUsZqysRTzx+cxYtVtanpPSFdHbCS6tIQmFUNZ4CbEpgoP2aoEDQ6BwWBvW Si/NNBuDCWWnFR+d9MBlelffOS7r1cfuRrkiZQXZaJnlZdcNXGgXklKeUuex8SG9x+jm gGhyYdOjY1BGjneMw6FUOfY2J5WlQ3I4Z3ygSqB6XXinxFIfbD5dMNLfdivtDZ6c1nZC jx9xckXT503VdxKgY08pZ1t9HHVa0RbX5WPEw/kjUG59vAcP55F3x2mjMS2ccFfZLLo6 Nr9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778787744; x=1779392544; 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=0g8pRkFjT+ycbumVbGtRWk9XgYLZIZDAXILTzHJKB7o=; b=eexwp/p2ThX3+N9ICgYFQ9jHlOdxq0Stv1QGTwrOddygX9X1AVaiTxqHLfCxwCm5BE qUwmSQOTczPt4GipAUa+agU0siIDb9mF5Fwhinw7bCoNZTnabFH/KtuYumsLBgn7gQm1 hLt960rWGRQ8vV7kDWQVydChRNuLutYieiuHmWhX8JQhVciDh4nt4Qe1wXRi7x/3KJr1 U5+0RR4hfZjAqhZ4Q9BlkZoQu0q5ewxzIIuDTxf5c09lboFMCdHLbPdTjFmP68tHuA1g F4F4BUn0zgCvnEsTPiZkTmeHKPTHpNOX7Sddlrl6KpljzIVTixOnYUfsjtMu3zh597eE sQtQ== X-Gm-Message-State: AOJu0Yzs/4Fj5UYUORWiOPoAuhRIULiv6DT6YpDbDNI4QvzILdoaE8hR ulNnPh+C4BxwvJ1Nq/2jJNDcDlhEcm0+LdA0lOvXUms19amWldQwqrZbeE7+gckrxHBHCKdi97n PhSe7z78= X-Gm-Gg: Acq92OFzPNG7x78qY5QgcIbgGFwFjXp7p+KQ3mudjPGmG6nhp7aEGTr0Ic6VUMVWiO2 J7d+0XrjRTO5O5wnDGy7G7b6154yFXImmG86jd2A5eP9cfLstP2KZUEQiOWmWJM+9BvDEpQo+kY z/7a/dYFqUVU5uM+pGLtRrSAj+gl8qsrs2wPXfGj5dUhDfCQNOgO5wMA+i5H33r05E44SMvKuq5 A9Zv1UAme5iNWU+M3iKiFASVJBZ2xmw5LlyeH4/1UvLWiD8/JEWqmqPMPd0aL+y9FXQQoUU2LyH 7D+fEC+M18NsleIr6+LF2npsdpuegyhCK6Yiq+eLYyjkJ1cLGI4waovILp/f3Uxo6GuknokUabx bAJ42q9Rd+ehr2ioe6qOC7vr9b/HSfXrcsPeESfxRq9EFL6LUNyHTX6IdDLxRYUok8ivahdXUOF GFc7Ju8Q4dehg3PkZLLVnq2diqygP+Xe+19Haw X-Received: by 2002:a05:622a:144e:b0:50d:8792:b6d1 with SMTP id d75a77b69052e-5165a0df5famr10478391cf.38.1778787743920; Thu, 14 May 2026 12:42:23 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:537:a9f7:1a84:f246]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-516456df09csm24864991cf.13.2026.05.14.12.42.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 12:42:23 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [OE-core][PATCH 07/11] patchtest: test_mbox: skip cover letters Date: Thu, 14 May 2026 15:42:03 -0400 Message-ID: <20260514194207.1958325-8-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260514194207.1958325-1-tgamblin@baylibre.com> References: <20260514194207.1958325-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, 14 May 2026 19:42:27 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/237054 When testing directories containing multiple patches, it's possible that cover letters are present. The user should ideally account for this and remove them as required, but we can also add some capability to test whether a given file is actually a cover letter and act appropriately. Start by adding a new regex pattern in patchtest_patterns.py to detect this case, then adjust the test_mbox suite to make use of it. AI-Generated: Uses Claude Code Signed-off-by: Trevor Gamblin --- meta/lib/patchtest/patchtest_patterns.py | 1 + meta/lib/patchtest/tests/test_mbox.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/meta/lib/patchtest/patchtest_patterns.py b/meta/lib/patchtest/patchtest_patterns.py index 1a8db92aa5..b3478d2f0f 100644 --- a/meta/lib/patchtest/patchtest_patterns.py +++ b/meta/lib/patchtest/patchtest_patterns.py @@ -57,6 +57,7 @@ invalid_submitters = [pyparsing.Regex("^Upgrade Helper.+"), mbox_bugzilla = pyparsing.Regex(r'\[\s?YOCTO.*\]') mbox_bugzilla_validation = pyparsing.Regex(r'\[(\s?YOCTO\s?#\s?(\d+)\s?,?)+\]') mbox_revert_shortlog_regex = pyparsing.Regex(r'Revert\s+".*"') +mbox_cover_letter_regex = pyparsing.Regex(r'\[\S+\s+0+/\d+\]') mbox_shortlog_maxlength = 90 # based on https://stackoverflow.com/questions/30281026/regex-parsing-github-usernames-javascript mbox_github_username = pyparsing.Regex(r'\B(? X-Patchwork-Id: 88127 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 C8CE8CD4F41 for ; Thu, 14 May 2026 19:42:27 +0000 (UTC) Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.19916.1778787746929474962 for ; Thu, 14 May 2026 12:42:27 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20251104.gappssmtp.com header.s=20251104 header.b=wW+VZKv/; spf=pass (domain: baylibre.com, ip: 209.85.222.170, mailfrom: tgamblin@baylibre.com) Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-90fbf21d9d3so329733485a.1 for ; Thu, 14 May 2026 12:42:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1778787746; x=1779392546; 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=f0oz8UC0HsO76iOCQQOJfXC7w97F/7y97/18eSRQVyA=; b=wW+VZKv/9GVjLNYqefbgK8D8tjRz1W6RNE1cejirylLwpBRCSVFWw8yMqCsBJzLAEH Fr7Ta+AHgsigoW5Ch8a9bIErjUX+fJl/KgSpevbQHRqbQ4NbKuYIIygn7/1zMrdCDoKe lp682L1giQAHfGaSDjkzxgEHnx6N4l9Tw9Xzt9Hk/ORGqU2p5Q0YkQ/I2DgdzRxDLiL3 OWSm2wvD8e/zZA7DTAaW5ljB3gKCOHe4rlfg3d7t96uCEGSTuC2ZQGql6cyFsmporS5s Cb/bpJoNNQhf6TVc/ZeOCbtwAKXWzB4+OjP7qWV7NAQu/DdThqlbnTotk1CnVnI/cwVs xVYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778787746; x=1779392546; 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=f0oz8UC0HsO76iOCQQOJfXC7w97F/7y97/18eSRQVyA=; b=f+5oNFD5tDd+Ca1826jANM0XRsBPu0UIppbY5oIVvTtVfGIUDzz+Bo9Ha9pakQMTf/ vpNfbsw2glJ+zRg59HnERuqh6P7Kc4Jcjk/ir3ntObTx7n1wJ/7R1SohhRVp0GaTEe8b rRLlc/cvCV4nvA3va+XBAVCEX9D2JQ45DFJNyZrjhFnKx9A3K8mPxxqWDRMBu8pgKiri UgL1NoUitO4RXF+VusDWyei4+T4ZmO4u32dx5MP4pNwC3Q4jaMoNPF7EkdtC83Z7FzbH yJ2LChoZa4/HVh6Cx2bwUJSuRrTsP0pjNUv+znUYBLOf3aNckIK23RY3PlPH6VhjhhG6 Mofg== X-Gm-Message-State: AOJu0YwkaTV/AlGaIzlf8tic/SJRmc55Jd/YkznW4hpHNCluhIW3EkAI 3nH15vLBTKqhGyID9eAfsIPEaJj7OJ3IUJ7t/0c/UXPjQW/8nLoQ7HS6dMVPkcYGM++7dgqoDku CgyBKp6Y= X-Gm-Gg: Acq92OGZY3ovIZDj5Agv7LFbNiLHZ2CIS3/8QjqUenSgzCzglqHSJag20WCfXrTOjEH ZTkRDvRY/aPUJh50BcW5FKGbMNWTpHBo2E4cp3R74iqqsJ3iz5zhiQoUeRaNbvUZ9a9Cv+Y2E02 c66TYNRFUrEyKr/49Ye5p+96rb0mKIsFXJHxt8JcSQU94GHbK22njDPR47jaQdSw87Se4Uo6N0A 0Vnde+u66qcbnn2Qmpl/TitUbZr2qE+TEADpZhPZoogU8cQRFH0CAJuZjE2AirIxR3v1FglPKR/ +cY6sIJUYVp3JcBXUtxpJTqdXw86kvMwpoaepspISIu1HDpv3hGXtQBy6PRqf6yNlNCWjIu36SL kZOWQc0G2Y0teb8zNtsFZkFXoxMy2oe7xbtFdalLMlUZpfV16SLd0a0WrtsJyWPMfHV+LOM+kS/ wnMfwiUh7lk+Xhd/0bIj6Ob4FQeKYB4BNhZcOv X-Received: by 2002:a05:620a:4481:b0:8cd:b6b7:1e6c with SMTP id af79cd13be357-911cdc4336emr172512785a.35.1778787745819; Thu, 14 May 2026 12:42:25 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:537:a9f7:1a84:f246]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8c90c372117sm31517336d6.47.2026.05.14.12.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 12:42:24 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [OE-core][PATCH 08/11] patchtest: mbox.py: improve 'From' line matching Date: Thu, 14 May 2026 15:42:04 -0400 Message-ID: <20260514194207.1958325-9-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260514194207.1958325-1-tgamblin@baylibre.com> References: <20260514194207.1958325-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, 14 May 2026 19:42:27 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/237055 It's possible that a patch's commit message includes a line that begins with 'From' to indicate a range, where a change's inspiration came from, and so on. The current patchtest logic automatically splits on anything that looks this way, which results in an error thrown due to missing context in the diff list. Add a new regex pattern matching the typical 'From' line format in patch files so that patchtest splits on the correct text. AI-Generated: Uses Claude Code Signed-off-by: Trevor Gamblin --- meta/lib/patchtest/mbox.py | 3 ++- meta/lib/patchtest/patchtest_patterns.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/meta/lib/patchtest/mbox.py b/meta/lib/patchtest/mbox.py index 2342fbda65..990ae02109 100644 --- a/meta/lib/patchtest/mbox.py +++ b/meta/lib/patchtest/mbox.py @@ -11,6 +11,7 @@ # import email +import patchtest_patterns import re # From: https://stackoverflow.com/questions/59681461/read-a-big-mbox-file-with-python @@ -32,7 +33,7 @@ class MboxReader: lines = [] while True: line = self.handle.readline() - if line == b'' or line.startswith(b'From '): + if line == b'' or patchtest_patterns.mbox_from.match(line): yield email.message_from_bytes(b''.join(lines)) if line == b'': break diff --git a/meta/lib/patchtest/patchtest_patterns.py b/meta/lib/patchtest/patchtest_patterns.py index b3478d2f0f..e12e85c65b 100644 --- a/meta/lib/patchtest/patchtest_patterns.py +++ b/meta/lib/patchtest/patchtest_patterns.py @@ -61,6 +61,10 @@ mbox_cover_letter_regex = pyparsing.Regex(r'\[\S+\s+0+/\d+\]') mbox_shortlog_maxlength = 90 # based on https://stackoverflow.com/questions/30281026/regex-parsing-github-usernames-javascript mbox_github_username = pyparsing.Regex(r'\B(? Www Mmm [D]D HH:MM:SS YYYY" +mbox_from = re.compile( + rb'^From \S+ \w{3} \w{3} [ \d]\d \d{2}:\d{2}:\d{2} \d{4}' +) # patch From patchwork Thu May 14 19:42:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 88128 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 E7EE4CD4F39 for ; Thu, 14 May 2026 19:42:37 +0000 (UTC) Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.19897.1778787749130114660 for ; Thu, 14 May 2026 12:42:29 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20251104.gappssmtp.com header.s=20251104 header.b=J4oMBF1G; spf=pass (domain: baylibre.com, ip: 209.85.219.41, mailfrom: tgamblin@baylibre.com) Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-8b5de17382cso61012326d6.1 for ; Thu, 14 May 2026 12:42:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1778787747; x=1779392547; 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=PeyK0wgBvEGvRBzxwPhgqKGbT7kA4AAeUKYw+Q1AWRU=; b=J4oMBF1GhudxYwezZfHdnR7o6S/BWSvAXpWRZbL4+DJct4UkdpuEH6x+cVwi2daTpq 8kJk9ovANisIUFDW0KFM/8Cs7Ivl50ISUIhdFTJRPqiUpPa3S+SLarii5evx3otZedKd FPvxSt/FGRQSuuIwgxjQsTcsJ6sgOceuEdp91eLQqlOXKF/rJXW+kzArhLq6JJPUW3oy hC2LdMs6tbNtDVitsdkgg7AWnpy6OzxhKtcU9DKCZYibdKoRODLg+S4hFxSPb71HfVek wzG8YBPMtmRmoWYytRV0+L6ugG0XaFuidCDRopp8jaonnkavsdXT6idSS6phBfimBdcC SE6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778787747; x=1779392547; 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=PeyK0wgBvEGvRBzxwPhgqKGbT7kA4AAeUKYw+Q1AWRU=; b=jJ1DWAtfFx/r4eXpI/8tClHxJIK1WnRe3nOZZSs5Tvu1DlCokFs1bWJ0VtKs3XyRBB IkFRr7Lda5YTz9xy65oqA0KbI/3jRLyCAWOAmuaigwZNYeZk8lt/gfsquajKg3MqzI4k X74JUDA0b/GdJXNk3graZT60ligjjOWMO5tIq7fteOoDlA7O2sh3bOpAsMLV3dQECMfB B1lSe143aD+VTwJzNBpbofAnVgIp8SCIUoTObm9lfQTTaiRx1Kx19ZPq3i85iseT27qa M5VRu6zAVAOw6hDM9CN064w6sQPQgktBGbmMffBGejc1U1iOueTGadn8lUFa2gjIr6CR GHaQ== X-Gm-Message-State: AOJu0YybrkDBK9q1Vc4m57j4PEWxzr/E1D8Sg6VWBWd5OUaMNZjbVdfb VZM4BrdCd+sFTz6bgD/671WilPXfQ6GehO+gUIbtn5StbcLQJM2YgDQkgO6T1oWnSGWr4yEsAxV 0tk0wXJA= X-Gm-Gg: Acq92OEjRYV+kK7kYDmcoGLf2JKNdoSAqSObQhfsw3niCnGExynmlMhVkqxuW85PiqB k7+I+EbP6BHQJ8QRD2ImgojQOURjwMtCDfRlrziZ8Qx24+3iG/beC34OeTZoJ1jzPZYP3jlQ+Ug ny0GeGBR2VjKVEngIUzVZZbIlHVln7ZdCsNzAC6EPatNOKppuUNuPPOKbMSkyW/kHW8T9E4swM3 ezWAK+sp+SfrlolfCT7gF2PnOAd7fQWeAi1Ul/pAMQxbNlr5XrZFZDG6AztmgVI1N6VuvbaulDU uyGzMQvmuvITUuhESsuCs9L5r56A3th9VCw6obGtIFNtA1Y6fMY3Z96Ihxk7aH7U1mKM2D/L1Wr Ek1Q9wPzKxj2L6OWkNrA3z5IAvJVmRypxnzKEEikEA1hGOFkJFEBcacmnoKD1ecDF/xc9eteNq5 zgyh8Lt/kZg4PdzL1NF3hCufXg9Q== X-Received: by 2002:a0c:f003:0:b0:8ca:eca:dc91 with SMTP id 6a1803df08f44-8ca0f634fa2mr19778636d6.6.1778787747490; Thu, 14 May 2026 12:42:27 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:537:a9f7:1a84:f246]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8c90c372117sm31517996d6.47.2026.05.14.12.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 12:42:26 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [OE-core][PATCH 09/11] patchtest: selftest: stop if patchtest fails Date: Thu, 14 May 2026 15:42:05 -0400 Message-ID: <20260514194207.1958325-10-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260514194207.1958325-1-tgamblin@baylibre.com> References: <20260514194207.1958325-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, 14 May 2026 19:42:37 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/237056 - Make sure that the selftest doesn't run the full suite and provide useless output if patchtest itself fails. Now we see this sort of message, for example when meta-selftest isn't in bblayers.conf: |(venv) tgamblin@megalith ~/workspace/yocto/openembedded-core (master)$ ./meta/lib/patchtest/selftest/selftest |patchtest failed before producing results: |patchtest: meta-selftest layer not found in /home/tgamblin/workspace/yocto/openembedded-core/build/conf/bblayers.conf - add it to BBLAYERS before running patchtest - If the selftest stops because patchtest does, the branch isn't reset. Make sure this happens. - Adjust the way we parse the resultline content in selftests so that malformed output lines are skipped instead of crashing the selftest script when we split on a ':' character. AI-Generated: Uses Claude Code Signed-off-by: Trevor Gamblin --- meta/lib/patchtest/selftest/selftest | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/meta/lib/patchtest/selftest/selftest b/meta/lib/patchtest/selftest/selftest index 26d1b61227..d922e12206 100755 --- a/meta/lib/patchtest/selftest/selftest +++ b/meta/lib/patchtest/selftest/selftest @@ -56,6 +56,8 @@ def analyze_result(results, patch, counts, return_code): expected_result = str(patch["expected"]) for resultline in results.splitlines(): if testid in resultline: + if ':' not in resultline: + continue result, _ = resultline.split(':', 1) if expected_result.upper() == "FAIL" and result.upper() == "FAIL" and return_code != 0: @@ -80,7 +82,10 @@ def analyze_result(results, patch, counts, return_code): counts["error"] = counts["error"] + 1 break else: - print ("No test for=%s" % patch["patch"]) + if return_code != 0: + print("patchtest failed before producing results:\n%s" % results.strip()) + sys.exit(return_code) + print("No test for=%s" % patch["patch"]) return counts @@ -131,12 +136,10 @@ def git_detach_head(): # Once the tests are in oe-core, we can remove the testdir param and use os.path.dirname to get relative paths def test(root, patch): - res = True patchpath = os.path.abspath(os.path.join(root, patch)) - - cmd = 'patchtest --base-commit HEAD --repodir %s --testdir %s/tests --patch %s' % (repodir, topdir, patchpath) - results = subprocess.run(cmd, capture_output=True, universal_newlines=True, shell=True) - + cmd = 'patchtest --base-commit HEAD --repodir %s --testdir %s/tests --patch %s' % (repodir, topdir, patchpath) + results = subprocess.run(cmd, universal_newlines=True, shell=True, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) return results.returncode, results.stdout def test_head_attached(patches, counts, branch): @@ -171,10 +174,12 @@ def run_tests(patches, counts): temp_branch = "test_patchtest_head_attached" git_state = get_git_state() assert git_state['branch'] != temp_branch, f"Cannot run patchtest selftest while on branch '{temp_branch}'" - counts = test_head_attached(patches, counts, temp_branch) - counts = test_head_detached(patches, counts) - restore_git_state(git_state) - run_sh(f"git branch -D {temp_branch}") + try: + counts = test_head_attached(patches, counts, temp_branch) + counts = test_head_detached(patches, counts) + finally: + restore_git_state(git_state) + run_sh(f"git branch -D {temp_branch}") return counts From patchwork Thu May 14 19:42:06 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 88125 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 DB2D7CD37AC for ; Thu, 14 May 2026 19:42:37 +0000 (UTC) Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.19919.1778787751293001413 for ; Thu, 14 May 2026 12:42:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20251104.gappssmtp.com header.s=20251104 header.b=Hicy4uPa; spf=pass (domain: baylibre.com, ip: 209.85.160.170, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-50fb4a7d704so63078631cf.1 for ; Thu, 14 May 2026 12:42:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1778787750; x=1779392550; 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=lXknqvWaPWsjxbAmO0lJ3X2Sp8TZCng9sPkyQcsqGFU=; b=Hicy4uPa4zTyuUWvtstTU8DulRbpSmK3UddELONXAJFJ0fMz1sZLqCSstd1Tkc5baf v2hosb+an1iNIfzAKMrulSS1P3urVU6CyzmOtc6uk9gtf2F7nsBh783SHBUa1RO5gisw 1UZeffEPl/0NAwmNXUk6ZmB2OxgjGW0PynzU+yr3mqB6YJXenl8MxaxlbTgKQMTySGhQ BIXXMwIOv/YhWixbeROc+iaHPEM0xb/bRU4ThIuA9PfDuBCTqqznO7nkodpdqwxFQujL qKNB5exCUvwUjYcJbWNBCI1Z8Gz6FeoLpEGvxvnSVCwuONddw8Qq5rujcSil73kq6igZ s9Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778787750; x=1779392550; 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=lXknqvWaPWsjxbAmO0lJ3X2Sp8TZCng9sPkyQcsqGFU=; b=lMzzIDFBffZQnoHxrYms7mr+sgefcVbJFQsHcvgDHv0elYWKvzCiC7k0+rdITB0UA8 oi7xOZNC6BYLNQHz1Fukxhz8af9X4pQN3o4it55GcA1xML5/W0fPQrw1iRmsxSAk608L S/znpgMN/CU1rrh/iT4hmi3oJkcHrkHua4L5HlX/4QmjnYpsZtSeyaUU2NrNpGXCrIwP oTp/A/sWVYN4Pa+N8jw2DCottawlhLgxII+MNTHnD3zWV3C4hkh3i+kqvsqxhqNxflVG RbBUgGtrDt3Vtvdik3r5WgPYhjDXokGvzBI817qn2B+SLRwAx1q5K8gvaOxQ3QX9lBwQ 9CxQ== X-Gm-Message-State: AOJu0Yx4ggT3mKrOQjzHwigScN0+kTfR+ybu5CDzf+4xr9qvf4Z3ZmgT moTEwXTYI8QFOtN9R/ffWlmIRrxOOYB+TEQT0aCRRKVjnKoa9T5myJdrwkG5779ZTpX36B3Nc/E y0PvkSGo= X-Gm-Gg: Acq92OH3urIet57mcxVL/dhrmTTTdx5eEn6TVYBkI4z9ZorJAprzBrlJViDNDXoVf9i 2rhqtKFWelQApbUbLtN4TdVeqi2DA2yOSRXEhAyxqs1oV4j2DsdipOoRca9ybde6q2RyMcAq3Gx xBDd9lxUa7b1wJfi6z6bVDoX+4owQyx5GI4GCxPMjFvHJYFqk5rxQvREqNuE3j89DSThJfz9k8b RVv50snSDLmdX9XSwxynO35NcHfKvGl5Mc1jGYAjHSZ+nrI3QdEkKRyy2agiLUsKmTu2s+KtUSm qmFja2fjWA0hEgjfQHibPdvyVjZt7XUZmoub5Ame3qpbvxMMjcnsmzOeyQ5dvhguAfRIJ3obrlD wY0wsmsLN9xeqQp+RXt4bA9p7sMCJ6O+UiXSu+YBe7KQgWHUDE7PMjEesOKjpTQPbkQ/evwxXiI 7q1fKLq/9Y56czzrpXsq3QS3tDVWBEDSWvA2nk X-Received: by 2002:ac8:5987:0:b0:50f:ca25:fb45 with SMTP id d75a77b69052e-5165a001ce2mr10802781cf.8.1778787749433; Thu, 14 May 2026 12:42:29 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:537:a9f7:1a84:f246]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-51645801211sm24295881cf.20.2026.05.14.12.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 12:42:28 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [OE-core][PATCH 10/11] patchtest: selftest: rework test files Date: Thu, 14 May 2026 15:42:06 -0400 Message-ID: <20260514194207.1958325-11-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260514194207.1958325-1-tgamblin@baylibre.com> References: <20260514194207.1958325-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, 14 May 2026 19:42:37 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/237057 Modify all of the selftest files so that they merge cleanly (except for the ones we expect to fail that test). This manifests as a change to the S variable and hunk offset adjustments. AI-Generated: Uses Claude Code Signed-off-by: Trevor Gamblin --- .../selftest/files/TestMbox.test_bugzilla_entry_format.fail | 5 ++--- .../selftest/files/TestMbox.test_bugzilla_entry_format.pass | 5 ++--- .../files/TestMbox.test_commit_message_presence.fail | 5 ++--- .../files/TestMbox.test_commit_message_presence.pass | 5 ++--- .../files/TestMbox.test_commit_message_user_tags.1.pass | 5 ++--- .../files/TestMbox.test_commit_message_user_tags.2.pass | 5 ++--- .../files/TestMbox.test_commit_message_user_tags.fail | 5 ++--- .../patchtest/selftest/files/TestMbox.test_mbox_format.pass | 5 ++--- .../selftest/files/TestMbox.test_shortlog_format.fail | 5 ++--- .../selftest/files/TestMbox.test_shortlog_format.pass | 5 ++--- .../selftest/files/TestMbox.test_shortlog_length.fail | 5 ++--- .../selftest/files/TestMbox.test_shortlog_length.pass | 5 ++--- .../files/TestMbox.test_signed_off_by_presence.1.fail | 5 ++--- .../files/TestMbox.test_signed_off_by_presence.2.fail | 5 ++--- .../selftest/files/TestMbox.test_signed_off_by_presence.pass | 5 ++--- .../selftest/files/TestPatch.test_cve_tag_format.fail | 5 ++--- .../selftest/files/TestPatch.test_cve_tag_format.pass | 5 ++--- .../files/TestPatch.test_signed_off_by_presence.fail | 5 ++--- .../files/TestPatch.test_signed_off_by_presence.pass | 5 ++--- 19 files changed, 38 insertions(+), 57 deletions(-) diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.fail index 6facb8c756..d5e8f898bd 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.fail +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.fail @@ -51,7 +51,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -60,8 +60,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.pass index 2f35458b4f..8bbf18d4f7 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.pass +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_bugzilla_entry_format.pass @@ -51,7 +51,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -60,8 +60,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.fail index 6f4e61c0da..479ac14008 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.fail +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.fail @@ -46,7 +46,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -55,8 +55,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.pass index 3fbc23fd00..f78acf17f6 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.pass +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_presence.pass @@ -50,7 +50,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -59,8 +59,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.1.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.1.pass index 57f2fc8a8e..31b010c327 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.1.pass +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.1.pass @@ -50,7 +50,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -59,8 +59,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.2.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.2.pass index cdae2c3fac..182b96ecdf 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.2.pass +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.2.pass @@ -50,7 +50,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -59,8 +59,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.fail index 9d54af9644..991d82144a 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.fail +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_commit_message_user_tags.fail @@ -49,7 +49,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -58,8 +58,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.pass index f06ae11d04..ffea42d831 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.pass +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_mbox_format.pass @@ -50,7 +50,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -59,8 +59,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.fail index c5e4df2549..ac7a233dab 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.fail +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.fail @@ -50,7 +50,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -59,8 +59,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.pass index 4948e26afc..4f1013244d 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.pass +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_format.pass @@ -50,7 +50,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -59,8 +59,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.fail index 4ed1242821..6008f234db 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.fail +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.fail @@ -50,7 +50,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -59,8 +59,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.pass index ef5066a650..7f5abe2b5c 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.pass +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_shortlog_length.pass @@ -50,7 +50,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -59,8 +59,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.1.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.1.fail index 4ede7271ee..7c07489bb8 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.1.fail +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.1.fail @@ -49,7 +49,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -58,8 +58,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.2.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.2.fail index f7c3f5145a..c4b833d52f 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.2.fail +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.2.fail @@ -50,7 +50,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -59,8 +59,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.pass index 2661c1416f..6c6a387275 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.pass +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_signed_off_by_presence.pass @@ -50,7 +50,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -59,8 +59,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.fail b/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.fail index f64f2a40b0..20978c2d07 100644 --- a/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.fail +++ b/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.fail @@ -50,7 +50,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -59,8 +59,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.pass b/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.pass index 3819487041..1213c6e732 100644 --- a/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.pass +++ b/meta/lib/patchtest/selftest/files/TestPatch.test_cve_tag_format.pass @@ -50,7 +50,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -59,8 +59,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.fail b/meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.fail index b2d0fab9e3..cd16385012 100644 --- a/meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.fail +++ b/meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.fail @@ -49,7 +49,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -58,8 +58,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.pass b/meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.pass index 2661c1416f..6c6a387275 100644 --- a/meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.pass +++ b/meta/lib/patchtest/selftest/files/TestPatch.test_signed_off_by_presence.pass @@ -50,7 +50,7 @@ diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/m index 2dc352d479e..d937759f157 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb -@@ -3,7 +3,9 @@ SECTION = "examples" +@@ -3,6 +3,8 @@ SECTION = "examples" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" @@ -59,8 +59,7 @@ index 2dc352d479e..d937759f157 100644 + file://0001-Fix-CVE-1234-56789.patch \ + " - S = "${WORKDIR}/sources" - UNPACKDIR = "${S}" + S = "${UNPACKDIR}" -- 2.45.1 From patchwork Thu May 14 19:42:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 88126 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 DC505CD4F3D for ; Thu, 14 May 2026 19:42:37 +0000 (UTC) Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.19899.1778787752459068888 for ; Thu, 14 May 2026 12:42:32 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre-com.20251104.gappssmtp.com header.s=20251104 header.b=QvBu3Fh3; spf=pass (domain: baylibre.com, ip: 209.85.222.180, mailfrom: tgamblin@baylibre.com) Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-90f850473f9so289650385a.3 for ; Thu, 14 May 2026 12:42:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1778787751; x=1779392551; 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=xEBrnzmKW2ahcR9vqTby4oO5YaS5ofAUWHok1tmp6hM=; b=QvBu3Fh3eHxgAnWMTTTZokVujLjHHmgG/YZJmcmLUXLMOyXq5V05ZB3IOoOn8r49I7 FPksuasa0s2w0qVoToiNx6cbhhg57M43LSmTeJ8Jy1n9Z8J8ulI4xFK2m2HLb2fhOUIk H35kOyHmPeZYDCwTov8rSzhFnVYRgmKiDxBhmKaHHQPHBq7Nnqj8bumFkv/+6B0saKl9 pg6w2p+QiXUJnqMWm2NvUI8gUHm5iZI3N6lWlcv5gxZI/VOPrd72jcRsb7BFf24F2LSm Hq6oEN+lfF+Iafx5N97WQy6/0PuJftwo6YXlc5otmfWMZOlBLOPUMVmicu+1gsf2byze Gemw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778787751; x=1779392551; 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=xEBrnzmKW2ahcR9vqTby4oO5YaS5ofAUWHok1tmp6hM=; b=KWTo0+nsyHNuoXYbS4mELyueJEd3lFaXs7kgqlsJlflts0CYl52Fjn0g8wSRnYuedr 0ZmC0O6Eq/Lh8zflXN2InyYMBb3lmIFUvZbSbNEs1mN876jQNz/zpx3X+pskZsqSfVSX WLXL3wlIAkhGgf+cVQt83QsGcjkSxkK7nrKnRLxGSRWbHTxk2MhO59YXDKRH2nEmSkyO 2OMltJ//jJ9Os7f1A04iPAHTBQEPKMODZt1tFZgtUaQKn6vOWEtImVK0nM9X18dz+84f t2HYEiUvXvvTg/HZ8FfK0tRGlJbZRq8lJWn7NLEayKuGdoDLlk2e7xQx4aLxO98kTL9k eGfQ== X-Gm-Message-State: AOJu0YxO2rCrnSCt/WW2sCaehne+oVaNTApAj6PPMHApei9V07P1cirt Yf5J60V+aiqOy1Fnq3l2sBs0Gj5+Mct0kHPe2cy/r7GPR3yGZU2iP776mO1y5NI4R/Lo0ZydQ7g BdaZttws= X-Gm-Gg: Acq92OEj1YWtByW7wFeLv9qi/aQQEohTkLy/BMHcMtM+YgiONmm0oFet9RhiVQogvlb 0agg/HRgqxfJX1zrGd3JoDPZB2oloWkiKfi9eoIn0qNnk82T85Dlktljmxk+qV094BAwpWlPs5t ppNNpcWGS9V+V+CCO3nfuiLHCxywDqHyhT4Z98lsf/dVoaBrno6SZuAkvx6zB2+/9UI75hjgHvY wjw0KJyWbsWyhlN+C/8l97p4IMwMvt4WE8TxmDryQ+2n4LGjgFwLTKiDOCVvyhEu+PzC4nSZYan /dfvoExGMZ1XMEY/G+Yov/zmIge7DzUZgrPTy547gc97glWA/yvWSNMdEITSXdvIA/WxVCBFhx6 OTx7xOYFsHHd8YBSZgsPiX9MjZiExjq5nv9wRJ7/o8rf4fCmj/AmiHbwAvcJjXYseEdVuNZlY7R Mstjm9nuSu4zbTtgV9SOKdA1JICg== X-Received: by 2002:a05:620a:2942:b0:8cd:8569:b957 with SMTP id af79cd13be357-911cec0dccamr170856185a.43.1778787751152; Thu, 14 May 2026 12:42:31 -0700 (PDT) Received: from localhost ([2001:1970:3847:e000:537:a9f7:1a84:f246]) by smtp.gmail.com with ESMTPSA id af79cd13be357-910bad2dd8esm330062085a.19.2026.05.14.12.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 12:42:30 -0700 (PDT) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: yoann.congal@smile.fr Subject: [OE-core][PATCH 11/11] patchtest: selftest: extend test file suite Date: Thu, 14 May 2026 15:42:07 -0400 Message-ID: <20260514194207.1958325-12-tgamblin@baylibre.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260514194207.1958325-1-tgamblin@baylibre.com> References: <20260514194207.1958325-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, 14 May 2026 19:42:37 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/237058 - Tweak the carried-but-unused test_series_merge_on_head selftest files so that one should pass and one should fail, since we can now test mergeability. - Add thirteen new selftest files for the following tests: - TestMbox.test_non_auh_upgrade - TestMbox.test_target_mailing_list - TestMetadata.test_max_line_length - TestPatch.test_upstream_status_presence_format - TestPatch.test_patch_malformed_context - TestPatch.test_patch_trailing_whitespace The selftest suite now runs a total of 51 tests: |============================================================================ |Testsuite summary for patchtest |============================================================================ |# TOTAL: 51 |# XPASS: 25 |# XFAIL: 26 |# XSKIP: 0 |# PASS: 0 |# FAIL: 0 |# SKIP: 0 |# ERROR: 0 |============================================================================ AI-Generated: Uses Claude Code Signed-off-by: Trevor Gamblin --- ...x.pretest_series_applies_on_branch.1.pass} | 22 +++---- ...x.pretest_series_applies_on_branch.2.fail} | 0 .../files/TestMbox.test_non_auh_upgrade.fail | 25 ++++++++ .../files/TestMbox.test_non_auh_upgrade.pass | 25 ++++++++ .../TestMbox.test_target_mailing_list.1.fail | 26 ++++++++ .../TestMbox.test_target_mailing_list.2.fail | 24 +++++++ .../TestMbox.test_target_mailing_list.pass | 25 ++++++++ .../TestMetadata.test_max_line_length.fail | 26 ++++++++ .../TestMetadata.test_max_line_length.pass | 25 ++++++++ ...estPatch.test_patch_malformed_context.fail | 38 ++++++++++++ ...estPatch.test_patch_malformed_context.pass | 38 ++++++++++++ ...tPatch.test_patch_trailing_whitespace.fail | 38 ++++++++++++ ...tPatch.test_patch_trailing_whitespace.pass | 38 ++++++++++++ ....test_upstream_status_presence_format.fail | 61 ++++++++++++++++++ ....test_upstream_status_presence_format.pass | 62 +++++++++++++++++++ 15 files changed, 458 insertions(+), 15 deletions(-) rename meta/lib/patchtest/selftest/files/{TestMbox.test_series_merge_on_head.1.skip => TestMbox.pretest_series_applies_on_branch.1.pass} (66%) rename meta/lib/patchtest/selftest/files/{TestMbox.test_series_merge_on_head.2.skip => TestMbox.pretest_series_applies_on_branch.2.fail} (100%) create mode 100644 meta/lib/patchtest/selftest/files/TestMbox.test_non_auh_upgrade.fail create mode 100644 meta/lib/patchtest/selftest/files/TestMbox.test_non_auh_upgrade.pass create mode 100644 meta/lib/patchtest/selftest/files/TestMbox.test_target_mailing_list.1.fail create mode 100644 meta/lib/patchtest/selftest/files/TestMbox.test_target_mailing_list.2.fail create mode 100644 meta/lib/patchtest/selftest/files/TestMbox.test_target_mailing_list.pass create mode 100644 meta/lib/patchtest/selftest/files/TestMetadata.test_max_line_length.fail create mode 100644 meta/lib/patchtest/selftest/files/TestMetadata.test_max_line_length.pass create mode 100644 meta/lib/patchtest/selftest/files/TestPatch.test_patch_malformed_context.fail create mode 100644 meta/lib/patchtest/selftest/files/TestPatch.test_patch_malformed_context.pass create mode 100644 meta/lib/patchtest/selftest/files/TestPatch.test_patch_trailing_whitespace.fail create mode 100644 meta/lib/patchtest/selftest/files/TestPatch.test_patch_trailing_whitespace.pass create mode 100644 meta/lib/patchtest/selftest/files/TestPatch.test_upstream_status_presence_format.fail create mode 100644 meta/lib/patchtest/selftest/files/TestPatch.test_upstream_status_presence_format.pass diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_series_merge_on_head.1.skip b/meta/lib/patchtest/selftest/files/TestMbox.pretest_series_applies_on_branch.1.pass similarity index 66% rename from meta/lib/patchtest/selftest/files/TestMbox.test_series_merge_on_head.1.skip rename to meta/lib/patchtest/selftest/files/TestMbox.pretest_series_applies_on_branch.1.pass index 072ccc28c0..7a004fb426 100644 --- a/meta/lib/patchtest/selftest/files/TestMbox.test_series_merge_on_head.1.skip +++ b/meta/lib/patchtest/selftest/files/TestMbox.pretest_series_applies_on_branch.1.pass @@ -3,19 +3,19 @@ From: Trevor Gamblin Date: Wed, 30 Aug 2023 12:15:00 -0400 Subject: [PATCH] selftest-hello: upgrade 1.0 -> 1.1 -This file should skip the test_series_merge_on_head test. +This patch should pass the pretest_series_applies_on_branch selftest. Signed-off-by: Trevor Gamblin --- - .../{selftest-hello_1.0.bb => selftest-hello_1.1.bb} | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - rename meta-selftest/recipes-test/selftest-hello/{selftest-hello_1.0.bb => selftest-hello_1.1.bb} (88%) + .../selftest-hello/{selftest-hello_1.0.bb => selftest-hello_1.1.bb} | 1 + + 1 file changed, 1 insertion(+) + rename meta-selftest/recipes-test/selftest-hello/{selftest-hello_1.0.bb => selftest-hello_1.1.bb} (95%) diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb -similarity index 88% +similarity index 95% rename from meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb rename to meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb -index 547587bef4..acc388ec2c 100644 +index 0ffe7308ba..0000000000 100644 --- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.1.bb @@ -1,3 +1,4 @@ @@ -23,13 +23,5 @@ index 547587bef4..acc388ec2c 100644 DESCRIPTION = "Simple helloworld application -- selftest variant" SECTION = "examples" LICENSE = "MIT" -@@ -16,4 +17,4 @@ do_install() { - install -m 0755 helloworld ${D}${bindir} - } - --BBCLASSEXTEND = "native nativesdk" -\ No newline at end of file -+BBCLASSEXTEND = "native nativesdk" --- +-- 2.41.0 - diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_series_merge_on_head.2.skip b/meta/lib/patchtest/selftest/files/TestMbox.pretest_series_applies_on_branch.2.fail similarity index 100% rename from meta/lib/patchtest/selftest/files/TestMbox.test_series_merge_on_head.2.skip rename to meta/lib/patchtest/selftest/files/TestMbox.pretest_series_applies_on_branch.2.fail diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_non_auh_upgrade.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_non_auh_upgrade.fail new file mode 100644 index 0000000000..b8b2cd45e0 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_non_auh_upgrade.fail @@ -0,0 +1,25 @@ +From 1234567890abcdef1234567890abcdef12345678 Mon Sep 17 00:00:00 2001 +From: Trevor Gamblin +Date: Fri, 31 May 2024 09:18:17 -0400 +Subject: [PATCH] selftest-hello: add CVE_STATUS + +This upgrade was performed by the Auto Upgrade Helper (auh@yoctoproject.org). + +Signed-off-by: Trevor Gamblin +--- + meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +index 2dc352d479e..88c5c98608f 100644 +--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb ++++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +@@ -17,4 +17,5 @@ do_install() { + install -m 0755 helloworld ${D}${bindir} + } + ++CVE_STATUS[CVE-2024-12345] = "not-applicable-platform: Issue only applies on Windows" + BBCLASSEXTEND = "native nativesdk" +-- +2.45.1 + diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_non_auh_upgrade.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_non_auh_upgrade.pass new file mode 100644 index 0000000000..2eb77ada3e --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_non_auh_upgrade.pass @@ -0,0 +1,25 @@ +From f91073242268d2b2c1a1a705e7fd585679f78a59 Mon Sep 17 00:00:00 2001 +From: Trevor Gamblin +Date: Fri, 31 May 2024 09:18:17 -0400 +Subject: [PATCH] selftest-hello: add CVE_STATUS + +This should pass the test_non_auh_upgrade selftest. + +Signed-off-by: Trevor Gamblin +--- + meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +index 2dc352d479e..88c5c98608f 100644 +--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb ++++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +@@ -17,4 +17,5 @@ do_install() { + install -m 0755 helloworld ${D}${bindir} + } + ++CVE_STATUS[CVE-2024-12345] = "not-applicable-platform: Issue only applies on Windows" + BBCLASSEXTEND = "native nativesdk" +-- +2.45.1 + diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_target_mailing_list.1.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_target_mailing_list.1.fail new file mode 100644 index 0000000000..5ec8dd13b6 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_target_mailing_list.1.fail @@ -0,0 +1,26 @@ +From f91073242268d2b2c1a1a705e7fd585679f78a59 Mon Sep 17 00:00:00 2001 +From: Trevor Gamblin +Date: Fri, 31 May 2024 09:18:17 -0400 +Subject: [meta-openembedded][PATCH] selftest-hello: add CVE_STATUS + +This should fail test_target_mailing_list because the subject contains +a [meta-openembedded] tag indicating it targets the wrong mailing list. + +Signed-off-by: Trevor Gamblin +--- + meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +index 2dc352d479e..88c5c98608f 100644 +--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb ++++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +@@ -17,4 +17,5 @@ do_install() { + install -m 0755 helloworld ${D}${bindir} + } + ++CVE_STATUS[CVE-2024-12345] = "not-applicable-platform: Issue only applies on Windows" + BBCLASSEXTEND = "native nativesdk" +-- +2.45.1 + diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_target_mailing_list.2.fail b/meta/lib/patchtest/selftest/files/TestMbox.test_target_mailing_list.2.fail new file mode 100644 index 0000000000..21dac46db8 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_target_mailing_list.2.fail @@ -0,0 +1,24 @@ +From 1234567890abcdef1234567890abcdef12345678 Mon Sep 17 00:00:00 2001 +From: Trevor Gamblin +Date: Fri, 31 May 2024 09:18:17 -0400 +Subject: [PATCH] bitbake: add patchtest selftest note + +This should fail test_target_mailing_list because it touches the +bitbake/ directory, which belongs to the bitbake mailing list. + +Signed-off-by: Trevor Gamblin +--- + bitbake/contrib/patchtest-selftest.txt | 1 + + 1 file changed, 1 insertion(+) + create mode 100644 bitbake/contrib/patchtest-selftest.txt + +diff --git a/bitbake/contrib/patchtest-selftest.txt b/bitbake/contrib/patchtest-selftest.txt +new file mode 100644 +index 00000000000..9a8f3b2e1c4 +--- /dev/null ++++ b/bitbake/contrib/patchtest-selftest.txt +@@ -0,0 +1 @@ ++This file is used by the patchtest selftest suite. +-- +2.45.1 + diff --git a/meta/lib/patchtest/selftest/files/TestMbox.test_target_mailing_list.pass b/meta/lib/patchtest/selftest/files/TestMbox.test_target_mailing_list.pass new file mode 100644 index 0000000000..9f3cd4d09a --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMbox.test_target_mailing_list.pass @@ -0,0 +1,25 @@ +From f91073242268d2b2c1a1a705e7fd585679f78a59 Mon Sep 17 00:00:00 2001 +From: Trevor Gamblin +Date: Fri, 31 May 2024 09:18:17 -0400 +Subject: [PATCH] selftest-hello: add CVE_STATUS + +This should pass the test_target_mailing_list selftest. + +Signed-off-by: Trevor Gamblin +--- + meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +index 2dc352d479e..88c5c98608f 100644 +--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb ++++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +@@ -17,4 +17,5 @@ do_install() { + install -m 0755 helloworld ${D}${bindir} + } + ++CVE_STATUS[CVE-2024-12345] = "not-applicable-platform: Issue only applies on Windows" + BBCLASSEXTEND = "native nativesdk" +-- +2.45.1 + diff --git a/meta/lib/patchtest/selftest/files/TestMetadata.test_max_line_length.fail b/meta/lib/patchtest/selftest/files/TestMetadata.test_max_line_length.fail new file mode 100644 index 0000000000..e4a6130d1c --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_max_line_length.fail @@ -0,0 +1,26 @@ +From 1234567890abcdef1234567890abcdef12345678 Mon Sep 17 00:00:00 2001 +From: Trevor Gamblin +Date: Fri, 31 May 2024 09:18:17 -0400 +Subject: [PATCH] selftest-hello: update DESCRIPTION + +This should fail the test_max_line_length selftest. + +Signed-off-by: Trevor Gamblin +--- + meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +index 2dc352d479e..d937759f157 100644 +--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb ++++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +@@ -1,4 +1,5 @@ +-DESCRIPTION = "Simple helloworld application -- selftest variant" ++DESCRIPTION = "Simple helloworld application -- selftest variant, \ ++ and this continuation line is intentionally very long to exceed the maximum allowed line length of two hundred characters as enforced by the patchtest framework for recipe metadata files" + SECTION = "examples" + LICENSE = "MIT" + LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" +-- +2.45.1 + diff --git a/meta/lib/patchtest/selftest/files/TestMetadata.test_max_line_length.pass b/meta/lib/patchtest/selftest/files/TestMetadata.test_max_line_length.pass new file mode 100644 index 0000000000..ae53374eef --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestMetadata.test_max_line_length.pass @@ -0,0 +1,25 @@ +From f91073242268d2b2c1a1a705e7fd585679f78a59 Mon Sep 17 00:00:00 2001 +From: Trevor Gamblin +Date: Fri, 31 May 2024 09:18:17 -0400 +Subject: [PATCH] selftest-hello: add CVE_STATUS + +This should pass the test_max_line_length selftest. + +Signed-off-by: Trevor Gamblin +--- + meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +index 2dc352d479e..88c5c98608f 100644 +--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb ++++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +@@ -17,4 +17,5 @@ do_install() { + install -m 0755 helloworld ${D}${bindir} + } + ++CVE_STATUS[CVE-2024-12345] = "not-applicable-platform: Issue only applies on Windows" + BBCLASSEXTEND = "native nativesdk" +-- +2.45.1 + diff --git a/meta/lib/patchtest/selftest/files/TestPatch.test_patch_malformed_context.fail b/meta/lib/patchtest/selftest/files/TestPatch.test_patch_malformed_context.fail new file mode 100644 index 0000000000..31f481daa8 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestPatch.test_patch_malformed_context.fail @@ -0,0 +1,38 @@ +From bbbb2222bbbb2222bbbb2222bbbb2222bbbb2222 Mon Sep 17 00:00:00 2001 +From: Trevor Gamblin +Date: Fri, 31 May 2024 09:54:50 -0400 +Subject: [PATCH] selftest-hello: add patch format test + +This should fail the test_patch_malformed_context test. + +Signed-off-by: Trevor Gamblin +--- + .../selftest-hello/files/0001-test-format.patch | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch + +diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch +new file mode 100644 +index 00000000000..210ff38b0a4 +--- /dev/null ++++ b/meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch +@@ -0,0 +1,17 @@ ++From abc123def456abc123def456abc123def456abc1 Mon Sep 17 00:00:00 2001 ++From: Test Author ++Date: Mon, 01 Jan 2024 00:00:00 +0000 ++Subject: [PATCH] example: fix ++ ++Upstream-Status: Backport [https://example.com/fix] ++ ++Signed-off-by: Test Author ++--- ++diff --git a/example.c b/example.c ++--- a/example.c +++++ b/example.c ++@@ -1,3 +1,3 @@ ++context line ++-old line +++new line ++ closing line +-- +2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestPatch.test_patch_malformed_context.pass b/meta/lib/patchtest/selftest/files/TestPatch.test_patch_malformed_context.pass new file mode 100644 index 0000000000..f594f4715f --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestPatch.test_patch_malformed_context.pass @@ -0,0 +1,38 @@ +From aaaa1111aaaa1111aaaa1111aaaa1111aaaa1111 Mon Sep 17 00:00:00 2001 +From: Trevor Gamblin +Date: Fri, 31 May 2024 09:54:50 -0400 +Subject: [PATCH] selftest-hello: add patch format test + +This should pass the test_patch_malformed_context test. + +Signed-off-by: Trevor Gamblin +--- + .../selftest-hello/files/0001-test-format.patch | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch + +diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch +new file mode 100644 +index 00000000000..cdc7ae9a2ab +--- /dev/null ++++ b/meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch +@@ -0,0 +1,17 @@ ++From abc123def456abc123def456abc123def456abc1 Mon Sep 17 00:00:00 2001 ++From: Test Author ++Date: Mon, 01 Jan 2024 00:00:00 +0000 ++Subject: [PATCH] example: fix ++ ++Upstream-Status: Backport [https://example.com/fix] ++ ++Signed-off-by: Test Author ++--- ++diff --git a/example.c b/example.c ++--- a/example.c +++++ b/example.c ++@@ -1,3 +1,3 @@ ++ context line ++-old line +++new line ++ closing line +-- +2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestPatch.test_patch_trailing_whitespace.fail b/meta/lib/patchtest/selftest/files/TestPatch.test_patch_trailing_whitespace.fail new file mode 100644 index 0000000000..9f70cc1145 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestPatch.test_patch_trailing_whitespace.fail @@ -0,0 +1,38 @@ +From dddd4444dddd4444dddd4444dddd4444dddd4444 Mon Sep 17 00:00:00 2001 +From: Trevor Gamblin +Date: Fri, 31 May 2024 09:54:50 -0400 +Subject: [PATCH] selftest-hello: add patch format test + +This should fail the test_patch_trailing_whitespace test. + +Signed-off-by: Trevor Gamblin +--- + .../selftest-hello/files/0001-test-format.patch | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch + +diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch +new file mode 100644 +index 00000000000..5eaaab7dc49 +--- /dev/null ++++ b/meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch +@@ -0,0 +1,17 @@ ++From abc123def456abc123def456abc123def456abc1 Mon Sep 17 00:00:00 2001 ++From: Test Author ++Date: Mon, 01 Jan 2024 00:00:00 +0000 ++Subject: [PATCH] example: fix ++ ++Upstream-Status: Backport [https://example.com/fix] ++ ++Signed-off-by: Test Author ++--- ++diff --git a/example.c b/example.c ++--- a/example.c +++++ b/example.c ++@@ -1,3 +1,3 @@ ++ context line ++-old line +++new line ++ closing line +-- +2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestPatch.test_patch_trailing_whitespace.pass b/meta/lib/patchtest/selftest/files/TestPatch.test_patch_trailing_whitespace.pass new file mode 100644 index 0000000000..6bb39c9592 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestPatch.test_patch_trailing_whitespace.pass @@ -0,0 +1,38 @@ +From cccc3333cccc3333cccc3333cccc3333cccc3333 Mon Sep 17 00:00:00 2001 +From: Trevor Gamblin +Date: Fri, 31 May 2024 09:54:50 -0400 +Subject: [PATCH] selftest-hello: add patch format test + +This should pass the test_patch_trailing_whitespace test. + +Signed-off-by: Trevor Gamblin +--- + .../selftest-hello/files/0001-test-format.patch | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch + +diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch +new file mode 100644 +index 00000000000..cdc7ae9a2ab +--- /dev/null ++++ b/meta-selftest/recipes-test/selftest-hello/files/0001-test-format.patch +@@ -0,0 +1,17 @@ ++From abc123def456abc123def456abc123def456abc1 Mon Sep 17 00:00:00 2001 ++From: Test Author ++Date: Mon, 01 Jan 2024 00:00:00 +0000 ++Subject: [PATCH] example: fix ++ ++Upstream-Status: Backport [https://example.com/fix] ++ ++Signed-off-by: Test Author ++--- ++diff --git a/example.c b/example.c ++--- a/example.c +++++ b/example.c ++@@ -1,3 +1,3 @@ ++ context line ++-old line +++new line ++ closing line +-- +2.45.1 diff --git a/meta/lib/patchtest/selftest/files/TestPatch.test_upstream_status_presence_format.fail b/meta/lib/patchtest/selftest/files/TestPatch.test_upstream_status_presence_format.fail new file mode 100644 index 0000000000..b00aac5fbb --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestPatch.test_upstream_status_presence_format.fail @@ -0,0 +1,61 @@ +From 1234567890abcdef1234567890abcdef12345678 Mon Sep 17 00:00:00 2001 +From: Trevor Gamblin +Date: Fri, 31 May 2024 09:54:50 -0400 +Subject: [PATCH] selftest-hello: add upstream fix + +This should fail the test_upstream_status_presence_format selftest +because the embedded patch is missing Upstream-Status. + +Signed-off-by: Trevor Gamblin +--- + .../files/0001-Fix-upstream-issue.patch | 23 +++++++++++++++++++ + .../selftest-hello/selftest-hello_1.0.bb | 4 ++- + 2 files changed, 26 insertions(+), 1 deletion(-) + create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-upstream-issue.patch + +diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-upstream-issue.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-upstream-issue.patch +new file mode 100644 +index 00000000000..8a4f9329303 +--- /dev/null ++++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-upstream-issue.patch +@@ -0,0 +1,23 @@ ++From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001 ++From: Trevor Gamblin ++Date: Tue, 29 Aug 2023 14:08:20 -0400 ++Subject: [PATCH] Fix upstream issue ++ ++Signed-off-by: Trevor Gamblin ++--- ++ strlen.c | 1 + ++ 1 file changed, 1 insertion(+) ++ ++diff --git a/strlen.c b/strlen.c ++index 1788f38..83d7918 100644 ++--- a/strlen.c +++++ b/strlen.c ++ ++int main() { ++ ++ printf("%d\n", str_len(string1)); ++ printf("%d\n", str_len(string2)); ++ printf("FIXED!!!\n"); ++ ++ return 0; ++} +diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +index 2dc352d479e..d937759f157 100644 +--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb ++++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +@@ -3,6 +3,8 @@ SECTION = "examples" + LICENSE = "MIT" + LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +-SRC_URI = "file://helloworld.c" ++SRC_URI = "file://helloworld.c \ ++ file://0001-Fix-upstream-issue.patch \ ++ " + + S = "${UNPACKDIR}" +-- +2.45.1 + diff --git a/meta/lib/patchtest/selftest/files/TestPatch.test_upstream_status_presence_format.pass b/meta/lib/patchtest/selftest/files/TestPatch.test_upstream_status_presence_format.pass new file mode 100644 index 0000000000..0316316cd7 --- /dev/null +++ b/meta/lib/patchtest/selftest/files/TestPatch.test_upstream_status_presence_format.pass @@ -0,0 +1,62 @@ +From c9519f11502d5bb5c143ed43b4c981b6a211bdf9 Mon Sep 17 00:00:00 2001 +From: Trevor Gamblin +Date: Fri, 31 May 2024 09:54:50 -0400 +Subject: [PATCH] selftest-hello: add upstream fix + +This should pass the test_upstream_status_presence_format selftest. + +Signed-off-by: Trevor Gamblin +--- + .../files/0001-Fix-upstream-issue.patch | 25 +++++++++++++++++++ + .../selftest-hello/selftest-hello_1.0.bb | 4 ++- + 2 files changed, 28 insertions(+), 1 deletion(-) + create mode 100644 meta-selftest/recipes-test/selftest-hello/files/0001-Fix-upstream-issue.patch + +diff --git a/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-upstream-issue.patch b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-upstream-issue.patch +new file mode 100644 +index 00000000000..8a4f9329303 +--- /dev/null ++++ b/meta-selftest/recipes-test/selftest-hello/files/0001-Fix-upstream-issue.patch +@@ -0,0 +1,25 @@ ++From b26a31186e6ee2eb1f506d5f2f9394d327a0df2f Mon Sep 17 00:00:00 2001 ++From: Trevor Gamblin ++Date: Tue, 29 Aug 2023 14:08:20 -0400 ++Subject: [PATCH] Fix upstream issue ++ ++Upstream-Status: Backport(http://example.com/example) ++ ++Signed-off-by: Trevor Gamblin ++--- ++ strlen.c | 1 + ++ 1 file changed, 1 insertion(+) ++ ++diff --git a/strlen.c b/strlen.c ++index 1788f38..83d7918 100644 ++--- a/strlen.c +++++ b/strlen.c ++ ++int main() { ++ ++ printf("%d\n", str_len(string1)); ++ printf("%d\n", str_len(string2)); ++ printf("FIXED!!!\n"); ++ ++ return 0; ++} +diff --git a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +index 2dc352d479e..d937759f157 100644 +--- a/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb ++++ b/meta-selftest/recipes-test/selftest-hello/selftest-hello_1.0.bb +@@ -3,6 +3,8 @@ SECTION = "examples" + LICENSE = "MIT" + LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +-SRC_URI = "file://helloworld.c" ++SRC_URI = "file://helloworld.c \ ++ file://0001-Fix-upstream-issue.patch \ ++ " + + S = "${UNPACKDIR}" +-- +2.45.1 +