Skip to contentSkip to conversation

oeqa/selftest/bblock/fitimage/sstatetests: Fix changing MACHINE during the test

PATCH In review Richard Purdie 2 participants 6 messages Oct 6, 2025 – Oct 10, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 oeqa/selftest/bblock/fitimage/sstatetests: Fix changing MACHINE during the test

With config fragments, changing MACHINE in the test like this no longer works. Use the forcevarable override to allow it to work. This also needs a tweak to bitbake to work correctly, sent seperately. Whilst ugly, this avoids the need to start changing config fragments within oeqa right now.

---
 meta/lib/oeqa/selftest/cases/bblock.py      |  4 +--
 meta/lib/oeqa/selftest/cases/fitimage.py    | 26 ++++++++--------
 meta/lib/oeqa/selftest/cases/sstatetests.py | 34 ++++++++++-----------
 3 files changed, 32 insertions(+), 32 deletions(-)
meta/lib/oeqa/selftest/cases/bblock.py +2 -2
index 2b62d2a0aa2..cb99d32bb5d 100644
@@ -122,11 +122,11 @@ class BBLock(OESelftestTestCase):
         else:
             machine = "qemux86-64"
 
-        self.write_config('MACHINE = "%s"\n' % machine)
+        self.write_config('MACHINE:forcevariable = "%s"\n' % machine)
 
         self.lock_recipes(recipes, tasks)
 
-        self.write_config('MACHINE = "%s"\n' % self.td["MACHINE"])
+        self.write_config('MACHINE:forcevariable = "%s"\n' % self.td["MACHINE"])
         # modify quilt's do_compile task
         self.modify_tasks(recipes, tasks)
 
meta/lib/oeqa/selftest/cases/fitimage.py +13 -13
index 3c408577476..195b9ee8b59 100644
@@ -787,7 +787,7 @@ FIT_CONF_PREFIX = "foo-"
 
         config = """
 DISTRO = "poky"
-MACHINE = "beaglebone-yocto"
+MACHINE:forcevariable = "beaglebone-yocto"
 """
         self.write_config(config)
 
@@ -828,7 +828,7 @@ MACHINE = "beaglebone-yocto"
         """
         config = """
 # Enable creation of fitImage
-MACHINE = "beaglebone-yocto"
+MACHINE:forcevariable = "beaglebone-yocto"
 # Add a devicetree overlay which does not need kernel sources
 PREFERRED_PROVIDER_virtual/dtb = "bbb-dtbs-as-ext"
 """
@@ -855,7 +855,7 @@ PREFERRED_PROVIDER_virtual/dtb = "bbb-dtbs-as-ext"
         # Generate a configuration section which gets included into the local.conf file
         config = """
 # Enable creation of fitImage
-MACHINE = "beaglebone-yocto"
+MACHINE:forcevariable = "beaglebone-yocto"
 UBOOT_SIGN_ENABLE = "1"
 UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys"
 UBOOT_SIGN_KEYNAME = "dev"
@@ -903,7 +903,7 @@ FIT_CONF_DEFAULT_DTB = "am335x-bonegreen.dtb"
         # Generate a configuration section which gets included into the local.conf file
         config = """
 # Enable creation of fitImage
-MACHINE = "beaglebone-yocto"
+MACHINE:forcevariable = "beaglebone-yocto"
 UBOOT_SIGN_ENABLE = "1"
 FIT_GENERATE_KEYS = "1"
 UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys"
@@ -939,7 +939,7 @@ UBOOT_MKIMAGE_SIGN_ARGS = "-c 'a smart comment'"
 
         config = """
 DISTRO = "poky"
-MACHINE = "beaglebone-yocto"
+MACHINE:forcevariable = "beaglebone-yocto"
 INITRAMFS_IMAGE = "core-image-minimal-initramfs"
 INITRAMFS_SCRIPTS = ""
 UBOOT_MACHINE = "am335x_evm_defconfig"
@@ -993,7 +993,7 @@ FIT_HASH_ALG = "sha256"
 
         config = """
 DISTRO = "poky"
-MACHINE = "beaglebone-yocto"
+MACHINE:forcevariable = "beaglebone-yocto"
 INITRAMFS_IMAGE_BUNDLE = "1"
 INITRAMFS_IMAGE = "core-image-minimal-initramfs"
 INITRAMFS_SCRIPTS = ""
@@ -1412,7 +1412,7 @@ class UBootFitImageTests(FitImageTestCase):
         """
         config = """
 # We need at least CONFIG_SPL_LOAD_FIT and CONFIG_SPL_OF_CONTROL set
-MACHINE = "qemuarm"
+MACHINE:forcevariable = "qemuarm"
 UBOOT_MACHINE = "am57xx_evm_defconfig"
 SPL_BINARY = "MLO"
 
@@ -1451,7 +1451,7 @@ UBOOT_FIT_DESC = "A model description"
         config = """
 # There's no U-boot defconfig with CONFIG_FIT_SIGNATURE yet, so we need at
 # least CONFIG_SPL_LOAD_FIT and CONFIG_SPL_OF_CONTROL set
-MACHINE = "qemuarm"
+MACHINE:forcevariable = "qemuarm"
 UBOOT_MACHINE = "am57xx_evm_defconfig"
 SPL_BINARY = "MLO"
 # Enable creation and signing of the U-Boot fitImage
@@ -1498,7 +1498,7 @@ UBOOT_FIT_HASH_ALG = "sha256"
         config = """
 # There's no U-boot deconfig with CONFIG_FIT_SIGNATURE yet, so we need at
 # least CONFIG_SPL_LOAD_FIT and CONFIG_SPL_OF_CONTROL set
-MACHINE = "qemuarm"
+MACHINE:forcevariable = "qemuarm"
 UBOOT_MACHINE = "am57xx_evm_defconfig"
 SPL_BINARY = "MLO"
 # Enable creation and signing of the U-Boot fitImage
@@ -1546,7 +1546,7 @@ UBOOT_SIGN_KEYNAME = "cfg-oe-selftest"
         """
         config = """
 # We need at least CONFIG_SPL_LOAD_FIT and CONFIG_SPL_OF_CONTROL set
-MACHINE = "qemuarm"
+MACHINE:forcevariable = "qemuarm"
 UBOOT_MACHINE = "am57xx_evm_defconfig"
 SPL_BINARY = "MLO"
 
@@ -1612,7 +1612,7 @@ UBOOT_FIT_ARM_TRUSTED_FIRMWARE_ENTRYPOINT = "0x80280000"
         config = """
 # There's no U-boot deconfig with CONFIG_FIT_SIGNATURE yet, so we need at
 # least CONFIG_SPL_LOAD_FIT and CONFIG_SPL_OF_CONTROL set
-MACHINE = "qemuarm"
+MACHINE:forcevariable = "qemuarm"
 UBOOT_MACHINE = "am57xx_evm_defconfig"
 SPL_BINARY = "MLO"
 # Enable creation and signing of the U-Boot fitImage
@@ -1676,7 +1676,7 @@ UBOOT_FIT_ARM_TRUSTED_FIRMWARE_ENTRYPOINT = "0x80280000"
         """
         config = """
 # Enable creation of fitImage
-MACHINE = "beaglebone-yocto"
+MACHINE:forcevariable = "beaglebone-yocto"
 UBOOT_SIGN_ENABLE = "1"
 UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys"
 UBOOT_SIGN_KEYNAME = "the-kernel-config-key"
@@ -1715,7 +1715,7 @@ FIT_SIGN_INDIVIDUAL = "1"
         config = """
 # There's no U-boot defconfig with CONFIG_FIT_SIGNATURE yet, so we need at
 # least CONFIG_SPL_LOAD_FIT and CONFIG_SPL_OF_CONTROL set
-MACHINE = "qemuarm"
+MACHINE:forcevariable = "qemuarm"
 UBOOT_MACHINE = "am57xx_evm_defconfig"
 # Enable creation and signing of the U-Boot fitImage (no SPL)
 UBOOT_FITIMAGE_ENABLE = "1"
meta/lib/oeqa/selftest/cases/sstatetests.py +17 -17
index 08f94b168a8..44dd674a325 100644
@@ -336,20 +336,20 @@ class SStateCacheManagement(SStateBase):
     def test_sstate_cache_management_script_using_pr_3(self):
         global_config = []
         target_config = []
-        global_config.append('MACHINE = "qemux86-64"')
+        global_config.append('MACHINE:forcevariable = "qemux86-64"')
         target_config.append('PR = "0"')
         global_config.append(global_config[0])
         target_config.append('PR = "1"')
-        global_config.append('MACHINE = "qemux86"')
+        global_config.append('MACHINE:forcevariable = "qemux86"')
         target_config.append('PR = "1"')
         self.run_test_sstate_cache_management_script('m4', global_config,  target_config, ignore_patterns=['populate_lic'])
 
     def test_sstate_cache_management_script_using_machine(self):
         global_config = []
         target_config = []
-        global_config.append('MACHINE = "qemux86-64"')
+        global_config.append('MACHINE:forcevariable = "qemux86-64"')
         target_config.append('')
-        global_config.append('MACHINE = "qemux86"')
+        global_config.append('MACHINE:forcevariable = "qemux86"')
         target_config.append('')
         self.run_test_sstate_cache_management_script('m4', global_config,  target_config, ignore_patterns=['populate_lic'])
 
@@ -357,7 +357,7 @@ class SStateHashSameSigs(SStateBase):
     def sstate_hashtest(self, sdkmachine):
 
         self.write_config("""
-MACHINE = "qemux86"
+MACHINE:forcevariable = "qemux86"
 TMPDIR = "${TOPDIR}/tmp-sstatesamehash"
 BUILD_ARCH = "x86_64"
 BUILD_OS = "linux"
@@ -368,7 +368,7 @@ BB_SIGNATURE_HANDLER = "OEBasicHash"
         self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash")
         bitbake("core-image-weston -S none")
         self.write_config("""
-MACHINE = "qemux86"
+MACHINE:forcevariable = "qemux86"
 TMPDIR = "${TOPDIR}/tmp-sstatesamehash2"
 BUILD_ARCH = "i686"
 BUILD_OS = "linux"
@@ -454,13 +454,13 @@ class SStateHashSameSigs2(SStateBase):
 
         configA = """
 TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\"
-MACHINE = \"qemux86-64\"
+MACHINE:forcevariable = \"qemux86-64\"
 BB_SIGNATURE_HANDLER = "OEBasicHash"
 """
         #OLDEST_KERNEL is arch specific so set to a different value here for testing
         configB = """
 TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\"
-MACHINE = \"qemuarm\"
+MACHINE:forcevariable = \"qemuarm\"
 OLDEST_KERNEL = \"3.3.0\"
 BB_SIGNATURE_HANDLER = "OEBasicHash"
 ERROR_QA:append = " somenewoption"
@@ -475,7 +475,7 @@ WARN_QA:append = " someotheroption"
 
         configA = """
 TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\"
-MACHINE = \"qemux86-64\"
+MACHINE:forcevariable = \"qemux86-64\"
 require conf/multilib.conf
 MULTILIBS = \"multilib:lib32\"
 DEFAULTTUNE:virtclass-multilib-lib32 = \"x86\"
@@ -483,7 +483,7 @@ BB_SIGNATURE_HANDLER = "OEBasicHash"
 """
         configB = """
 TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\"
-MACHINE = \"qemuarm\"
+MACHINE:forcevariable = \"qemuarm\"
 require conf/multilib.conf
 MULTILIBS = \"\"
 BB_SIGNATURE_HANDLER = "OEBasicHash"
@@ -500,7 +500,7 @@ class SStateHashSameSigs3(SStateBase):
 
         self.write_config("""
 TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\"
-MACHINE = \"qemux86\"
+MACHINE:forcevariable = \"qemux86\"
 require conf/multilib.conf
 MULTILIBS = "multilib:lib32"
 DEFAULTTUNE:virtclass-multilib-lib32 = "x86"
@@ -510,7 +510,7 @@ BB_SIGNATURE_HANDLER = "OEBasicHash"
         bitbake("world meta-toolchain -S none")
         self.write_config("""
 TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\"
-MACHINE = \"qemux86copy\"
+MACHINE:forcevariable = \"qemux86copy\"
 require conf/multilib.conf
 MULTILIBS = "multilib:lib32"
 DEFAULTTUNE:virtclass-multilib-lib32 = "x86"
@@ -546,7 +546,7 @@ BB_SIGNATURE_HANDLER = "OEBasicHash"
 
         self.write_config("""
 TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\"
-MACHINE = \"qemux86\"
+MACHINE:forcevariable = \"qemux86\"
 require conf/multilib.conf
 MULTILIBS = "multilib:lib32"
 DEFAULTTUNE:virtclass-multilib-lib32 = "x86"
@@ -556,7 +556,7 @@ BB_SIGNATURE_HANDLER = "OEBasicHash"
         bitbake("binutils-native  -S none")
         self.write_config("""
 TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\"
-MACHINE = \"qemux86copy\"
+MACHINE:forcevariable = \"qemux86copy\"
 BB_SIGNATURE_HANDLER = "OEBasicHash"
 """)
         self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash2")
@@ -707,7 +707,7 @@ class SStateFindSiginfo(SStateBase):
         """
         self.write_config("""
 TMPDIR = \"${TOPDIR}/tmp-sstates-findsiginfo\"
-MACHINE = \"qemux86-64\"
+MACHINE:forcevariable = \"qemux86-64\"
 require conf/multilib.conf
 MULTILIBS = "multilib:lib32"
 DEFAULTTUNE:virtclass-multilib-lib32 = "x86"
@@ -957,13 +957,13 @@ class SStateMirrors(SStateCheckObjectPresence):
         if check_cdn:
             self.config_sstate(True)
             self.append_config("""
-MACHINE = "{}"
+MACHINE:forcevariable = "{}"
 BB_HASHSERVE_UPSTREAM = "hashserv.yoctoproject.org:8686"
 SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH"
 """.format(machine))
         else:
             self.append_config("""
-MACHINE = "{}"
+MACHINE:forcevariable = "{}"
 """.format(machine))
         result = bitbake("-DD -n {}".format(targets))
         bitbake("-S none {}".format(targets))
#1 lore raw

PATCH 2/3 oeqa/selftest/oescripts: Ensure buildstats is present

These tests need buildstats to be configured. Add that piece of config in case it isn't by default.

---
 meta/lib/oeqa/selftest/cases/oescripts.py | 4 ++++
 1 file changed, 4 insertions(+)
meta/lib/oeqa/selftest/cases/oescripts.py +4 -0
index 64fb3f1a1db..ebaf01f777c 100644
@@ -18,6 +18,10 @@ class OEPybootchartguyTests(OESelftestTestCase):
     @classmethod
     def setUpClass(cls):
         super().setUpClass()
+        cls.write_config(cls,
+"""
+INHERIT += "buildstats"
+""")
         bitbake("core-image-minimal -c rootfs -f")
         cls.tmpdir = get_bb_var('TMPDIR')
         cls.buildstats = cls.tmpdir + "/buildstats/" + sorted(os.listdir(cls.tmpdir + "/buildstats"))[-1]
#2 lore raw

PATCH 3/3 oeqa/selftest/buildhistory: Fix test if USER_CLASSES is unset

In reply to Richard Purdie

If USER_CLASSES is unset, the test was failing. Fix that.

---
 meta/lib/oeqa/selftest/cases/buildhistory.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/buildhistory.py +1 -1
index 511c666554f..1edc60c72d0 100644
@@ -16,7 +16,7 @@ class BuildhistoryTests(OESelftestTestCase):
 
     def config_buildhistory(self, tmp_bh_location=False):
         bb_vars = get_bb_vars(['USER_CLASSES', 'INHERIT'])
-        if (not 'buildhistory' in bb_vars['USER_CLASSES']) and (not 'buildhistory' in bb_vars['INHERIT']):
+        if (not bb_vars['USER_CLASSES'] or not 'buildhistory' in bb_vars['USER_CLASSES']) and (not 'buildhistory' in bb_vars['INHERIT']):
             add_buildhistory_config = 'INHERIT += "buildhistory"\nBUILDHISTORY_COMMIT = "1"'
             self.append_config(add_buildhistory_config)
 
#3 lore raw
In reply to Richard Purdie
Quoted 5 lines · Richard Purdie via lists.openembedded.org

With config fragments, changing MACHINE in the test like this no longer works. Use the forcevarable override to allow it to work. This also needs a tweak to bitbake to work correctly, sent seperately. Whilst ugly, this avoids the need to start changing config fragments within oeqa right now.

Why not move the inclusion of auto.conf after the addfragments call in bitbake.conf? Maybe this triggers another issue, but I'm just wondering.

Antonin

Signature · 3 lines
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw
Quoted 11 lines · Antonin Godard
Quoted 5 lines · Richard Purdie via lists.openembedded.org

With config fragments, changing MACHINE in the test like this no longer works. Use the forcevarable override to allow it to work. This also needs a tweak to bitbake to work correctly, sent seperately. Whilst ugly, this avoids the need to start changing config fragments within oeqa right now.

Why not move the inclusion of auto.conf after the addfragments call in bitbake.conf? Maybe this triggers another issue, but I'm just wondering.

It would change behaviour, there is a lot of things out there which assume the current ordering and we don't really want to change it as the breakage is potentially very subtle and not obvious.

Cheers,

Richard

#5 lore raw
Quoted 9 lines · Richard Purdie
Quoted 8 lines · Antonin Godard
Quoted 5 lines · Richard Purdie via lists.openembedded.org

With config fragments, changing MACHINE in the test like this no longer works. Use the forcevarable override to allow it to work. This also needs a tweak to bitbake to work correctly, sent seperately. Whilst ugly, this avoids the need to start changing config fragments within oeqa right now.

Quoted 7 lines
Quoted 3 lines

Why not move the inclusion of auto.conf after the addfragments call in bitbake.conf? Maybe this triggers another issue, but I'm just wondering.

It would change behaviour, there is a lot of things out there which assume the current ordering and we don't really want to change it as the breakage is potentially very subtle and not obvious.

Ok, I also assumed along those lines... thanks.

Antonin

Signature · 3 lines
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com