All of lore.kernel.org
 help / color / mirror / Atom feed
* [OSSTest PATCH v2 0/2] Test case for cpupools
@ 2015-02-04 15:26 Dario Faggioli
  2015-02-04 15:27 ` [OSSTest PATCH v2 1/2] ts-cpupools: new test script Dario Faggioli
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dario Faggioli @ 2015-02-04 15:26 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Ian Jackson, Ian Campbell

We aren't doing any cpupools smoke testing as of now. So, do some. :-)

As suggested by Juergen, I adjusted things such that we are now generating test
jobs for ARM too. In fact, here is the list of jobs, and for each jobs the
runvars, being introduced by this series:

dariof@hoopak:~/osstest.git$ diff -Nru runvars.orig runvars.patched 
--- runvars.orig        2015-02-04 15:15:35.214928000 +0000
+++ runvars.patched     2015-02-04 15:11:30.529748000 +0000
@@ -0,0 +1,18 @@
+test-amd64-amd64-xl-cpupools              all_hostflags               arch-amd64,arch-xen-amd64,suite-wheezy,purpose-test                             
+test-amd64-amd64-xl-cpupools              arch                        amd64                                                                           
+test-amd64-amd64-xl-cpupools              buildjob                    build-amd64                                                                     
+test-amd64-amd64-xl-cpupools              debian_arch                 amd64                                                                           
+test-amd64-amd64-xl-cpupools              debian_kernkind             pvops                                                                           
+test-amd64-amd64-xl-cpupools              kernbuildjob                build-amd64-pvops                                                               
+test-amd64-amd64-xl-cpupools              kernkind                    pvops                                                                           
+test-amd64-amd64-xl-cpupools              toolstack                   xl                                                                              
+test-amd64-amd64-xl-cpupools              xenbuildjob                 build-amd64                                                                     
+test-armhf-armhf-xl-cpupools              all_hostflags               arch-armhf,arch-xen-armhf,suite-wheezy,purpose-test                             
+test-armhf-armhf-xl-cpupools              arch                        armhf                                                                           
+test-armhf-armhf-xl-cpupools              buildjob                    build-armhf                                                                     
+test-armhf-armhf-xl-cpupools              debian_arch                 armhf                                                                           
+test-armhf-armhf-xl-cpupools              debian_kernkind             pvops                                                                           
+test-armhf-armhf-xl-cpupools              kernbuildjob                build-armhf-pvops                                                               
+test-armhf-armhf-xl-cpupools              kernkind                    pvops                                                                           
+test-armhf-armhf-xl-cpupools              toolstack                   xl                                                                              
+test-armhf-armhf-xl-cpupools              xenbuildjob                 build-armhf 

Regards,
Dario
---
Dario Faggioli (2):
      ts-cpupools: new test script
      Testing cpupools: recipe for it and job definition


 make-flight |   12 ++++++
 sg-run-job  |    7 +++
 ts-cpupools |  124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 143 insertions(+)
 create mode 100755 ts-cpupools

--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [OSSTest PATCH v2 1/2] ts-cpupools: new test script
  2015-02-04 15:26 [OSSTest PATCH v2 0/2] Test case for cpupools Dario Faggioli
@ 2015-02-04 15:27 ` Dario Faggioli
  2015-03-11 16:01   ` Ian Campbell
  2015-02-04 15:28 ` [OSSTest PATCH v2 2/2] Testing cpupools: recipe for it and job definition Dario Faggioli
  2015-03-05 16:41 ` [OSSTest PATCH v2 0/2] Test case for cpupools Dario Faggioli
  2 siblings, 1 reply; 6+ messages in thread
From: Dario Faggioli @ 2015-02-04 15:27 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Ian Jackson, Ian Campbell

for smoke testing cpupools a bit. It tries to partition
a live host in two cpupools, trying out the following 3
schedulers for the new cpupool (one after the other):
 credit, credit2 and RTDS.

It also tries to migrating a domain to the new cpupool
and then back to Pool-0.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Juergen Gross <jgross@suse.com>
---
 ts-cpupools |  124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 124 insertions(+)
 create mode 100755 ts-cpupools

diff --git a/ts-cpupools b/ts-cpupools
new file mode 100755
index 0000000..fe612e1
--- /dev/null
+++ b/ts-cpupools
@@ -0,0 +1,124 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2014 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();
+
+our ($whhost,$gn)= @ARGV;
+$whhost ||= 'host';
+$gn ||= 'debian';
+
+our ($ho,$gho) = ts_get_host_guest($whhost,$gn);
+#our $ho= selecthost(@ARGV);
+
+our $default_cpupool= "Pool-0";
+our @schedulers= ("credit","credit2","rtds");
+our @cpulist;
+our $nr_cpus;
+
+sub check () {
+  my $out;
+
+  # Figure out the number of pCPUs of the host. We need to know
+  # that in order to decide with what pCPUs we want to create
+  # cpupools
+  my $xlinfo= target_cmd_output_root($ho, "xl info");
+  $xlinfo =~ /nr_cpus\s*:\s([0-9]*)/;
+  $nr_cpus= $1;
+  logm("Found $nr_cpus pCPUs");
+  die "Too few pCPUs to test cpupools: $nr_cpus" if $nr_cpus < 2;
+
+  # We want only 1 cpupool to exist
+  my $cppinfo= target_cmd_output_root($ho, "xl cpupool-list");
+  my $nr_cpupools= $cppinfo =~ tr/\n//;
+  logm("Found $nr_cpupools cpupools");
+  die "There already is more than one cpu pool!" if $nr_cpupools > 1;
+  die "Non-default cpupool configuration detected" if $cppinfo =~ /^$default_cpupool\b/;
+
+  $out= target_cmd_output_root($ho, "xl cpupool-list"); logm("$out");
+  $out= target_cmd_output_root($ho, "xl cpupool-list -c"); logm("$out");
+}
+
+# List of the odd pCPUs
+sub prep_cpulist () {
+  if (! defined @cpulist) {
+    foreach my $cpu (0..$nr_cpus) {
+      next unless $cpu % 2;
+      push @cpulist, $cpu;
+    }
+  }
+}
+
+sub prep ($) {
+  my ($sched)= @_;
+
+  # Remove the pCPUs from in $cpulist from the default cpupool
+  my $cpustr= "[";
+  foreach my $cpu (@cpulist) {
+    target_cmd_root($ho,"xl cpupool-cpu-remove $default_cpupool $cpu");
+    $cpustr.= "\"$cpu\", ";
+  }
+  $cpustr.= "]";
+
+  logm("Creating config file for cpupool-osstest-$sched with cpus=$cpustr");
+  target_putfilecontents_stash($ho,100,<<"END","/etc/xen/cpupool-osstest-$sched");
+name = "cpupool-osstest-$sched"
+sched=\"$sched\"
+cpus=$cpustr
+END
+}
+
+check();
+prep_cpulist();
+foreach my $sched (@schedulers) {
+  my $out;
+
+  prep("$sched");
+
+  # For each cpupool:
+  #  * create it
+  #  * rename it
+  #  * move a domain in it
+  #  * move back a domain out of it
+  #  * add back the pcpus from it to the default pool
+  #  * destroy it
+  target_cmd_root($ho, "xl cpupool-create /etc/xen/cpupool-osstest-$sched");
+  target_cmd_output_root($ho, "xl cpupool-rename cpupool-osstest-$sched cpupool-test");
+  $out= target_cmd_output_root($ho, "xl cpupool-list -c"); logm("$out");
+  $out= target_cmd_output_root($ho, "xl cpupool-list"); logm("$out");
+
+  target_cmd_root($ho, "xl cpupool-migrate $gho->{Name} cpupool-test");
+  $out= target_cmd_output_root($ho, "xl cpupool-list"); logm("$out");
+  $out= target_cmd_output_root($ho, "xl vcpu-list"); logm("$out");
+
+  target_cmd_root($ho, "xl cpupool-migrate $gho->{Name} Pool-0");
+  $out= target_cmd_output_root($ho, "xl cpupool-list"); logm("$out");
+
+  foreach my $cpu (@cpulist) {
+    target_cmd_root($ho,"xl cpupool-cpu-remove cpupool-test $cpu");
+    target_cmd_root($ho,"xl cpupool-cpu-add $default_cpupool $cpu");
+  }
+  $out= target_cmd_output_root($ho, "xl cpupool-list -c"); logm("$out");
+
+  target_cmd_root($ho, "xl cpupool-destroy cpupool-test");
+  $out= target_cmd_output_root($ho, "xl cpupool-list"); logm("$out");
+}
+

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [OSSTest PATCH v2 2/2] Testing cpupools: recipe for it and job definition
  2015-02-04 15:26 [OSSTest PATCH v2 0/2] Test case for cpupools Dario Faggioli
  2015-02-04 15:27 ` [OSSTest PATCH v2 1/2] ts-cpupools: new test script Dario Faggioli
@ 2015-02-04 15:28 ` Dario Faggioli
  2015-03-11 16:02   ` Ian Campbell
  2015-03-05 16:41 ` [OSSTest PATCH v2 0/2] Test case for cpupools Dario Faggioli
  2 siblings, 1 reply; 6+ messages in thread
From: Dario Faggioli @ 2015-02-04 15:28 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Ian Jackson, Ian Campbell

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Changes from v1:
 * added invocation to ts-guest-stop in the recipe to kill
   leak-check complaints (which went unnoticed during v1
   testing, sorry)
 * moved the test before the "ARM cutoff", and remove the
   per-arch filtering, so that the test can run on ARM
   hardware too
---
 make-flight |   12 ++++++++++++
 sg-run-job  |    7 +++++++
 2 files changed, 19 insertions(+)

diff --git a/make-flight b/make-flight
index 63b14f5..4d2e4bf 100755
--- a/make-flight
+++ b/make-flight
@@ -283,6 +283,16 @@ do_multivcpu_tests () {
                     $debian_runvars all_hostflags=$most_hostflags
 }
 
+do_cpupools_tests () {
+  if [ $xenarch != $dom0arch ]; then
+    return
+  fi
+
+  job_create_test test-$xenarch$kern-$dom0arch-xl-cpupools            \
+                    test-cpupools xl $xenarch $dom0arch               \
+                    $debian_runvars all_hostflags=$most_hostflags
+}
+
 do_passthrough_tests () {
   if [ $xenarch != amd64 -o $dom0arch != amd64 -o "$kern" != "" ]; then
     return
@@ -318,6 +328,8 @@ test_matrix_do_one () {
   do_sedf_tests
   do_credit2_tests
 
+  do_cpupools_tests
+
   # No further arm tests at the moment
   if [ $dom0arch = armhf ]; then
       return
diff --git a/sg-run-job b/sg-run-job
index 2cf810a..fae5af0 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -272,6 +272,13 @@ proc run-job/test-debianhvm {} {
     test-guest debianhvm
 }
 
+proc need-hosts/test-cpupools {} { return host }
+proc run-job/test-cpupools {} {
+    install-guest-debian
+    run-ts . = ts-cpupools
+    run-ts . = ts-guest-stop + host debian
+}
+
 proc need-hosts/test-pair {} { return {src_host dst_host} }
 proc run-job/test-pair {} {
     run-ts . =              ts-debian-install      dst_host

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [OSSTest PATCH v2 0/2] Test case for cpupools
  2015-02-04 15:26 [OSSTest PATCH v2 0/2] Test case for cpupools Dario Faggioli
  2015-02-04 15:27 ` [OSSTest PATCH v2 1/2] ts-cpupools: new test script Dario Faggioli
  2015-02-04 15:28 ` [OSSTest PATCH v2 2/2] Testing cpupools: recipe for it and job definition Dario Faggioli
@ 2015-03-05 16:41 ` Dario Faggioli
  2 siblings, 0 replies; 6+ messages in thread
From: Dario Faggioli @ 2015-03-05 16:41 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Campbell


[-- Attachment #1.1: Type: text/plain, Size: 440 bytes --]

On Wed, 2015-02-04 at 15:26 +0000, Dario Faggioli wrote:
> ---
> Dario Faggioli (2):
>       ts-cpupools: new test script
>       Testing cpupools: recipe for it and job definition
> 
> 
>  make-flight |   12 ++++++
>  sg-run-job  |    7 +++
>  ts-cpupools |  124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 143 insertions(+)
>  create mode 100755 ts-cpupools
> 
Ping...

Regards,
Dario

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [OSSTest PATCH v2 1/2] ts-cpupools: new test script
  2015-02-04 15:27 ` [OSSTest PATCH v2 1/2] ts-cpupools: new test script Dario Faggioli
@ 2015-03-11 16:01   ` Ian Campbell
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2015-03-11 16:01 UTC (permalink / raw)
  To: Dario Faggioli; +Cc: Juergen Gross, Ian Jackson, xen-devel

On Wed, 2015-02-04 at 15:27 +0000, Dario Faggioli wrote:
> +  my $xlinfo= target_cmd_output_root($ho, "xl info");
> +  $xlinfo =~ /nr_cpus\s*:\s([0-9]*)/;

I thought Perl needed a modifier to work in multiline mode?

> +  $nr_cpus= $1;
> +  logm("Found $nr_cpus pCPUs");
> +  die "Too few pCPUs to test cpupools: $nr_cpus" if $nr_cpus < 2;

This will cause a sticky test failure if this ever gets run on a single
cpu host (which might just about be plausible on ARM).

The proper fix would be a property in the hostdb which was used to
constrain which hosts the jobs containing this test could run on. (e.g.
we have pcipassthrough-nic).

Maybe this way is OK until we find we are commissioning a machine with a
single CPU, at which point this failure will seem pretty obvious. Ian?


> +
> +  # We want only 1 cpupool to exist
> +  my $cppinfo= target_cmd_output_root($ho, "xl cpupool-list");
> +  my $nr_cpupools= $cppinfo =~ tr/\n//;
> +  logm("Found $nr_cpupools cpupools");
> +  die "There already is more than one cpu pool!" if $nr_cpupools > 1;
> +  die "Non-default cpupool configuration detected" if $cppinfo =~ /^$default_cpupool\b/;

Shouldn't the condition on the last one be inverted, i.e. die unless
Pool-0 is present?

Also: long lines?

> +
> +  $out= target_cmd_output_root($ho, "xl cpupool-list"); logm("$out");
> +  $out= target_cmd_output_root($ho, "xl cpupool-list -c"); logm("$out");

Is this just for logging? target_cmd_root will just do that for you I
think.

You may want to include one or more of these in ts-logs-capture too,
which allow us to have some chance of noticing pooling oddities on other
jobs.

> +}
> +
> +# List of the odd pCPUs
> +sub prep_cpulist () {
> +  if (! defined @cpulist) {
> +    foreach my $cpu (0..$nr_cpus) {
> +      next unless $cpu % 2;
> +      push @cpulist, $cpu;
> +    }
> +  }

Seems like this ought to be doable as a one or two liner with grep or
map.

> +}
> +
> +sub prep ($) {
> +  my ($sched)= @_;
> +
> +  # Remove the pCPUs from in $cpulist from the default cpupool
> +  my $cpustr= "[";
> +  foreach my $cpu (@cpulist) {
> +    target_cmd_root($ho,"xl cpupool-cpu-remove $default_cpupool $cpu");
> +    $cpustr.= "\"$cpu\", ";
> +  }
> +  $cpustr.= "]";

I think you should accumulate $cpu in @cpus and then join it at the end
and add the []s (or leave them inline in the here doc.

> +
> +  logm("Creating config file for cpupool-osstest-$sched with cpus=$cpustr");
> +  target_putfilecontents_stash($ho,100,<<"END","/etc/xen/cpupool-osstest-$sched");
> +name = "cpupool-osstest-$sched"
> +sched=\"$sched\"

One of these two quoting styles must be wrong I think?

> +cpus=$cpustr
> +END
> +}
> +
> +check();
> +prep_cpulist();
> +foreach my $sched (@schedulers) {
> +  my $out;
> +
> +  prep("$sched");
> +
> +  # For each cpupool:
> +  #  * create it
> +  #  * rename it
> +  #  * move a domain in it
> +  #  * move back a domain out of it
> +  #  * add back the pcpus from it to the default pool
> +  #  * destroy it
> +  target_cmd_root($ho, "xl cpupool-create /etc/xen/cpupool-osstest-$sched");
> +  target_cmd_output_root($ho, "xl cpupool-rename cpupool-osstest-$sched cpupool-test");

Doesn't this throw away the output? I think you want to drop _output
here.

> +  $out= target_cmd_output_root($ho, "xl cpupool-list -c"); logm("$out");

What about libvirt? This either needs to use the
toolstack()/Osstest::Toolstack abstraction or it needs to error for
toolstacks which aren't xl.

> +  $out= target_cmd_output_root($ho, "xl cpupool-list"); logm("$out");
> +
> +  target_cmd_root($ho, "xl cpupool-migrate $gho->{Name} cpupool-test");
> +  $out= target_cmd_output_root($ho, "xl cpupool-list"); logm("$out");
> +  $out= target_cmd_output_root($ho, "xl vcpu-list"); logm("$out");
> +
> +  target_cmd_root($ho, "xl cpupool-migrate $gho->{Name} Pool-0");
> +  $out= target_cmd_output_root($ho, "xl cpupool-list"); logm("$out");
> +
> +  foreach my $cpu (@cpulist) {
> +    target_cmd_root($ho,"xl cpupool-cpu-remove cpupool-test $cpu");
> +    target_cmd_root($ho,"xl cpupool-cpu-add $default_cpupool $cpu");
> +  }
> +  $out= target_cmd_output_root($ho, "xl cpupool-list -c"); logm("$out");
> +
> +  target_cmd_root($ho, "xl cpupool-destroy cpupool-test");
> +  $out= target_cmd_output_root($ho, "xl cpupool-list"); logm("$out");
> +}
> +
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [OSSTest PATCH v2 2/2] Testing cpupools: recipe for it and job definition
  2015-02-04 15:28 ` [OSSTest PATCH v2 2/2] Testing cpupools: recipe for it and job definition Dario Faggioli
@ 2015-03-11 16:02   ` Ian Campbell
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2015-03-11 16:02 UTC (permalink / raw)
  To: Dario Faggioli; +Cc: Juergen Gross, Ian Jackson, xen-devel

On Wed, 2015-02-04 at 15:28 +0000, Dario Faggioli wrote:
> Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-11 16:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-04 15:26 [OSSTest PATCH v2 0/2] Test case for cpupools Dario Faggioli
2015-02-04 15:27 ` [OSSTest PATCH v2 1/2] ts-cpupools: new test script Dario Faggioli
2015-03-11 16:01   ` Ian Campbell
2015-02-04 15:28 ` [OSSTest PATCH v2 2/2] Testing cpupools: recipe for it and job definition Dario Faggioli
2015-03-11 16:02   ` Ian Campbell
2015-03-05 16:41 ` [OSSTest PATCH v2 0/2] Test case for cpupools Dario Faggioli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.