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 \
238 : ${upload_if_notests:=false}
242 0) summary='all OK'; email=''
243 upload=$upload_if_ok ;;
244 2) summary='OK (some skipped)'; email=''
245 upload=$upload_if_ok ;;
246 8) summary='package declares no tests'; email=''
247 upload=$upload_if_notests; extras='nt' ;;
248 4|6) summary='test(s) failed!'; email="$maintainer_email" ;;
249 12) summary='erroneous package!'; email="$maintainer_email" ;;
250 16) summary='testbed failed!'; email="administrator_email" ;;
251 *) summary='unexpected failure!'; email="administrator_email"; ourx=20;;
254 progress "RESULTS $summary"
258 printf "\n%s\n" "$summary" >>"$tmp"/_summary
259 ln "$tmp"/_summary "$tp"/summary
261 for odir in tmp out; do
262 if test -d "$tp"/$odir; then
263 GZIP=-2 tar -f "$tp"/$odir.tar.gz -C "$tp" -zc $odir
269 printf >&3 "uploading"
270 $rsync -rltH --safe-links --delete "$tp" "$destrsynchead/$destdirfin/"
274 if [ "x$email" != x ]; then
275 progress "contacting $email"
276 eval "email_addr=\$$email"
277 printf >&3 "email \"%s\" " "$email_addr"
278 cat >"$tmp"/_email <<END
281 Subject: autopkgtest $distro $desc: $summary
283 Test executed for: $distro $target $pkg
286 sed -e 's/^/ /' "$tmp"/_summary >>"$tmp"/_email
287 cat >>"$tmp"/_email <<END
289 This message is automatically generated by the autopkgtest package
290 testing system. You are receiving it because:
294 cat >>"$tmp"/_email <<END
295 You are listed in the Maintainer field of the $pkg package in $distro
296 and the test results appear to indicate a problem with the package.
299 maintainer_email_override)
300 cat >>"$tmp"/_email <<END
301 The test results appear to indicate a problem with the package
302 and reports for package maintainers for $distro are being directed to
303 $maintainer_email_override
307 cat >>"$tmp"/_email <<END
308 You are the administrator for the autopkgtest installation.
312 echo >&2 "huh email $email is what why?"
316 cat >>"$tmp/_email" <<END
318 The test log, which is intended to be sufficient to diagnose most
319 failures, can be found below. However, in case this is not
320 sufficient, another copy can be found along with output files, saved
321 temporary files, and so on, at:
322 $desthttphead/$destdirfin/
324 If you have any questions about this service please contact me at:
334 printf >>"$var"/log "%s=%s rc=%s emailed='%s'\n" \
335 "$target" "$pkg" $rc "$email_addr"
337 if [ "x$ourx" = x0 ]; then
338 sed -e "/^$pkg /d" <"$lastinfo" >"$lastinfo".new
339 printf "%s %s %s %s\n" "$pkg" "$pVersion" "$now" "$extras" \
341 mv "$lastinfo".new "$lastinfo"
344 progress "fault ($ourx)."
347 if [ "x$email" = x ]; then
348 if $interactive; then
352 cat >>"$tmp"/_email 2>&1 "$tmp"/_log ||:
353 if $interactive; then
354 cat "$tmp"/_email >&2
356 sendmail -odi -oem -t -oi <"$tmp"/_email
360 printf >&3 "done %s.\n" $ourx