]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oeqa/selftest: Use SSTATE_DIR of parent build dir
authorThomas Roos <throos@amazon.de>
Fri, 14 Apr 2023 14:31:40 +0000 (16:31 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 20 Apr 2023 10:51:39 +0000 (11:51 +0100)
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.

Signed-off-by: Thomas Roos <throos@amazon.de>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
meta/lib/oeqa/selftest/context.py

index 0a7a9da72afe333bf8d5fc911e471c06a14d58e6..f2a5ba792f6346d61a437bb04d80ce1e7767d800 100644 (file)
@@ -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):