From: "'Cedric Hombourger' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: Cedric Hombourger <cedric.hombourger@siemens.com>
Subject: [PATCH 1/4] CI: support negative build tests
Date: Sat, 1 Nov 2025 12:13:14 +0100 [thread overview]
Message-ID: <20251101111326.600581-2-cedric.hombourger@siemens.com> (raw)
In-Reply-To: <20251101111326.600581-1-cedric.hombourger@siemens.com>
It appears that our build tests are only check for successful
builds. We also want to make sure builds fail when they are
expected to. This adds a should_fail boolean to bitbake() and
perform_build_test()
Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
---
testsuite/cibase.py | 4 ++--
testsuite/cibuilder.py | 12 ++++++++----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/testsuite/cibase.py b/testsuite/cibase.py
index 6ffedcea..0a006a21 100755
--- a/testsuite/cibase.py
+++ b/testsuite/cibase.py
@@ -14,12 +14,12 @@ from avocado.utils import process
class CIBaseTest(CIBuilder):
- def perform_build_test(self, targets, **kwargs):
+ def perform_build_test(self, targets, should_fail=False, **kwargs):
self.configure(**kwargs)
self.log.info("Starting build...")
- self.bitbake(targets, **kwargs)
+ self.bitbake(targets, should_fail=should_fail, **kwargs)
def perform_wic_partition_test(self, targets, wic_deploy_parts, **kwargs):
self.configure(wic_deploy_parts=wic_deploy_parts, **kwargs)
diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index cd5e70ba..366f6a1f 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -281,7 +281,8 @@ class CIBuilder(Test):
if os.path.exists(self.build_dir + '/' + src):
shutil.move(self.build_dir + '/' + src, self.build_dir + '/' + dst)
- def bitbake(self, target, bitbake_cmd=None, sig_handler=None, **kwargs):
+ def bitbake(self, target, bitbake_cmd=None, should_fail=False,
+ sig_handler=None, **kwargs):
self.check_init()
self.log.info("===================================================")
self.log.info(f"Building {str(target)}")
@@ -318,13 +319,16 @@ class CIBuilder(Test):
continue
if fd == p1.stdout.fileno():
self.log.info(p1.stdout.readline().rstrip())
- if fd == p1.stderr.fileno():
+ if fd == p1.stderr.fileno() and should_fail is False:
app_log.error(p1.stderr.readline().rstrip())
if p1.poll() is not None:
break
p1.wait()
- if p1.returncode:
- self.fail("Bitbake failed")
+ if should_fail is False:
+ if p1.returncode:
+ self.fail("Bitbake failed")
+ elif p1.returncode == 0:
+ self.fail("Bitbake suceeded but was expected to fail!")
def backupfile(self, path):
self.check_init()
--
2.47.3
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20251101111326.600581-2-cedric.hombourger%40siemens.com.
next prev parent reply other threads:[~2025-11-01 11:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-01 11:13 [PATCH 0/4] Add test-cases for dracut-based initrds 'Cedric Hombourger' via isar-users
2025-11-01 11:13 ` 'Cedric Hombourger' via isar-users [this message]
2025-11-01 11:13 ` [PATCH 2/4] CI: add smoke-tests for switch to dracut in isar-image-ci 'Cedric Hombourger' via isar-users
2025-11-01 11:13 ` [PATCH 3/4] CI: add build tests for isar-dracut initrd images 'Cedric Hombourger' via isar-users
2025-11-01 11:13 ` [PATCH 4/4] CI: check if the build fails when dracut fails 'Cedric Hombourger' via isar-users
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251101111326.600581-2-cedric.hombourger@siemens.com \
--to=isar-users@googlegroups.com \
--cc=cedric.hombourger@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox