From: Ian Jackson Subject: Re: [PATCH V3 1/2] TestSupport.pm: introduce host_get_free_memory Date: Tue, 15 Apr 2014 16:43:41 +0100 Message-ID: <21325.21421.919072.565239@mariner.uk.xensource.com> References: <1397491530-15224-1-git-send-email-wei.liu2@citrix.com> <1397491530-15224-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: <1397491530-15224-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 V3 1/2] TestSupport.pm: introduce host_get_free_memory"): > ... which returns the size of free memory in MB. Thanks. ... > +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+)\s*$/m; > + @matched or die "fail to get host free memory"; I have one tiny quibble: the error message (which helpfully includes a descriptive string unlike much of the rest of osstest) fails to include the contents of $info. In general it is a good idea in osstest to include the complete text which has failed a regexp match. That greatly assists debugging. (When you do that you need to make sure that the $info doesn't appear right at the end of the message, because if the message ends in a newline it suppresses perl's addition of the script line number. Adding " ?" or "'" or something is sufficient.) Can you change that, and then send me a git pull request style email with a reference to a git branch ? I'll then send it into the osstest push gate as soon as it's free. Thanks, Ian.