From: Ian Jackson Subject: Re: [PATCH V2 1/2] TestSupport.pm: introduce host_get_free_memory Date: Mon, 14 Apr 2014 16:44:10 +0100 Message-ID: <21324.586.275868.975915@mariner.uk.xensource.com> References: <1397489516-4988-1-git-send-email-wei.liu2@citrix.com> <1397489516-4988-2-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1397489516-4988-2-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: ian.campbell@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Wei Liu writes ("[PATCH V2 1/2] TestSupport.pm: introduce host_get_free_memory"): > ... which returns the size of free memory in MB. ... Thanks, this is much better. > +sub host_get_free_memory($$) { > + my ($ho,$toolstack) = @_; > + # The line is as followed: > + # free_memory : XXXX > + my $info = target_cmd_output_root($ho, "$toolstack info", 10); > + my @matched = $info =~ /free_memory\s*:\s*(\d+)/; But maybe you wanted /^free_memory\s*:\s*(\d+)\s*$/m; Also, you should die if the regexp doesn't match, rather than returning undef. Ian.