From patchwork Fri Jan 7 18:48:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 465031 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 p07ImGtI012422 for ; Fri, 7 Jan 2011 18:48:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754092Ab1AGSsF (ORCPT ); Fri, 7 Jan 2011 13:48:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36188 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754037Ab1AGSsD (ORCPT ); Fri, 7 Jan 2011 13:48:03 -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 p07Im1Om004741 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 7 Jan 2011 13:48:01 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p07Im1gR031910; Fri, 7 Jan 2011 13:48:01 -0500 Received: from moof.tlv.redhat.com (dhcp-1-185.tlv.redhat.com [10.35.1.185]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p07IlkZR032671; Fri, 7 Jan 2011 13:48:00 -0500 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH v3 11/11] KVM test: use error.context() in guest_s4 Date: Fri, 7 Jan 2011 20:48:11 +0200 Message-Id: <1294426091-16704-11-git-send-email-mgoldish@redhat.com> In-Reply-To: <1294426091-16704-1-git-send-email-mgoldish@redhat.com> References: <1294426091-16704-1-git-send-email-mgoldish@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]); Fri, 07 Jan 2011 18:48:19 +0000 (UTC) diff --git a/client/tests/kvm/tests/guest_s4.py b/client/tests/kvm/tests/guest_s4.py index 7f61c33..5641654 100644 --- a/client/tests/kvm/tests/guest_s4.py +++ b/client/tests/kvm/tests/guest_s4.py @@ -3,6 +3,7 @@ from autotest_lib.client.common_lib import error import kvm_test_utils, kvm_utils +@error.context_aware def run_guest_s4(test, params, env): """ Suspend guest to disk, supports both Linux & Windows OSes. @@ -11,13 +12,15 @@ def run_guest_s4(test, params, env): @param params: Dictionary with test parameters. @param env: Dictionary with the test environment. """ + error.base_context("before S4") vm = env.get_vm(params["main_vm"]) vm.verify_alive() timeout = int(params.get("login_timeout", 360)) session = vm.wait_for_login(timeout=timeout) - logging.info("Checking whether guest OS supports suspend to disk (S4)...") + error.context("checking whether guest OS supports S4", logging.info) session.cmd(params.get("check_s4_support_cmd")) + error.context() logging.info("Waiting until all guest OS services are fully started...") time.sleep(float(params.get("services_up_timeout", 30))) @@ -32,15 +35,19 @@ def run_guest_s4(test, params, env): session2 = vm.wait_for_login(timeout=timeout) # Make sure the background program is running as expected + error.context("making sure background program is running") check_s4_cmd = params.get("check_s4_cmd") session2.cmd(check_s4_cmd) logging.info("Launched background command in guest: %s" % test_s4_cmd) + error.context() + error.base_context() # Suspend to disk logging.info("Starting suspend to disk now...") session2.sendline(params.get("set_s4_cmd")) # Make sure the VM goes down + error.base_context("after S4") suspend_timeout = 240 + int(params.get("smp")) * 60 if not kvm_utils.wait_for(vm.is_dead, suspend_timeout, 2, 2): raise error.TestFail("VM refuses to go down. Suspend failed.") @@ -58,8 +65,10 @@ def run_guest_s4(test, params, env): session2 = vm.wait_for_login(timeout=relogin_timeout) # Check whether the test command is still alive - logging.info("Checking if background command is still alive...") + error.context("making sure background program is still running", + logging.info) session2.cmd(check_s4_cmd) + error.context() logging.info("VM resumed successfuly after suspend to disk") session2.cmd_output(params.get("kill_test_s4_cmd"))