From patchwork Fri Dec 4 17:41: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: 107353 Received: from mail-vk1-f174.google.com (mail-vk1-f174.google.com [209.85.221.174]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.2724.1796406082549776482 for ; Fri, 04 Dec 2026 09:41:22 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=CnQHnduX; spf=pass (domain: baylibre.com, ip: 209.85.221.174, mailfrom: tgamblin@baylibre.com) Received: by mail-vk1-f174.google.com with SMTP id 71dfb90a1353d-5eadef147ffso835923e0c.3 for ; Fri, 04 Dec 2026 09:41:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1796406081; x=1797010881; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=l9Ph93FZN/TOgkt72eKRxMWKmZ3YL98qDvqBYDqBE00=; b=CnQHnduXaDeTtugHPmXxz2HNjxLpTNV1hywJqYTn0LWZMxjfj2JDcveCtGTby7UxhR ttf3c9+k/I1xoXqxhX6/eVgv3o3Cwa2nkOiGIu5EpbhO8jblmn+WhFtPY491W5PHBt7T mw1cFpT7BIvzOMAyLBoMM1D+uTI0h6fijij7FgNQs866S5PVQWKGQJ1dKHItOBsrAX1c 5aWNxJFxitcXlxfHSUbbWf+kmu2ML+0N5KhJZmhMDKu/rzuw32DsQQA+ATFnHLXtLq0A /ynpuiTslDJduKxwzqQWFJZv57Fv9QajEEpQJGEe+3uteOh91D8+NBeNeMiK++UAONAT LWZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796406081; x=1797010881; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-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RtGOry8735OLwe8M9fJNnIwC5tHv65S+MidaSdT6aHJ gFCK3n8TxXCQgQehGhod9vUG3J/vBNW0aYbDKfiYbhVSA3MmCVC4z/BGdLkisZ3zCTfkJFsiQqZ eNMu+u2ttIcttbvafi87TbPhLu5OtkpcRR8EF7kVFHG3PXb8MTWoh34vDi8RLr3/OowNMsbP4Ed 0RQFzcW1b6w== X-Received: by 2002:a05:6122:431a:b0:5ea:9a2c:27a8 with SMTP id 71dfb90a1353d-5f01cfc1bfamr2859049e0c.14.1796406081552; Fri, 04 Dec 2026 09:41:21 -0800 (PST) Return-Path: Received: from megalith.oryx-coho.ts.net ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5f01d3bf4d6sm1398046e0c.10.2026.12.04.09.41.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 09:41:20 -0800 (PST) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Subject: [OE-core][PATCH 6/6] patchtest: tests: test_metadata.py: parse each recipe only once Date: Fri, 4 Dec 2026 12:41:07 -0500 Message-ID: <20261204174107.1295971-7-tgamblin@baylibre.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204174107.1295971-1-tgamblin@baylibre.com> References: <20261204174107.1295971-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 lin-tor-korg-lkml-alma10-1 with HTTPS for ; Fri, 04 Dec 2026 17:41:29 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/252014 Each metadata test called tinfoil.parse_recipe() for every recipe it checked, so after merging, an added recipe was parsed three times and a modified one twice. The tests only read variables, so parse each recipe once per test run and reuse the result. Results aren't kept between the pre-merge and post-merge runs, since the recipes change in between. test_license_presence's auto.conf change doesn't affect this, since it happens after bitbake has read its configuration. AI-Generated: Uses Claude Code Opus 5.5 --- meta/lib/patchtest/tests/base.py | 8 ++++++++ meta/lib/patchtest/tests/test_metadata.py | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/meta/lib/patchtest/tests/base.py b/meta/lib/patchtest/tests/base.py index 3fb9882cb4..e55dd59393 100644 --- a/meta/lib/patchtest/tests/base.py +++ b/meta/lib/patchtest/tests/base.py @@ -132,6 +132,7 @@ class Metadata(Base): @classmethod def setUpClassLocal(cls): cls.tinfoil = cls.setup_tinfoil() + cls.recipe_data = {} # get info about added/modified/remove recipes cls.added, cls.modified, cls.removed = cls.get_metadata_stats(cls.patchset) @@ -140,6 +141,13 @@ class Metadata(Base): def tearDownClassLocal(cls): cls.tinfoil.shutdown() + @classmethod + def parse_recipe(cls, pn): + """Parse a recipe, reusing the result for every test that needs it""" + if pn not in cls.recipe_data: + cls.recipe_data[pn] = cls.tinfoil.parse_recipe(pn) + return cls.recipe_data[pn] + @classmethod def setup_tinfoil(cls, config_only=False): """Initialize tinfoil api from bitbake""" diff --git a/meta/lib/patchtest/tests/test_metadata.py b/meta/lib/patchtest/tests/test_metadata.py index 442e80973d..cf02af5528 100644 --- a/meta/lib/patchtest/tests/test_metadata.py +++ b/meta/lib/patchtest/tests/test_metadata.py @@ -32,7 +32,7 @@ class TestMetadata(base.Metadata): no_license = False for pn in self.added: - rd = self.tinfoil.parse_recipe(pn) + rd = self.parse_recipe(pn) license = rd.getVar(patchtest_patterns.metadata_lic) if license == patchtest_patterns.invalid_license: no_license = True @@ -56,7 +56,7 @@ class TestMetadata(base.Metadata): self.skip('No added recipes, skipping test') for pn in self.added: - rd = self.tinfoil.parse_recipe(pn) + rd = self.parse_recipe(pn) pathname = rd.getVar('FILE') # we are not interested in images if '/images/' in pathname: @@ -111,7 +111,7 @@ class TestMetadata(base.Metadata): for pn in self.modified: if 'core-image' in pn: continue - rd = self.tinfoil.parse_recipe(pn) + rd = self.parse_recipe(pn) PatchTestDataStore[ "%s-%s-%s" % (key_prefix, patchtest_patterns.metadata_src_uri, pn) ] = rd.getVar(patchtest_patterns.metadata_src_uri) @@ -168,7 +168,7 @@ class TestMetadata(base.Metadata): # we are not interested in images if 'core-image' in pn: continue - rd = self.tinfoil.parse_recipe(pn) + rd = self.parse_recipe(pn) summary = rd.getVar(patchtest_patterns.metadata_summary) # "${PN} version ${PN}-${PR}" is the default, so fail if default @@ -190,7 +190,7 @@ class TestMetadata(base.Metadata): # we are not interested in images if 'core-image' in pn: continue - rd = self.tinfoil.parse_recipe(pn) + rd = self.parse_recipe(pn) cve_check_ignore = rd.getVar(patchtest_patterns.cve_check_ignore_var) if cve_check_ignore is not None: