All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Juergen Gross <jgross@suse.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	xen-devel <xen-devel@lists.xen.org>
Subject: Re: [OSSTest PATCH v2 1/2] ts-cpupools: new test script
Date: Wed, 11 Mar 2015 16:01:11 +0000	[thread overview]
Message-ID: <1426089671.21353.297.camel@citrix.com> (raw)
In-Reply-To: <20150204152738.29118.38314.stgit@Abyss>

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");
> +}
> +
> 

  reply	other threads:[~2015-03-11 16:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426089671.21353.297.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=jgross@suse.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.