From patchwork Tue Jan 11 16:55:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 472111 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0BGtupQ019147 for ; Tue, 11 Jan 2011 16:55:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932300Ab1AKQzx (ORCPT ); Tue, 11 Jan 2011 11:55:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:20740 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932296Ab1AKQzx (ORCPT ); Tue, 11 Jan 2011 11:55:53 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0BGtpKr016217 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 11 Jan 2011 11:55:52 -0500 Received: from freedom.redhat.com (vpn-10-242.rdu.redhat.com [10.11.10.242]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0BGtnmB025503; Tue, 11 Jan 2011 11:55:50 -0500 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, lcapitulino@redhat.com, Lucas Meneghel Rodrigues , Qingtang Zhou Subject: [PATCH] KVM test: qmp_basic: Go through available monitors to find a qmp one Date: Tue, 11 Jan 2011 14:55:47 -0200 Message-Id: <1294764947-22044-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 11 Jan 2011 16:55:57 +0000 (UTC) diff --git a/client/tests/kvm/tests/qmp_basic.py b/client/tests/kvm/tests/qmp_basic.py index 952da99..94ba9ee 100644 --- a/client/tests/kvm/tests/qmp_basic.py +++ b/client/tests/kvm/tests/qmp_basic.py @@ -1,4 +1,4 @@ -import kvm_test_utils +import kvm_test_utils, kvm_monitor from autotest_lib.client.common_lib import error def run_qmp_basic(test, params, env): @@ -384,13 +384,22 @@ def run_qmp_basic(test, params, env): vm = env.get_vm(params["main_vm"]) vm.verify_alive() + # Look for the first qmp monitor available, otherwise, fail the test + qmp_monitor = None + for m in vm.monitors: + if isinstance(m, kvm_monitor.QMPMonitor): + qmp_monitor = m + + if qmp_monitor is None: + raise error.TestError('Could not find a QMP monitor, aborting test') + # Run all suites - greeting_suite(vm.monitor) - input_object_suite(vm.monitor) - argument_checker_suite(vm.monitor) - unknown_commands_suite(vm.monitor) - json_parsing_errors_suite(vm.monitor) + greeting_suite(qmp_monitor) + input_object_suite(qmp_monitor) + argument_checker_suite(qmp_monitor) + unknown_commands_suite(qmp_monitor) + json_parsing_errors_suite(qmp_monitor) # check if QMP is still alive - if not vm.monitor.is_responsive(): - raise error.TestFail('QEMU is not alive after QMP testing') + if not qmp_monitor.is_responsive(): + raise error.TestFail('QMP monitor is not responsive after testing')