1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

oeqa/selftest: Use SSTATE_DIR of parent build dir

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.

(From OE-Core rev: 71dca60ddcf4370ff7e91de6ddf8a7d4cf76db50)

Signed-off-by: Thomas Roos <throos@amazon.de>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Thomas Roos
2023-04-14 16:31:40 +02:00
committed by Richard Purdie
parent d8e9c1c049
commit 67e22b9fc9
+10
View File
@@ -16,6 +16,7 @@ from random import choice
import oeqa import oeqa
import oe import oe
import bb.utils import bb.utils
import bb.tinfoil
from oeqa.core.context import OETestContext, OETestContextExecutor from oeqa.core.context import OETestContext, OETestContextExecutor
from oeqa.core.exception import OEQAPreRun, OEQATestNotFound from oeqa.core.exception import OEQAPreRun, OEQATestNotFound
@@ -79,6 +80,12 @@ class OESelftestTestContext(OETestContext):
self.removebuilddir = removebuilddir self.removebuilddir = removebuilddir
def setup_builddir(self, suffix, selftestdir, suite): 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'] builddir = os.environ['BUILDDIR']
if not selftestdir: if not selftestdir:
selftestdir = get_test_layer() selftestdir = get_test_layer()
@@ -118,6 +125,9 @@ class OESelftestTestContext(OETestContext):
if os.environ[e].endswith(builddir): if os.environ[e].endswith(builddir):
os.environ[e] = os.environ[e].replace(builddir, newbuilddir) 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) os.chdir(newbuilddir)
def patch_test(t): def patch_test(t):