chiark / gitweb /
* adt-testreport-onepackage: Handling of source packages'
authorIan Jackson <ian@davenant.greenend.org.uk>
Tue, 28 Aug 2007 16:42:29 +0000 (17:42 +0100)
committerIan Jackson <ian@davenant.greenend.org.uk>
Tue, 28 Aug 2007 16:42:29 +0000 (17:42 +0100)
  Architecture: field corrected so package selection works properly.
* adt-testreport-onepackage: use ln -f when installing summary.
* hosts/cadmium/*: new directory for stuff on Canonical buildd.
* adt-run: increase timeouts 100s, 3ks, 10ks, 100ks.
* adt-testreport-onepackage: suppress repetitive emails.
* hosts/cadmium/onepackage-config: change destination directory
* adt-testreport-onepackage: support for Launchpad bug filing
  including signing emails, `affects' line, etc.
* hosts/chinstrap/*: screen-scrap Launchpad to get existing bugs.
* adt-testreport-onepackage: suppress email for packages listed
  in existing bugs suppression file.
* hosts/cadmium/*: convenience scripts changed.
* better formatting and explanations in some emails.
* options for setting timeouts.

16 files changed:
.bzrignore
debian/changelog
hosts/cadmium/cleanup [new file with mode: 0755]
hosts/cadmium/cronjob [new file with mode: 0755]
hosts/cadmium/crontab [new file with mode: 0644]
hosts/cadmium/install-on-cadmium [new file with mode: 0755]
hosts/cadmium/lalonde-nightly [new file with mode: 0755]
hosts/cadmium/manual-test-one-source [new file with mode: 0755]
hosts/cadmium/nightly-lock [new file with mode: 0644]
hosts/cadmium/onepackage-config [new file with mode: 0644]
hosts/chinstrap/crontab [new file with mode: 0644]
hosts/chinstrap/install-on-chinstrap [new file with mode: 0755]
hosts/chinstrap/update-suppressions [new file with mode: 0755]
runner/adt-run
runner/adt-run.1
runner/adt-testreport-onepackage

index feb11fbe0f790868cb4ce376e596576652b2438b..df38628b2349d7615505fdf01c3e7478df8c0d13 100644 (file)
@@ -5,3 +5,6 @@ debian/tmp
 debian/files
 xen/sed-readconfig
 xen/readconfig
+hosts/chinstrap/webpage
+hosts/chinstrap/suppressions
+hosts/chinstrap/suppressions.new
index 70964503a7b6df3943fc454815b658b5bdc51b6a..5a3b1ecf4a3d789c4f52de653fd6a3e23ed6bd40 100644 (file)
@@ -1,3 +1,25 @@
+autopkgtest (1.0.4) gutsy; urgency=low
+
+  * adt-testreport-onepackage: Handling of source packages'
+    Architecture: field corrected so package selection works properly.
+  * adt-testreport-onepackage: use ln -f when installing summary.
+  * hosts/cadmium/*: new directory for stuff on Canonical buildd.
+  * adt-run: increase timeouts 100s, 3ks, 10ks, 100ks.
+  * adt-testreport-onepackage: suppress repetitive emails.
+  * hosts/cadmium/onepackage-config: change destination directory
+  * adt-testreport-onepackage: support for Launchpad bug filing
+    including signing emails, `affects' line, etc.
+  * hosts/chinstrap/*: screen-scrap Launchpad to get existing bugs.
+  * adt-testreport-onepackage: suppress email for packages listed
+    in existing bugs suppression file.
+  * hosts/cadmium/*: convenience scripts changed.
+  * better formatting and explanations in some emails.
+  * options for setting timeouts.
+
+ -- Ian Jackson <iwj@ubuntu.com>  Tue, 28 Aug 2007 17:42:13 +0100
+
+Tue, 28 Aug 2007 17:41:35 +0100
+
 autopkgtest (1.0.3) unstable; urgency=low
 
   * Set LANG to C by default for commands (eg builds and tests) run on
diff --git a/hosts/cadmium/cleanup b/hosts/cadmium/cleanup
new file mode 100755 (executable)
index 0000000..aa7edad
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+set -e
+cd /home/iwj/public_html/autopkgtest-output
+
+#rmvia=true
+
+find *                                 \
+       -maxdepth 2                     \
+       -mindepth 2                     \
+       \(                              \
+                  -name src            \
+               -o -name tmp.\*         \
+               -o -type d              \
+               -o -size +100k          \
+       \)                              \
+       -mtime +3                       \
+       -print0                         \
+ | xargs -tr0 $rmvia rm -rf --
+
+find *                                 \
+       -maxdepth 1                     \
+       -mindepth 1                     \
+       -type d                         \
+       -mtime +100                     \
+       -print0                         \
+ | xargs -tr0 $rmvia rm -rf --
+
diff --git a/hosts/cadmium/cronjob b/hosts/cadmium/cronjob
new file mode 100755 (executable)
index 0000000..28d45ce
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+cd adt-play
+exec >>overall.log 2>&1
+test -f go
+with-lock-ex -q nightly-lock ./lalonde-nightly max_test_count=100
diff --git a/hosts/cadmium/crontab b/hosts/cadmium/crontab
new file mode 100644 (file)
index 0000000..119497e
--- /dev/null
@@ -0,0 +1,4 @@
+# m h dom mon dow       command
+4-59/5 * * * *         adt-play/cronjob
+22 0 * * Mon           savelog -n7 adt-play/overall.log
+58 7 * * *             adt-play/cleanup
diff --git a/hosts/cadmium/install-on-cadmium b/hosts/cadmium/install-on-cadmium
new file mode 100755 (executable)
index 0000000..bc1aa6e
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+set -e
+cd /work/AutomatedTesting/autopkgtest--main/
+rsync -a . cadmium.buildd:autopkgtest/.
diff --git a/hosts/cadmium/lalonde-nightly b/hosts/cadmium/lalonde-nightly
new file mode 100755 (executable)
index 0000000..020b5f2
--- /dev/null
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+set -e
+
+PATH=/home/iwj/autopkgtest/runner:/usr/local/sbin:/usr/sbin:$PATH
+export PATH
+
+#any_tests_ok=false
+any_tests_ok=true
+source_tests_ok=true
+binary_tests_ok=true
+gutsy_tests_ok=true
+max_test_count=10
+go_anyway=false
+
+for x in "$@"; do eval "$x"; done
+
+fail () { printf >&2 "%s\n" "$*"; exit 127; }
+progress () { printf "========== %s ==========\n" "$1"; }
+x () { printf "+ %s\n" "$*"; "$@"; }
+x2 () { printf >&2 "+ %s\n" "$*"; "$@"; }
+
+wait_for () {
+       remain=$1; interval=$2; on_not=$3; shift;shift;shift
+       progress "await ($interval/$remain) $*"
+       while true; do
+               date
+               if "$@"; then return; fi
+               remain=$(( $remain - $interval ))
+               if [ $remain -lt 0 ]; then fail "wait timed out for $*"; fi
+               eval "$on_not"
+               sleep $interval
+       done
+}
+
+progress testing
+
+xoptslist="source gutsy, target=source:binary gutsy, target=binary-amd64"
+
+test_count=0
+
+while $any_tests_ok && ($go_anyway || test -f go) && test $test_count -lt $max_test_count; do
+       now=`date`
+       printf "%s" "$now: "
+       
+       xopts="${xoptslist%%:*}"
+       xopts_opts="${xopts#*,}"
+       xoptslist="${xoptslist#*:}:$xopts"
+       printf "considering (%s) " "$xopts_opts"
+
+       anybroken=false
+       for x in ${xopts%%,*}; do
+               if eval \$${x}_tests_ok; then :; else
+                       printf "   skipping because of %s\n" "$x"
+                       anybroken=true
+                       break
+               fi
+       done
+       if $anybroken; then continue; fi
+
+       adt-testreport-onepackage /home/iwj/adt-play/onepackage-config \
+               adtrun_extra_opts=--built-binaries-filter=__ \
+               interactive=false $xopts_opts
+
+       test_count=$(( $test_count + 1 ))
+done
+
+progress 'stopping'
diff --git a/hosts/cadmium/manual-test-one-source b/hosts/cadmium/manual-test-one-source
new file mode 100755 (executable)
index 0000000..c25842f
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+# usage: .../manual-test-one-source <package-name>
+set -ex
+cd /home/iwj/adt-play
+PATH=/home/iwj/autopkgtest/runner:/usr/local/sbin:/usr/sbin:$PATH
+export PATH
+adt-testreport-onepackage /home/iwj/adt-play/onepackage-config adtrun_extra_opts=--built-binaries-filter=__ interactive=false target=source pkg=$1
diff --git a/hosts/cadmium/nightly-lock b/hosts/cadmium/nightly-lock
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/hosts/cadmium/onepackage-config b/hosts/cadmium/onepackage-config
new file mode 100644 (file)
index 0000000..aa747db
--- /dev/null
@@ -0,0 +1,31 @@
+cd /home/iwj/adt-play
+mirror=http://archive.ubuntu.com/ubuntu
+distro=gutsy
+suite=main
+administrator_email=iwj@ubuntu.com
+#maintainer_email_override="$administrator_email"
+salutation="Ian"
+from="$salutation Jackson <ian+ubuntu-autopkgtest@chiark.greenend.org.uk>"
+disable=false
+desthttphead=http://autopkgtest.ubuntu.com
+destrsynchead=/home/iwj/public_html
+destdirtail=autopkgtest-output
+adtvirt_extra_opts=--userv
+upload_if_ok=true
+upload_if_notests=true
+suppressrepeatedemails=false
+suppresspackages=suppressions
+
+email_extra_info='
+The test environment is an amd64 Xen guest with limited amounts of
+memory.  The relevant dependencies are installed for each test but
+very few other packages.  Most autopkgtest reports are FTBFS problems.
+'
+
+maintainer_email_override="new@bugs.launchpad.net"
+email_package_header='
+ affects /ubuntu/%s
+ importance high
+
+'
+email_signing_key=0xD6279768
diff --git a/hosts/chinstrap/crontab b/hosts/chinstrap/crontab
new file mode 100644 (file)
index 0000000..9d95c70
--- /dev/null
@@ -0,0 +1,3 @@
+MAILTO=iwj@ubuntu.com
+# m h dom mon dow       command
+6-46/20 * * * *        autopkgtest/hosts/chinstrap/update-suppressions >/dev/null
diff --git a/hosts/chinstrap/install-on-chinstrap b/hosts/chinstrap/install-on-chinstrap
new file mode 100755 (executable)
index 0000000..189ff1c
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+set -e
+cd /work/AutomatedTesting/autopkgtest--main/
+rsync -a . chinstrap.ubuntu.com:autopkgtest/.
diff --git a/hosts/chinstrap/update-suppressions b/hosts/chinstrap/update-suppressions
new file mode 100755 (executable)
index 0000000..601c4cf
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+cd ${0%/*}
+
+url='https://launchpad.net/ubuntu/+bugs?field.searchtext=&orderby=-importance&field.status%3Alist=New&field.status%3Alist=Incomplete&field.status%3Alist=Confirmed&field.status%3Alist=Triaged&field.status%3Alist=In+Progress&field.status%3Alist=Fix+Committed&assignee_option=any&field.assignee=&field.bug_reporter=ian%2Bubuntu-autopkgtest&field.bug_contact=&field.bug_commenter=&field.subscriber=&field.status_upstream-empty-marker=1&field.omit_dupes.used=&field.has_patch.used=&field.tag=&field.has_cve.used=&search=Search'
+
+echo 'fetching'
+curl -s -k -o webpage "$url"
+
+echo 'grepping'
+perl -ne '
+    print "$1\n" or die $! if
+     m,"https://bugs.launchpad.net/ubuntu/\+source/([-+.0-9a-z]+)/\+bug/\d+",
+' <webpage >suppressions.new
+
+nl -ba suppressions.new
+
+if ! test -s suppressions.new;
+then
+       echo >&2 'NO SUPPRESSIONS - PROBABLY WENT WRONG'
+fi
+
+echo 'uploading'
+
+mv suppressions.new suppressions
+RSYNC_RSH=ssh rsync suppressions cadmium.buildd:adt-play/.
+
+echo 'done.'
index e5a2c97ab861f9f515a24d5ffbb0f310c962d9be..c14e9265821e3aef19f0a41f5703df0a0b9d8b30 100755 (executable)
@@ -45,7 +45,7 @@ signal.signal(signal.SIGINT, signal.SIG_DFL) # undo stupid Python SIGINT thing
 tmpdir = None          # pathstring on host
 testbed = None         # Testbed
 errorcode = 0          # exit status that we are going to use
-timeouts = { 'short':10, 'install':900, 'test':600, 'build':3000 }
+timeouts = { 'short':100, 'install':3000, 'test':10000, 'build':100000 }
 binaries = None                # Binaries (.debs we have registered)
 build_essential = ["build-essential"]
 
@@ -408,7 +408,7 @@ class Action:
        return "<Action %s %s %s>" % (a.kind, a.what, `a.af`)
 
 def parse_args():
-       global opts
+       global opts, timeouts
        global n_non_actions # argh, stupid python scoping rules
        usage = "%prog <options> --- <virt-server>..."
        parser = OptionParser(usage=usage)
@@ -558,6 +558,13 @@ def parse_args():
                help='write a summary report to SUMMARY,'
                     ' emptying it beforehand')
 
+       for k in timeouts.keys():
+               pa('','--timeout-'+k,   type='int', dest='timeout_'+k,
+                       metavar='T', help='set %s timeout to T')
+       pa('','--timeout-factor',       type='float', dest='timeout_factor',
+                       metavar='FACTOR', default=1.0,
+                       help='multiply all default timeouts by FACTOR')
+
        pa('','--user',                 type='string', dest='user',
                help='run tests as USER (needs root on testbed)')
        pa('','--gain-root',            type='string', dest='gainroot',
@@ -594,6 +601,11 @@ def parse_args():
        if n_non_actions >= len(parser.largs):
                parser.error('nothing to do specified')
 
+       for k in timeouts.keys():
+               t = getattr(opts,'timeout_'+k)
+               if t is None: t = timeouts[k] * opts.timeout_factor
+               timeouts[k] = int(t)
+
        arghandling = initial_arghandling
        opts.actions = []
        ix = 0
@@ -654,7 +666,7 @@ def setup_trace():
        if opts.summary is not None:
                summary_stream = open(opts.summary, 'w', 0)
 
-       debug('options: '+`opts`, 1)
+       debug('options: '+`opts`+'; timeouts: '+`timeouts`, 1)
 
 def finalise_options():
        global opts, tb, build_essential
index fda5fd683fa16c2787ae6d5f942e07133667bbdd..ff1a661efae13e3d9ad96d00445b62dfa225d06a 100644 (file)
@@ -159,6 +159,27 @@ Specifies that a summary of the outcome should be written to
 in any case.
 \fIsummary\fR is not affected by \fB--paths-testbed\fR.
 .TP
+.BR --timeout- \fIwhich\fR = \fIseconds\fR
+Use a different timeout for operations on or with the testbed.  There
+are four timeouts affected by four values of \fIwhich\fR:
+.BR short :
+supposedly
+short operations like setting up the testbed's apt and checking the
+state (default: 100s);
+.BR install :
+installation of packages including dependencies
+(default: 3ks);
+.BR test :
+test runs (default: 10ks); and
+.BR build :
+builds (default:
+100ks).  The value must be specified as an integer number of seconds.
+.TP
+.BR --timeout-factor =\fIdouble\fR
+Multiply all of the default timeouts by the specified factor (see
+\fB--timeout-\fR\fIwhich\fR above).  Only the defaults are affected;
+explicit timeout settings are used exactly as specified.
+.TP
 .BR --debug | -d
 Include additional debugging information in the trace log.  Each
 additional \fB-d\fR increases the debugging level; the current maximum
index 122abfb552a6e26d7670784894b9a63ed931c53c..37c4766ff68b07f91ecefcd857f561576c12e8c0 100755 (executable)
@@ -9,6 +9,7 @@ rsync=rsync
 disable=true
 interactive=true
 target=source
+suppressrepeatedemails=false
 arch=`dpkg --print-architecture`
 
 for config in "$@"; do
@@ -99,6 +100,7 @@ if [ "x$pkg" = x ]; then
                return if $score < $best_score
                     or ($score==$best_score and \
                         $package gt $best_package);
+#printf STDERR " <----- best score=%s best_score=%s\n", $score, $best_score;
                $best_score= $score;
                $best_package= $package;
        }
@@ -124,8 +126,10 @@ if [ "x$pkg" = x ]; then
                        $score= 1e7 if $score>1e7;
                        $score *= 5 if $lastver{$package} ne $version;
                        $score *= 10 unless $extras{$package} =~ m/ nt /;
+#print STDERR "$package score $score\n";
                } elsif (m/^Architecture:.*/ &&
-                        !m/\s'$arch'\s/) {
+                        !m/\s(?:'$arch'|all|any)\s/) {
+#printf STDERR " <----- skip %s %s\n", $&, "'$arch'";
                        $skip= 1;
                } elsif (m/^$/) {
                        endpackage();
@@ -253,10 +257,33 @@ esac
 
 progress "RESULTS $summary"
 
+if  [ "x$suppresspackages" != x ] \
+ && grep -x "$pkg" "$suppresspackages" >/dev/null; then
+       printf >&3 "email-suppressed "
+       email=''
+fi
+
 if $upload; then
        progress "bundling"
        printf "\n%s\n" "$summary" >>"$tmp"/_summary
-       ln "$tmp"/_summary "$tp"/summary
+
+       edest=${email%_email}
+       esummary="$var"/emailed/last-$pkg,$edest
+       if [ "x$edest" = x ]; then
+               printf >&3 "email-none "
+               rm -f "$var"/emailed/last-$pkg,*
+               esummary=''
+       elif $suppressrepeatedemails \
+         && [ -f "$esummary" ] \
+         && diff -u "$esummary" "$tmp"/_summary >"$var"/emailed/diff-$pkg; then
+               printf >&3 "email-same $email "
+               email=''
+               esummary=''
+       else
+               cp "$tmp"/_summary "$esummary".new
+       fi
+
+       ln -f "$tmp"/_summary "$tp"/summary
 
        for odir in tmp out; do
                if test -d "$tp"/$odir; then
@@ -275,11 +302,16 @@ if [ "x$email" != x ]; then
        progress "contacting $email"
        eval "email_addr=\$$email"
        printf >&3 "email \"%s\" " "$email_addr"
-       cat >"$tmp"/_email <<END
+       cat >"$tmp"/_email_header <<END
 From: $from
 To: $email_addr
 Subject: autopkgtest $distro $desc: $summary
 
+END
+
+       printf >"$tmp"/_email "$email_package_header" "$pkg"
+
+       cat >>"$tmp"/_email <<END
  Test executed for:  $distro  $target  $pkg
  Outcome: $summary
 END
@@ -293,14 +325,14 @@ END
                pMaintainer)
                        cat >>"$tmp"/_email <<END
  You are listed in the Maintainer field of the $pkg package in $distro
 and the test results appear to indicate a problem with the package.
+ and the test results appear to indicate a problem with the package.
 END
                        ;;
                maintainer_email_override)
                        cat >>"$tmp"/_email <<END
  The test results appear to indicate a problem with the package
 and reports for package maintainers for $distro are being directed to
 $maintainer_email_override
+ and reports for package maintainers for $distro are being directed to
+ $maintainer_email_override
 END
                        ;;
                administrator_email)
@@ -320,7 +352,7 @@ failures, can be found below.  However, in case this is not
 sufficient, another copy can be found along with output files, saved
 temporary files, and so on, at:
  $desthttphead/$destdirfin/
-
+$email_extra_info
 If you have any questions about this service please contact me at:
  $from
 
@@ -350,10 +382,25 @@ if [ "x$email" = x ]; then
        fi
 else
        cat >>"$tmp"/_email 2>&1 "$tmp"/_log ||:
+
+       if [ "x$email_signing_key" != x ]; then
+               printf >&3 "signing "
+               echo >>"$tmp/_email"
+               gpg -u"$email_signing_key" --clearsign \
+                       <"$tmp/_email" >"$tmp/_email.asc"
+               mv -f "$tmp/_email.asc" "$tmp/_email"
+       fi
+       cat "$tmp/_email_header" "$tmp/_email" >"$tmp/_email.new"
+       mv -f "$tmp/_email.new" "$tmp/_email"
+
        if $interactive; then
                cat "$tmp"/_email >&2
        else
                sendmail -odi -oem -t -oi <"$tmp"/_email
+               if [ "x$esummary" != x ]; then
+                       printf >&3 "email-recorded "
+                       mv "$esummary".new "esummary"
+               fi
        fi
 fi