public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: Uladzimir Bely <ubely@ilbers.de>
Cc: isar-users@googlegroups.com
Subject: Re: [PATCH 02/11] testsuite: Allow custom image names in start_vm.py
Date: Tue, 24 Jan 2023 07:59:18 +0100	[thread overview]
Message-ID: <20230124075918.0f68283a@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <20230113071942.22506-3-ubely@ilbers.de>

Am Fri, 13 Jan 2023 08:19:33 +0100
schrieb Uladzimir Bely <ubely@ilbers.de>:

> This removes hardcoded `isar-image-base` image name used in
> `testsuite/start_vm.py`.
> 
> Now, user can pass custom value with `-i` or `--image` option
> (e.g. `isar-image-debug` or any other value used in their downstream.
> 
> Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
> ---
>  testsuite/cibuilder.py |  6 +++---
>  testsuite/citest.py    |  2 +-
>  testsuite/start_vm.py  | 21 +++++++++++----------
>  3 files changed, 15 insertions(+), 14 deletions(-)
> 
> diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
> index 6a3cf052..9139cd7b 100755
> --- a/testsuite/cibuilder.py
> +++ b/testsuite/cibuilder.py
> @@ -201,7 +201,7 @@ class CIBuilder(Test):
>  
>          return env['LAYERDIR_' + layer].strip('"')
>  
> -    def vm_start(self, arch='amd64', distro='buster',
> enforce_pcbios=False):
> +    def vm_start(self, arch='amd64', distro='buster',
> image='isar-image-base', enforce_pcbios=False): time_to_wait =
> self.params.get('time_to_wait', default=60) 
>          self.log.info('===================================================')
> @@ -224,7 +224,7 @@ class CIBuilder(Test):
>              os.unlink(latest_link)
>          os.symlink(os.path.basename(output_file), latest_link)
>  
> -        cmdline = start_vm.format_qemu_cmdline(arch, self.build_dir,
> distro,
> +        cmdline = start_vm.format_qemu_cmdline(arch, self.build_dir,
> distro, image, output_file, None, enforce_pcbios)
>          cmdline.insert(1, '-nographic')
>  
> @@ -235,7 +235,7 @@ class CIBuilder(Test):
>          module_output = b'Just an example'
>          resize_output = None
>  
> -        bb_output = start_vm.get_bitbake_env(arch, distro).decode()
> +        bb_output = start_vm.get_bitbake_env(arch, distro,
> image).decode() image_fstypes = start_vm.get_bitbake_var(bb_output,
> 'IMAGE_FSTYPES') wks_file = start_vm.get_bitbake_var(bb_output,
> 'WKS_FILE') # only the first type will be tested in start_vm.py
> diff --git a/testsuite/citest.py b/testsuite/citest.py
> index 7aa1e6b5..08a2a00e 100755
> --- a/testsuite/citest.py
> +++ b/testsuite/citest.py
> @@ -351,7 +351,7 @@ class VmBootTestFull(CIBaseTest):
>          # test efi boot
>          self.vm_start('amd64','buster')
>          # test pcbios boot
> -        self.vm_start('amd64', 'buster', True)
> +        self.vm_start('amd64', 'buster', enforce_pcbios=True)

i would move that to "all names", not a mix of names and positional

Henning

>      def test_amd64_focal(self):
>          self.init()
> diff --git a/testsuite/start_vm.py b/testsuite/start_vm.py
> index 82fe489e..d6c47dcd 100755
> --- a/testsuite/start_vm.py
> +++ b/testsuite/start_vm.py
> @@ -9,8 +9,8 @@ import subprocess
>  import sys
>  import time
>  
> -def get_bitbake_env(arch, distro):
> -    multiconfig = 'mc:qemu' + arch + '-' + distro +
> ':isar-image-base' +def get_bitbake_env(arch, distro, image):
> +    multiconfig = 'mc:qemu' + arch + '-' + distro + ':' + image
>      output = subprocess.check_output(['bitbake', '-e',
> str(multiconfig)]) return output
>  
> @@ -21,18 +21,19 @@ def get_bitbake_var(output, var):
>              ret = line.split('"')[1]
>      return ret
>  
> -def format_qemu_cmdline(arch, build, distro, out, pid,
> enforce_pcbios=False):
> -    bb_output = get_bitbake_env(arch, distro).decode()
> +def format_qemu_cmdline(arch, build, distro, image, out, pid,
> enforce_pcbios=False):
> +    bb_output = get_bitbake_env(arch, distro, image).decode()
>  
> -    rootfs_image = ''
>      extra_args = ''
>      cpu = ['']
>  
>      image_type = get_bitbake_var(bb_output,
> 'IMAGE_FSTYPES').split()[0] deploy_dir_image =
> get_bitbake_var(bb_output, 'DEPLOY_DIR_IMAGE') base = 'ubuntu' if
> distro in ['focal', 'bionic'] else 'debian' +
> +    rootfs_image = image + '-' + base + '-' + distro + '-qemu' +
> arch + '.' + image_type +
>      if image_type == 'ext4':
> -        rootfs_image = 'isar-image-base-' + base + '-' + distro +
> '-qemu' + arch + '.ext4' kernel_image = deploy_dir_image + '/' +
> get_bitbake_var(bb_output, 'KERNEL_IMAGE') initrd_image =
> get_bitbake_var(bb_output, 'INITRD_IMAGE') 
> @@ -48,7 +49,6 @@ def format_qemu_cmdline(arch, build, distro, out,
> pid, enforce_pcbios=False): extra_args = ['-kernel', kernel_image,
> '-initrd', initrd_image] extra_args.extend(kargs)
>      elif image_type == 'wic':
> -        rootfs_image = 'isar-image-base-' + base + '-' + distro +
> '-qemu' + arch + '.wic' extra_args = ['-snapshot']
>      else:
>          raise ValueError('Invalid image type: ' + str(image_type))
> @@ -87,8 +87,8 @@ def format_qemu_cmdline(arch, build, distro, out,
> pid, enforce_pcbios=False): 
>      return cmd
>  
> -def start_qemu(arch, build, distro, out, pid, enforce_pcbios):
> -    cmdline = format_qemu_cmdline(arch, build, distro, out, pid,
> enforce_pcbios) +def start_qemu(arch, build, distro, image, out, pid,
> enforce_pcbios):
> +    cmdline = format_qemu_cmdline(arch, build, distro, image, out,
> pid, enforce_pcbios) cmdline.insert(1, '-nographic')
>  
>      print(cmdline)
> @@ -99,9 +99,10 @@ if __name__ == "__main__":
>      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=['buster', 'bullseye', 'bookworm'], help='set
> isar Debian distribution.', default='bookworm')
> +    parser.add_argument('-i', '--image', help='set image name.',
> default='isar-image-base') 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.') parser.add_argument('--pcbios', action="store_true",
> help='remove any bios options to enforce use of pc bios') args =
> parser.parse_args() 
> -    start_qemu(args.arch, args.build, args.distro, args.out,
> args.pid, args.pcbios)
> +    start_qemu(args.arch, args.build, args.distro, args.image,
> args.out, args.pid, args.pcbios)


  reply	other threads:[~2023-01-24  6:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13  7:19 [PATCH 00/11] Support running custom commands in VM Uladzimir Bely
2023-01-13  7:19 ` [PATCH 01/11] testsuite: Fix failing hostname service in qemu guest Uladzimir Bely
2023-01-13  7:19 ` [PATCH 02/11] testsuite: Allow custom image names in start_vm.py Uladzimir Bely
2023-01-24  6:59   ` Henning Schild [this message]
2023-01-13  7:19 ` [PATCH 03/11] testsuite: Fix terminal broken after run test executed Uladzimir Bely
2023-01-13  7:19 ` [PATCH 04/11] testsuite: Add SSH key pair for using in CI Uladzimir Bely
2023-01-13  7:19 ` [PATCH 05/11] image-account-extension: Add copy-ci-key flag for user Uladzimir Bely
2023-01-24  7:09   ` Henning Schild
2023-01-24  7:18     ` Henning Schild
2023-01-25  7:36       ` Uladzimir Bely
2023-01-25  8:45         ` Henning Schild
2023-01-13  7:19 ` [PATCH 06/11] meta-isar: Fix PCI bus initialization in qemuarm machine Uladzimir Bely
2023-02-08 13:03   ` Uladzimir Bely
2023-01-13  7:19 ` [PATCH 07/11] testsuite: Use random free port for qemu SSH forwarding Uladzimir Bely
2023-01-24  7:11   ` Henning Schild
2023-02-08 13:04   ` Uladzimir Bely
2023-01-13  7:19 ` [PATCH 08/11] testsuite: Support running custom commands in VM Uladzimir Bely
2023-01-24  7:14   ` Henning Schild
2023-01-24  7:14     ` Henning Schild
2023-01-13  7:19 ` [PATCH 09/11] meta-isar: Use a separate image recipe in CI Uladzimir Bely
2023-01-13  7:19 ` [PATCH 10/11] isar-image-ci: Make ethernet inerface auto bring up in ubuntu-focal Uladzimir Bely
2023-01-24  7:24   ` Henning Schild
2023-01-24  7:27     ` Henning Schild
2023-01-13  7:19 ` [PATCH 11/11] testsuite: Run custom commands on some qemu targets Uladzimir Bely
2023-01-24  7:39   ` 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=20230124075918.0f68283a@md1za8fc.ad001.siemens.net \
    --to=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=ubely@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