From: Cleber Rosa <crosa@redhat.com>
To: Wainer dos Santos Moschetta <wainersm@redhat.com>
Cc: philmd@redhat.com, qemu-devel@nongnu.org, ehabkost@redhat.com
Subject: Re: [PATCH 2/2] tests/acceptance: Makes linux_initrd and empty_cpu_model use QEMUMachine
Date: Tue, 10 Dec 2019 00:24:25 -0500 [thread overview]
Message-ID: <20191210052425.GH31990@localhost.localdomain> (raw)
In-Reply-To: <20191112135801.854-3-wainersm@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3243 bytes --]
On Tue, Nov 12, 2019 at 08:58:01AM -0500, Wainer dos Santos Moschetta wrote:
> On linux_initrd and empty_cpu_model tests the same effect of
> calling QEMU through run() to inspect the terminated process is
> achieved with a sequence of set_qmp_monitor() / launch() / wait()
> commands on an QEMUMachine object. This patch changes those
> tests to use QEMUMachine instead, so they follow the same pattern
> to launch QEMU found on other acceptance tests.
>
> Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> ---
> tests/acceptance/empty_cpu_model.py | 13 +++++++------
> tests/acceptance/linux_initrd.py | 13 +++++++------
> 2 files changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/tests/acceptance/empty_cpu_model.py b/tests/acceptance/empty_cpu_model.py
> index 3f4f663582..8c20a4ef4a 100644
> --- a/tests/acceptance/empty_cpu_model.py
> +++ b/tests/acceptance/empty_cpu_model.py
> @@ -7,13 +7,14 @@
> #
> # This work is licensed under the terms of the GNU GPL, version 2 or
> # later. See the COPYING file in the top-level directory.
> -import subprocess
> from avocado_qemu import Test
>
> class EmptyCPUModel(Test):
> def test(self):
> - cmd = [self.qemu_bin, '-S', '-display', 'none', '-machine', 'none', '-cpu', '']
> - r = subprocess.run(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
> - self.assertEquals(r.returncode, 1, "QEMU exit code should be 1")
> - self.assertEquals(r.stdout, b'', "QEMU stdout should be empty")
> - self.assertNotEquals(r.stderr, b'', "QEMU stderr shouldn't be empty")
> + self.vm.add_args('-S', '-display', 'none', '-machine', 'none',
> + '-cpu', '')
> + self.vm.set_qmp_monitor(disabled=True)
> + self.vm.launch()
> + self.vm.wait()
> + self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
> + self.assertRegex(self.vm.get_log(), r'-cpu option cannot be empty')
> diff --git a/tests/acceptance/linux_initrd.py b/tests/acceptance/linux_initrd.py
> index c61d9826a4..158ec4d46c 100644
> --- a/tests/acceptance/linux_initrd.py
> +++ b/tests/acceptance/linux_initrd.py
> @@ -10,7 +10,6 @@
>
> import logging
> import tempfile
> -from avocado.utils.process import run
>
> from avocado_qemu import Test
>
> @@ -41,13 +40,15 @@ class LinuxInitrd(Test):
> initrd.seek(max_size)
> initrd.write(b'\0')
> initrd.flush()
> - cmd = "%s -kernel %s -initrd %s -m 4096" % (
> - self.qemu_bin, kernel_path, initrd.name)
> - res = run(cmd, ignore_status=True)
> - self.assertEqual(res.exit_status, 1)
> + self.vm.add_args('-kernel', kernel_path, '-initrd', initrd.name,
> + '-m', '4096')
> + self.vm.set_qmp_monitor(disabled=True)
Like I've said on the previous patch, I'd personally go with
`enabled=True` as the default method signature, so this would become
`enabled=False`, or simply:
self.vm.set_qmp_monitor(False)
But either way,
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Tested-by: Cleber Rosa <crosa@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-12-10 5:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-12 13:57 [PATCH 0/2] tests/acceptance: Use QEMUMachine on tests that expect failure Wainer dos Santos Moschetta
2019-11-12 13:58 ` [PATCH 1/2] python/qemu: Add set_qmp_monitor() to QEMUMachine Wainer dos Santos Moschetta
2019-12-10 5:17 ` Cleber Rosa
2019-12-11 14:55 ` Wainer dos Santos Moschetta
2019-11-12 13:58 ` [PATCH 2/2] tests/acceptance: Makes linux_initrd and empty_cpu_model use QEMUMachine Wainer dos Santos Moschetta
2019-12-10 5:24 ` Cleber Rosa [this message]
2019-12-09 17:44 ` [PATCH 0/2] tests/acceptance: Use QEMUMachine on tests that expect failure Wainer dos Santos Moschetta
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=20191210052425.GH31990@localhost.localdomain \
--to=crosa@redhat.com \
--cc=ehabkost@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wainersm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.