chiark / gitweb /
* adt-xenlvm-with-testbed: sleep 1 after xm destroy, which is racy.
[autopkgtest.git] / runner / adt-testreport-runloop
1 #!/bin/bash
2 # This file is part of autopkgtest
3 # autopkgtest is a tool for testing Debian packages
4 #
5 # autopkgtest is Copyright (C) 2006 Canonical Ltd.
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #
21 # See the file CREDITS for a full list of credits information (often
22 # installed as /usr/share/doc/autopkgtest/CREDITS).
23
24 set -e
25
26 max_test_count=10
27 go_anyway=false
28
29 for arg in "$@"; do
30         case "$arg" in
31         !*)     arg="${arg#!}" ;;
32         *)      onepackage_args[${#onepackage_args[*]}]="${arg#@}" ;;
33         esac
34
35         case "$arg" in
36         @*)                     ;;
37         *=*)    eval "$arg"     ;;
38         *)      . "$arg"        ;;
39         esac
40 done
41
42 if [ "x$distro" = x ]; then
43         : ${testbed_check_path:=/var/lib/autopkgtest/xenlvm/adt_${distro}/good}
44 else
45         : ${testbed_check_path:=/dev/null}
46 fi
47
48 if [ "x$test_classes" = x ]; then
49         : ${architecture:=`dpkg --print-architecture`}
50         test_classes="source $distro, target=source : binary $distro, target=binary-$architecture"
51 fi
52
53 fail () { printf >&2 "%s\n" "$*"; exit 127; }
54 progress () { printf "========== %s ==========\n" "$1"; }
55 x () { printf "+ %s\n" "$*"; "$@"; }
56 x2 () { printf >&2 "+ %s\n" "$*"; "$@"; }
57
58 progress testing
59
60 test_count=0
61
62 while ($go_anyway || test -f go) && test $test_count -lt $max_test_count; do
63         now=`date`
64         printf "%s" "$now: "
65
66         if ! test -e $testbed_check_path; then
67                 printf " testbed broken, bailing\n"
68                 break
69         fi
70
71         xopts="${test_classes%%:*}"
72         xopts_opts="${xopts#*,}"
73         printf "considering (%s) " "$xopts_opts"
74
75         case "$test_classes" in
76         *:*)    test_classes="${test_classes#*:}:$xopts" ;;
77         esac
78
79         anybroken=false
80         for x in ${xopts%%,*}; do
81                 if test -f "stop-$x"; then
82                         printf "   skipping because of %s" "$x"
83                         anybroken=true
84                         break
85                 fi
86         done
87         if $anybroken; then
88                 printf "\n"
89                 continue
90         fi
91
92         adt-testreport-onepackage                               \
93                 adtrun_extra_opts=--built-binaries-filter=__    \
94                 interactive=false                               \
95                 "${onepackage_args[@]}"                         \
96                 $xopts_opts
97
98         test_count=$(( $test_count + 1 ))
99 done
100
101 progress 'stopping'