qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cleber Rosa <crosa@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <pmathieu@redhat.com>,
	"Caio Carrara" <ccarrara@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Cleber Rosa" <crosa@redhat.com>
Subject: [Qemu-devel] [PATCH 1/1] Acceptance tests: add test for set-numa-node error handler fix
Date: Wed, 21 Nov 2018 08:41:51 -0500	[thread overview]
Message-ID: <20181121134151.23993-2-crosa@redhat.com> (raw)
In-Reply-To: <20181121134151.23993-1-crosa@redhat.com>

Commit a22528b918 fixed an issue that is exposed by means of the
"set-numa-node" QMP command (introduced in f3be67812).  This adds a
test that pretty much maps the steps documented on the fix.

Additionally, given that 'set-numa-node' is only allowed in
'preconfig' state, a specific check for that was added a separate
test.

Tests: a22528b918c7d29795129b5a64c4cb44bb57a44d
Reference: f3be67812c226162f86ce92634bd913714445420
CC: Igor Mammedov <imammedo@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
 tests/acceptance/set_numa_node.py | 41 +++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 tests/acceptance/set_numa_node.py

diff --git a/tests/acceptance/set_numa_node.py b/tests/acceptance/set_numa_node.py
new file mode 100644
index 0000000000..0c55315231
--- /dev/null
+++ b/tests/acceptance/set_numa_node.py
@@ -0,0 +1,41 @@
+# Tests for QMP set-numa-node related behavior and regressions
+#
+# Copyright (c) 2018 Red Hat, Inc.
+#
+# Author:
+#  Cleber Rosa <crosa@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+from avocado_qemu import Test
+
+
+class SetNumaNode(Test):
+    """
+    :avocado: enable
+    :avocado: tags=quick,numa
+    """
+    def test_numa_not_supported(self):
+        self.vm.add_args('-nodefaults', '-S', '-preconfig')
+        self.vm.set_machine('none')
+        self.vm.launch()
+        res = self.vm.qmp('set-numa-node', type='node')
+        self.assertIsNotNone(res, 'Unexpected empty QMP response to "set-numa-node"')
+        self.assertEqual(res['error']['class'], 'GenericError')
+        self.assertEqual(res['error']['desc'],
+                         'NUMA is not supported by this machine-type')
+        self.assertTrue(self.vm.is_running())
+        self.vm.qmp('x-exit-preconfig')
+        self.vm.shutdown()
+        self.assertEqual(self.vm.exitcode(), 0)
+
+    def test_no_preconfig(self):
+        self.vm.add_args('-nodefaults', '-S')
+        self.vm.set_machine('none')
+        self.vm.launch()
+        res = self.vm.qmp('set-numa-node', type='node')
+        self.assertIsNotNone(res, 'Unexpected empty QMP response to "set-numa-node"')
+        self.assertEqual(res['error']['class'], 'GenericError')
+        self.assertEqual(res['error']['desc'],
+                         "The command is permitted only in 'preconfig' state")
-- 
2.19.1

  reply	other threads:[~2018-11-21 13:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21 13:41 [Qemu-devel] [PATCH 0/1] Acceptance tests: add test for set-numa-node error handler fix Cleber Rosa
2018-11-21 13:41 ` Cleber Rosa [this message]
2018-11-21 15:50   ` [Qemu-devel] [PATCH 1/1] " Markus Armbruster
2018-11-21 16:17     ` Cleber Rosa
2018-11-22 12:19   ` Wainer dos Santos Moschetta
2018-11-22 15:32     ` Cleber Rosa

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=20181121134151.23993-2-crosa@redhat.com \
    --to=crosa@redhat.com \
    --cc=armbru@redhat.com \
    --cc=ccarrara@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=pmathieu@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 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).