From: Wei Liu Subject: Re: [PATCH V3 1/2] TestSupport.pm: introduce host_get_free_memory Date: Tue, 15 Apr 2014 17:07:25 +0100 Message-ID: <20140415160725.GM3635@zion.uk.xensource.com> References: <1397491530-15224-1-git-send-email-wei.liu2@citrix.com> <1397491530-15224-2-git-send-email-wei.liu2@citrix.com> <21325.21421.919072.565239@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <21325.21421.919072.565239@mariner.uk.xensource.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: Ian Jackson Cc: Wei Liu , ian.campbell@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, Apr 15, 2014 at 04:43:41PM +0100, Ian Jackson wrote: > 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. Please pull from git://xenbits.xen.org/people/liuw/osstest.git get-host-free-memory Wei.