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 *" -b") e_source=false; e_targets='build binary' ;;
45 *" -B") e_source=false; e_targets='build-arch binary-arch' ;;
46 *" -A") e_source=false; e_targets='build-indep binary-indep' ;;
47 *" -S") e_source=true; e_targets=' ' ;;
48 *" -F") e_source=true; e_targets='build binary' ;;
49 *" -G") e_source=true; e_targets='build-arch binary-arch' ;;
50 *" -g") e_source=true; e_targets='build-indep binary-indep' ;;
51 *) e_source=true; e_targets='build binary' ;;
58 echo >&4 "SOURCE EXISTS"
60 echo >&4 "SOURCE MISSING"
66 *bad-build-deps*) return 1 ;;
71 bm-compute-expected () {
72 require_fail=unexpect # or required
73 tolerate_fail=unexpect # or tolerate
79 git) echo >&4 'BUILD-MODES PROGRAM git clean -xdf' ;;
80 git-ff) echo >&4 'BUILD-MODES PROGRAM git clean -xdff' ;;
81 check) echo >&4 'BUILD-MODES PROGRAM git clean -xdn' ;;
82 dpkg-source-d) echo >&4 "EXAMPLE RULES TARGET clean" ;;
83 dpkg-source) bm-build-deps-ok || tolerate_fail=tolerate
84 echo >&4 "EXAMPLE RULES TARGET clean"
87 *) fail "t-compute-expected-run $cleanmode ??" ;;
90 if [ "x$e_targets" != x ]; then
91 # e_targets can be " " to mean `/may/ fail due to b-d'
92 bm-build-deps-ok || tolerate_fail=tolerate
95 for t in $e_targets; do
96 bm-build-deps-ok || require_fail=required
97 echo >&4 "EXAMPLE RULES TARGET $t"
100 bm-report-source $e_source
106 local args="$DGIT_TEST_BM_BASEARGS --clean=$cleanmode $real_act"
108 bmid="$act,$cleanmode,$branch"
111 heading="===== [$bmid] dgit $args ====="
113 bmlog=$tmp/run.$bmid.output
114 bmexp=$tmp/run.$bmid.expected
115 bmgot=$tmp/run.$bmid.results
120 git clean -xdf # since we might not do any actual cleaning
122 dsc='../example_1.0.dsc'
126 t-dgit --rm-old-changes --git=$tmp/stunt-git $args 2>&1 | tee $bmlog
127 local ps="${PIPESTATUS[*]}"
136 "0 0") actual_status=success ;;
137 *" 0") actual_status=failure; echo >&4 "OPERATION FAILED"; ;;
138 *) fail "tee failed" ;;
141 case "$require_fail-$tolerate_fail-$actual_status" in
142 required-********-failure) echo >>$bmexp "REQUIRED FAILURE" ;;
143 ********-tolerate-failure) echo >>$bmexp "TOLERATED FAILURE" ;;
144 unexpect-********-success) ;;
145 *) fail "RF=$require_fail TF=$tolerate_fail AS=$actual_status" ;;
148 egrep >&4 '^EXAMPLE RULES TARGET|^BUILD-MODES' $bmlog || [ $? = 1 ]
150 bm-report-source [ -e $dsc ]
154 $bm_quirk_before_diff
156 [ $actual_status = failure ] || diff -U10 $bmexp $bmgot
160 for cleanmode in $cleanmodes; do
161 for branch in $bm_branches; do
165 : bm-act-iterate done.
170 DGIT_TEST_BM_BASEARGS+=' --always-split-source-build'
171 export DGIT_TEST_BM_BASEARGS
172 t-chain-test "${t%%-asplit}"