From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH 1/3] ci: Implement dynamic KFAIL checking
Date: Wed, 27 Apr 2022 15:32:03 +0300 [thread overview]
Message-ID: <20220427123205.30111-2-amikan@ilbers.de> (raw)
In-Reply-To: <20220427123205.30111-1-amikan@ilbers.de>
Remove KFAIL protection hardcoding and inctroduce ISAR_CI_KFAIL
environment variable instead.
Example:
ISAR_CI_KFAIL="cross_rpi cross_ubuntu nocross_rpi nocross_sidports"
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/cibuilder.py | 54 ++++++++++++++++++++++++++++--------------
testsuite/citest.py | 30 +++++------------------
2 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 7ce13dc..98b8933 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -10,6 +10,7 @@ import tempfile
import start_vm
+from avocado.core import exceptions
from avocado import Test
from avocado.utils import path
from avocado.utils import process
@@ -124,6 +125,15 @@ class CIBuilder(Test):
self.check_init()
process.run('rm -rf ' + self.build_dir + '/' + path, sudo=True)
+ def is_in_list(self, envname):
+ test_prefix = 'test_'
+ caller = self._testMethodName
+ tests_list = (os.getenv(envname) or '').split()
+ if caller.startswith(test_prefix):
+ if caller[len(test_prefix):] in tests_list:
+ return True
+ return False
+
def bitbake(self, target, bitbake_cmd=None, **kwargs):
self.check_init()
self.log.info('===================================================')
@@ -141,24 +151,30 @@ class CIBuilder(Test):
else:
cmdline.append(target)
- with subprocess.Popen(" ".join(cmdline), stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, universal_newlines=True,
- shell=True) as p1:
- poller = select.poll()
- poller.register(p1.stdout, select.POLLIN)
- poller.register(p1.stderr, select.POLLIN)
- while p1.poll() is None:
- events = poller.poll(1000)
- for fd, event in events:
- if event != select.POLLIN:
- continue
- if fd == p1.stdout.fileno():
- self.log.info(p1.stdout.readline().rstrip())
- if fd == p1.stderr.fileno():
- app_log.error(p1.stderr.readline().rstrip())
- p1.wait()
- if p1.returncode:
- self.fail('Bitbake failed')
+ try:
+ with subprocess.Popen(" ".join(cmdline), stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, universal_newlines=True,
+ shell=True) as p1:
+ poller = select.poll()
+ poller.register(p1.stdout, select.POLLIN)
+ poller.register(p1.stderr, select.POLLIN)
+ while p1.poll() is None:
+ events = poller.poll(1000)
+ for fd, event in events:
+ if event != select.POLLIN:
+ continue
+ if fd == p1.stdout.fileno():
+ self.log.info(p1.stdout.readline().rstrip())
+ if fd == p1.stderr.fileno():
+ app_log.error(p1.stderr.readline().rstrip())
+ p1.wait()
+ if p1.returncode:
+ self.fail('Bitbake failed')
+ except exceptions.TestFail:
+ if self.is_in_list('ISAR_CI_KFAIL'):
+ self.cancel('KFAIL')
+ else:
+ raise
def backupfile(self, path):
self.check_init()
@@ -258,4 +274,6 @@ class CIBuilder(Test):
else:
app_log.error(data.decode(errors='replace'))
+ if self.is_in_list('ISAR_CI_KFAIL'):
+ self.cancel('KFAIL: log ' + output_file)
self.fail('Log ' + output_file)
diff --git a/testsuite/citest.py b/testsuite/citest.py
index 994c130..879c8d2 100755
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -79,10 +79,7 @@ class CrossTest(CIBaseTest):
]
self.init()
- try:
- self.perform_build_test(targets, cross=True, debsrc_cache=True)
- except:
- self.cancel('KFAIL')
+ self.perform_build_test(targets, cross=True, debsrc_cache=True)
def test_cross_ubuntu(self):
targets = [
@@ -90,10 +87,7 @@ class CrossTest(CIBaseTest):
]
self.init()
- try:
- self.perform_build_test(targets, cross=True)
- except:
- self.cancel('KFAIL')
+ self.perform_build_test(targets, cross=True)
def test_cross_bookworm(self):
targets = [
@@ -101,10 +95,7 @@ class CrossTest(CIBaseTest):
]
self.init()
- try:
- self.perform_build_test(targets, cross=True)
- except:
- self.cancel('KFAIL')
+ self.perform_build_test(targets, cross=True)
class SdkTest(CIBaseTest):
@@ -165,10 +156,7 @@ class NoCrossTest(CIBaseTest):
]
self.init()
- try:
- self.perform_build_test(targets, cross=False, debsrc_cache=True)
- except:
- self.cancel('KFAIL')
+ self.perform_build_test(targets, cross=False, debsrc_cache=True)
def test_nocross_bookworm(self):
targets = [
@@ -180,10 +168,7 @@ class NoCrossTest(CIBaseTest):
]
self.init()
- try:
- self.perform_build_test(targets, cross=False)
- except:
- self.cancel('KFAIL')
+ self.perform_build_test(targets, cross=False)
def test_nocross_sidports(self):
targets = [
@@ -192,10 +177,7 @@ class NoCrossTest(CIBaseTest):
]
self.init()
- try:
- self.perform_build_test(targets, cross=False)
- except:
- self.cancel('KFAIL')
+ self.perform_build_test(targets, cross=False)
class RebuildTest(CIBaseTest):
--
2.17.1
next prev parent reply other threads:[~2022-04-27 12:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 12:32 [PATCH 0/3] Make CI targets be configured Anton Mikanovich
2022-04-27 12:32 ` Anton Mikanovich [this message]
2022-04-27 12:32 ` [PATCH 2/3] ci: Implement dynamic tests skipping Anton Mikanovich
2022-04-27 12:32 ` [PATCH 3/3] ci: Correct container test case name Anton Mikanovich
2022-04-27 15:59 ` [PATCH 0/3] Make CI targets be configured Henning Schild
2022-04-27 17:50 ` Anton Mikanovich
2022-04-28 7:48 ` Henning Schild
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=20220427123205.30111-2-amikan@ilbers.de \
--to=amikan@ilbers.de \
--cc=isar-users@googlegroups.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