From patchwork Mon Apr 28 10:41:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 29193 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 70E35202FE for ; Mon, 28 Apr 2014 10:42:33 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wn1sf40072459obc.5 for ; Mon, 28 Apr 2014 03:42:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=om3fisoIz/8cc3xyJexZGT6nyTAU8CCVZHgc9hPx+2w=; b=NAUXcJnpI2RPN7szarN0XbN4OkopfUOOCn4pqEBkPfQ0O5DaaB+OleXVEHTtomUt+X r7OXftUykC19OuzH9u3sL+fO9x18Xch4U9d8B6bj/tofhb3V64oPt9CCGHWAgCuqNN32 E5eMrQxvaywk5f8wYUUI7/1qTf+w21wfmDFlYPsi778yvvTkfnfl/SvDbkO4EdPx3Rfi xSms18kjMeEu98knyODZKKD9a6QU6kwg2SFZ0OkvIckkfCYagtToMWdk+fVZvuVw/EWN 8Z5qh26EwuSWlP7P1BySlokMwXPDzZHrjD9ec5ySyUUFWxb04RNcntcynV3GIXoCBVNK xXHg== X-Gm-Message-State: ALoCoQmwuaQ6PPEhCadxem6+w1st8WXYGvox6+tZ2lOPX7xurAoheolO8qCkVkAAPeG7Dh5dTYRo X-Received: by 10.182.98.230 with SMTP id el6mr12682421obb.10.1398681752979; Mon, 28 Apr 2014 03:42:32 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.94.118 with SMTP id f109ls2402414qge.8.gmail; Mon, 28 Apr 2014 03:42:32 -0700 (PDT) X-Received: by 10.220.184.72 with SMTP id cj8mr7425391vcb.10.1398681752852; Mon, 28 Apr 2014 03:42:32 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id ie18si3524657vec.175.2014.04.28.03.42.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Apr 2014 03:42:32 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hr9so7864606vcb.15 for ; Mon, 28 Apr 2014 03:42:32 -0700 (PDT) X-Received: by 10.58.123.71 with SMTP id ly7mr23176421veb.11.1398681752786; Mon, 28 Apr 2014 03:42:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp107023vcb; Mon, 28 Apr 2014 03:42:31 -0700 (PDT) X-Received: by 10.224.67.195 with SMTP id s3mr2295033qai.96.1398681751713; Mon, 28 Apr 2014 03:42:31 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id n1si7539396qcr.55.2014.04.28.03.42.31 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 28 Apr 2014 03:42:31 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wej0M-0007rP-Dz; Mon, 28 Apr 2014 10:41:46 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wej0K-0007pc-46 for xen-devel@lists.xen.org; Mon, 28 Apr 2014 10:41:44 +0000 Received: from [85.158.139.211:44407] by server-13.bemta-5.messagelabs.com id 6E/30-16341-7603E535; Mon, 28 Apr 2014 10:41:43 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-15.tower-206.messagelabs.com!1398681700!979240!2 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 23778 invoked from network); 28 Apr 2014 10:41:42 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-15.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 28 Apr 2014 10:41:42 -0000 X-IronPort-AV: E=Sophos;i="4.97,943,1389744000"; d="scan'208";a="125320433" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 28 Apr 2014 10:41:42 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Mon, 28 Apr 2014 06:41:41 -0400 Received: from kazak.uk.xensource.com ([10.80.2.80] helo=zakaz.uk.xensource.com) by ukmail1.uk.xensource.com with smtp (Exim 4.69) (envelope-from ) id 1Wej0G-0007Ze-Ga; Mon, 28 Apr 2014 11:41:41 +0100 Received: by zakaz.uk.xensource.com (sSMTP sendmail emulation); Mon, 28 Apr 2014 11:41:40 +0100 From: Ian Campbell To: Date: Mon, 28 Apr 2014 11:41:26 +0100 Message-ID: <1398681696-2773-5-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1398681672.29700.55.camel@kazak.uk.xensource.com> References: <1398681672.29700.55.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Ian Campbell , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH OSSTEST v2 05/15] TestSupport: Add helper to wait for a guest to shutdown X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: Signed-off-by: Ian Campbell --- Osstest/TestSupport.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 35838a7..b283e07 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -91,7 +91,8 @@ BEGIN { guest_umount_lv guest_await guest_await_dhcp_tcp guest_checkrunning guest_check_ip guest_find_ether guest_find_domid guest_check_up guest_check_up_quick - guest_get_state guest_await_reboot guest_destroy + guest_get_state guest_await_reboot + guest_await_shutdown guest_destroy guest_vncsnapshot_begin guest_vncsnapshot_stash guest_check_remus_ok guest_editconfig host_involves_pcipassthrough host_get_pcipassthrough_devs @@ -1249,6 +1250,17 @@ sub guest_await_reboot ($$$) { return undef if $st eq 'sr'; fail("guest unexpectedly shutdown; state is '$st'") if $st =~ m/^s/ || $st eq ''; + return "guest state is \"$st\""; + }); +} + +sub guest_await_shutdown ($$$) { + my ($ho,$gho, $timeout) = @_; + poll_loop($timeout, 30, "await shutdown request from $gho->{Guest}", sub { + my $st= guest_get_state($ho,$gho); + return undef if $st eq 's'; + fail("guest unexpectedly shutdown; state is '$st'") + if $st =~ m/^s/ || $st eq ''; return "guest state is $st"; }); }