Skip to contentSkip to conversation

Reduce rumpuserxen tests, and loose ends

PATCH Superseded Ian Jackson 2 participants 14 messages Jun 27, 2014 – Jun 30, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Reduce rumpuserxen tests, and loose ends

These patches are general fixups and loose ends:
1/9 adhoc-revtuple-generator: Avoid an undefined variable warning 3/9 submodulefixup: Tell git cache [fetch=try]
4/9 standalone: Honour OSSTEST_CONFIG
5/9 standalone-config-example: Provide a setting of Repos

These provide a new test utility:
2/9 adhoc-revtuple-generator: Do not always reclone 6/9 mg-list-all-branches: New script.
7/9 standalone-generate-dump-flight-runvars: New utility

These remove some unnecessary tests:
8/9 make-flight: Break out do_rumpkernel_tests 9/9 make-flight: Test rump kernels only when needed

I have checked the change in behaviour before and after the last two patches with the new tool
standalone-generate-dump-flight-runvars
and
diff -bu <(sort before) <(sort after) |less
and the diff appears correct.

#1 lore raw

PATCH 1/9 adhoc-revtuple-generator: Avoid an undefined variable warning

---
 adhoc-revtuple-generator |    1 +
 1 file changed, 1 insertion(+)
adhoc-revtuple-generator +1 -0
index 4a2ec63..dbe4773 100755
@@ -129,6 +129,7 @@ END
 	    m/^(\w+)\s(.*)$/ or die "$cmd: $_ ?";
 	    push @{ $r{$1} }, $2;
 	}
+	$r{Parents} ||= [ ];
 	die "$treename -" unless @{ $r{commit} } == 1;
 	die "$treename -" unless @{ $r{committer} } == 1;
 	die "$treename -" unless $r{committer}[0] =~ m/ (\d+)(?: [-+]\d{4})$/;
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/9 adhoc-revtuple-generator: Do not always reclone

In reply to Ian Jackson

Instead, try setting the `origin' remote's URL and fetching. If that fails it may be that the local repo is corrupted, so then we try recloning.

---
 adhoc-revtuple-generator |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
adhoc-revtuple-generator +11 -3
index dbe4773..f94f189 100755
@@ -99,9 +99,17 @@ sub git_generator ($) {
     my $treename= $tree->{Treename};
     my $eff_url = git_massage_url($tree->{Url});
     my $upcmd= <<END;
-        set -e; exec >&2
-        rm -rf $c{Repos}/$treename
-        git clone --bare $eff_url $c{Repos}/$treename
+        set -xe; exec >&2
+        if ! sh -xe <<ENDIFCOND
+            # the "set -e"-disarmament done by "if" leaks into ( ) !
+	    cd $c{Repos}/$treename
+	    git remote set-url origin $eff_url
+	    git fetch -p origin
+ENDIFCOND
+	then
+            rm -rf $c{Repos}/$treename
+            git clone --bare $eff_url $c{Repos}/$treename
+	fi
 END
     print DEBUG "GIT-GEN UPCMD\n$upcmd\n";
     shellcmd($upcmd) if $doupdate;
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/9 submodulefixup: Tell git cache [fetch=try]

In reply to Ian Jackson

Make git_massage_url take an optional %xopts list, currently with only GitFetchBestEffort as a possible key.

Use that in submodulefixup, unconditionally. Often the submodule update will work fine with an older version of the submodule, and if the submodule we get is out of date then the submodule update will fail anyway.

---
 Osstest/BuildSupport.pm |    5 ++++-
 Osstest/TestSupport.pm  |    8 ++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
Osstest/BuildSupport.pm +4 -1
index bd79b4b..f3b8c63 100644
@@ -117,7 +117,10 @@ sub submodulefixup ($$$$) {
 		    $log1->("  recording url=$u");
 		    store_runvar($urv, $u);
 		}
-		my $nu = $submod->{Url} = git_massage_url($u);
+		my $nu = $submod->{Url} =
+		    git_massage_url($u, GitFetchBestEffort => 1);
+		# If we don't manage to fetch a version which contains the
+		# necessary commit(s), we will fail later.
 		$_ = "${l}${nu}\n";
 	    }
 	    print ::EO or die $!;
Osstest/TestSupport.pm +6 -2
index 93c8fcf..23ad106 100644
@@ -1026,12 +1026,16 @@ sub file_simple_write_contents ($$) {
 
 #---------- building, vcs's, etc. ----------
 
-sub git_massage_url ($) {
-    my ($url) = @_;
+sub git_massage_url ($;@) {
+    my ($url, %xopts) = @_;
+    # Supports $xopts{GitFetchBestEffort}
 
     if ($url =~ m,^(git|https?)://, && $c{GitCacheProxy} &&
 	substr($url,0,length($c{GitCacheProxy})) ne $c{GitCacheProxy}) {
 	$url = $c{GitCacheProxy}.$url;
+	if ($xopts{GitFetchBestEffort}) {
+	    $url .= '%20[fetch=try]';
+	}
     }
     return $url;
 }
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 4/9 standalone: Honour OSSTEST_CONFIG

In reply to Ian Jackson

If OSSTEST_CONFIG is set in the environment, do not default it to ~/.xen-osstest/config.

---
 standalone |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
standalone +1 -1
index b5eb9bc..55e884f 100755
@@ -61,7 +61,7 @@ TEMP=$(getopt -o c:f:h:rR --long config:,flight:,host:,reuse,noreuse,reinstall,l
 
 eval set -- "$TEMP"
 
-config=$HOME/.xen-osstest/config
+config=${OSSTEST_CONFIG-$HOME/.xen-osstest/config}
 flight="standalone"
 host=
 reuse=1 # Don't blow away machines by default
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH 5/9 standalone-config-example: Provide a setting of Repos

In reply to Ian Jackson
---
 standalone-config-example |    2 ++
 1 file changed, 2 insertions(+)
standalone-config-example +2 -0
index 9b2b79b..9289010 100644
@@ -30,3 +30,5 @@ DebianMirrorHost debian.uk.xensource.com
 DebianPreseed= <<'END'
 d-i clock-setup/ntp-server string ntp.uk.xensource.com
 END
+
+Repos= "$ENV{'HOME'}/osstest-repos"
Signature · 1 line
1.7.10.4
#6 lore raw

PATCH 6/9 mg-list-all-branches: New script.

In reply to Ian Jackson

The approach here is a little unpleasant but it has the virtue of getting the ones out of crontab too, and of not depending on the production database (which will in any case contain obsolete flights).

---
 mg-list-all-branches |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100755 mg-list-all-branches
mg-list-all-branches new file +18 -0
new file mode 100755
index 0000000..c968a99
@@ -0,0 +1,18 @@
+#!/usr/bin/perl -w
+# prints on stdout a list of all the "branches"
+# mentioned in cr-daily-branch or crontab
+
+use strict;
+
+our %branches;
+
+foreach my $f (qw(cr-for-branches crontab)) {
+    open C, $f or die $!;
+    while (<C>) {
+        next unless m/(?:EXTRA_)?BRANCHES[:+]?='?([-.0-9a-z ]+)/;
+        $branches{$_}=1 foreach split /\s+/, $1;
+    }
+    close C or die $!;
+}
+
+print $_,"\n" or die $! foreach sort keys %branches;
Signature · 1 line
1.7.10.4
#7 lore raw

PATCH 7/9 standalone-generate-dump-flight-runvars: New utility

In reply to Ian Jackson

This is helpful for showing the effect of changes to make-flight, cr-daily-branch, et al.

---
 standalone-generate-dump-flight-runvars |   70 +++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100755 standalone-generate-dump-flight-runvars
standalone-generate-dump-flight-runvars new file +70 -0
new file mode 100755
index 0000000..90c6ea8
@@ -0,0 +1,70 @@
+#!/bin/bash
+#
+# Prints the results of each cr-daily-branch's make-flight
+#
+# Usage:
+#    ./standalone-generate-dump-flight-runvars [BRANCH....]
+#
+# If no BRANCHes specified, does all that are normally run by
+# cr-daily-branch or out of crontab.
+
+# 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/>.
+
+set -e
+
+set -o pipefail
+
+mkdir -p tmp
+
+procs=""
+
+if [ $# = 0 ]; then
+   set `./mg-list-all-branches`
+fi
+
+perbranch () {
+    log=tmp/make-flight.$branch.log
+    flight=check_${branch//[-._]/_}
+}
+
+for branch in $@; do
+    perbranch
+    DAILY_BRANCH_POSTMAKE_HOOK='exit 0' \
+    ./standalone make-flight -f $flight $branch >$log 2>&1 &
+    procs+=" $branch=$!"
+done
+
+perproc () {
+    branch=${proc%=*}
+    pid=${proc##*=}
+    perbranch
+}
+
+for proc in $procs; do
+    perproc
+    if ! wait $pid; then
+       set +e
+       cat $log >&2
+       echo >&2 "make-flight $branch failed"
+       exit 1
+    fi
+done
+
+for proc in $procs; do
+    perproc
+    ./mg-show-flight-runvars $flight | sed "s/^/`printf '%-20s' $branch`/"
+done
Signature · 1 line
1.7.10.4
#8 lore raw

Re: [OSSTEST PATCH 7/9] standalone-generate-dump-flight-runvars: New utility

Quoted 1 line · Ian Jackson

+ DAILY_BRANCH_POSTMAKE_HOOK='exit 0' \

standalone make-flight sets DAILY_BRANCH_PREEXEC_HOOK, I think with the same intent. Your one exits earlier but I can't think why we wouldn't want that to be the default

standalone-generate-dump-flight-runvars line 48

Quoted 2 lines
standalone-generate-dump-flight-runvars new file +2 -0
+    ./standalone make-flight -f $flight $branch >$log 2>&1 &
+    procs+=" $branch=$!"

Don't some branches have things in them which aren't valid in shell variable names? e.g. "-" and ".".

I think perbranch should produce a var with a sanitized name in it and use it for the flight name and here.

Ian.

#9 lore raw

Re: [OSSTEST PATCH 7/9] standalone-generate-dump-flight-runvars: New utility

Ian Campbell writes ("Re: [OSSTEST PATCH 7/9] standalone-generate-dump-flight-runvars: New utility"):

Quoted 6 lines · Ian Jackson
Quoted 1 line

+ DAILY_BRANCH_POSTMAKE_HOOK='exit 0' \

standalone make-flight sets DAILY_BRANCH_PREEXEC_HOOK, I think with the same intent. Your one exits earlier but I can't think why we wouldn't want that to be the default

Well, it generates half of the prospective email. I assumed you'd left that in deliberately. If you want to change that, that's fine by me (and I should add a patch to my series to do so).

Quoted 5 lines

standalone-generate-dump-flight-runvars line 48

Quoted 2 lines
standalone-generate-dump-flight-runvars new file +2 -0
+    ./standalone make-flight -f $flight $branch >$log 2>&1 &
+    procs+=" $branch=$!"

Don't some branches have things in them which aren't valid in shell variable names? e.g. "-" and ".".

It's not a variable setting; it's just a convenient syntax to be picked apart by "perproc". (If the script had the bug you suppose it wouldn't have worked at all...)

Thanks,
Ian.

#10 lore raw

Re: [OSSTEST PATCH 7/9] standalone-generate-dump-flight-runvars: New utility

Quoted 11 lines · Ian Jackson

Ian Campbell writes ("Re: [OSSTEST PATCH 7/9] standalone-generate-dump-flight-runvars: New utility"):

Quoted 6 lines · Ian Jackson
Quoted 1 line

+ DAILY_BRANCH_POSTMAKE_HOOK='exit 0' \

standalone make-flight sets DAILY_BRANCH_PREEXEC_HOOK, I think with the same intent. Your one exits earlier but I can't think why we wouldn't want that to be the default

Well, it generates half of the prospective email. I assumed you'd left that in deliberately. If you want to change that, that's fine by me (and I should add a patch to my series to do so).

I just didn't fully understand the flow of cr-daily-branch at that point. I don't think half the prospective email is a useful thing to have in standalone mode, except insofar as it is useful to test that code itself.

Quoted 8 lines
Quoted 5 lines

standalone-generate-dump-flight-runvars line 48

Quoted 2 lines
standalone-generate-dump-flight-runvars new file +2 -0
+    ./standalone make-flight -f $flight $branch >$log 2>&1 &
+    procs+=" $branch=$!"

Don't some branches have things in them which aren't valid in shell variable names? e.g. "-" and ".".

It's not a variable setting; it's just a convenient syntax to be picked apart by "perproc".

Ah, I somehow imagined up an eval in there somewhere, sorry.

Quoted 2 lines

(If the script had the bug you suppose
it wouldn't have worked at all...)

I wasn't sure if you'd only run it branches which happened to not have - in them (e.g. rumpkernels), if not than than I was indeed wondering how it worked for you...

Ian.

#11 lore raw

PATCH 8/9 make-flight: Break out do_rumpkernel_tests

In reply to Ian Jackson

No functional change in this patch.

---
 make-flight |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
make-flight +10 -8
index a01e5ee..a53fab0 100755
@@ -115,6 +115,15 @@ test_matrix_branch_filter_callback () {
   return 0
 }
 
+do_rumpkernel_tests () {
+  rumparch=$dom0arch
+  job_create_test test-$xenarch$kern-$dom0arch-rumpuserxen-$rumparch \
+                      test-rumpuserxen xl \
+            $xenarch $dom0arch                                       \
+            rump_rumpuserxenbuildjob=build-$rumparch-rumpuserxen     \
+            all_hostflags=$most_hostflags
+}
+
 do_freebsd_tests () {
 
   if [ $xenarch != amd64 -o $dom0arch != i386 -o "$kern" != "" ]; then
@@ -292,14 +301,7 @@ test_matrix_do_one () {
   *)               test_xend=n ;;
   esac
 
-  rumparch=$dom0arch
-  if true; then
-      job_create_test test-$xenarch$kern-$dom0arch-rumpuserxen-$rumparch \
-                      test-rumpuserxen xl \
-            $xenarch $dom0arch                                       \
-            rump_rumpuserxenbuildjob=build-$rumparch-rumpuserxen     \
-            all_hostflags=$most_hostflags
-  fi
+  do_rumpkernel_tests
 
   # xend PV guest test on x86 only
   if [ x$test_xend = xy -a \( $dom0arch = "i386" -o $dom0arch = "amd64" \) ]; then
Signature · 1 line
1.7.10.4
#12 lore raw

PATCH 9/9 make-flight: Test rump kernels only when needed

In reply to Ian Jackson

Introduce a new subroutine branch_wants_rumpkernel_tests and call it before making the rumpuserxen build and test jobs.

The default is not to include a rumpuserxen test. We include it for rumpuserxen itself, xen, linux (in case there is a frontend/backend incompatibility), and osstest.

---
 make-flight |    2 ++
 mfi-common  |   14 ++++++++++++++
 2 files changed, 16 insertions(+)
make-flight +2 -0
index a53fab0..fbda440 100755
@@ -116,6 +116,8 @@ test_matrix_branch_filter_callback () {
 }
 
 do_rumpkernel_tests () {
+  branch_wants_rumpkernel_tests || return 0
+
   rumparch=$dom0arch
   job_create_test test-$xenarch$kern-$dom0arch-rumpuserxen-$rumparch \
                       test-rumpuserxen xl \
mfi-common +14 -0
index d1b2737..5dcb2ee 100644
@@ -31,6 +31,16 @@ stripy () {
   eval "$out_vn=\"\$out_$out_val\""
 }
 
+branch_wants_rumpkernel_tests () {
+  case "$branch" in
+  osstest*) return 0;;
+  rump*)    return 0;;
+  xen*)     return 0;;
+  linux*)   return 0;;
+  *)        return 1;;
+  esac
+}
+
 create_build_jobs () {
 
   local arch
@@ -180,6 +190,8 @@ create_build_jobs () {
 
     fi
 
+    if branch_wants_rumpkernel_tests; then
+
     case $arch in
     i386|amd64)
     ./cs-job-create $flight build-$arch-rumpuserxen build-rumpuserxen        \
@@ -197,6 +209,8 @@ create_build_jobs () {
 		;;
     esac
 
+    fi
+
     case "$arch" in
     armhf) continue;; # don't do any other kernel builds
     esac
Signature · 1 line
1.7.10.4
#13 lore raw
In reply to Ian Jackson
Quoted 6 lines · Ian Jackson

These patches are general fixups and loose ends:
1/9 adhoc-revtuple-generator: Avoid an undefined variable warning 3/9 submodulefixup: Tell git cache [fetch=try]
4/9 standalone: Honour OSSTEST_CONFIG
5/9 standalone-config-example: Provide a setting of Repos

Quoted 8 lines

These provide a new test utility:
2/9 adhoc-revtuple-generator: Do not always reclone 6/9 mg-list-all-branches: New script.
7/9 standalone-generate-dump-flight-runvars: New utility

These remove some unnecessary tests:
8/9 make-flight: Break out do_rumpkernel_tests 9/9 make-flight: Test rump kernels only when needed

Apart from the comment on 7/9 looks good to me.

Ian.