Skip to contentSkip to conversation

oeqa/selftest: Use SSTATE_DIR of parent build dir

PATCH New [email protected] 1 participant 1 message Apr 14, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 oeqa/selftest: Use SSTATE_DIR of parent build dir

From: Thomas Roos <[email protected]>

This will configure the build-st/conf/local.conf with the SSTATE_DIR of the parent build dir to speed up the build, test, dev process.

---
 meta/lib/oeqa/selftest/context.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/lib/oeqa/selftest/context.py +10 -0
index 0a7a9da72a..f2a5ba792f 100644
@@ -16,6 +16,7 @@ from random import choice
 import oeqa
 import oe
 import bb.utils
+import bb.tinfoil
 
 from oeqa.core.context import OETestContext, OETestContextExecutor
 from oeqa.core.exception import OEQAPreRun, OEQATestNotFound
@@ -79,6 +80,12 @@ class OESelftestTestContext(OETestContext):
             self.removebuilddir = removebuilddir
 
     def setup_builddir(self, suffix, selftestdir, suite):
+        # Get SSTATE_DIR from the parent build dir
+        with bb.tinfoil.Tinfoil(tracking=True) as tinfoil:
+            tinfoil.prepare(quiet=2, config_only=True)
+            d = tinfoil.config_data
+            sstatedir = str(d.getVar('SSTATE_DIR'))
+
         builddir = os.environ['BUILDDIR']
         if not selftestdir:
             selftestdir = get_test_layer()
@@ -118,6 +125,9 @@ class OESelftestTestContext(OETestContext):
             if os.environ[e].endswith(builddir):
                 os.environ[e] = os.environ[e].replace(builddir, newbuilddir)
 
+        # Set SSTATE_DIR to match the parent SSTATE_DIR
+        subprocess.check_output("echo 'SSTATE_DIR ?= \"%s\"' >> %s/conf/local.conf" % (sstatedir, newbuilddir), cwd=newbuilddir, shell=True)
+
         os.chdir(newbuilddir)
 
         def patch_test(t):
Signature · 14 lines
2.34.1




Amazon Web Services EMEA SARL
38 avenue John F. Kennedy, L-1855 Luxembourg
Sitz der Gesellschaft: L-1855 Luxemburg
eingetragen im Luxemburgischen Handelsregister unter R.C.S. B186284

Amazon Web Services EMEA SARL, Niederlassung Deutschland
Marcel-Breuer-Str. 12, D-80807 Muenchen
Sitz der Zweigniederlassung: Muenchen
eingetragen im Handelsregister des Amtsgerichts Muenchen unter HRB 242240, USt-ID DE317013094