Skip to contentSkip to conversation

README: Advise using `play' for playground flights

PATCH In review Ian Jackson 2 participants 33 messages May 18, 2017 – May 23, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/24 README: Advise using `play' for playground flights

Any flight eventually blessed `adhoc' is supposed to contain, in the db, accurate information corresponding to a real clean run. This is not appropriate for playing about.

Using `play' usefully disables a number of safety catches, including one which prevents post-startup flight modification.

---
 README | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
README +14 -14
index 0e93f43..b45058d 100644
@@ -619,8 +619,8 @@ ExecutiveDbOwningRoleRegexp
    changes - because, that role will end up owning the database objects.
    Defaults to `osstest'.
 
-Adhoc/Custom Flights
-====================
+Flights for by-hand testing
+===========================
 
 Normally a flight is constructed using "make-flight", either via
 "./standalone make-flight" or by calling make-flight (or another
@@ -638,14 +638,14 @@ A fresh empty flight is created by using the "cs-flight-create"
 script. It takes as arguments a "blessing" and a "branch" and on
 success prints the new flight number.
 
-The blessing should almost always be "adhoc". The branch doesn't
+The blessing should almost always be "play". The branch doesn't
 really matter, if you are testing something related to a failure on a
-given branch you may as well use that, otherwise "adhoc" or
+given branch you may as well use that, otherwise "play" or
 "xen-unstable" is a reasonably fallback.
 
 Thus the normal way to invoke cs-flight-create is:
 
-    $ flight=`./cs-flight-create adhoc adhoc`
+    $ flight=`./cs-flight-create play play`
 
 Which results in a $flight which can be used for the remainder of the
 configuration.
@@ -687,20 +687,20 @@ run-job/$recipe" which runs the required test steps. There are plenty
 of examples in sg-run-job.
 
 Once the flight is created it is run using mg-execute-flight. It is
-usual to pass -Badhoc (to set the target blessing) and -Eemail to set
+usual to pass -Bplay (to set the target blessing) and -Eemail to set
 the destination for the test report as well as giving the flight:
 
-    $ ./mg-execute-flight -Badhoc [email protected] $flight
+    $ ./mg-execute-flight -Bplay [email protected] $flight
 
 A worked example, including a custom recipe (in this case to reboot
 Xen five times on the host) and .
 
-Custom sg-run-job-adhoc, requires a single host (ident "host") and
+Custom sg-run-job-play, requires a single host (ident "host") and
 runs ts-host-reboot + a ping check 5 times:
 
 ----START-------
-proc need-hosts/adhoc-xen-boot-x5 {} { return host }
-proc run-job/adhoc-xen-boot-x5 {} {
+proc need-hosts/play-xen-boot-x5 {} { return host }
+proc run-job/play-xen-boot-x5 {} {
     repeat-ts 5 xen-boot.repeat \
                ts-host-reboot     host \; \
                ts-host-ping-check host
@@ -719,13 +719,13 @@ lnxrev=<some revision of Linux which we want to test>
 template=123456
 
 # Create the flight
-flight=`./cs-flight-create adhoc adhoc`
+flight=`./cs-flight-create play play`
 echo $flight
 
 # Create a test job from scratch, many of the runvars cribbed from a
 # random job in a real flight created by make-flight.
-job=adhoc-amd64-amd64-xen-boot
-./cs-job-create $flight $job adhoc-xen-boot-x5 \
+job=play-amd64-amd64-xen-boot
+./cs-job-create $flight $job play-xen-boot-x5 \
     all_hostflags=arch-amd64,arch-xen-amd64,suite-wheezy,purpose-test \
     arch=amd64 toolstack=xl enable_xsm=false kernkind=pvops \
     host=$host
@@ -746,5 +746,5 @@ job=adhoc-amd64-amd64-xen-boot
 ./cs-adjust-flight $flight runvar-set $job kernbuildjob build-amd64-pvops
 
 # Now run the job.
-./mg-execute-flight -Badhoc [email protected] $flight
+./mg-execute-flight -Bplay [email protected] $flight
 ----END---------
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

PATCH 2/24 sg-report-flight: Do not report <none executed> unless it's true

This fallback $storefail->() call is normally run because the job failed without running any steps. But it can also happen because the job execution itself failed (eg, sg-run-job crashed).

If there were any steps, replace the <none executed> text with <job status>. This is accurate, if rather uninformative.

---
 sg-report-flight | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
sg-report-flight +4 -1
index 5e362b9..b7cd03a 100755
@@ -454,8 +454,11 @@ END
         };
 
         my $gridrow= 0;
+	my $foundsteps= 0;
 
 	while (my $s= $stepsq->fetchrow_hashref()) {
+	    $foundsteps++;
+
 	    $jobtext .= sprintf "%2d %-${sl}s %-${rl}s\n",
 	        $s->{stepno}, $s->{testid}, $s->{status};
 
@@ -493,7 +496,7 @@ END
             $storefail->({
                 stepno => '',
                 status => "$j->{status}",
-                testid => '<none executed>'
+                testid => $foundsteps ? '<job status>' : '<none executed>'
             });
         }
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

PATCH 3/24 cs-flight-create: Fix usage error message

In reply to Ian Jackson

This spuriously prints $!. It's still a poor message.

---
 cs-flight-create | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cs-flight-create +1 -1
index a412396..dc61e62 100755
@@ -24,7 +24,7 @@ use Osstest;
 
 csreadconfig();
 
-@ARGV==2 or die $!;
+@ARGV==2 or die;
 our ($intended,$branch) = @ARGV;
 
 my ($flight) =
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 3/24
#3 lore raw

Re: [OSSTEST PATCH 03/24] cs-flight-create: Fix usage error message

Quoted 12 lines · Ian Jackson

This spuriously prints $!. It's still a poor message.

---
 cs-flight-create | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cs-flight-create +0 -0
index a412396..dc61e62 100755

cs-flight-create use Osstest; · line 27

Quoted 5 lines
cs-flight-create +1 -1
@@ -24,7 +24,7 @@ use Osstest;
 
 csreadconfig();
 
-@ARGV==2 or die $!;
+@ARGV==2 or die;

Maybe a "Invalid number of arguments provided, expected 2"?

In any case:

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw

PATCH 4/24 ts-hosts-allocate-Executive: tolerate lack of hostflags

In reply to Ian Jackson

Jobs generated by make-hosts-flight do not need to (and therefore do not) set any hostflags: they set a `host' runvar instead, for the specific host. Do not pointlessly bomb out in this situation.

---
 ts-hosts-allocate-Executive | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
ts-hosts-allocate-Executive +2 -1
index 9417226..0987e2b 100755
@@ -232,7 +232,8 @@ sub compute_hids () {
             print DEBUG "HID $ident OVERRIDE $hid->{OverrideUse}\n";
         }
         my @flags= get_hostflags($ident);
-	die "no hostflags?!" unless @flags;
+	die "no hostflags?!" unless @flags or
+	    $hid->{OverrideUse} or $r{$ident};
         print DEBUG "HID $ident FLAGS @flags\n";
         $hid->{Ident}= $ident;
         my %flags;
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#5 lore raw

PATCH 5/24 tcmd: Work around ssh bug with `ssh host ""'

In reply to Ian Jackson

This runs an interactive shell session on the host, rathern than running `sh -c ""' on it.

Evidently ssh checks for the presence of a command line specification after (foolishly, but now historically unavoidably) concatenating all the command line arguments with spaces in between.

Turn ssh host "" into ssh host " " which is the expected no-op.

---
 Osstest/TestSupport.pm | 1 +
 1 file changed, 1 insertion(+)
Osstest/TestSupport.pm +1 -0
index 19bdd23..b947a0c 100644
@@ -676,6 +676,7 @@ sub tcmd { # $tcmd will be put between '' but not escaped
     my ($stdin,$stdout,$user,$ho,$tcmd,$timeout,$extrasshopts) = @_;
     $timeout=30 if !defined $timeout;
     target_adjust_timeout($ho,\$timeout);
+    $tcmd = ' ' if $tcmd eq ''; # ssh host '' logs in !
     tcmdex($timeout,$stdin,$stdout,
            'ssh', sshopts(), @{ $extrasshopts || [] },
            sshuho($user,$ho), $tcmd);
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 5/24
#6 lore raw

Re: [OSSTEST PATCH 05/24] tcmd: Work around ssh bug with `ssh host ""'

Quoted 10 lines · Ian Jackson

This runs an interactive shell session on the host, rathern than running `sh -c ""' on it.

Evidently ssh checks for the presence of a command line specification after (foolishly, but now historically unavoidably) concatenating all the command line arguments with spaces in between.

Turn ssh host "" into ssh host " " which is the expected no-op.

SoB doesn't match "From:", apart from that:

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw

Re: [OSSTEST PATCH 05/24] tcmd: Work around ssh bug with `ssh host ""'

Roger Pau Monné writes ("Re: [Xen-devel] [OSSTEST PATCH 05/24] tcmd: Work around ssh bug with `ssh host ""'"):

Quoted 8 lines · Ian Jackson
Quoted 7 lines

This runs an interactive shell session on the host, rathern than running `sh -c ""' on it.

Evidently ssh checks for the presence of a command line specification after (foolishly, but now historically unavoidably) concatenating all the command line arguments with spaces in between.

Quoted 7 lines
Quoted 3 lines

Turn ssh host "" into ssh host " " which is the expected no-op.

SoB doesn't match "From:", apart from that:

Thanks for the reviews. Sadly I already pushed this with the wrong From:. I'm not sure exactly how that snuck in. I probably committed that on my laptop but the tree has a user.email config...

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw

PATCH 6/24 cs-hosts-list: New utility

In reply to Ian Jackson

No callers yet.

---
 cs-hosts-list | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100755 cs-hosts-list
cs-hosts-list new file +64 -0
new file mode 100755
index 0000000..1fea3cd
@@ -0,0 +1,64 @@
+#!/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/>.
+
+
+# usage:
+#   ./cs-hosts-list HOSTFLAG[,...]
+# prints the names of all hosts which have all of the HOSTFLAGs set,
+# one per line
+
+use strict qw(vars);
+use DBI;
+unshift @INC, qw(.);
+use Osstest;
+
+csreadconfig();
+
+@ARGV == 1 or die $!;
+my ($flags) = @ARGV;
+$flags =~ m/^-/ and die $!;
+
+my @qargs;
+my $qtxt= <<END;
+        SELECT resname
+          FROM resources
+         WHERE restype='host'
+END
+foreach my $flag (grep { length} split /\,/, $flags) {
+    $qtxt.= <<END;
+	   AND EXISTS (SELECT 1 FROM HOSTFLAGS f
+			       WHERE resname=f.hostname
+				 AND f.hostflag=?)
+END
+    push @qargs, $flag;
+}
+
+my $q= $dbh_tests->prepare($qtxt);
+my $o;
+
+db_retry($dbh_tests,[],sub {
+    $o='';
+    $q->execute(@qargs);
+    while (my ($host) = $q->fetchrow_array()) {
+	$o .= $host;
+	$o .= "\n";
+    }
+});
+
+print $o or die $!;
+close STDOUT or die $!;
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 6/24
#9 lore raw

Re: [OSSTEST PATCH 06/24] cs-hosts-list: New utility

Quoted 14 lines · Ian Jackson

No callers yet.

---
 cs-hosts-list | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100755 cs-hosts-list
cs-hosts-list new file +0 -0
new file mode 100755
index 0000000..1fea3cd

cs-hosts-list line 4

Quoted 4 lines
cs-hosts-list new file +4 -0
@@ -0,0 +1,64 @@
+#!/usr/bin/perl -w
+
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2013 Citrix Inc.
                        ^ 2017?
Quoted 31 lines
cs-hosts-list new file +31 -0
+# 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/>.
+
+
+# usage:
+#   ./cs-hosts-list HOSTFLAG[,...]
+# prints the names of all hosts which have all of the HOSTFLAGs set,
+# one per line
+
+use strict qw(vars);
+use DBI;
+unshift @INC, qw(.);
+use Osstest;
+
+csreadconfig();
+
+@ARGV == 1 or die $!;
+my ($flags) = @ARGV;
+$flags =~ m/^-/ and die $!;
+
+my @qargs;

cs-hosts-list line 46

Quoted 10 lines
cs-hosts-list new file +10 -0
+my $qtxt= <<END;
+        SELECT resname
+          FROM resources
+         WHERE restype='host'
+END
+foreach my $flag (grep { length} split /\,/, $flags) {
+    $qtxt.= <<END;
+	   AND EXISTS (SELECT 1 FROM HOSTFLAGS f
+			       WHERE resname=f.hostname
+				 AND f.hostflag=?)

There seems to be a mix between hard tabs and spaces above.

Quoted 8 lines
cs-hosts-list new file +8 -0
+END
+    push @qargs, $flag;
+}
+
+my $q= $dbh_tests->prepare($qtxt);
+my $o;
+
+db_retry($dbh_tests,[],sub {

cs-hosts-list line 64

Quoted 10 lines
cs-hosts-list new file +10 -0
+    $o='';
+    $q->execute(@qargs);
+    while (my ($host) = $q->fetchrow_array()) {
+	$o .= $host;
+	$o .= "\n";
+    }
+});
+
+print $o or die $!;
+close STDOUT or die $!;

Don't know that much about osstest DB (or DB's in general), but I don't see anything obviously wrong:

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#10 lore raw

Re: [OSSTEST PATCH 06/24] cs-hosts-list: New utility

Roger Pau Monné writes ("Re: [Xen-devel] [OSSTEST PATCH 06/24] cs-hosts-list: New utility"):

Quoted 8 lines · Ian Jackson

cs-hosts-list line 46

Quoted 5 lines
cs-hosts-list new file +5 -0
+foreach my $flag (grep { length} split /\,/, $flags) {
+    $qtxt.= <<END;
+	   AND EXISTS (SELECT 1 FROM HOSTFLAGS f
+			       WHERE resname=f.hostname
+				 AND f.hostflag=?)

There seems to be a mix between hard tabs and spaces above.

Indeed. Does that bother you ? osstest is full of that and it doesn't bothere me...

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#11 lore raw

Re: [OSSTEST PATCH 06/24] cs-hosts-list: New utility

Quoted 10 lines · Ian Jackson

Roger Pau Monné writes ("Re: [Xen-devel] [OSSTEST PATCH 06/24] cs-hosts-list: New utility"):

Quoted 8 lines · Ian Jackson

cs-hosts-list line 46

Quoted 5 lines
cs-hosts-list new file +5 -0
+foreach my $flag (grep { length} split /\,/, $flags) {
+    $qtxt.= <<END;
+	   AND EXISTS (SELECT 1 FROM HOSTFLAGS f
+			       WHERE resname=f.hostname
+				 AND f.hostflag=?)

There seems to be a mix between hard tabs and spaces above.

Quoted 2 lines

Indeed. Does that bother you ? osstest is full of that and it doesn't bothere me...

Not really, but for new scripts I've tried to keep a more uniform style, although vim was very confused about whether it should use hard tabs or spaces :).

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#12 lore raw

PATCH 7/24 cs-hosts-list: Support --arches and --kernels

In reply to Ian Jackson
---
 cs-hosts-list | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)
cs-hosts-list +40 -1
index 1fea3cd..92f44ee 100755
@@ -29,9 +29,25 @@ use Osstest;
 
 csreadconfig();
 
+our @kernels = qw(xen linux);
+our @arches;
+
+while (@ARGV && $ARGV[0] =~ m/^-/) {
+    $_ = shift @ARGV;
+    last if m/^--$/;
+    while (m/^-./) {
+	if (s/^--arches=(.*)/-/) {
+	    @arches = split /\,/, $1;
+	} elsif (s/^--kernels=(.*)/-/) {
+	    @kernels = split /\,/, $1;
+	} else {
+	    die "bad option $_ ?";
+	}
+    }
+}
+
 @ARGV == 1 or die $!;
 my ($flags) = @ARGV;
-$flags =~ m/^-/ and die $!;
 
 my @qargs;
 my $qtxt= <<END;
@@ -49,13 +65,36 @@ END
 }
 
 my $q= $dbh_tests->prepare($qtxt);
+
+my $flagq = $dbh_tests->prepare(<<END);
+        SELECT 1
+          FROM hostflags
+         WHERE hostname=? AND hostflag=?
+END
+
 my $o;
 
+sub report_arch ($) {
+    my ($host) = @_;
+    foreach my $kernel (@kernels) {
+	my $kernprefix = $kernel eq 'linux' ? '' : "$kernel-";
+	foreach my $arch (@arches) {
+	    $flagq->execute($host,"arch-$kernprefix$arch");
+	    if ($flagq->fetchrow_arrayref()) {
+		$o .= " $kernel $arch";
+		return;
+	    }
+	}
+    }
+    $o .= " NONE NONE";
+}
+
 db_retry($dbh_tests,[],sub {
     $o='';
     $q->execute(@qargs);
     while (my ($host) = $q->fetchrow_array()) {
 	$o .= $host;
+	report_arch($host) if @arches;
 	$o .= "\n";
     }
 });
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#13 lore raw

PATCH 8/24 cs-hosts-list: Support --suites

In reply to Ian Jackson
---
 cs-hosts-list | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
cs-hosts-list +16 -0
index 92f44ee..9b82d51 100755
@@ -31,6 +31,7 @@ csreadconfig();
 
 our @kernels = qw(xen linux);
 our @arches;
+our @suites;
 
 while (@ARGV && $ARGV[0] =~ m/^-/) {
     $_ = shift @ARGV;
@@ -40,6 +41,8 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
 	    @arches = split /\,/, $1;
 	} elsif (s/^--kernels=(.*)/-/) {
 	    @kernels = split /\,/, $1;
+	} elsif (s/^--suites=(.*)/-/) {
+	    @suites = split /\,/, $1;
 	} else {
 	    die "bad option $_ ?";
 	}
@@ -89,12 +92,25 @@ sub report_arch ($) {
     $o .= " NONE NONE";
 }
 
+sub report_suite ($) {
+    my ($host) = @_;
+    foreach my $suite (@suites) {
+	$flagq->execute($host,"suite-$suite");
+	if ($flagq->fetchrow_arrayref()) {
+	    $o .= " $suite";
+	    return;
+	}
+    }
+    $o .= " NONE";
+}
+
 db_retry($dbh_tests,[],sub {
     $o='';
     $q->execute(@qargs);
     while (my ($host) = $q->fetchrow_array()) {
 	$o .= $host;
 	report_arch($host) if @arches;
+	report_suite($host) if @suites;
 	$o .= "\n";
     }
 });
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 8/24
#14 lore raw

Re: [OSSTEST PATCH 08/24] cs-hosts-list: Support --suites

Quoted 18 lines · Ian Jackson
---
 cs-hosts-list | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
cs-hosts-list +1 -0
index 92f44ee..9b82d51 100755
@@ -31,6 +31,7 @@ csreadconfig();
 
 our @kernels = qw(xen linux);
 our @arches;
+our @suites;
 
 while (@ARGV && $ARGV[0] =~ m/^-/) {
     $_ = shift @ARGV;

cs-hosts-list while (@ARGV && $ARGV[0] =~ m/^-/) { · line 45

Quoted 5 lines
cs-hosts-list +2 -0
@@ -40,6 +41,8 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
 	    @arches = split /\,/, $1;
 	} elsif (s/^--kernels=(.*)/-/) {
 	    @kernels = split /\,/, $1;
+	} elsif (s/^--suites=(.*)/-/) {
+	    @suites = split /\,/, $1;

I should add a --freebsd=... option.

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#15 lore raw

Re: [OSSTEST PATCH 08/24] cs-hosts-list: Support --suites

Roger Pau Monné writes ("Re: [Xen-devel] [OSSTEST PATCH 08/24] cs-hosts-list: Support --suites"):

Quoted 1 line

I should add a --freebsd=... option.

Yes. Although currently my host examination uses only Linux and Xen.

Do you think there's any value in doing it with FreeBSD as well ?

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#16 lore raw

PATCH 9/24 cs-hosts-list, standalone-generate-dump-flight-runvars: make compatible

In reply to Ian Jackson

Honour OSSTEST_HOSTSLIST_DUMMY, to cause cs-hosts-list to produce dummy output. This means that standalone-generate-dump-flight-runvars can now try generating flights whose contents depend on the host database, and which are therefore normally only useable in Executive mode.

---
 cs-hosts-list                           | 18 ++++++++++++++++--
 standalone-generate-dump-flight-runvars |  1 +
 2 files changed, 17 insertions(+), 2 deletions(-)
cs-hosts-list +16 -2
index 9b82d51..16b5219 100755
@@ -52,6 +52,22 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
 @ARGV == 1 or die $!;
 my ($flags) = @ARGV;
 
+my $o;
+
+if ($ENV{'OSSTEST_HOSTSLIST_DUMMY'}) {
+    $o .= "SOMEHOST";
+    if (@arches) {
+	$o .= " $kernels[0]";
+	$o .= " {".join(',',@arches)."}";
+    }
+    if (@suites) {
+	$o .= " $suites[0]";
+    }
+    $o .= "\n";
+    print $o or die $!;
+    exit 0;
+}
+
 my @qargs;
 my $qtxt= <<END;
         SELECT resname
@@ -75,8 +91,6 @@ my $flagq = $dbh_tests->prepare(<<END);
          WHERE hostname=? AND hostflag=?
 END
 
-my $o;
-
 sub report_arch ($) {
     my ($host) = @_;
     foreach my $kernel (@kernels) {
standalone-generate-dump-flight-runvars +1 -0
index 8fcc852..04631b3 100755
@@ -41,6 +41,7 @@ fi
 : ${AP_FETCH_PLACEHOLDERS:=y}
 export AP_FETCH_PLACEHOLDERS
 
+export OSSTEST_HOSTSLIST_DUMMY=1
 
 if [ "x$AP_FETCH_PLACEHOLDERS" != xy ]; then
     if [ "x$AP_FETCH_MEMO_KEEP" = x ]; then
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#17 lore raw

PATCH 10/24 sg-run-job: new run-ts iffail syntax -...

In reply to Ian Jackson

Indicates not to throw a Tcl exception if the step fails.

---
 sg-run-job | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
sg-run-job +7 -5
index 8e625d9..4fd7505 100755
@@ -146,9 +146,11 @@ proc testid_matches_globs {testid globs} {
 
 #---------- test script handling ----------
 
-proc run-ts {args} {
-    set reap [eval spawn-ts $args]
-    if {![reap-ts $reap]} { error "test script failed" }
+proc run-ts {iffail args} {
+    set wantstatus pass
+    if {[regsub {^-} $iffail {} iffail]} { set wantstatus * }
+    set reap [eval [list spawn-ts $iffail] $args]
+    if {![reap-ts $reap $wantstatus]} { error "test script failed" }
 }
 
 proc repeat-ts {reps testid args} {
@@ -261,7 +263,7 @@ proc spawn-ts {iffail testid args} {
     return [list fh $fh $details]
 }
 
-proc reap-ts {reap} {
+proc reap-ts {reap {wantstatus pass}} {
     global truncate truncate_globs
 
     switch -exact [lindex $reap 0] {
@@ -288,7 +290,7 @@ proc reap-ts {reap} {
         jobdb::logputs stdout "truncating job now as instructed"
         set truncate 1
     }
-    return [expr {![string compare $result pass]}]
+    return [string match $wantstatus $result]
 }
 
 #---------- per-host infrastructure (non-build tests only) ----------
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#18 lore raw

PATCH 11/24 host examination: Initial skeleton

In reply to Ian Jackson

Introduce an initial cut of job recipies host-examine-linux and host-examine-xen, and a flight generation script which can make a flight to examine all hosts with a particular blessing.

So far all this does is provide a way to make a flight which:
* Allocates each relevant host
* Installs Debian and, if applicable, Xen
* Reboots (if applicable, into Xen)
* Collects the logs to the flight log directory

---
 make-hosts-flight | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sg-run-job        |  30 +++++++++++++++
 2 files changed, 143 insertions(+)
 create mode 100755 make-hosts-flight
make-hosts-flight new file +113 -0
new file mode 100755
index 0000000..bbd3343
@@ -0,0 +1,113 @@
+#!/bin/bash
+
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2017 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/>.
+
+
+set -e -o posix
+
+branch=$1
+xenbranch=$2
+hostflags=$3
+blessing=$4
+buildflight=$5
+
+: ${ALL_ARCHES:=amd64 i386 arm64 armhf}
+: ${ALL_SUITES:=jessie stretch}
+
+flight=`./cs-flight-create $blessing $branch`
+
+. ./cri-common
+. ./ap-common
+. ./mfi-common
+
+defsuite=`getconfig DebianSuite`
+
+job_create_build_filter_callback () {
+  local job=$1; shift
+
+  case "$job" in
+    build-*-libvirt) return 1;;
+  esac
+  case " $* " in
+    *" enable_xsm=true "*) return 1;;
+  esac
+  return 0
+}
+
+build_matrix_branch_filter_callback () {
+    :
+}
+
+hosts_iterate () {
+  ./cs-hosts-list --arches=${ALL_ARCHES// /,} \
+                  --suites=${ALL_SUITES// /,} \
+                  $hostflags >tmp/$flight.hosts-list
+  exec 3<tmp/$flight.hosts-list
+
+  while read <&3 host kern arch suite; do
+    runvars="
+              arch=$arch host=$host
+            "
+
+    case $kern in
+      xen|linux)
+        local di_version=`getconfig_TftpDiVersion_suite $suite`
+        runvars+=" 
+                   kernkind=pvops
+                   all_host_di_version=$di_version
+                   all_host_suite=$suite
+                 "
+        ;;
+    esac
+
+    case $kern in
+      xen)
+        runvars+=" 
+                   enable_xsm=false
+                   buildjob=${bfi}build-$arch
+                   xenbuildjob=${bfi}build-$arch
+                   kernbuildjob=${bfi}build-$arch-pvops
+                   toolstack=xl
+                 "
+        ;;
+    esac
+
+    ./cs-job-create $flight examine-$host host-examine-$kern $runvars
+  done
+}
+
+if [ x$buildflight = x ]; then
+
+  WANT_XEND=false REVISION_LINUX_OLD=disable
+
+  create_build_jobs
+
+else
+
+  bfi=$buildflight.
+
+fi
+
+hosts_iterate
+
+echo $flight
+
+# Local variables:
+# mode: sh
+# sh-basic-offset: 2
+# indent-tabs-mode: nil
+# End:
sg-run-job +30 -0
index 4fd7505..51dc2ec 100755
@@ -498,6 +498,36 @@ if {[file exists sg-run-job-adhoc]} {
     source sg-run-job-adhoc
 }
 
+#---------- host examination recipes ----------
+
+proc examine-host-install-debian {} {
+    run-ts broken  =            ts-hosts-allocate     + host
+    run-ts broken  host-install ts-host-install-twice + host
+}
+proc examine-host-install-xen {} {
+    examine-host-install-debian
+    run-ts .       =            ts-xen-install        + host
+    # examine-hosts-examine will do reboot
+}
+
+proc examine-host-examine {install} {
+    catching-otherwise fail {
+	examine-host-install-$install
+	run-ts .   reboot       ts-host-reboot        + host
+    }
+    run-ts !broken capture-logs ts-logs-capture       + host
+}
+
+proc need-hosts/host-examine-xen {} { return {} }
+proc run-job/host-examine-xen {} {
+    examine-host-examine xen
+}
+
+proc need-hosts/host-examine-linux {} { return {} }
+proc need-hosts/host-examine-linux {} {
+    examine-host-examine debian
+}
+
 #---------- builds ----------
 
 proc need-hosts/build {} { return BUILD }
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#19 lore raw

PATCH 12/24 Debian.pm: Break out setupboot_bootloader_edited_rune

In reply to Ian Jackson

The host examination scripts are going to want this.

---
 Osstest/Debian.pm | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
Osstest/Debian.pm +17 -2
index 4155056..8ba48bf 100644
@@ -34,6 +34,7 @@ BEGIN {
     $VERSION     = 1.00;
     @ISA         = qw(Exporter);
     @EXPORT      = qw(debian_boot_setup
+                      setupboot_bootloader_edited_rune
                       debian_overlays
                       debian_guest_suite debian_guest_di_version
                       %preseed_cmds
@@ -165,6 +166,19 @@ fi
 END
 }
 
+sub setupboot_bootloader_edited_rune ($) {
+    my ($ho) = @_;
+    # returns script to run after actual bootloader file is edited
+    if ($ho->{Flags}{'need-uboot-bootscr'}) {
+	return <<END;
+mkimage -A arm -T script -d /boot/boot.xen /boot/boot.scr.xen
+cp /boot/boot.scr.xen /boot/boot.scr
+END
+    } else {
+	return '';
+    }
+}
+
 sub setupboot_uboot ($$$$) {
     my ($ho,$want_kernver,$want_xsm,$xenhopt,$xenkopt) = @_;
     my $bl= { };
@@ -247,6 +261,8 @@ END
 	my $set_xen_addr_r =
 	    $xen_addr_r ? "setenv xen_addr_r $xen_addr_r" : "";
 
+	my $edited_rune = setupboot_bootloader_edited_rune($ho);
+
 	target_cmd_root($ho, <<END);
 if test ! -f /boot/$kern ; then
     exit 1
@@ -297,8 +313,7 @@ fdt print /chosen
 echo Booting \\\${xen_addr_r} - \\\${fdt_addr}
 bootz \\\${xen_addr_r} - \\\${fdt_addr}
 EOF
-mkimage -A arm -T script -d /boot/boot.xen /boot/boot.scr.xen
-cp /boot/boot.scr.xen /boot/boot.scr
+$edited_rune
 
 # Create boot.scr.nat for convenience too
 cat >/boot/boot.nat <<EOF
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#20 lore raw

PATCH 13/24 TestSupport, Executive: Provide intended_blessing

In reply to Ian Jackson

This will be used by a ts script which permanently saves some logs in a host-specific rather than flight-specific directory. Non-real flights ought not to mess up real data.

The function is not provided for Standalone mode, so a test step that tries to use it will fail.

---
 Osstest/JobDB/Executive.pm |  8 ++++++++
 Osstest/TestSupport.pm     | 11 ++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
Osstest/JobDB/Executive.pm +8 -0
index 83e19e4..45aabd4 100644
@@ -196,6 +196,14 @@ END
     }
 }
 
+sub dbfl_intended ($) { #method
+    my ($jd, $fl) = @_;
+    my ($intended) = $dbh_tests->selectrow_array(<<END, {}, $fl);
+        SELECT intended FROM flights WHERE flight=?
+END
+    return $intended;
+}
+
 sub flight_create ($$$) { #method
     my ($jd,$intended,$branch) = @_;
     die "OSSTEST_FLIGHT set on entry to JobDB::Executive::flight_create\n"
Osstest/TestSupport.pm +10 -1
index b947a0c..c23ac13 100644
@@ -43,7 +43,7 @@ BEGIN {
                       ts_get_host_guest ts_check_done
 
                       fail broken logm $logm_handle $logm_prefix
-                      substep_start substep_finish
+                      substep_start substep_finish intended_blessing
                       get_filecontents
                       report_once
 
@@ -245,6 +245,15 @@ sub substep_finish ($$) {
     $mjobdb->step_finish($testid,$stepstatus);
 }
 
+sub intended_blessing () {
+    # must be run outside transaction
+    my $intended;
+    db_retry($flight,'running',$dbh_tests,[], sub {
+        $intended = $mjobdb->dbfl_intended($flight);
+    });
+    return $intended;
+}
+
 sub get_filecontents ($;$) {
     my ($path, $ifnoent) = @_;  # $ifnoent=undef => is error
     my $data= get_filecontents_core_quiet($path);
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#21 lore raw

PATCH 14/24 host examination: Check that serial output is working

In reply to Ian Jackson

Check that both the output from the bootloader, and from the host (dom0, if applicable), appears in the serial logs.

---
 sg-run-job             |  5 +++
 ts-examine-serial-post | 81 +++++++++++++++++++++++++++++++++++++++++
 ts-examine-serial-pre  | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 183 insertions(+)
 create mode 100755 ts-examine-serial-post
 create mode 100755 ts-examine-serial-pre
sg-run-job +5 -0
index 51dc2ec..ceb7980 100755
@@ -511,11 +511,16 @@ proc examine-host-install-xen {} {
 }
 
 proc examine-host-examine {install} {
+    global ok
     catching-otherwise fail {
 	examine-host-install-$install
+	run-ts .   =            ts-examine-serial-pre + host
 	run-ts .   reboot       ts-host-reboot        + host
     }
     run-ts !broken capture-logs ts-logs-capture       + host
+    if {$ok} {
+	run-ts -.  =           ts-examine-serial-post + host
+    }
 }
 
 proc need-hosts/host-examine-xen {} { return {} }
ts-examine-serial-post new file +81 -0

81 lines not on this page · raw message

ts-examine-serial-pre new file +97 -0

97 lines not on this page · raw message

Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#22 lore raw

PATCH 15/24 host examination: Permanently save the logs

In reply to Ian Jackson

After this, we retain some of the logs from the last examination of each host, in a directory in results/ named after the host.

The logic for computing the destination directory has similar env var logic to that used in the invocation of sg-report-host-history but if those are not set (as they usually won't be) has config-based fallback.

In Standalone mode enough of these variables must be set to avoid calling blessing_suffix, since we don't want the filename to depend on a not-really-very-useful (and not implemented by intended_blessing) Standalone flight's intended blessing.

---
 ts-examine-logs-save | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 106 insertions(+)
 create mode 100755 ts-examine-logs-save
ts-examine-logs-save new file +106 -0
new file mode 100755
index 0000000..014522a
@@ -0,0 +1,106 @@
+#!/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);
+unshift @INC, qw(.);
+use Osstest;
+use Osstest::TestSupport;
+
+use POSIX;
+use File::Path qw(rmtree);
+
+tsreadconfig();
+
+if (!$mjobdb->jobdb_enable_log_capture) {
+    die "log capturing not enabled";
+}
+
+our ($whhost) = @ARGV;
+$whhost ||= 'host';
+our $ho= selecthost($whhost);
+
+our $dstdir;
+our $td;
+
+sub blessing_suffix () {
+    my $b = intended_blessing();
+    return $b eq 'real' ? '' : "-$b";
+}
+
+sub dstdir_prep () {
+    my $hdir =
+	($ENV{OSSTEST_HTML_DIR} //
+	 ($ENV{OSSTEST_HTML_DIR} // $c{PubBaseDir}).'/'.
+	 ($ENV{OSSTEST_HTML_SUBDIR} // 'results'.
+	  ($ENV{OSSTEST_HTML_SUFFIX} // blessing_suffix()))).
+	      '/host';
+    if (!stat "$hdir") {
+	die "$hdir $!" unless $!==ENOENT;
+	logm("$hdir: $! - not saving logs");
+	exit 0;
+    }
+    # concurrency: lock is the host allocation
+    $dstdir = "$hdir/$ho->{Name}.examine";
+    $td = "$dstdir.tmp";
+    logm("constructing in $td");
+    rmtree $td;
+    mkdir $td or die "$td: $!";
+}
+
+sub mustrename ($$) {
+    rename $_[0],$_[1] or die "@_ $!";
+}
+
+sub dstdir_commit () {
+    mustrename "$td",         "$dstdir.new";
+    rename     "$dstdir",     "$dstdir.old" or $!==ENOENT or die "$dstdir $!";
+    mustrename "$dstdir.new", "$dstdir";
+    rmtree "$dstdir.old";
+    logm("installed new $dstdir");
+}
+
+sub save_logs () {
+    my @re;
+    no warnings qw(qw);
+    foreach my $pat (qw(---var-log-dmesg
+			---var-log-dmesg\.0
+			-output-cat_#proc#cpuinfo
+			-output-cat_#proc#modules
+			-output-cat_#proc#partitions
+			-output-ifconfig
+			-output-lspci_-tv)) {
+	my $re = $pat;
+	$re =~ s/^-/\Q$ho->{Name}\E-/;
+	push @re, "^$re\$";
+    }
+    my $re = join '|', @re;
+    logm("saving files matching $re");
+
+    opendir D, $stash or die "$stash $!";
+    while ($!=0, defined (my $f = readdir D)) {
+	#print STDERR ">$f<\n";
+	next unless $f =~ m/$re/o;
+	logm("saving $f");
+	link "$stash/$f", "$td/$f" or die "$stash $td $f $!";
+    }
+    die "$stash $!" if $!;
+    closedir D;
+}
+
+dstdir_prep();
+save_logs();
+dstdir_commit();
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#23 lore raw

PATCH 16/24 ts-hosts-allocate-Executive: Honour hostalloc_maxwait_max

In reply to Ian Jackson

No functional change with existing flights.

---
 ts-hosts-allocate-Executive | 13 +++++++++++++
 1 file changed, 13 insertions(+)
ts-hosts-allocate-Executive +13 -0
index 0987e2b..9955cba 100755
@@ -56,6 +56,7 @@ if ($ENV{'OSSTEST_NOALLOCATE'}) {
 }
 
 # initialised by setup:
+our $alloc_start_time;
 our $taskid;
 our %magictaskid;
 our $fi;
@@ -109,6 +110,8 @@ END
              WHERE type='magic' AND refkey=?
 END
     }
+
+    $alloc_start_time = time // die $!;
 }
 
 #---------- prepared sql statements ----------
@@ -748,6 +751,16 @@ sub attempt_allocation {
 	logm("host allocation: successful, reporting to planner.");
     } else {
 	logm("host allocation: planned start in $best->{Start} seconds.");
+	my $maxwait = $r{hostalloc_maxwait_max};
+	if (defined $maxwait) {
+	    # We quit if:
+	    #  * we have been waiting at least $maxwait/2
+	    #  * we estimate it will take at least $maxwait overall
+	    my $wait_sofar = (time // die $!) - $alloc_start_time;
+	    die "timed out: $wait_sofar, $best->{Start}, $maxwait"
+                if $wait_sofar > $maxwait/2
+		&& $wait_sofar + $best->{Start} > $maxwait;
+	}
     }
 
     if ($fake) {
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#24 lore raw

PATCH 17/24 make-hosts-flight: Impose a timeout

In reply to Ian Jackson

If we cannot acquire a particular host for more than 20ks (~5.5h), give up on it. This allows flights to complete if hosts are blocked for a long time.

---
 make-hosts-flight | 3 +++
 1 file changed, 3 insertions(+)
make-hosts-flight +3 -0
index bbd3343..d619de6 100755
@@ -28,6 +28,8 @@ buildflight=$5
 : ${ALL_ARCHES:=amd64 i386 arm64 armhf}
 : ${ALL_SUITES:=jessie stretch}
 
+: ${PERHOST_MAXWAIT:=20000} # seconds
+
 flight=`./cs-flight-create $blessing $branch`
 
 . ./cri-common
@@ -61,6 +63,7 @@ hosts_iterate () {
   while read <&3 host kern arch suite; do
     runvars="
               arch=$arch host=$host
+              hostalloc_maxwait_max=$PERHOST_MAXWAIT
             "
 
     case $kern in
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#25 lore raw

PATCH 18/24 cr-daily-branch: Move harness_rev definition

In reply to Ian Jackson

And also adjust some formatting.

No functional change.

---
 cr-daily-branch | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
cr-daily-branch +7 -5
index 158554d..f0c6718 100755
@@ -272,9 +272,9 @@ if [ "x$OLD_REVISION" = xdetermine-late ]; then
 fi
 
 case $branch in
-distros-*) makeflight=./make-distros-flight ;;
-xen-*-coverity)makeflight=./make-coverity-flight ;;
-*)         makeflight=./make-flight ;;
+distros-*)	makeflight=./make-distros-flight ;;
+xen-*-coverity)	makeflight=./make-coverity-flight ;;
+*)         	makeflight=./make-flight ;;
 esac
 
 if [ "x$NEW_REVISION" = "x$OLD_REVISION" ]; then
@@ -294,10 +294,12 @@ $DAILY_BRANCH_PREMAKE_HOOK
 
 flight=`$makeflight $branch $xenbranch $OSSTEST_BLESSING "$@"`
 
+harness_rev=$(perl -e 'use Osstest; print get_harness_rev();')
+narness_rev=${harness_rev%+}
+
 case $branch in
 xen-unstable-smoke)
-	harness_rev=$(perl -e 'use Osstest; print get_harness_rev();')
-	: ${SMOKE_HARNESS_REV:=${harness_rev%+}}
+	: ${SMOKE_HARNESS_REV:=$harness_rev}
 
 	./mg-adjust-flight-makexrefs -v $flight \
 		'!build-amd64 !build-amd64-libvirt !build-armhf build-*' \
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#26 lore raw

PATCH 19/24 host examination: Add a check to many flights

In reply to Ian Jackson

Check that nothing in the principal other branches is likely to regress the host examination machinery. This is particularly relevant for osstest itself, of course.

Runvars look like this (e.g., from test-amd64-amd64-examine):

  all_host_di_version     current
  all_host_suite          jessie
  all_hostflags           arch-amd64,arch-xen-amd64,suite-jessie,purpose-test,PropMinVer:LinuxKernelMin:3.0
  arch                    amd64
  buildjob                build-amd64
  kernbuildjob            build-amd64-pvops
  kernkind                pvops
  toolstack               xl
  xenbuildjob             build-amd64

New jobs are:

  test-amd64-amd64-examine        linux-3.16
  test-amd64-i386-examine         linux-3.18
  test-arm64-arm64-examine   X    linux-4.1
  test-armhf-armhf-examine        linux-4.9

linux-linus
linux-next
osstest
xen-unstable

test-amd64-amd64-examine linux-3.0
test-amd64-i386-examine X linux-3.4

                                  linux-3.10
                                  linux-3.14

test-arm64-arm64-examine X linux-arm-xen

---
 make-flight | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
make-flight +14 -0
index 6dd0e5f..39ef6de 100755
@@ -642,6 +642,18 @@ do_pv_debian_tests () {
   $endfmt$dom0arch
 }
 
+do_examine_one () {
+  case "$branch" in
+    xen-unstable)		;; # only likely to regress on -unstable
+    osstest)			;; # very likely to regress
+    linux-*)			;; # often seems to regress
+    *)			return	;; # stuff used for guests is irrelevant
+  esac
+  job_create_test test-$xenarch$kern-$dom0arch-examine \
+                  host-examine-xen xl $xenarch $dom0arch \
+                  all_hostflags=$most_hostflags
+}
+
 test_matrix_do_one () {
 
   do_pv_debian_tests
@@ -663,6 +675,8 @@ test_matrix_do_one () {
   do_rtds_tests
   do_credit2_tests
 
+  do_examine_one
+
   # No further arm tests at the moment
   if [ $dom0arch = armhf -o $dom0arch = arm64 ]; then
       return
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#27 lore raw

PATCH 20/24 host examination: Run a regular exam flight

In reply to Ian Jackson

Examine every host, once a month.

This flight contains these jobs:

    build-amd64 build-amd64-pvops
    build-arm64 build-arm64-pvops
    build-armhf build-armhf-pvops
    build-i386  build-i386-pvops
    examine-*

The build jobs are very similar to normal build jobs and I won't recount their contents here. In any case, normally they will be replaced with build jobs from a recent xen-unstable or osstest flight.

The examine-SOMEHOST job looks like this:

    all_host_di_version     current
    all_host_suite          jessie
    arch                    {amd64,i386,arm64,armhf}
    buildjob                build-{amd64,i386,arm64,armhf}
    enable_xsm              false
    host                    SOMEHOST
    hostalloc_maxwait_max   20000
    kernbuildjob            build-{amd64,i386,arm64,armhf}-pvops
    kernkind                pvops
    toolstack               xl
    xenbuildjob             build-{amd64,i386,arm64,armhf}

The above is from standalone-generate-dump-flight-runvars so contains dummy data. The suite, architectures, host and recipe will vary depending on the output from cs-list-hosts.

---
 cr-daily-branch   | 15 ++++++++++++++-
 cri-common        |  2 +-
 crontab           |  1 +
 crontab-cambridge |  2 ++
 4 files changed, 18 insertions(+), 2 deletions(-)
cr-daily-branch +14 -1
index f0c6718..8a314ce 100755
@@ -69,7 +69,7 @@ fetch_version () {
 }
 
 case $branch in
-    distros-*)
+    distros-*|examine)
 	treeurl=none;;
     *)
 	treeurl=`./ap-print-url $branch`;;
@@ -274,6 +274,11 @@ fi
 case $branch in
 distros-*)	makeflight=./make-distros-flight ;;
 xen-*-coverity)	makeflight=./make-coverity-flight ;;
+examine)	makeflight=make_hosts_flight
+		make_hosts_flight () {
+			./make-hosts-flight $1 $2 blessed-$3 $3 $4
+		}
+		;;
 *)         	makeflight=./make-flight ;;
 esac
 
@@ -309,6 +314,14 @@ xen-unstable-smoke)
 	# Even adhoc or play flights ought to reuse only real
 	# previous builds.
 	;;
+examine)
+	./mg-adjust-flight-makexrefs -v $flight				\
+		'build-*'						\
+		--debug --blessings=real				\
+		--branch=xen-unstable,osstest				\
+		--revision-xen=$REVISION_XEN				\
+		--revision-osstest=$harness_rev
+	;;
 esac
 
 $DAILY_BRANCH_POSTMAKE_HOOK
cri-common +1 -1
index ac360de..903fb4e 100644
@@ -80,7 +80,7 @@ select_xenbranch () {
 	seabios)		tree=seabios;	xenbranch=xen-unstable ;;
 	xtf)			tree=xtf;	xenbranch=xen-unstable ;;
 	ovmf)			tree=ovmf;	xenbranch=xen-unstable ;;
-	distros-*)		tree=none;	xenbranch=xen-unstable ;;
+	distros-*|examine)	tree=none;	xenbranch=xen-unstable ;;
 	osstest)		tree=osstest;	xenbranch=xen-unstable ;;
 	esac
 	if [ "x$tree" = xlinux ]; then
crontab +1 -0
index 62047f3..4856569 100755
@@ -9,6 +9,7 @@ [email protected],[email protected]
 4-59/30		*	* * *		cd testing.git &&				./cr-for-branches branches -q "./cr-daily-branch --real"
 18		9	* * 1,3,5	cd testing.git && BRANCHES=linux-next		./cr-for-branches branches -w "./cr-daily-branch --real"
 18		9	* * 3,7		cd testing.git && BRANCHES=xen-unstable-coverity ./cr-for-branches branches -w "./cr-daily-branch --real"
+34		15	23 * *		cd testing.git && BRANCHES=examine		./cr-for-branches branches -w "./cr-daily-branch --real"
 18		4	* * *		cd testing.git && BRANCHES='linux-3.0 libvirt rumprun' ./cr-for-branches branches -w "./cr-daily-branch --real"
 6-59/15   	*	* * *		cd testing.git && EXTRA_BRANCHES='linux-3.0 rumprun libvirt' ./cr-for-branches bisects -w "./cr-try-bisect --real"
 #8-59/5		*	* * *		cd bisects/adhoc.git &&	with-lock-ex -q data-tree-lock bash -c "./cr-try-bisect-adhoc; exit $?"
crontab-cambridge +2 -0
index 2ababb0..3c197de 100755
@@ -15,6 +15,8 @@ [email protected],[email protected]
 46		7	* * 5		cd testing.git && BRANCHES='distros-debian-jessie'	./cr-for-branches branches -w "./cr-daily-branch --real"
 46		7	* * 6		cd testing.git && BRANCHES='distros-debian-stretch'	./cr-for-branches branches -w "./cr-daily-branch --real"
 
+34		15	25 * *		cd testing.git && BRANCHES=examine		./cr-for-branches branches -w "./cr-daily-branch --real"
+
 #8-59/5		*	* * *		cd bisects/adhoc.git && with-lock-ex -q data-tree-lock bash -c "./cr-try-bisect-adhoc; exit $?"
 22		8	* * *		cd testing.git && BRANCHES=maintjobs		./cr-for-branches . -w ./cr-all-branch-statuses ''
 3		4	* * *		savelog -c28 testing.git/tmp/cr-for-branches.log >/dev/null
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#28 lore raw

PATCH 21/24 host examination: serial, grub2: put cookie in menu lines

In reply to Ian Jackson

Empirically, the message printed by `echo' is not always shown. It seems to depend on the host BIOS. I suspect that there's a VGA-to-serial conversion step which only triggers when grub asks for keyboard input, or something. In any case, empirically, increasing the sleep (and sleeping before) did not work on the godellos.

Instead, stuff the cookie into the start of grub menu entries. This is gross but effective.

We put it in the first menu, and the first submenu, which means it will appear on the screen somewhere.

---
 ts-examine-serial-pre | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
ts-examine-serial-pre +6 -6
index 01134ad..26fbc56 100755
@@ -83,12 +83,12 @@ echo osstest uboot $c
 END
     } else {
 	$ed->('/boot/grub/grub.cfg',<<END); # no support for grub1
-\$
-?^terminal_
-a
-echo osstest grub2 $c
-sleep 2
-.
+1 
+/^ *menuentry  *
+s/'\([^']*\)'/'$c \1'
+1
+/^ *submenu  *
+s
 END
     }
 }
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#29 lore raw

PATCH 22/24 host examination: bootloader: Do not use ed

In reply to Ian Jackson

These ed runes are what I used to develop this approach, but they are rather opaque to those very few programmers who are not proficient users of ed, the standard text editor.

Also, using target_editfile_root means we keep a record of the bootloader config in the logs, which is desirable.

The regexps used to edit the grub2 confiug are slightly more sophisticated than the ed ones were.

---
 ts-examine-serial-pre | 49 ++++++++++++++++++++++++-------------------------
 1 file changed, 24 insertions(+), 25 deletions(-)
ts-examine-serial-pre +24 -25
index 26fbc56..86f332f 100755
@@ -61,35 +61,34 @@ END
 
 sub bootloader () {
     my $c = get_cookie('bootloader');
-    my $ed = sub {
-	my ($file,$script) = @_;
-	my $cmd = <<END;
-            ed $file <<EOF
-$script
-w
-q
-EOF
-END
-	$cmd .= setupboot_bootloader_edited_rune($ho);
-	target_cmd_root($ho, $cmd, 200);
+    my $edit = sub {
+	my ($file,$editor) = @_;
+	target_editfile_root($ho,$file,$editor);
+	target_cmd_root($ho, setupboot_bootloader_edited_rune($ho), 200);
     };
     my $edscript;
     if ($ho->{Flags}{'need-uboot-bootscr'}) {
-	$ed->('/boot/boot.xen',<<END)
-/^echo Loaded
-i
-echo osstest uboot $c
-.
-END
+	$edit->('/boot/boot.xen', sub {
+            my $done;
+            while (<::EI>) {
+		if (m/^echo Loaded/ && !$done++) {
+		    print ::EO "echo osstest uboot $c\n";
+		}
+		print ::EO;
+	    }
+	});
     } else {
-	$ed->('/boot/grub/grub.cfg',<<END); # no support for grub1
-1 
-/^ *menuentry  *
-s/'\([^']*\)'/'$c \1'
-1
-/^ *submenu  *
-s
-END
+	# no support for grub1
+	$edit->('/boot/grub/grub.cfg', sub {
+            my %done;
+            while (<::EI>) {
+		s{^(\s* ( menuentry | submenu ) \s+
+		      (['"]) )( [^'"]+ \3) }{
+                    $done{$2}++ ? $& : "$1$c $4"
+                }xe;
+		print ::EO;
+	    }
+	});
     }
 }
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#30 lore raw

PATCH 23/24 host examination: bootloader: edit all grub2 menu entries

In reply to Ian Jackson

edit all the menuentry and submenu entries.

This is a good idea because in princple the first menu and submenu entries in the autogenerated grub.cfg might be in a function which is not actually called.

The resulting grub menu now looks even sillier.

---
 ts-examine-serial-pre | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
ts-examine-serial-pre +2 -5
index 86f332f..90037c6 100755
@@ -80,12 +80,9 @@ sub bootloader () {
     } else {
 	# no support for grub1
 	$edit->('/boot/grub/grub.cfg', sub {
-            my %done;
             while (<::EI>) {
-		s{^(\s* ( menuentry | submenu ) \s+
-		      (['"]) )( [^'"]+ \3) }{
-                    $done{$2}++ ? $& : "$1$c $4"
-                }xe;
+		s{^(\s* (?: menuentry | submenu ) \s+
+		      (['"]) )( [^'"]+ \2) }{$1$c $3}x;
 		print ::EO;
 	    }
 	});
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#31 lore raw

PATCH 24/24 host examination: bootloader: better handling of multiple runs

In reply to Ian Jackson

If ts-examine-serial-pre was run more than once (which happens by hand during development, for example), it would reuse the same ids (which is not idea for manual testing, since we normally want to know if the last run was good). Instead, generate new cookies each time (and overwrite the old ones in the runvars).

Also, it owuld keep adding new copies to the grub menu entries (obscuring the actual interesting menu text completely). Instead, prefix the mentries with a fixed string so they can be stripped out again. They now look a bit sillier after one run, but less silly after several.

---
 ts-examine-serial-pre | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
ts-examine-serial-pre +3 -2
index 90037c6..3905e52 100755
@@ -42,7 +42,6 @@ die "do not want to mess up a shared host" if
 sub get_cookie ($) {
     my ($key) = @_;
     my $rname = "examine_serial_cookie_$key";
-    return $r{$rname} if defined $r{$rname};
     open R, "/dev/urandom";
     my $v;
     my $l = 16;
@@ -82,7 +81,9 @@ sub bootloader () {
 	$edit->('/boot/grub/grub.cfg', sub {
             while (<::EI>) {
 		s{^(\s* (?: menuentry | submenu ) \s+
-		      (['"]) )( [^'"]+ \2) }{$1$c $3}x;
+		      (['"]) )
+                      (?: osstest \ cookie \ [0-9a-f]+ \ )?
+                      ( [^'"]+ \2) }{$1osstest cookie $c $3}x;
 		print ::EO;
 	    }
 	});
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 1/24
#32 lore raw
In reply to Ian Jackson
Quoted 8 lines · Ian Jackson

Any flight eventually blessed `adhoc' is supposed to contain, in the db, accurate information corresponding to a real clean run. This is not appropriate for playing about.

Using `play' usefully disables a number of safety catches, including one which prevents post-startup flight modification.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel