From: Wei Liu Subject: [PATCH 1/2] TestSupport.pm: introduce host_get_free_memory Date: Mon, 14 Apr 2014 12:17:02 +0100 Message-ID: <1397474223-24387-2-git-send-email-wei.liu2@citrix.com> References: <1397474223-24387-1-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: <1397474223-24387-1-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: xen-devel@lists.xen.org Cc: Wei Liu , ian.jackson@eu.citrix.com, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org ... which returns the size of free memory in MB. Signed-off-by: Wei Liu --- Osstest/TestSupport.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index b11eb17..17a43a4 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -79,6 +79,7 @@ BEGIN { remote_perl_script_open remote_perl_script_done host_reboot target_reboot target_reboot_hard target_choose_vg target_umount_lv target_await_down + host_get_free_memory target_ping_check_down target_ping_check_up target_kernkind_check target_kernkind_console_inittab @@ -915,6 +916,15 @@ sub host_reboot ($) { }); } +sub host_get_free_memory($$) { + my ($ho,$toolstack) = @_; + # The line is as followed: + # free_memory : XXXX + my $cmd = "$toolstack info | grep free_memory | awk {'print \$3'}"; + my $free_memory_mb = target_cmd_root($ho, $cmd, 10); + return $free_memory_mb; +} + sub target_reboot ($) { my ($ho) = @_; target_cmd_root($ho, "init 6"); -- 1.7.10.4