* [PATCH 1/4] CI: Fix getVars API self checks
2024-01-25 9:06 [PATCH 0/4] Improve variables obtaining in CI Anton Mikanovich
@ 2024-01-25 9:06 ` Anton Mikanovich
2024-01-25 9:06 ` [PATCH 2/4] CI: Remove getlayerdir API Anton Mikanovich
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Anton Mikanovich @ 2024-01-25 9:06 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
Fix bitbake lock filename and add init calling check to make getVars
API more stable.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/cibuilder.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index bb62bb8d..a5b57a3c 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -254,6 +254,7 @@ class CIBuilder(Test):
return env['LAYERDIR_' + layer].strip('"')
def getVars(self, *vars, target=None):
+ self.check_init()
def fixStream(stream):
# fix stream objects to emulate _io.TextIOWrapper
stream.isatty = lambda: False
@@ -264,7 +265,8 @@ class CIBuilder(Test):
fixStream(sys.stdout)
fixStream(sys.stderr)
- lockfile = os.path.join(self.build_dir, 'bitbake.lock2')
+ # wait until previous bitbake will be finished
+ lockfile = os.path.join(self.build_dir, 'bitbake.lock')
checks = 0
while os.path.exists(lockfile) and checks < 5:
time.sleep(1)
@@ -276,11 +278,11 @@ class CIBuilder(Test):
tinfoil.prepare(quiet=2)
d = tinfoil.parse_recipe(target)
for var in vars:
- values = values + (d.getVar(var),)
+ values = values + (d.getVar(var, True) or 'None',)
else:
tinfoil.prepare(config_only=True, quiet=2)
for var in vars:
- values = values + (tinfoil.config_data.getVar(var),)
+ values = values + (tinfoil.config_data.getVar(var, True) or 'None',)
return values if len(values) > 1 else values[0]
def create_tmp_layer(self):
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/4] CI: Remove getlayerdir API
2024-01-25 9:06 [PATCH 0/4] Improve variables obtaining in CI Anton Mikanovich
2024-01-25 9:06 ` [PATCH 1/4] CI: Fix getVars API self checks Anton Mikanovich
@ 2024-01-25 9:06 ` Anton Mikanovich
2024-01-25 9:06 ` [PATCH 3/4] CI: Reuse getVars in repro-build-test Anton Mikanovich
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Anton Mikanovich @ 2024-01-25 9:06 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
Use getVars() instead to avoid process creation overhead.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/cibuilder.py | 8 --------
testsuite/citest.py | 2 +-
2 files changed, 1 insertion(+), 9 deletions(-)
diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index a5b57a3c..273a1dce 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -245,14 +245,6 @@ class CIBuilder(Test):
except FileNotFoundError:
self.log.warn(path + backup_prefix + ' not exist')
- def getlayerdir(self, layer):
- self.check_init()
- output = process.getoutput('bitbake -e | grep "^LAYERDIR_.*="')
- env = dict(((x.split('=', 1) + [''])[:2] \
- for x in output.splitlines() if x != ''))
-
- return env['LAYERDIR_' + layer].strip('"')
-
def getVars(self, *vars, target=None):
self.check_init()
def fixStream(stream):
diff --git a/testsuite/citest.py b/testsuite/citest.py
index d7ece76c..7efe0059 100755
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -46,7 +46,7 @@ class DevTest(CIBaseTest):
def test_dev_rebuild(self):
self.init()
- layerdir_core = self.getlayerdir('core')
+ layerdir_core = self.getVars('LAYERDIR_core')
dpkgbase_file = layerdir_core + '/classes/dpkg-base.bbclass'
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/4] CI: Reuse getVars in repro-build-test
2024-01-25 9:06 [PATCH 0/4] Improve variables obtaining in CI Anton Mikanovich
2024-01-25 9:06 ` [PATCH 1/4] CI: Fix getVars API self checks Anton Mikanovich
2024-01-25 9:06 ` [PATCH 2/4] CI: Remove getlayerdir API Anton Mikanovich
@ 2024-01-25 9:06 ` Anton Mikanovich
2024-01-25 9:06 ` [PATCH 4/4] CI: Use getVars for vm output checking Anton Mikanovich
2024-01-31 14:41 ` [PATCH 0/4] Improve variables obtaining in CI Uladzimir Bely
4 siblings, 0 replies; 6+ messages in thread
From: Anton Mikanovich @ 2024-01-25 9:06 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
Avoid manual bitbake execution and variables parsing.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/repro-build-test.py | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/testsuite/repro-build-test.py b/testsuite/repro-build-test.py
index 1c0b05ba..040a844e 100755
--- a/testsuite/repro-build-test.py
+++ b/testsuite/repro-build-test.py
@@ -29,13 +29,7 @@ class ReproBuild(CIBuilder):
def get_image_path(self, target_name):
image_dir = "tmp/deploy/images"
- output = process.getoutput(
- f'bitbake -e {target_name} '
- r'| grep "^MACHINE=\|^IMAGE_FULLNAME="'
- )
- env = dict(d.split("=", 1) for d in output.splitlines())
- machine = env["MACHINE"].strip("\"")
- image_name = env["IMAGE_FULLNAME"].strip("\"")
+ machine, image_name = self.getVars("MACHINE", "IMAGE_FULLNAME", target=target_name)
return f"{image_dir}/{machine}/{image_name}.tar.gz"
def build_repro_image(
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] CI: Use getVars for vm output checking
2024-01-25 9:06 [PATCH 0/4] Improve variables obtaining in CI Anton Mikanovich
` (2 preceding siblings ...)
2024-01-25 9:06 ` [PATCH 3/4] CI: Reuse getVars in repro-build-test Anton Mikanovich
@ 2024-01-25 9:06 ` Anton Mikanovich
2024-01-31 14:41 ` [PATCH 0/4] Improve variables obtaining in CI Uladzimir Bely
4 siblings, 0 replies; 6+ messages in thread
From: Anton Mikanovich @ 2024-01-25 9:06 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
This will reduce overhead and should speedup startvm tests execution.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/cibuilder.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 273a1dce..0f2aa0f5 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -507,17 +507,20 @@ BBPATH .= ":${LAYERDIR}"\
return 1
- def vm_parse_output(self, boot_log, bb_output, skip_modulecheck):
+ def vm_parse_output(self, boot_log, multiconfig, skip_modulecheck):
# the printk of recipes-kernel/example-module
module_output = b'Just an example'
resize_output = None
- image_fstypes = start_vm.get_bitbake_var(bb_output, 'IMAGE_FSTYPES')
- wks_file = start_vm.get_bitbake_var(bb_output, 'WKS_FILE')
+ image_fstypes, \
+ wks_file, \
+ bbdistro = self.getVars('IMAGE_FSTYPES', \
+ 'WKS_FILE', \
+ 'DISTRO', \
+ target=multiconfig)
# only the first type will be tested in start_vm.py
if image_fstypes.split()[0] == 'wic':
if wks_file:
- bbdistro = start_vm.get_bitbake_var(bb_output, 'DISTRO')
# ubuntu is less verbose so we do not see the message
# /etc/sysctl.d/10-console-messages.conf
if bbdistro and "ubuntu" not in bbdistro:
@@ -627,8 +630,8 @@ BBPATH .= ":${LAYERDIR}"\
self.vm_turn_off(vm)
self.fail('Failed to run test over ssh')
else:
- bb_output = start_vm.get_bitbake_env(arch, distro, image).decode()
- rc = self.vm_parse_output(boot_log, bb_output, skip_modulecheck)
+ multiconfig = 'mc:qemu' + arch + '-' + distro + ':' + image
+ rc = self.vm_parse_output(boot_log, multiconfig, skip_modulecheck)
if rc != 0:
if stop_vm:
self.vm_turn_off(vm)
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] Improve variables obtaining in CI
2024-01-25 9:06 [PATCH 0/4] Improve variables obtaining in CI Anton Mikanovich
` (3 preceding siblings ...)
2024-01-25 9:06 ` [PATCH 4/4] CI: Use getVars for vm output checking Anton Mikanovich
@ 2024-01-31 14:41 ` Uladzimir Bely
4 siblings, 0 replies; 6+ messages in thread
From: Uladzimir Bely @ 2024-01-31 14:41 UTC (permalink / raw)
To: Anton Mikanovich, isar-users
On Thu, 2024-01-25 at 11:06 +0200, Anton Mikanovich wrote:
> Reuse getVars API for as much cases as possible inside our CI to
> reduce
> external process creation overhead and speedup variables obtaining.
> This will also make this process much easier for testcase authors.
>
> Anton Mikanovich (4):
> CI: Fix getVars API self checks
> CI: Remove getlayerdir API
> CI: Reuse getVars in repro-build-test
> CI: Use getVars for vm output checking
>
> testsuite/cibuilder.py | 31 ++++++++++++++-----------------
> testsuite/citest.py | 2 +-
> testsuite/repro-build-test.py | 8 +-------
> 3 files changed, 16 insertions(+), 25 deletions(-)
>
> --
> 2.34.1
>
Applied to next.
^ permalink raw reply [flat|nested] 6+ messages in thread