[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 07/27] ts-unixbench-run: kick off the benchmark on the target
There is a runvar called 'unixbench_params', for specifying the benchmark's runtime arguments. The commit also adds a couple of generic functions in TestSupport.pm, for `cat'-ing the content of a file on the target into a corresponding file in the stash area. Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx> Cc: Wei Liu <wei.liu2@xxxxxxxxxx> Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxx> Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> --- Changes from RFCv1: * add default value for runtime arguments. --- Osstest/TestSupport.pm | 23 ++++++++++++++++ ts-unixbench-run | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100755 ts-unixbench-run diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 67befd0..7cc5be6 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -57,6 +57,7 @@ BEGIN { target_getfile_stash target_getfile_root_stash target_put_guest_image target_editfile target_editfile_root target_file_exists + target_catfile_stash target_catfile_root_stash target_run_apt target_install_packages target_install_packages_norec target_jobdir target_extract_jobdistpath_subdir @@ -488,6 +489,28 @@ sub target_getfile_root_stash ($$$;$) { tgfs_core(\&target_getfile_root, @_); } +sub tcfs_core { + my ($tcmdoutf,$ho,$rfile)= @_; + my $lleaf; + + target_somefile_getleaf(\$lleaf,$rfile,$ho); + + my $h= new IO::File "$stash/$lleaf", 'w' or die $!; + my $fdata= $tcmdoutf->($ho, "cat $rfile"); + print $h $fdata or die $!; + close $h or die $!; +} + +sub target_catfile_stash ($$) { + my ($ho,$rfile)= @_; + tcfs_core(\&target_cmd_output,@_); +} + +sub target_catfile_root_stash ($$) { + my ($ho,$rfile)= @_; + tcfs_core(\&target_cmd_output_root,@_); +} + sub target_file_exists ($$) { my ($ho,$rfile) = @_; my $out= target_cmd_output($ho, "if test -e $rfile; then echo y; fi"); diff --git a/ts-unixbench-run b/ts-unixbench-run new file mode 100755 index 0000000..47e6964 --- /dev/null +++ b/ts-unixbench-run @@ -0,0 +1,67 @@ +#!/usr/bin/perl -w +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2009-2013 Citrix Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +use strict qw(vars); +use DBI; +use Osstest; +use Osstest::TestSupport; + +tsreadconfig(); + +# what we expect as argument list is: +# host=<somehost> [<someguest>] +our ($whhost,$gn) = @ARGV; +$whhost ||= 'host'; +our $ho= selecthost($whhost); + +our $gho= $ho; +if (defined $gn and $gn ne "") { + $gho= selectguest($gn, $ho); + my $err= guest_check_ip($gho); + die "$err $gho->{Name}" if defined $err; +} + +# Runtime parameters for the benchmark. We expect them to be +# specified via a runvar. If not, let's provide a safe default. +if (!defined($r{ 'unixbench_params' })) { + store_runvar('unixbench_params',"-i 3"); +} +our $args= $r{'unixbench_params'}; +our $timeout= (defined($r{'unixbench_timeout'})) ? + $r{'unixbench_timeout'} : 6000; + +sub run() { + logm("Running: /root/unixbench/Run $args (timeout: $timeout)"); + target_cmd_root($gho, <<END, $timeout); + set -ex + cd /root/unixbench/ + rm -rf results/* + time ./Run $args +END +} + +sub hwinfo() { + # Collect some info about the target (virtual) hardware, + # in case we need them when looking and analyzing results. + # + # 'root' because there is no 'osstest' user in guests. + target_catfile_root_stash($gho, "/proc/cpuinfo"); + target_catfile_root_stash($gho, "/proc/meminfo"); +} + +hwinfo(); +run(); _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |