6 if [ "x$DGIT_TEST_INTREE" != x ]; then
7 : ${DGIT_TEST:=$DGIT_TEST_INTREE/dgit}
8 : ${DGIT_REPOS_SERVER_TEST:=$DGIT_TEST_INTREE/infra/dgit-repos-server}
9 : ${DGIT_SSH_DISPATCH_TEST:=$DGIT_TEST_INTREE/infra/dgit-ssh-dispatch}
10 export DGIT_TEST DGIT_REPOS_SERVER_TEST DGIT_SSH_DISPATCH_TEST
15 testname="${DGIT_TEST_TESTNAME-${0##*/}}"
18 if [ x"$tmp" = x ]; then
20 tmp=tests/tmp/$testname
28 export DGIT_TEST_DUMMY_DIR=$tmp
32 cp $troot/gnupg/* $tmp/gnupg
33 chmod go-rw $tmp/gnupg/*
34 export GNUPGHOME=$tmp/gnupg
36 mkdir -p $tmp/incoming
37 cat <<END >$tmp/dput.cf
40 incoming = $tmp/incoming
51 local edittree=$1.edit
52 if test -d "$edittree"; then
53 cp -al "$edittree"/* .
61 t-untar $troot/worktrees/${p}_$1
68 local gs=$troot/git-srcs/${p}_$v.git
69 (set -e; cd $tmp/git; t-untar $gs)
74 (set -e; cd $tmp/git; tar xf $troot/git-template.tar)
78 local now=`git rev-parse HEAD`
79 local ancestor=`git rev-parse $1^{}`
80 local mbase=`git merge-base $ancestor $now`
81 if [ x$mbase != x$ancestor ]; then
82 fail "not ff $ancestor..$now, $mbase != $ancestor"
88 mkdir -p $tmp/aq $tmp/mirror
89 echo sid >$tmp/aq/suite.unstable
92 t-archive-process-incoming () {
93 mv incoming/${p}_${v}[._]* mirror/
98 local dscf=${p}_${v}.dsc
99 echo "${v} $dscf" >>$tmp/aq/package.sid.${p}
105 local dscf=${p}_$2.dsc
106 rm -f $tmp/mirror/${p}_*
107 ln $troot/pkg-srcs/${p}_${2%-*}* $tmp/mirror/
111 (set -e; cd $tmp/extract; dpkg-source -x ../mirror/$dscf)
115 local dgit=${DGIT_TEST-dgit}
117 {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{'
118 $dgit --dgit=$dgit --dget:-u --dput:--config=$tmp/dput.cf \
119 -dtest-dummy $DGIT_TEST_OPTS ${DGIT_TEST_DEBUG--D} \
121 : '}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
126 diff --exclude=.git --exclude=.pc -ruN $*
129 t-cloned-fetched-good () {
130 t-diff-nogit ../extract/$p-${v%-*} .
131 t-clean-on-branch dgit/sid
134 refs/heads/dgit/sid \
135 refs/remotes/dgit/dgit/sid
136 t-refs-notexist dgit/unstable remotes/dgit/dgit/unstable
140 printf "%s\n" "$1" >$tmp/t.want
143 diff $tmp/t.want $tmp/t.got
146 t-clean-on-branch () {
147 t-output "## $1" git status -b --porcelain
152 git show-ref -d $1 | perl -ne '
153 $x = $1 if m#^(\w+) \Q'$1'\E(?:\^\{\})?$#;
154 END { print "$x\n" if length $x; }
160 local val=`t-git-get-ref $name`
161 t-ref-same-val "$name" $val
165 local val=`git rev-parse HEAD`
166 t-ref-same-val HEAD $val
175 *) fail "ref varies: $name: $val != $t_ref_val" ;;
180 t-refs-same-start () {
194 val=`t-git-get-ref $g >$tmp/t.refx`
195 if [ "x$val" != x ]; then
196 fail "ref $g unexpectedly exists ($val)"
202 echo refs/tags/debian/${v//\~/_}
211 refs/remotes/dgit/dgit/sid
213 refs/heads/dgit/unstable \
214 refs/remotes/dgit/dgit/unstable
215 (set -e; cd $tmp/git/$p.git
222 git verify-tag `t-v-tag`
229 use Dpkg::Control::Hash;
230 my $h = new Dpkg::Control::Hash allow_pgp=>1;
231 $h->parse(\*STDIN,"'"$file"'");
232 my $val = $h->{"'$field'"},"\n";
233 die "'"$file $field"'" unless defined $val;
239 local dsc=${p}_${v}.dsc
240 local val=`t-822-field $tmp/incoming/$dsc Dgit`
241 perl -e '$_=shift @ARGV; die "$dsc Dgit $_ ?" unless m/^\w+\b/;' "$val"
242 t-ref-same-val $dsc "$val"
248 (cd $troot/pkg-srcs; debdiff ${p}_${v1}.dsc ${p}_${v2}.dsc) \
253 git config --global "$@"
257 export DGIT_TEST_TROOT=$troot
258 export DGIT_TEST_TMP=$tmp
259 t-git-config dgit-distro.test-dummy.git-url "ext::$troot/drs-git-ext %S "
260 t-git-config dgit-distro.test-dummy.git-check true
261 t-git-config dgit-distro.test-dummy.git-create true
262 cp $root/tests/gnupg/{dd.gpg,dm.gpg,dm.txt} $tmp/.
263 cp $root/tests/suites $tmp/.
264 ln -s /bin/true $tmp/policy
269 t-git-config dgit-distro.test-dummy.ssh "$troot/dss-ssh"
270 t-git-config dgit-distro.test-dummy.git-check ssh-cmd
271 t-git-config dgit-distro.test-dummy.git-create true
272 t-git-config dgit-distro.test-dummy.git-url \
273 "ext::$troot/dss-ssh X %S /dgit/test-dummy/repos"
275 t-git-config dgit-distro.test-dummy.diverts.drs /drs
276 t-git-config dgit-distro.test-dummy/drs.ssh "$troot/ssh"
277 t-git-config dgit-distro.test-dummy/drs.git-url $tmp/git
278 t-git-config dgit-distro.test-dummy/drs.git-check ssh-cmd
279 t-git-config dgit-distro.test-dummy/drs.git-create ssh-cmd
281 dss_dispatch=$tmp/dispatch-dir/distro=test-dummy
282 mkdir -p $dss_dispatch
283 ln -sf $root $dss_dispatch/dgit-live
284 ln -sf $tmp/git $dss_dispatch/repos
285 ln -sf $tmp/suites $tmp/dm.txt $dss_dispatch/
286 mkdir -p $dss_dispatch/keyrings
287 ln -sf $tmp/dd.gpg $dss_dispatch/keyrings/debian-keyring.gpg
288 ln -sf $tmp/dm.gpg $dss_dispatch/keyrings/debian-maintainers.gpg
290 echo 'no-such-package* drs' >$dss_dispatch/diverts
297 export DGIT_TEST_TESTNAME="$testname"
305 t-chain-test "${t#*-}"