From patchwork Wed Nov 21 13:41:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 10692589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 69B9C13BB for ; Wed, 21 Nov 2018 13:56:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59E4C2BC28 for ; Wed, 21 Nov 2018 13:56:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D5E62BC6A; Wed, 21 Nov 2018 13:56:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D36192BC2A for ; Wed, 21 Nov 2018 13:56:33 +0000 (UTC) Received: from localhost ([::1]:39276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPSzZ-00084J-0q for patchwork-qemu-devel@patchwork.kernel.org; Wed, 21 Nov 2018 08:56:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPSyS-0006mz-CP for qemu-devel@nongnu.org; Wed, 21 Nov 2018 08:55:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPSlQ-0004Xy-9d for qemu-devel@nongnu.org; Wed, 21 Nov 2018 08:41:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49978) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPSlQ-0004Ws-4a for qemu-devel@nongnu.org; Wed, 21 Nov 2018 08:41:56 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E046308429C for ; Wed, 21 Nov 2018 13:41:55 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-125-180.rdu2.redhat.com [10.10.125.180]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48BE06A529; Wed, 21 Nov 2018 13:41:54 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Wed, 21 Nov 2018 08:41:51 -0500 Message-Id: <20181121134151.23993-2-crosa@redhat.com> In-Reply-To: <20181121134151.23993-1-crosa@redhat.com> References: <20181121134151.23993-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 21 Nov 2018 13:41:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/1] Acceptance tests: add test for set-numa-node error handler fix X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Cleber Rosa , Markus Armbruster , Wainer dos Santos Moschetta , =?utf-8?q?Philippe_Mathi?= =?utf-8?q?eu-Daud=C3=A9?= , Caio Carrara , Igor Mammedov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 CC: Markus Armbruster Signed-off-by: Cleber Rosa --- 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 +# +# 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")