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] CI: Restore downstream compatibility for startvm
Date: Thu, 25 Jan 2024 11:09:02 +0200	[thread overview]
Message-ID: <20240125090902.2946108-1-amikan@ilbers.de> (raw)

Downstream CI should not generate running qemu machines if not using
new options. That's why migrate from mandatory stop_vm=True option to
optional keep=True. Default startvm call without any other options will
stop qemu just like it behaved before adding keep alive ability.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 testsuite/cibuilder.py |  8 ++---
 testsuite/citest.py    | 82 +++++++++++++++++-------------------------
 2 files changed, 36 insertions(+), 54 deletions(-)

diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 0f2aa0f5..002a368b 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -562,7 +562,7 @@ BBPATH .= ":${LAYERDIR}"\
     def vm_start(self, arch='amd64', distro='buster',
                  enforce_pcbios=False, skip_modulecheck=False,
                  image='isar-image-base', cmd=None, script=None,
-                 stop_vm=False):
+                 keep=False):
         time_to_wait = self.params.get('time_to_wait', default=DEF_VM_TO_SEC)
 
         self.log.info('===================================================')
@@ -626,18 +626,18 @@ BBPATH .= ":${LAYERDIR}"\
 
             rc, stdout, stderr = self.remote_run(cmd, script, timeout)
             if rc != 0:
-                if stop_vm:
+                if not keep:
                     self.vm_turn_off(vm)
                 self.fail('Failed to run test over ssh')
         else:
             multiconfig = 'mc:qemu' + arch + '-' + distro + ':' + image
             rc = self.vm_parse_output(boot_log, multiconfig, skip_modulecheck)
             if rc != 0:
-                if stop_vm:
+                if not keep:
                     self.vm_turn_off(vm)
                 self.fail('Failed to parse output')
 
-        if stop_vm:
+        if not keep:
             self.vm_turn_off(vm)
 
         return stdout, stderr
diff --git a/testsuite/citest.py b/testsuite/citest.py
index 7efe0059..cdeace56 100755
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -61,18 +61,15 @@ class DevTest(CIBaseTest):
 
     def test_dev_run_amd64_bullseye(self):
         self.init()
-        self.vm_start('amd64', 'bullseye', image='isar-image-ci',
-                      stop_vm=True)
+        self.vm_start('amd64', 'bullseye', image='isar-image-ci')
 
     def test_dev_run_arm64_bullseye(self):
         self.init()
-        self.vm_start('arm64', 'bullseye',
-                      stop_vm=True)
+        self.vm_start('arm64', 'bullseye')
 
     def test_dev_run_arm_bullseye(self):
         self.init()
-        self.vm_start('arm', 'bullseye', skip_modulecheck=True,
-                      stop_vm=True)
+        self.vm_start('arm', 'bullseye', skip_modulecheck=True)
 
 class ReproTest(CIBaseTest):
 
@@ -311,8 +308,7 @@ class SingleTest(CIBaseTest):
         machine = self.params.get('machine', default='qemuamd64')
         distro = self.params.get('distro', default='bullseye')
 
-        self.vm_start(machine.removeprefix('qemu'), distro,
-                      stop_vm=True)
+        self.vm_start(machine.removeprefix('qemu'), distro)
 
 class SourceTest(CIBaseTest):
 
@@ -340,50 +336,47 @@ class VmBootTestFast(CIBaseTest):
 
     def test_arm_bullseye(self):
         self.init()
-        self.vm_start('arm','bullseye', image='isar-image-ci')
+        self.vm_start('arm','bullseye', image='isar-image-ci', keep=True)
 
     def test_arm_bullseye_example_module(self):
         self.init()
         self.vm_start('arm','bullseye', image='isar-image-ci',
-                      cmd='lsmod | grep example_module')
+                      cmd='lsmod | grep example_module', keep=True)
 
     def test_arm_bullseye_getty_target(self):
         self.init()
         self.vm_start('arm','bullseye', image='isar-image-ci',
-                      script='test_systemd_unit.sh getty.target 10',
-                      stop_vm=True)
+                      script='test_systemd_unit.sh getty.target 10')
 
 
     def test_arm_buster(self):
         self.init()
-        self.vm_start('arm','buster', image='isar-image-ci')
+        self.vm_start('arm','buster', image='isar-image-ci', keep=True)
 
     def test_arm_buster_getty_target(self):
         self.init()
         self.vm_start('arm','buster', image='isar-image-ci',
-                      cmd='systemctl is-active getty.target')
+                      cmd='systemctl is-active getty.target', keep=True)
 
     def test_arm_buster_example_module(self):
         self.init()
         self.vm_start('arm','buster', image='isar-image-ci',
-                      script='test_kernel_module.sh example_module',
-                      stop_vm=True)
+                      script='test_kernel_module.sh example_module')
 
 
     def test_arm_bookworm(self):
         self.init()
-        self.vm_start('arm','bookworm', image='isar-image-ci')
+        self.vm_start('arm','bookworm', image='isar-image-ci', keep=True)
 
     def test_arm_bookworm_example_module(self):
         self.init()
         self.vm_start('arm','bookworm', image='isar-image-ci',
-                      cmd='lsmod | grep example_module')
+                      cmd='lsmod | grep example_module', keep=True)
 
     def test_arm_bookworm_getty_target(self):
         self.init()
         self.vm_start('arm','bookworm', image='isar-image-ci',
-                      script='test_systemd_unit.sh getty.target 10',
-                      stop_vm=True)
+                      script='test_systemd_unit.sh getty.target 10')
 
 
 class VmBootTestFull(CIBaseTest):
@@ -396,103 +389,92 @@ class VmBootTestFull(CIBaseTest):
 
     def test_arm_bullseye(self):
         self.init()
-        self.vm_start('arm','bullseye',
-                      stop_vm=True)
+        self.vm_start('arm','bullseye')
 
 
     def test_arm_buster(self):
         self.init()
-        self.vm_start('arm','buster', image='isar-image-ci')
+        self.vm_start('arm','buster', image='isar-image-ci', keep=True)
 
     def test_arm_buster_example_module(self):
         self.init()
         self.vm_start('arm','buster', image='isar-image-ci',
-                      cmd='lsmod | grep example_module')
+                      cmd='lsmod | grep example_module', keep=True)
 
     def test_arm_buster_getty_target(self):
         self.init()
         self.vm_start('arm','buster', image='isar-image-ci',
-                      script='test_systemd_unit.sh getty.target 10',
-                      stop_vm=True)
+                      script='test_systemd_unit.sh getty.target 10')
 
 
     def test_arm64_bullseye(self):
         self.init()
-        self.vm_start('arm64','bullseye', image='isar-image-ci')
+        self.vm_start('arm64','bullseye', image='isar-image-ci', keep=True)
 
     def test_arm64_bullseye_getty_target(self):
         self.init()
         self.vm_start('arm64','bullseye', image='isar-image-ci',
-                      cmd='systemctl is-active getty.target')
+                      cmd='systemctl is-active getty.target', keep=True)
 
     def test_arm64_bullseye_example_module(self):
         self.init()
         self.vm_start('arm64','bullseye', image='isar-image-ci',
-                      script='test_kernel_module.sh example_module',
-                      stop_vm=True)
+                      script='test_kernel_module.sh example_module')
 
 
     def test_i386_buster(self):
         self.init()
-        self.vm_start('i386','buster',
-                      stop_vm=True)
+        self.vm_start('i386','buster')
 
 
     def test_amd64_buster(self):
         self.init()
         # test efi boot
-        self.vm_start('amd64','buster', image='isar-image-ci',
-                      stop_vm=True)
+        self.vm_start('amd64','buster', image='isar-image-ci')
         # test pcbios boot
-        self.vm_start('amd64', 'buster', True, image='isar-image-ci',
-                      stop_vm=True)
+        self.vm_start('amd64', 'buster', True, image='isar-image-ci')
 
 
     def test_amd64_focal(self):
         self.init()
-        self.vm_start('amd64','focal', image='isar-image-ci')
+        self.vm_start('amd64','focal', image='isar-image-ci', keep=True)
 
     def test_amd64_focal_example_module(self):
         self.init()
         self.vm_start('amd64','focal', image='isar-image-ci',
-                      cmd='lsmod | grep example_module')
+                      cmd='lsmod | grep example_module', keep=True)
 
     def test_amd64_focal_getty_target(self):
         self.init()
         self.vm_start('amd64','focal', image='isar-image-ci',
-                      script='test_systemd_unit.sh getty.target 10',
-                      stop_vm=True)
+                      script='test_systemd_unit.sh getty.target 10')
 
 
     def test_amd64_bookworm(self):
         self.init()
-        self.vm_start('amd64', 'bookworm', image='isar-image-ci',
-                      stop_vm=True)
+        self.vm_start('amd64', 'bookworm', image='isar-image-ci')
 
 
     def test_arm_bookworm(self):
         self.init()
-        self.vm_start('arm','bookworm', image='isar-image-ci',
-                      stop_vm=True)
+        self.vm_start('arm','bookworm', image='isar-image-ci')
 
 
     def test_i386_bookworm(self):
         self.init()
-        self.vm_start('i386','bookworm',
-                      stop_vm=True)
+        self.vm_start('i386','bookworm')
 
 
     def test_mipsel_bookworm(self):
         self.init()
-        self.vm_start('mipsel','bookworm', image='isar-image-ci')
+        self.vm_start('mipsel','bookworm', image='isar-image-ci', keep=True)
 
     def test_mipsel_bookworm_getty_target(self):
         self.init()
         self.vm_start('mipsel','bookworm', image='isar-image-ci',
-                      cmd='systemctl is-active getty.target')
+                      cmd='systemctl is-active getty.target', keep=True)
 
     def test_mipsel_bookworm_example_module(self):
         self.init()
         self.vm_start('mipsel','bookworm', image='isar-image-ci',
-                      script='test_kernel_module.sh example_module',
-                      stop_vm=True)
+                      script='test_kernel_module.sh example_module')
-- 
2.34.1


             reply	other threads:[~2024-01-25  9:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25  9:09 Anton Mikanovich [this message]
2024-01-25  9:11 ` Anton Mikanovich
2024-01-31 14:42 ` Uladzimir Bely

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=20240125090902.2946108-1-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