aboutsummaryrefslogtreecommitdiff
path: root/tests/acceptance/linux_initrd.py
diff options
context:
space:
mode:
authorWainer dos Santos Moschetta <wainersm@redhat.com>2019-12-11 13:55:36 -0500
committerCleber Rosa <crosa@redhat.com>2019-12-16 10:59:50 -0500
commitc80c6beb171c3175a14ddb99217dc7b89354a9a3 (patch)
tree189ac870437193416599ee7e2dbdfb4745ddcc07 /tests/acceptance/linux_initrd.py
parent74b56bb5539553d93908d6acb2bc2c5e2f019f7d (diff)
tests/acceptance: Makes linux_initrd and empty_cpu_model use QEMUMachine
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> Reviewed-by: Cleber Rosa <crosa@redhat.com> Tested-by: Cleber Rosa <crosa@redhat.com> Message-Id: <20191211185536.16962-3-wainersm@redhat.com> Signed-off-by: Cleber Rosa <crosa@redhat.com>
Diffstat (limited to 'tests/acceptance/linux_initrd.py')
-rw-r--r--tests/acceptance/linux_initrd.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/acceptance/linux_initrd.py b/tests/acceptance/linux_initrd.py
index c61d9826a4..aaa4eb9698 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(enabled=False)
+ self.vm.launch()
+ self.vm.wait()
+ self.assertEqual(self.vm.exitcode(), 1)
expected_msg = r'.*initrd is too large.*max: \d+, need %s.*' % (
max_size + 1)
- self.assertRegex(res.stderr_text, expected_msg)
+ self.assertRegex(self.vm.get_log(), expected_msg)
def test_with_2gib_file_should_work_with_linux_v4_16(self):
"""