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 () {
45 e_source=true; e_targets='' ;;
46 *" -b") e_source=false; e_targets='build binary' ;;
47 *" -B") e_source=false; e_targets='build-arch binary-arch' ;;
48 *" -A") e_source=false; e_targets='build-indep binary-indep' ;;
49 *" -S") e_source=true; e_targets=' ' ;;
50 *" -F") e_source=true; e_targets='build binary' ;;
51 *" -G") e_source=true; e_targets='build-arch binary-arch' ;;
52 *" -g") e_source=true; e_targets='build-indep binary-indep' ;;
53 *) e_source=true; e_targets='build binary' ;;
60 echo >&4 "SOURCE EXISTS"
62 echo >&4 "SOURCE MISSING"
68 *bad-build-deps*) return 1 ;;
73 bm-compute-expected () {
74 require_fail=unexpect # or required
75 tolerate_fail=unexpect # or tolerate
81 git) echo >&4 'BUILD-MODES PROGRAM git clean -xdf' ;;
82 git-ff) echo >&4 'BUILD-MODES PROGRAM git clean -xdff' ;;
83 check) echo >&4 'BUILD-MODES PROGRAM git clean -xdn' ;;
84 dpkg-source-d) echo >&4 "EXAMPLE RULES TARGET clean" ;;
85 dpkg-source) bm-build-deps-ok || tolerate_fail=tolerate
86 echo >&4 "EXAMPLE RULES TARGET clean"
89 *) fail "t-compute-expected-run $cleanmode ??" ;;
92 if [ "x$e_targets" != x ]; then
93 # e_targets can be " " to mean `/may/ fail due to b-d'
94 bm-build-deps-ok || tolerate_fail=tolerate
97 for t in $e_targets; do
98 bm-build-deps-ok || require_fail=required
99 echo >&4 "EXAMPLE RULES TARGET $t"
102 bm-report-source $e_source
108 local args="$DGIT_TEST_BM_BASEARGS --clean=$cleanmode $real_act"
110 bmid="$act,$cleanmode,$branch"
113 heading="===== [$bmid] dgit $args ====="
115 bmlog=$tmp/run.$bmid.output
116 bmexp=$tmp/run.$bmid.expected
117 bmgot=$tmp/run.$bmid.results
122 git clean -xdf # since we might not do any actual cleaning
124 dsc='../example_1.0.dsc'
128 t-dgit --rm-old-changes --git=$tmp/stunt-git $args 2>&1 | tee $bmlog
129 local ps="${PIPESTATUS[*]}"
138 "0 0") actual_status=success ;;
139 *" 0") actual_status=failure; echo >&4 "OPERATION FAILED"; ;;
140 *) fail "tee failed" ;;
143 case "$require_fail-$tolerate_fail-$actual_status" in
144 required-********-failure) echo >>$bmexp "REQUIRED FAILURE" ;;
145 ********-tolerate-failure) echo >>$bmexp "TOLERATED FAILURE" ;;
146 unexpect-********-success) ;;
147 *) fail "RF=$require_fail TF=$tolerate_fail AS=$actual_status" ;;
150 egrep >&4 '^EXAMPLE RULES TARGET|^BUILD-MODES' $bmlog || [ $? = 1 ]
152 bm-report-source [ -e $dsc ]
156 $bm_quirk_before_diff
158 [ $actual_status = failure ] || diff -U10 $bmexp $bmgot
162 for cleanmode in $cleanmodes; do
163 for branch in $bm_branches; do
167 : bm-act-iterate done.
172 DGIT_TEST_BM_BASEARGS+=' --always-split-source-build'
173 export DGIT_TEST_BM_BASEARGS
174 t-chain-test "${t%%-asplit}"