12 arch=`dpkg --print-architecture`
14 for config in "$@"; do
16 *=*) eval "$config" ;;
22 echo >&2 'disabled because config inadequate (no disable=false)'
26 : ${destdirtail:=$distro-$target}
27 : ${destdirfin:="$destdircommon$destdirtail"}
36 descx="${target#binary-}"
39 echo >&2 'target must be source or binary-*'
44 printf >&3 "starting "
52 echo '(log diverted to stdout)' >>"$tmp"/_log
59 echo "++++++ $1 ++++++"
63 progress "fetching $1"
67 gurl "$mirror/dists/$distro/$suite/$target/$sources.gz" "$tmp"/_$sources.gz
68 zcat "$tmp"/_$sources.gz >"$tmp"/_$sources-in
70 lastinfo="$var"/lastinfo-$target
77 if [ "x$pkg" = x ]; then
82 $vre= "[-+.0-9a-zA-Z:~]+";
84 sub f1() { $fn=shift @ARGV; open F, $fn or die "$fn $!"; }
85 sub f2() { F->error and die "$fn $!"; close F or die "$fn $!"; }
89 die unless m/^($pre) ($vre) (\d+)( .*)?$/;
99 return if $score < $best_score
100 or ($score==$best_score and \
101 $package gt $best_package);
103 $best_package= $package;
106 return unless (defined $package
109 die unless defined $package;
110 die unless defined $version;
117 if (m/^Package: ($pre)$/) {
118 die if defined $package;
120 } elsif (m/^Version: ($vre)$/) {
121 die if defined $version;
123 $score= '$now' - $lasttime{$package};
124 $score= 1e7 if $score>1e7;
125 $score *= 5 if $lastver{$package} ne $version;
126 $score *= 10 unless $extras{$package} =~ m/ nt /;
127 } elsif (m/^Architecture:.*/ &&
136 die unless length $best_package;
137 open L, ">&4" or die $!;
138 printf L "selected %s (age %s, score %d)\n",
140 exists($lastime{$best_package})
141 ? '$now' - $lasttime{$best_package}
144 print "$best_package\n" or die $!;
145 ' "$lastinfo" "$tmp"/_$sources-in`"
147 printf >&4 "package forced: %s\n" "$pkg"
150 sed -n "/^Package: $pkg\$/,/^\$/p" \
151 <"$tmp"/_$sources-in >"$tmp"/_this-stanza
154 cat "$tmp"/_this-stanza
158 sed -n '\''s/^'$1': //p'\'' \
163 printf >&3 "selected \"%s\" " $pkg
166 mkdir "$tp" "$tp/src" "$tp/tmp" "$tp/out"
170 if test $target = source; then
173 sed -n '/^Files:/,/^([^ ].*)?$/{ /^ /{
174 s/^ [0-9a-z][0-9a-z]* *[0-9][0-9]* //; p
178 for leafname in $leafnames; do
179 df="$tp/src/$leafname"
181 */*|.*) echo >&2 "bad leafname: $leafname"; exit 1;;
184 gurl "$mirror/$pDirectory/$leafname" "$df"
189 : ${upload_if_ok:=true}
192 fot="$tp/src/$pkg.deb"
193 gurl "$mirror/$pFilename" "$fot"
194 testmode='--binaries=install --binary'
195 testmode2=--instantiate
197 : ${upload_if_ok:=false}
200 if [ "x$maintainer_email_override" = x ]; then
202 maintainer_email=pMaintainer
204 maintainer_email=maintainer_email_override
207 printf >&3 "adt-run "
209 progress "starting test"
219 echo 'fatal: adt-run did not start properly' >"$tmp"/_summary
221 xrc adt-run --tmp-dir "$tp"/tmp \
222 --output-dir "$tp"/out \
223 --log-file "$tp"/log \
224 --summary "$tmp"/_summary \
226 $testmode "$fot" $testmode2 \
229 $adtvirt_extra_opts \
241 0) summary='all OK'; email=''
242 upload=$upload_if_ok ;;
243 2) summary='OK (some skipped)'; email=''
244 upload=$upload_if_ok ;;
245 8) summary='package declares no tests'; email=''
246 upload=false; extras='nt' ;;
247 4|6) summary='test(s) failed!'; email="$maintainer_email" ;;
248 12) summary='erroneous package!'; email="$maintainer_email" ;;
249 16) summary='testbed failed!'; email="administrator_email" ;;
250 *) summary='unexpected failure!'; email="administrator_email"; ourx=20;;
253 progress "RESULTS $summary"
257 ln "$tmp"/_summary "$tp"/summary
259 for odir in tmp out; do
260 if test -d "$tp"/$odir; then
261 GZIP=-2 tar -f "$tp"/$odir.tar.gz -C "$tp" -zc $odir
267 printf >&3 "uploading"
268 $rsync -rltH --safe-links --delete "$tp" "$destrsynchead/$destdirfin/"
272 if [ "x$email" != x ]; then
273 progress "contacting $email"
274 eval "email_addr=\$$email"
275 printf >&3 "email \"%s\" " "$email_addr"
276 cat >"$tmp"/_email <<END
279 Subject: autopkgtest $distro $desc: $summary
281 Test executed for: $distro $target $pkg
284 sed -e 's/^/ /' "$tmp"/_summary >>"$tmp"/_email
285 cat >>"$tmp"/_email <<END
287 This message is automatically generated by the autopkgtest package
288 testing system. You are receiving it because:
292 cat >>"$tmp"/_email <<END
293 You are listed in the Maintainer field of the $pkg package in $distro
294 and the test results appear to indicate a problem with the package.
297 maintainer_email_override)
298 cat >>"$tmp"/_email <<END
299 The test results appear to indicate a problem with the package
300 and reports for package maintainers for $distro are being directed to
301 $maintainer_email_override
305 cat >>"$tmp"/_email <<END
306 You are the administrator for the autopkgtest installation.
310 echo >&2 "huh email $email is what why?"
314 cat >>"$tmp/_email" <<END
316 The test log, which is intended to be sufficient to diagnose most
317 failures, can be found below. However, in case this is not
318 sufficient, another copy can be found along with output files, saved
319 temporary files, and so on, at:
320 $desthttphead/$destdirfin/
322 If you have any questions about this service please contact me at:
332 printf >>"$var"/log "%s=%s rc=%s emailed='%s'\n" \
333 "$target" "$pkg" $rc "$email_addr"
335 if [ "x$ourx" = x0 ]; then
336 sed -e "/^$pkg /d" <"$lastinfo" >"$lastinfo".new
337 printf "%s %s %s %s\n" "$pkg" "$pVersion" "$now" "$extras" \
339 mv "$lastinfo".new "$lastinfo"
342 progress "fault ($ourx)."
345 if [ "x$email" = x ]; then
346 if $interactive; then
350 cat >>"$tmp"/_email 2>&1 "$tmp"/_log ||:
351 if $interactive; then
352 cat "$tmp"/_email >&2
354 sendmail -odi -oem -t -oi <"$tmp"/_email
358 printf >&3 "done %s.\n" $ourx