public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Roman Pletnev <rpletnev@ilbers.de>, Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH v2 2/5] start_vm.py: Fix target name handling
Date: Mon, 15 Feb 2021 12:26:32 +0300	[thread overview]
Message-ID: <20210215092635.24511-3-amikan@ilbers.de> (raw)
In-Reply-To: <20210215092635.24511-1-amikan@ilbers.de>

From: Roman Pletnev <rpletnev@ilbers.de>

This patch fix bb_output search (issue with wrong arch name being
selected for qemu). It also add mipsel to the list of supported
architectures, add options -o (output file) and -p (pid file).

Signed-off-by: Roman Pletnev <rpletnev@ilbers.de>
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 testsuite/start_vm.py                  | 20 ++++++++++++++------
 testsuite/vm_boot_test/vm_boot_test.py |  3 ++-
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/testsuite/start_vm.py b/testsuite/start_vm.py
index a3e32ac..dce140e 100755
--- a/testsuite/start_vm.py
+++ b/testsuite/start_vm.py
@@ -17,11 +17,11 @@ def get_bitbake_env(arch, distro):
 def get_bitbake_var(output, var):
     ret = ''
     for line in output.splitlines():
-        if line.startswith(var):
+        if line.startswith(var + '='):
             ret = line.split('"')[1]
     return ret
 
-def format_qemu_cmdline(arch, build, distro):
+def format_qemu_cmdline(arch, build, distro, out, pid):
     bb_output = get_bitbake_env(arch, distro).decode()
 
     rootfs_image = ''
@@ -57,6 +57,11 @@ def format_qemu_cmdline(arch, build, distro):
     qemu_cpu = get_bitbake_var(bb_output, 'QEMU_CPU')
     qemu_disk_args = get_bitbake_var(bb_output, 'QEMU_DISK_ARGS')
 
+    if out:
+        extra_args.extend(['-serial', out])
+    if pid:
+        extra_args.extend(['-pidfile', pid])
+
     qemu_disk_args = qemu_disk_args.replace('##ROOTFS_IMAGE##', deploy_dir_image + '/' + rootfs_image).split()
 
     cmd = ['qemu-system-' + qemu_arch, '-m', '1024M']
@@ -72,17 +77,20 @@ def format_qemu_cmdline(arch, build, distro):
 
     return cmd
 
-def start_qemu(arch, build, distro):
-    cmdline = format_qemu_cmdline(arch, build, distro)
+def start_qemu(arch, build, distro, out, pid):
+    cmdline = format_qemu_cmdline(arch, build, distro, out, pid)
     cmdline.insert(1, '-nographic')
 
+    print(cmdline)
     p1 = subprocess.call(cmdline)
 
 if __name__ == "__main__":
     parser = argparse.ArgumentParser()
-    parser.add_argument('-a', '--arch', choices=['arm', 'arm64', 'amd64', 'i386'], help='set isar machine architecture.', default='arm')
+    parser.add_argument('-a', '--arch', choices=['arm', 'arm64', 'amd64', 'i386', 'mipsel'], help='set isar machine architecture.', default='arm')
     parser.add_argument('-b', '--build', help='set path to build directory.', default=os.getcwd())
     parser.add_argument('-d', '--distro', choices=['jessie', 'stretch'], help='set isar Debian distribution.', default='stretch')
+    parser.add_argument('-o', '--out', help='Route QEMU console output to specified file.')
+    parser.add_argument('-p', '--pid', help='Store QEMU pid to specified file.')
     args = parser.parse_args()
 
-    start_qemu(args.arch, args.build, args.distro)
+    start_qemu(args.arch, args.build, args.distro, args.out, args.pid)
diff --git a/testsuite/vm_boot_test/vm_boot_test.py b/testsuite/vm_boot_test/vm_boot_test.py
index d4849c7..f1b7b1f 100644
--- a/testsuite/vm_boot_test/vm_boot_test.py
+++ b/testsuite/vm_boot_test/vm_boot_test.py
@@ -30,7 +30,8 @@ class VmBootTest(Test):
         if os.path.exists(output_file):
             os.remove(output_file)
 
-        cmdline = start_vm.format_qemu_cmdline(arch, build_dir, distro)
+        cmdline = start_vm.format_qemu_cmdline(arch, build_dir, distro,
+                                               None, None)
         cmdline.insert(1, '-nographic')
         cmdline.append('-serial')
         cmdline.append('file:' + output_file)
-- 
2.25.1


  parent reply	other threads:[~2021-02-15  9:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12 16:41 [PATCH v1 0/6] Update Avocado testsuite Anton Mikanovich
2021-02-12 16:41 ` [PATCH v1 1/6] testsuite: Fix prepare guide for Debian 10 Anton Mikanovich
2021-02-12 16:41 ` [PATCH v1 2/6] start_vm.py: Fix target name handling Anton Mikanovich
2021-02-12 16:41 ` [PATCH v1 3/6] testsuite: Fix format_qemu_cmdline input parameters Anton Mikanovich
2021-02-12 16:41 ` [PATCH v1 4/6] testsuite: Add Python generations for testsuite in gitignore Anton Mikanovich
2021-02-12 16:41 ` [PATCH v1 5/6] testsuite: Fix log file path in vm_boot_test Anton Mikanovich
2021-02-12 16:41 ` [PATCH v1 6/6] ci-build: Add ci_build tests cases to Avocado Anton Mikanovich
2021-02-15  9:26 ` [PATCH v2 0/5] Update Avocado testsuite Anton Mikanovich
2021-02-15  9:26   ` [PATCH v2 1/5] testsuite: Fix prepare guide for Debian 10 Anton Mikanovich
2021-02-15  9:26   ` Anton Mikanovich [this message]
2021-02-15  9:26   ` [PATCH v2 3/5] testsuite: Add Python generations for testsuite in gitignore Anton Mikanovich
2021-02-15  9:26   ` [PATCH v2 4/5] testsuite: Fix log file path in vm_boot_test Anton Mikanovich
2021-02-15  9:26   ` [PATCH v2 5/5] ci-build: Add ci_build tests cases to Avocado Anton Mikanovich
2021-02-15 10:42   ` [PATCH v2 0/5] Update Avocado testsuite Jan Kiszka
2021-02-15 11:41     ` Baurzhan Ismagulov
2021-02-15 13:44       ` Jan Kiszka

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=20210215092635.24511-3-amikan@ilbers.de \
    --to=amikan@ilbers.de \
    --cc=isar-users@googlegroups.com \
    --cc=rpletnev@ilbers.de \
    /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