From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Pavel Dovgalyuk <Pavel.Dovgaluk@gmail.com>, qemu-devel@nongnu.org
Cc: wrampazz@redhat.com, dovgaluk@ispras.ru,
pavel.dovgaluk@ispras.ru, crosa@redhat.com, pbonzini@redhat.com,
alex.bennee@linaro.org, ehabkost@redhat.com
Subject: Re: [PATCH v3 10/11] tests/acceptance: refactor boot_linux to allow code reuse
Date: Sun, 31 May 2020 14:04:41 +0200 [thread overview]
Message-ID: <235f4ab0-6f2a-e63c-0960-524f4d045a5c@redhat.com> (raw)
In-Reply-To: <159073593167.20809.17582679291556188984.stgit@pasha-ThinkPad-X280>
On 5/29/20 9:05 AM, Pavel Dovgalyuk wrote:
> This patch moves image downloading functions to the separate class to allow
> reusing them from record/replay tests.
>
> Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
> ---
> 0 files changed
>
> diff --git a/tests/acceptance/boot_linux.py b/tests/acceptance/boot_linux.py
> index 075a386300..3aa57e88b0 100644
> --- a/tests/acceptance/boot_linux.py
> +++ b/tests/acceptance/boot_linux.py
> @@ -26,22 +26,8 @@ KVM_NOT_AVAILABLE = ACCEL_NOT_AVAILABLE_FMT % "KVM"
> TCG_NOT_AVAILABLE = ACCEL_NOT_AVAILABLE_FMT % "TCG"
>
>
> -class BootLinux(Test):
> - """
> - Boots a Linux system, checking for a successful initialization
> - """
> -
> - timeout = 900
> - chksum = None
> -
> - def setUp(self):
> - super(BootLinux, self).setUp()
> - self.vm.add_args('-smp', '2')
> - self.vm.add_args('-m', '1024')
> - self.prepare_boot()
> - self.prepare_cloudinit()
> -
> - def prepare_boot(self):
> +class BootLinuxBase(Test):
> + def download_boot(self):
> self.log.debug('Looking for and selecting a qemu-img binary to be '
> 'used to create the bootable snapshot image')
> # If qemu-img has been built, use it, otherwise the system wide one
> @@ -60,17 +46,17 @@ class BootLinux(Test):
> if image_arch == 'ppc64':
> image_arch = 'ppc64le'
> try:
> - self.boot = vmimage.get(
> + boot = vmimage.get(
> 'fedora', arch=image_arch, version='31',
> checksum=self.chksum,
> algorithm='sha256',
> cache_dir=self.cache_dirs[0],
> snapshot_dir=self.workdir)
> - self.vm.add_args('-drive', 'file=%s' % self.boot.path)
> except:
> self.cancel('Failed to download/prepare boot image')
> + return boot.path
>
> - def prepare_cloudinit(self):
> + def download_cloudinit(self):
> self.log.info('Preparing cloudinit image')
> try:
> cloudinit_iso = os.path.join(self.workdir, 'cloudinit.iso')
> @@ -81,9 +67,32 @@ class BootLinux(Test):
> # QEMU's hard coded usermode router address
> phone_home_host='10.0.2.2',
> phone_home_port=self.phone_home_port)
> - self.vm.add_args('-drive', 'file=%s,format=raw' % cloudinit_iso)
> except Exception:
> self.cancel('Failed to prepared cloudinit image')
> + return cloudinit_iso
> +
> +class BootLinux(BootLinuxBase):
> + """
> + Boots a Linux system, checking for a successful initialization
> + """
> +
> + timeout = 900
> + chksum = None
> +
> + def setUp(self):
> + super(BootLinux, self).setUp()
> + self.vm.add_args('-smp', '2')
> + self.vm.add_args('-m', '1024')
> + self.prepare_boot()
> + self.prepare_cloudinit()
> +
> + def prepare_boot(self):
> + path = self.download_boot()
> + self.vm.add_args('-drive', 'file=%s' % path)
> +
> + def prepare_cloudinit(self):
> + cloudinit_iso = self.download_cloudinit()
> + self.vm.add_args('-drive', 'file=%s,format=raw' % cloudinit_iso)
>
> def launch_and_wait(self):
> self.vm.set_console()
>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
next prev parent reply other threads:[~2020-05-31 12:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-29 7:04 [PATCH v3 00/11] Record/replay acceptance tests Pavel Dovgalyuk
2020-05-29 7:04 ` [PATCH v3 01/11] tests/acceptance: allow console interaction with specific VMs Pavel Dovgalyuk
2020-05-29 7:04 ` [PATCH v3 02/11] tests/acceptance: refactor boot_linux_console test to allow code reuse Pavel Dovgalyuk
2020-05-29 7:04 ` [PATCH v3 03/11] tests/acceptance: add base class record/replay kernel tests Pavel Dovgalyuk
2020-05-29 7:04 ` [PATCH v3 04/11] tests/acceptance: add kernel record/replay test for x86_64 Pavel Dovgalyuk
2020-05-29 7:05 ` [PATCH v3 05/11] tests/acceptance: add record/replay test for aarch64 Pavel Dovgalyuk
2020-05-29 7:05 ` [PATCH v3 06/11] tests/acceptance: add record/replay test for arm Pavel Dovgalyuk
2020-05-29 7:05 ` [PATCH v3 07/11] tests/acceptance: add record/replay test for ppc64 Pavel Dovgalyuk
2020-05-29 7:05 ` [PATCH v3 08/11] tests/acceptance: add record/replay test for m68k Pavel Dovgalyuk
2020-06-19 16:08 ` Laurent Vivier
2020-05-29 7:05 ` [PATCH v3 09/11] tests/acceptance: record/replay tests with advcal images Pavel Dovgalyuk
2020-06-21 11:51 ` Philippe Mathieu-Daudé
2020-05-29 7:05 ` [PATCH v3 10/11] tests/acceptance: refactor boot_linux to allow code reuse Pavel Dovgalyuk
2020-05-31 12:04 ` Philippe Mathieu-Daudé [this message]
2020-05-29 7:05 ` [PATCH v3 11/11] tests/acceptance: Linux boot test for record/replay Pavel Dovgalyuk
2020-06-22 8:03 ` Philippe Mathieu-Daudé
2020-06-22 8:54 ` Philippe Mathieu-Daudé
2020-05-31 15:09 ` [PATCH v3 00/11] Record/replay acceptance tests Philippe Mathieu-Daudé
2020-06-20 23:36 ` Philippe Mathieu-Daudé
2020-06-22 7:44 ` Pavel Dovgalyuk
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=235f4ab0-6f2a-e63c-0960-524f4d045a5c@redhat.com \
--to=philmd@redhat.com \
--cc=Pavel.Dovgaluk@gmail.com \
--cc=alex.bennee@linaro.org \
--cc=crosa@redhat.com \
--cc=dovgaluk@ispras.ru \
--cc=ehabkost@redhat.com \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wrampazz@redhat.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;
as well as URLs for NNTP newsgroup(s).