public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH 23/23] CI: Add make world test case
Date: Mon, 25 Mar 2024 17:55:40 +0200	[thread overview]
Message-ID: <20240325155540.4162990-24-amikan@ilbers.de> (raw)
In-Reply-To: <20240325155540.4162990-1-amikan@ilbers.de>

Add test case which builds all available targets.

Single bitbake usage (directly from mc.conf):
$ avocado run testsuite/citest.py -t world

Multiple bitbakes usage (from generated yaml file):
$ avocado run testsuite/citest.py -t world -m testsuite/data/targets.yml

There is also a script to regenerate yaml from mc.conf:
$ ./testsuite/utils/targets_gen.py

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 .gitignore                     |   2 +-
 scripts/ci_build.sh            |   7 +-
 testsuite/cibuilder.py         |  21 ++++++
 testsuite/citest.py            |  24 +++++++
 testsuite/data/targets.yml     | 118 +++++++++++++++++++++++++++++++++
 testsuite/utils/targets_gen.py |  27 ++++++++
 6 files changed, 197 insertions(+), 2 deletions(-)
 create mode 100644 testsuite/data/targets.yml
 create mode 100755 testsuite/utils/targets_gen.py

diff --git a/.gitignore b/.gitignore
index b1b51dd4..7f5ab1ad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,4 @@
 /*.patch
 __pycache__
 .config.yaml*
-build/
+build*
diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh
index 5903cbe5..c8ca84ad 100755
--- a/scripts/ci_build.sh
+++ b/scripts/ci_build.sh
@@ -49,6 +49,7 @@ show_help() {
     echo "    -b, --base BASE_DIR      set path to base directory. If not set,"
     echo "                             the tests will be started in current path."
     echo "    -d, --debug              enable debug bitbake output."
+    echo "    -m, --muxfile            input file for yaml-to-mux plugin."
     echo "    -T, --tags               specify basic avocado tags."
     echo "    --help                   display this message and exit."
     echo
@@ -94,6 +95,10 @@ do
         NORUN="1"
         echo "warning: deprecated parameter '$key', consider using '-T <TAG>,-startvm' instead"
         ;;
+    -m|--muxfile)
+        MUXFILE="-m $2"
+        shift
+        ;;
     -t|--timeout)
         TIMEOUT="-p time_to_wait=$2"
         shift
@@ -150,4 +155,4 @@ set -x
 
 avocado ${VERBOSE} --config "${BASE_DIR}/avocado.conf" run "${TESTFILE}" \
     -t "${TAGS}" --max-parallel-tasks=1 --disable-sysinfo \
-    ${SSTATE} ${TIMEOUT}
+    ${SSTATE} ${MUXFILE} ${TIMEOUT}
diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index cc589b1f..cef52e63 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -231,6 +231,15 @@ class CIBuilder(Test):
         except FileNotFoundError:
             self.log.warn(path + backup_prefix + ' not exist')
 
+    def get_test_images(self):
+        return ['isar-image-base', 'isar-image-ci']
+
+    def get_targets(self):
+        d = bb.data.init()
+        d.setVar('BBPATH', os.path.join(isar_root, 'meta-isar'))
+        d = bb.cookerdata.parse_config_file('conf/mc.conf', d, False)
+        return d.getVar('BBMULTICONFIG').split()
+
     def getVars(self, *vars, target=None):
         self.check_init()
         def fixStream(stream):
@@ -263,6 +272,18 @@ class CIBuilder(Test):
                     values = values + (tinfoil.config_data.getVar(var, True) or 'None',)
             return values if len(values) > 1 else values[0]
 
+    def gen_targets_yaml(self, fn='targets.yml'):
+        targetsfile = os.path.join(os.path.dirname(__file__), 'data', fn)
+        with open(targetsfile, 'w') as f:
+            f.write('a: !mux\n')
+            for target in self.get_targets():
+                f.write(f'  {target}:\n    name: {target}\n')
+            f.write('b: !mux\n')
+            prefix = 'isar-image-'
+            for image in self.get_test_images():
+                nodename = image[image.startswith(prefix) and len(prefix):]
+                f.write(f'  {nodename}:\n    image: {image}\n')
+
     def create_tmp_layer(self):
         tmp_layer_dir = os.path.join(isar_root, 'meta-tmp')
 
diff --git a/testsuite/citest.py b/testsuite/citest.py
index 395b2965..7b504989 100755
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -5,6 +5,7 @@ import os
 from avocado import skipUnless
 from avocado.utils import path
 from cibase import CIBaseTest
+from cibuilder import isar_root
 
 UMOCI_AVAILABLE = True
 SKOPEO_AVAILABLE = True
@@ -808,3 +809,26 @@ class VmBootFull(CIBaseTest):
         self.init()
         self.vm_start('mipsel','bookworm', image='isar-image-ci',
                       script='test_kernel_module.sh example_module')
+
+class World(CIBaseTest):
+
+    """
+    All targets build test
+
+    :avocado: tags=world
+    """
+    def test_world(self):
+        name = self.params.get('name')
+        image = self.params.get('image', default='isar-image-ci')
+        targets = []
+
+        if name is None:
+            self.init()
+            for target in self.get_targets():
+                for image in self.get_test_images():
+                    targets.append(f'mc:{target}:{image}')
+        else:
+            targets.append(f'mc:{name}:{image}')
+            self.init(f'build-{name}')
+
+        self.perform_build_test(targets, container=True)
diff --git a/testsuite/data/targets.yml b/testsuite/data/targets.yml
new file mode 100644
index 00000000..21fd0522
--- /dev/null
+++ b/testsuite/data/targets.yml
@@ -0,0 +1,118 @@
+a: !mux
+  qemuarm-buster:
+    name: qemuarm-buster
+  qemuarm-bullseye:
+    name: qemuarm-bullseye
+  qemuarm-bookworm:
+    name: qemuarm-bookworm
+  qemuarm-trixie:
+    name: qemuarm-trixie
+  qemuarm64-buster:
+    name: qemuarm64-buster
+  qemuarm64-bullseye:
+    name: qemuarm64-bullseye
+  qemuarm64-bookworm:
+    name: qemuarm64-bookworm
+  qemuarm64-trixie:
+    name: qemuarm64-trixie
+  qemui386-buster:
+    name: qemui386-buster
+  qemui386-bullseye:
+    name: qemui386-bullseye
+  qemui386-bookworm:
+    name: qemui386-bookworm
+  qemuamd64-buster:
+    name: qemuamd64-buster
+  qemuamd64-bullseye:
+    name: qemuamd64-bullseye
+  qemuamd64-sb-bullseye:
+    name: qemuamd64-sb-bullseye
+  qemuamd64-bookworm:
+    name: qemuamd64-bookworm
+  qemuamd64-trixie:
+    name: qemuamd64-trixie
+  container-amd64-buster:
+    name: container-amd64-buster
+  container-amd64-bullseye:
+    name: container-amd64-bullseye
+  container-amd64-bookworm:
+    name: container-amd64-bookworm
+  qemumipsel-buster:
+    name: qemumipsel-buster
+  qemumipsel-bullseye:
+    name: qemumipsel-bullseye
+  qemumipsel-bookworm:
+    name: qemumipsel-bookworm
+  qemuriscv64-sid:
+    name: qemuriscv64-sid
+  bananapi-buster:
+    name: bananapi-buster
+  bananapi-bullseye:
+    name: bananapi-bullseye
+  bananapi-bookworm:
+    name: bananapi-bookworm
+  beagleplay-bookworm:
+    name: beagleplay-bookworm
+  de0-nano-soc-buster:
+    name: de0-nano-soc-buster
+  de0-nano-soc-bullseye:
+    name: de0-nano-soc-bullseye
+  de0-nano-soc-bookworm:
+    name: de0-nano-soc-bookworm
+  hikey-bullseye:
+    name: hikey-bullseye
+  hikey-bookworm:
+    name: hikey-bookworm
+  imx6-sabrelite-buster:
+    name: imx6-sabrelite-buster
+  imx6-sabrelite-bullseye:
+    name: imx6-sabrelite-bullseye
+  phyboard-mira-bullseye:
+    name: phyboard-mira-bullseye
+  nanopi-neo-buster:
+    name: nanopi-neo-buster
+  nanopi-neo-bullseye:
+    name: nanopi-neo-bullseye
+  nanopi-neo-bookworm:
+    name: nanopi-neo-bookworm
+  nanopi-neo-efi-bookworm:
+    name: nanopi-neo-efi-bookworm
+  stm32mp15x-bullseye:
+    name: stm32mp15x-bullseye
+  virtualbox-bullseye:
+    name: virtualbox-bullseye
+  virtualbox-bookworm:
+    name: virtualbox-bookworm
+  rpi-arm-bullseye:
+    name: rpi-arm-bullseye
+  rpi-arm-bookworm:
+    name: rpi-arm-bookworm
+  rpi-arm-v7-bullseye:
+    name: rpi-arm-v7-bullseye
+  rpi-arm-v7-bookworm:
+    name: rpi-arm-v7-bookworm
+  rpi-arm-v7l-bullseye:
+    name: rpi-arm-v7l-bullseye
+  rpi-arm-v7l-bookworm:
+    name: rpi-arm-v7l-bookworm
+  rpi-arm64-v8-bullseye:
+    name: rpi-arm64-v8-bullseye
+  rpi-arm64-v8-bookworm:
+    name: rpi-arm64-v8-bookworm
+  sifive-fu540-sid:
+    name: sifive-fu540-sid
+  starfive-visionfive2-sid:
+    name: starfive-visionfive2-sid
+  qemuarm64-focal:
+    name: qemuarm64-focal
+  qemuarm64-jammy:
+    name: qemuarm64-jammy
+  qemuamd64-focal:
+    name: qemuamd64-focal
+  qemuamd64-jammy:
+    name: qemuamd64-jammy
+b: !mux
+  base:
+    image: isar-image-base
+  ci:
+    image: isar-image-ci
diff --git a/testsuite/utils/targets_gen.py b/testsuite/utils/targets_gen.py
new file mode 100755
index 00000000..49e00dd6
--- /dev/null
+++ b/testsuite/utils/targets_gen.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+
+"""
+# This software is a part of Isar.
+# Copyright (C) 2024 ilbers GmbH
+
+# targets_gen.py: Generates yaml for yaml-to-mux Avocado varianter plugin.
+"""
+
+import os
+import sys
+
+sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/..')
+from cibuilder import CIBuilder
+
+class TGen(CIBuilder):
+    def __init__(self):
+        super(CIBuilder, self).__init__()
+        self.gen_targets_yaml()
+    def test():
+        pass
+
+def main():
+    TGen()
+
+if __name__ == "__main__":
+    main()
-- 
2.34.1


      parent reply	other threads:[~2024-03-25 15:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 15:55 [PATCH 00/23] Additional CI improvements Anton Mikanovich
2024-03-25 15:55 ` [PATCH 01/23] CI: Introduce Standard CI for cross building Anton Mikanovich
2024-03-25 15:55 ` [PATCH 02/23] CI: Rename cross to fast Anton Mikanovich
2024-03-25 15:55 ` [PATCH 03/23] CI: Rename nocross to full Anton Mikanovich
2024-03-25 15:55 ` [PATCH 04/23] CI: Remove test keyword from class names Anton Mikanovich
2024-03-25 15:55 ` [PATCH 05/23] CI: Rename base test cases Anton Mikanovich
2024-03-25 15:55 ` [PATCH 06/23] CI: Remove cleanup before nocross build Anton Mikanovich
2024-03-25 15:55 ` [PATCH 07/23] CI: Update default target to bookworm Anton Mikanovich
2024-03-25 15:55 ` [PATCH 08/23] CI: Remove duplicated targets Anton Mikanovich
2024-03-25 15:55 ` [PATCH 09/23] CI: Run startvm for all qemu targets Anton Mikanovich
2024-03-25 15:55 ` [PATCH 10/23] CI: Fix errors reporting during startvm Anton Mikanovich
2024-03-25 15:55 ` [PATCH 11/23] CI: Remove logging hack for job.log Anton Mikanovich
2024-03-25 15:55 ` [PATCH 12/23] CI: Do not lost errors on failed processes Anton Mikanovich
2024-03-25 15:55 ` [PATCH 13/23] CI: Remove container package list hack from testsuite Anton Mikanovich
2024-03-25 15:55 ` [PATCH 14/23] CI: Minimize debsrc_cache checking Anton Mikanovich
2024-03-25 15:55 ` [PATCH 15/23] CI: Minimize kselftest checking Anton Mikanovich
2024-03-25 15:55 ` [PATCH 16/23] CI: Do not include testsuites into each other Anton Mikanovich
2024-03-25 15:55 ` [PATCH 17/23] CI: Mark some single testcases with tags Anton Mikanovich
2024-03-25 15:55 ` [PATCH 18/23] CI: Execute startvm testcases after building Anton Mikanovich
2024-03-25 15:55 ` [PATCH 19/23] CI: Fix missing endline in generated config Anton Mikanovich
2024-03-25 15:55 ` [PATCH 20/23] CI: Remove absolute path to citest.py Anton Mikanovich
2024-03-25 15:55 ` [PATCH 21/23] CI: Create avocado.conf inside build_dir Anton Mikanovich
2024-03-25 15:55 ` [PATCH 22/23] CI: Set also cache dir for Avocado Anton Mikanovich
2024-03-25 15:55 ` Anton Mikanovich [this message]

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=20240325155540.4162990-24-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