From patchwork Mon Nov 30 15:27:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 106508 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.34835.1796052446045394014 for ; Mon, 30 Nov 2026 07:27:26 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=cMGznjNU; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.50, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4ba013938d7so100519245e9.2 for ; Mon, 30 Nov 2026 07:27:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1796052444; x=1796657244; 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=Gu4jZ+5cQh9M2uddjP56zxsRZ7QrndFuHvTpiho8otc=; b=cMGznjNUVtp6eRPIDCxJn3B7i7wy7k//rz+YZ2LRB0rpwX0QCniLQh8a0PzT7UD0kw eU3FZDgVlkEPFH+C6Ni+lXqEWXKN5tbFWL0+sw/Kc8riX8vbfDJ/z7Q6IzBL0RxqFL66 BFarXNI/UMO0bluJvId7foRx2ASa59tFgH3/U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796052444; x=1796657244; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=Gu4jZ+5cQh9M2uddjP56zxsRZ7QrndFuHvTpiho8otc=; b=raPcnjowleztFaSoa0af0KQZqyBSeYYkf8IG0oNHh536Xd803YGMVvlpnIVHCcaN2K ZULMMGKC8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rlYKg== X-Received: by 2002:a05:600c:6290:b0:4bb:741d:eba with SMTP id 5b1f17b1804b1-4bb88824a5bmr661602805e9.13.1796052444126; Mon, 30 Nov 2026 07:27:24 -0800 (PST) Return-Path: Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:2444:81bb:2aff:8d84]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb8538b09bsm1704014155e9.4.2026.11.30.07.27.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 07:27:22 -0800 (PST) From: Richard Purdie To: openembedded-core@lists.openembedded.org Subject: [PATCH 12/16] oeqa: Update test layers for the new layer.conf format Date: Mon, 30 Nov 2026 15:27:00 +0000 Message-ID: <20261130152704.3471590-12-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261130152704.3471590-1-richard.purdie@linuxfoundation.org> References: <20261130152704.3471590-1-richard.purdie@linuxfoundation.org> 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 ; Mon, 30 Nov 2026 15:27:31 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251621 Update the test layer creation code to use the new layer format. Use LAYERDIR_ as the way to check if a layer is available to replace the collections check which is no longer available. AI-Generated: Uses Claude Opus 5.5 Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/cases/buildoptions.py | 8 +++---- meta/lib/oeqa/selftest/cases/devtool.py | 24 +++++--------------- meta/lib/oeqa/selftest/cases/layerappend.py | 18 +++++++-------- meta/lib/oeqa/selftest/cases/recipetool.py | 11 ++++----- meta/lib/oeqa/utils/commands.py | 15 +++++------- 5 files changed, 28 insertions(+), 48 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/buildoptions.py b/meta/lib/oeqa/selftest/cases/buildoptions.py index 92d8595591b..264fe09b959 100644 --- a/meta/lib/oeqa/selftest/cases/buildoptions.py +++ b/meta/lib/oeqa/selftest/cases/buildoptions.py @@ -117,11 +117,9 @@ class SanityOptionsTest(OESelftestTestCase): os.makedirs(dummy_layer_conf_dir) dummy_layer_conf_path = os.path.join(dummy_layer_conf_dir, 'layer.conf') - dummy_layer_content = 'BBPATH .= ":${LAYERDIR}"\n' \ - 'BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"\n' \ - 'BBFILE_COLLECTIONS += "%s"\n' \ - 'BBFILE_PATTERN_%s = "^${LAYERDIR}/"\n' \ - 'BBFILE_PRIORITY_%s = "6"\n' % (dummy_layer_name, dummy_layer_name, dummy_layer_name) + dummy_layer_content = 'LAYERNAME = "%s"\n' \ + 'LAYERDEPENDS = "oe-core"\n' \ + 'LAYERSERIES_COMPAT = "%s"\n' % (dummy_layer_name, get_bb_var('LAYERSERIES_CORENAMES')) ftools.write_file(dummy_layer_conf_path, dummy_layer_content) diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 89ca79e6358..7d815534996 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py @@ -218,8 +218,8 @@ class DevtoolTestCase(OESelftestTestCase): self.fail('bbappend for recipe %s does not seem to be created in test layer' % testrecipe) return bbappendfile - def _create_temp_layer(self, templayerdir, addlayer, templayername, priority=999, recipepathspec='recipes-*/*'): - create_temp_layer(templayerdir, templayername, priority, recipepathspec) + def _create_temp_layer(self, templayerdir, addlayer, templayername): + create_temp_layer(templayerdir, templayername) if addlayer: self.add_command_to_tearDown('bitbake-layers remove-layer %s || true' % templayerdir) result = runCmd('bitbake-layers add-layer %s' % templayerdir, cwd=self.builddir) @@ -687,8 +687,7 @@ class DevtoolAddTests(DevtoolBase): self._test_recipe_contents(recipefile, checkvars, []) def test_devtool_add_npm(self): - collections = get_bb_var('BBFILE_COLLECTIONS').split() - if "openembedded-layer" not in collections: + if not get_bb_var('LAYERDIR_meta-oe'): self.skipTest("Test needs meta-oe for nodejs") pn = 'savoirfairelinux-node-server-example' @@ -1553,10 +1552,9 @@ class DevtoolUpdateTests(DevtoolBase): def test_devtool_update_recipe_append_git(self): # Check preconditions testrecipe = 'mtd-utils-selftest' - bb_vars = get_bb_vars(['FILE', 'SRC_URI', 'LAYERSERIES_CORENAMES'], testrecipe) + bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe) recipefile = bb_vars['FILE'] src_uri = bb_vars['SRC_URI'] - corenames = bb_vars['LAYERSERIES_CORENAMES'] self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe) for entry in src_uri.split(): if entry.startswith('git://'): @@ -1578,18 +1576,8 @@ class DevtoolUpdateTests(DevtoolBase): result = runCmd('echo "# Additional line" >> Makefile.am', cwd=tempsrcdir) result = runCmd('git commit -a -m "Change the Makefile"', cwd=tempsrcdir) self._add_recipe_cleanup(recipefile) - # Create a temporary layer - os.makedirs(os.path.join(templayerdir, 'conf')) - with open(os.path.join(templayerdir, 'conf', 'layer.conf'), 'w') as f: - f.write('BBPATH .= ":${LAYERDIR}"\n') - f.write('BBFILES += "${LAYERDIR}/recipes-*/*/*.bbappend"\n') - f.write('BBFILE_COLLECTIONS += "oeselftesttemplayer"\n') - f.write('BBFILE_PATTERN_oeselftesttemplayer = "^${LAYERDIR}/"\n') - f.write('BBFILE_PRIORITY_oeselftesttemplayer = "999"\n') - f.write('BBFILE_PATTERN_IGNORE_EMPTY_oeselftesttemplayer = "1"\n') - f.write('LAYERSERIES_COMPAT_oeselftesttemplayer = "%s"\n' % corenames) - self.add_command_to_tearDown('bitbake-layers remove-layer %s || true' % templayerdir) - result = runCmd('bitbake-layers add-layer %s' % templayerdir, cwd=self.builddir) + # Create a temporary layer and add it to bblayers.conf + self._create_temp_layer(templayerdir, True, 'oeselftesttemplayer') # Create the bbappend result = runCmd('devtool update-recipe -m srcrev %s -a %s' % (testrecipe, templayerdir)) self.assertNotIn('WARNING:', result.output) diff --git a/meta/lib/oeqa/selftest/cases/layerappend.py b/meta/lib/oeqa/selftest/cases/layerappend.py index afd65b485f1..b915cd98460 100644 --- a/meta/lib/oeqa/selftest/cases/layerappend.py +++ b/meta/lib/oeqa/selftest/cases/layerappend.py @@ -11,16 +11,12 @@ from oeqa.utils.commands import bitbake, get_bb_var import oeqa.utils.ftools as ftools class LayerAppendTests(OESelftestTestCase): + # Each layer depends on the previous one so that the bbappends are + # applied in a defined order (layer 2's after layer 1's) layerconf = """ -# We have a conf and classes directory, append to BBPATH -BBPATH .= ":${LAYERDIR}" - -# We have a recipes directory, add to BBFILES -BBFILES += "${LAYERDIR}/recipes*/*.bb ${LAYERDIR}/recipes*/*.bbappend" - -BBFILE_COLLECTIONS += "meta-layerINT" -BBFILE_PATTERN_meta-layerINT := "^${LAYERDIR}/" -BBFILE_PRIORITY_meta-layerINT = "6" +LAYERNAME = "meta-layertestINT" +LAYERDEPENDS = "DEPENDS" +LAYERSERIES_COMPAT = "CORENAMES" """ recipe = """ LICENSE = "MIT" @@ -57,6 +53,8 @@ SRC_URI:append = " file://appendtest.txt" def test_layer_appends(self): corebase = get_bb_var("COREBASE") + corenames = get_bb_var("LAYERSERIES_CORENAMES") + depends = {"0": "oe-core", "1": "meta-layertest0", "2": "meta-layertest1"} for l in ["0", "1", "2"]: layer = os.path.join(corebase, "meta-layertest" + l) @@ -64,7 +62,7 @@ SRC_URI:append = " file://appendtest.txt" os.mkdir(layer) os.mkdir(layer + "/conf") with open(layer + "/conf/layer.conf", "w") as f: - f.write(self.layerconf.replace("INT", l)) + f.write(self.layerconf.replace("INT", l).replace("DEPENDS", depends[l]).replace("CORENAMES", corenames)) os.mkdir(layer + "/recipes-test") if l == "0": with open(layer + "/recipes-test/layerappendtest.bb", "w") as f: diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index 181d95804fc..fdcc468a837 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py @@ -318,9 +318,9 @@ class RecipetoolAppendTests(RecipetoolBase): _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-postinst', self.testfile, '-r selftest-recipetool-appendfile', expectedlines, ['testfile']) def test_recipetool_appendfile_extlayer(self): - # Try creating a bbappend in a layer that's not in bblayers.conf and has a different structure + # Try creating a bbappend in a layer that's not in bblayers.conf exttemplayerdir = os.path.join(self.tempdir, 'extlayer') - self._create_temp_layer(exttemplayerdir, False, 'oeselftestextlayer', recipepathspec='metadata/recipes/recipes-*/*') + self._create_temp_layer(exttemplayerdir, False, 'oeselftestextlayer') result = runCmd('recipetool appendfile %s /usr/share/selftest-replaceme-orig %s' % (exttemplayerdir, self.testfile)) self.assertNotIn('Traceback', result.output) createdfiles = [] @@ -328,8 +328,8 @@ class RecipetoolAppendTests(RecipetoolBase): for f in files: createdfiles.append(os.path.relpath(os.path.join(root, f), exttemplayerdir)) createdfiles.remove('conf/layer.conf') - expectedfiles = ['metadata/recipes/recipes-test/selftest-recipetool-appendfile/selftest-recipetool-appendfile.bbappend', - 'metadata/recipes/recipes-test/selftest-recipetool-appendfile/selftest-recipetool-appendfile/selftest-replaceme-orig'] + expectedfiles = ['recipes-test/recipetool/selftest-recipetool-appendfile.bbappend', + 'recipes-test/recipetool/selftest-recipetool-appendfile/selftest-replaceme-orig'] self.assertEqual(sorted(createdfiles), sorted(expectedfiles)) def test_recipetool_appendfile_wildcard(self): @@ -434,8 +434,7 @@ class RecipetoolCreateTests(RecipetoolBase): self._test_recipe_contents(recipefile, checkvars, inherits) def test_recipetool_create_npm(self): - collections = get_bb_var('BBFILE_COLLECTIONS').split() - if "openembedded-layer" not in collections: + if not get_bb_var('LAYERDIR_meta-oe'): self.skipTest("Test needs meta-oe for nodejs") temprecipe = os.path.join(self.tempdir, 'recipe') diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index cf2b7aa9418..35459358535 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py @@ -337,18 +337,15 @@ def get_test_layer(bblayers=None): break return testlayer -def create_temp_layer(templayerdir, templayername, priority=999, recipepathspec='recipes-*/*'): +def create_temp_layer(templayerdir, templayername, layerdepends='oe-core'): + # Bitbake constructs BBPATH and BBFILES itself, recipes and bbappends + # are found in any recipes* directories within the layer os.makedirs(os.path.join(templayerdir, 'conf')) corenames = get_bb_var('LAYERSERIES_CORENAMES') with open(os.path.join(templayerdir, 'conf', 'layer.conf'), 'w') as f: - f.write('BBPATH .= ":${LAYERDIR}"\n') - f.write('BBFILES += "${LAYERDIR}/%s/*.bb \\' % recipepathspec) - f.write(' ${LAYERDIR}/%s/*.bbappend"\n' % recipepathspec) - f.write('BBFILE_COLLECTIONS += "%s"\n' % templayername) - f.write('BBFILE_PATTERN_%s = "^${LAYERDIR}/"\n' % templayername) - f.write('BBFILE_PRIORITY_%s = "%d"\n' % (templayername, priority)) - f.write('BBFILE_PATTERN_IGNORE_EMPTY_%s = "1"\n' % templayername) - f.write('LAYERSERIES_COMPAT_%s = "%s"\n' % (templayername, corenames)) + f.write('LAYERNAME = "%s"\n' % templayername) + f.write('LAYERDEPENDS = "%s"\n' % layerdepends) + f.write('LAYERSERIES_COMPAT = "%s"\n' % corenames) @contextlib.contextmanager def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None, qemuparams=None, overrides={}, boot_patterns = {}, discard_writes=True):