* [PATCH 1/3] testsuite: Allow using custom isar location in test initialization
2023-09-14 10:43 [PATCH 0/3] Improve testsuite and fix bootstrap sstate issue Uladzimir Bely
@ 2023-09-14 10:43 ` Uladzimir Bely
2023-09-14 10:43 ` [PATCH 2/3] testsuite: Rework cache populating of sstate-cache in SstateTest Uladzimir Bely
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Uladzimir Bely @ 2023-09-14 10:43 UTC (permalink / raw)
To: isar-users
By default, isar copy checked out by CI is used for the build.
This change allows to pass custom isar directory to start build from.
It may be useful if we need to have several independent builds started
from different initial directories in order to compare their results.
Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
testsuite/cibuilder.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 12f0e193..9c9f5a03 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -39,13 +39,13 @@ class CIBuilder(Test):
self._file_handler.setFormatter(formatter)
app_log.addHandler(self._file_handler)
- def init(self, build_dir='build'):
+ def init(self, build_dir='build', isar_dir=isar_root):
# initialize build_dir and setup environment
# needs to run once (per test case)
if hasattr(self, 'build_dir'):
self.error("Broken test implementation: init() called multiple times.")
- self.build_dir = os.path.join(isar_root, build_dir)
- os.chdir(isar_root)
+ self.build_dir = os.path.join(isar_dir, build_dir)
+ os.chdir(isar_dir)
os.environ["TEMPLATECONF"] = "meta-test/conf"
path.usable_rw_dir(self.build_dir)
output = process.getoutput('/bin/bash -c "source isar-init-build-env \
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] testsuite: Rework cache populating of sstate-cache in SstateTest
2023-09-14 10:43 [PATCH 0/3] Improve testsuite and fix bootstrap sstate issue Uladzimir Bely
2023-09-14 10:43 ` [PATCH 1/3] testsuite: Allow using custom isar location in test initialization Uladzimir Bely
@ 2023-09-14 10:43 ` Uladzimir Bely
2023-09-14 10:43 ` [PATCH 3/3] isar-bootstrap: Avoid absolute paths in SRC_URI Uladzimir Bely
2023-09-19 4:18 ` [PATCH 0/3] Improve testsuite and fix bootstrap sstate issue Uladzimir Bely
3 siblings, 0 replies; 5+ messages in thread
From: Uladzimir Bely @ 2023-09-14 10:43 UTC (permalink / raw)
To: isar-users
In SstateTest class we run first build to populate sstate-cache and
the following builds to check if it's used or not.
Since both first and following builds are started from the same isar
location, this approach doesn't allow to find possible issues that are
sensitive to this path.
This patch moves sstate-cache populating to a separate test so that
it uses a different isar location, e.g.:
1st build: "./isar-sstate" => "./isar-sstate/../sstate-cache";
2nd build: "." => "./sstate-cache".
Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
testsuite/cibase.py | 26 +++++++++++++++++++-------
testsuite/citest.py | 6 ++++++
2 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/testsuite/cibase.py b/testsuite/cibase.py
index d9641377..d7010387 100755
--- a/testsuite/cibase.py
+++ b/testsuite/cibase.py
@@ -106,6 +106,25 @@ class CIBaseTest(CIBuilder):
self.delete_from_build_dir('ccache')
self.unconfigure()
+ def perform_sstate_populate(self, image_target, **kwargs):
+ # Use a different isar root for populating sstate cache
+ isar_sstate = f"{isar_root}/isar-sstate"
+ os.makedirs(isar_sstate)
+ process.run(f'git --work-tree={isar_sstate} checkout HEAD -- .')
+
+ self.init('../build-sstate', isar_dir=isar_sstate)
+ self.configure(sstate=True, sstate_dir="", **kwargs)
+
+ # Cleanup sstate and tmp before test
+ self.delete_from_build_dir('sstate-cache')
+ self.delete_from_build_dir('tmp')
+
+ # Populate cache
+ self.bitbake(image_target, **kwargs)
+
+ # Remove isar configuration so the the following test creates a new one
+ self.delete_from_build_dir('conf')
+
def perform_sstate_test(self, image_target, package_target, **kwargs):
def check_executed_tasks(target, expected):
taskorder_file = glob.glob(f'{self.build_dir}/tmp/work/*/{target}/*/temp/log.task_order')
@@ -129,13 +148,6 @@ class CIBaseTest(CIBuilder):
self.configure(sstate=True, sstate_dir="", **kwargs)
- # Cleanup sstate and tmp before test
- self.delete_from_build_dir('sstate-cache')
- self.delete_from_build_dir('tmp')
-
- # Populate cache
- self.bitbake(image_target, **kwargs)
-
# Check signature files for cachability issues like absolute paths in signatures
result = process.run(f'{isar_root}/scripts/isar-sstate lint {self.build_dir}/sstate-cache '
f'--build-dir {self.build_dir} --sources-dir {isar_root}')
diff --git a/testsuite/citest.py b/testsuite/citest.py
index 48b10286..1e7a32c0 100755
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -276,6 +276,12 @@ class SstateTest(CIBaseTest):
:avocado: tags=sstate,full
"""
+
+ def test_sstate_populate(self):
+ image_target = 'mc:qemuamd64-bullseye:isar-image-base'
+
+ self.perform_sstate_populate(image_target)
+
def test_sstate(self):
image_target = 'mc:qemuamd64-bullseye:isar-image-base'
package_target = 'mc:qemuamd64-bullseye:hello'
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/3] isar-bootstrap: Avoid absolute paths in SRC_URI
2023-09-14 10:43 [PATCH 0/3] Improve testsuite and fix bootstrap sstate issue Uladzimir Bely
2023-09-14 10:43 ` [PATCH 1/3] testsuite: Allow using custom isar location in test initialization Uladzimir Bely
2023-09-14 10:43 ` [PATCH 2/3] testsuite: Rework cache populating of sstate-cache in SstateTest Uladzimir Bely
@ 2023-09-14 10:43 ` Uladzimir Bely
2023-09-19 4:18 ` [PATCH 0/3] Improve testsuite and fix bootstrap sstate issue Uladzimir Bely
3 siblings, 0 replies; 5+ messages in thread
From: Uladzimir Bely @ 2023-09-14 10:43 UTC (permalink / raw)
To: isar-users
After commit ae3c091c, absolute path to source list file appears in
SRC_URI for isar-bootstrap tasks.
This leads to broken SSTATE_DIR sharing between different instances of
isar on the same machine, since almost all tasks depend on bootstrap
one.
This patch fixes the issue by leaving relative paths returned by
get_aptsources_list() function.
Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 8af73a9b..3477c2fb 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -152,19 +152,17 @@ def get_aptsources_list(d):
from collections import OrderedDict
apt_sources_var = d.getVar("DISTRO_VARS_PREFIX") + "DISTRO_APT_SOURCES"
apt_sources_list = list(OrderedDict.fromkeys((d.getVar(apt_sources_var) or "").split()))
- ret = []
for p in apt_sources_list:
try:
- f = bb.parse.resolve_file(p, d)
- ret.append(f)
+ bb.parse.resolve_file(p, d)
except FileNotFoundError as e:
bb.fatal(os.strerror(errno.ENOENT) + ' "' + p + '"')
- return ret
+ return apt_sources_list
def generate_distro_sources(d):
apt_sources_list = get_aptsources_list(d)
for entry in apt_sources_list:
- with open(entry, "r") as in_fd:
+ with open(bb.parse.resolve_file(entry, d), "r") as in_fd:
for line in in_fd:
parsed = parse_aptsources_list_line(line)
if parsed:
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] Improve testsuite and fix bootstrap sstate issue
2023-09-14 10:43 [PATCH 0/3] Improve testsuite and fix bootstrap sstate issue Uladzimir Bely
` (2 preceding siblings ...)
2023-09-14 10:43 ` [PATCH 3/3] isar-bootstrap: Avoid absolute paths in SRC_URI Uladzimir Bely
@ 2023-09-19 4:18 ` Uladzimir Bely
3 siblings, 0 replies; 5+ messages in thread
From: Uladzimir Bely @ 2023-09-19 4:18 UTC (permalink / raw)
To: isar-users
On Thu, 2023-09-14 at 12:43 +0200, Uladzimir Bely wrote:
> Patches 1-2 modify testsuite so that sstate cache populating is done
> from a separate Isar location.
>
> This allows to find issues that can't be detected when the same Isar
> location used for populating and reusing sstate-cache.
>
> Patch 3 (previously sent separately) fixes such an issue found in
> isar-bootsrap routines.
>
> Uladzimir Bely (3):
> testsuite: Allow using custom isar location in test initialization
> testsuite: Rework cache populating of sstate-cache in SstateTest
> isar-bootstrap: Avoid absolute paths in SRC_URI
>
> .../isar-bootstrap/isar-bootstrap.inc | 8 +++---
> testsuite/cibase.py | 26 ++++++++++++++---
> --
> testsuite/cibuilder.py | 6 ++---
> testsuite/citest.py | 6 +++++
> 4 files changed, 31 insertions(+), 15 deletions(-)
>
> --
> 2.20.1
>
Applied to next.
^ permalink raw reply [flat|nested] 5+ messages in thread