2 bm-prep-ownpackage-branches () {
3 cat <<'END' >$tmp/stunt-git
6 *clean*) echo >&2 "BUILD-MODES PROGRAM git $*" ;;
10 chmod +x $tmp/stunt-git
16 t-tstunt-parsechangelog
18 t-prep-newpackage example 1.0
22 git checkout -b bad-build-deps indep-arch
23 perl -pe 's/Build-Depends.*/$&, x-dgit-no-such-package/' \
25 git commit -a -m bad-build-deps
27 bm-prep-ownpackage-branches 'indep-arch bad-build-deps'
29 if zgrep 'dpkg-buildpackage: Make dependency checks fatal for -S' \
30 /usr/share/doc/dpkg-dev/changelog.gz; then
31 dpkgbuildpackage_deps_for_clean=true
33 dpkgbuildpackage_deps_for_clean=false
36 cleanmodes_default="git none dpkg-source dpkg-source-d"
37 cleanmodes_all="$cleanmodes_default git-ff check"
38 cleanmodes="$cleanmodes_default"
41 bm-guess-e-source-e-targets () {
44 sbuild*" --no-arch-all"*)
45 e_source=true; e_targets='build-arch binary-arch' ;;
47 e_source=true; e_targets='' ;;
48 *" -b") e_source=false; e_targets='build binary' ;;
49 *" -B") e_source=false; e_targets='build-arch binary-arch' ;;
50 *" -A") e_source=false; e_targets='build-indep binary-indep' ;;
51 *" -S") e_source=true; e_targets=' ' ;;
52 *" -F") e_source=true; e_targets='build binary' ;;
53 *" -G") e_source=true; e_targets='build-arch binary-arch' ;;
54 *" -g") e_source=true; e_targets='build-indep binary-indep' ;;
55 *) e_source=true; e_targets='build binary' ;;
59 bm-quirk-sbuild-after-act () {
60 # sbuild likes to run the package clean target in the chroot,
61 # which isn't necessary in our case. We don't disable it in
62 # dgit because we want to do what sbuild does, in case there
63 # are packages which don't build unless their clean target was
64 # run. We know it must be running it in the chroot because we
65 # provide sbuild with the dsc, not the tree, so we simply
66 # ignore all executions of the clean target by schroot.
67 local arch=$(dpkg-architecture -qDEB_BUILD_ARCH)
68 local sblog=../example_1.0_$arch.build
69 if [ -e $sblog ]; then
71 s/^EXAMPLE RULES TARGET clean/HOOK SUPPRESSED &/;
78 echo >&4 "SOURCE EXISTS"
80 echo >&4 "SOURCE MISSING"
86 *bad-build-deps*) return 1 ;;
91 bm-compute-expected () {
92 require_fail=unexpect # or required
93 tolerate_fail=unexpect # or tolerate
99 git) echo >&4 'BUILD-MODES PROGRAM git clean -xdf' ;;
100 git-ff) echo >&4 'BUILD-MODES PROGRAM git clean -xdff' ;;
101 check) echo >&4 'BUILD-MODES PROGRAM git clean -xdn' ;;
102 dpkg-source-d) echo >&4 "EXAMPLE RULES TARGET clean" ;;
103 dpkg-source) bm-build-deps-ok || tolerate_fail=tolerate
104 echo >&4 "EXAMPLE RULES TARGET clean"
107 *) fail "t-compute-expected-run $cleanmode ??" ;;
110 if [ "x$e_targets" != x ]; then
111 # e_targets can be " " to mean `/may/ fail due to b-d'
112 bm-build-deps-ok || tolerate_fail=tolerate
115 for t in $e_targets; do
116 bm-build-deps-ok || require_fail=required
117 echo >&4 "EXAMPLE RULES TARGET $t"
120 bm-report-source $e_source
126 local args="$DGIT_TEST_BM_BASEARGS --clean=$cleanmode $real_act"
128 bmid="$act,$cleanmode,$branch"
131 heading="===== [$bmid] dgit $args ====="
133 bmlog=$tmp/run.$bmid.output
134 bmexp=$tmp/run.$bmid.expected
135 bmgot=$tmp/run.$bmid.results
140 git clean -xdf # since we might not do any actual cleaning
142 dsc='../example_1.0.dsc'
146 t-dgit --rm-old-changes --git=$tmp/stunt-git $args 2>&1 | tee $bmlog
147 local ps="${PIPESTATUS[*]}"
156 "0 0") actual_status=success ;;
157 *" 0") actual_status=failure; echo >&4 "OPERATION FAILED"; ;;
158 *) fail "tee failed" ;;
161 case "$require_fail-$tolerate_fail-$actual_status" in
162 required-********-failure) echo >>$bmexp "REQUIRED FAILURE" ;;
163 ********-tolerate-failure) echo >>$bmexp "TOLERATED FAILURE" ;;
164 unexpect-********-success) ;;
165 *) fail "RF=$require_fail TF=$tolerate_fail AS=$actual_status" ;;
168 egrep >&4 '^EXAMPLE RULES TARGET|^BUILD-MODES' $bmlog || [ $? = 1 ]
170 bm-report-source [ -e $dsc ]
174 $bm_quirk_before_diff
176 [ $actual_status = failure ] || diff -U10 $bmexp $bmgot
180 for cleanmode in $cleanmodes; do
181 for branch in $bm_branches; do
185 : bm-act-iterate done.
190 DGIT_TEST_BM_BASEARGS+=' --always-split-source-build'
191 export DGIT_TEST_BM_BASEARGS
192 t-chain-test "${t%%-asplit}"