6 if [ "x$DGIT_TEST_INTREE" != x ]; then
7 : ${DGIT_TEST:=$DGIT_TEST_INTREE/dgit}
8 : ${DGIT_REPOS_SERVER_TEST:=$DGIT_TEST_INTREE/dgit-repos-server}
9 export DGIT_TEST DGIT_REPOS_SERVER_TEST
14 testname="${DGIT_TEST_TESTNAME-${0##*/}}"
17 if [ x"$tmp" = x ]; then
19 tmp=tests/tmp/$testname
27 export DGIT_TEST_DUMMY_DIR=$tmp
31 cp $troot/gnupg/* $tmp/gnupg
32 chmod go-rw $tmp/gnupg/*
33 export GNUPGHOME=$tmp/gnupg
35 mkdir -p $tmp/incoming
36 cat <<END >$tmp/dput.cf
39 incoming = $tmp/incoming
50 local edittree=$1.edit
51 if test -d "$edittree"; then
52 cp -al "$edittree"/* .
60 t-untar $troot/worktrees/${p}_$1
67 local gs=$troot/git-srcs/${p}_$v.git
68 (set -e; cd $tmp/git; t-untar $gs)
73 (set -e; cd $tmp/git; tar xf $troot/git-template.tar)
77 local now=`git rev-parse HEAD`
78 local ancestor=`git rev-parse $1^{}`
79 local mbase=`git merge-base $ancestor $now`
80 if [ x$mbase != x$ancestor ]; then
81 fail "not ff $ancestor..$now, $mbase != $ancestor"
87 mkdir -p $tmp/aq $tmp/mirror
88 echo sid >$tmp/aq/suite.unstable
91 t-archive-process-incoming () {
92 mv incoming/${p}_${v}[._]* mirror/
97 local dscf=${p}_${v}.dsc
98 echo "${v} $dscf" >>$tmp/aq/package.sid.${p}
104 local dscf=${p}_$2.dsc
105 rm -f $tmp/mirror/${p}_*
106 ln $troot/pkg-srcs/${p}_${2%-*}* $tmp/mirror/
110 (set -e; cd $tmp/extract; dpkg-source -x ../mirror/$dscf)
114 local dgit=${DGIT_TEST-dgit}
116 {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{'
117 $dgit --dgit=$dgit --dget:-u --dput:--config=$tmp/dput.cf \
118 -dtest-dummy $DGIT_TEST_OPTS ${DGIT_TEST_DEBUG--D} \
120 : '}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
125 diff --exclude=.git --exclude=.pc -ruN $*
128 t-cloned-fetched-good () {
129 t-diff-nogit ../extract/$p-${v%-*} .
130 t-clean-on-branch dgit/sid
133 refs/heads/dgit/sid \
134 refs/remotes/dgit/dgit/sid
135 t-refs-notexist dgit/unstable remotes/dgit/dgit/unstable
139 printf "%s\n" "$1" >$tmp/t.want
142 diff $tmp/t.want $tmp/t.got
145 t-clean-on-branch () {
146 t-output "## $1" git status -b --porcelain
151 git show-ref -d $1 | perl -ne '
152 $x = $1 if m#^(\w+) \Q'$1'\E(?:\^\{\})?$#;
153 END { print "$x\n" if length $x; }
159 local val=`t-git-get-ref $name`
160 t-ref-same-val "$name" $val
164 local val=`git rev-parse HEAD`
165 t-ref-same-val HEAD $val
174 *) fail "ref varies: $name: $val != $t_ref_val" ;;
179 t-refs-same-start () {
193 val=`t-git-get-ref $g >$tmp/t.refx`
194 if [ "x$val" != x ]; then
195 fail "ref $g unexpectedly exists ($val)"
201 echo refs/tags/debian/${v//\~/_}
210 refs/remotes/dgit/dgit/sid
212 refs/heads/dgit/unstable \
213 refs/remotes/dgit/dgit/unstable
214 (set -e; cd $tmp/git/$p.git
221 git verify-tag `t-v-tag`
228 use Dpkg::Control::Hash;
229 my $h = new Dpkg::Control::Hash allow_pgp=>1;
230 $h->parse(\*STDIN,"'"$file"'");
231 my $val = $h->{"'$field'"},"\n";
232 die "'"$file $field"'" unless defined $val;
238 local dsc=${p}_${v}.dsc
239 local val=`t-822-field $tmp/incoming/$dsc Dgit`
240 perl -e '$_=shift @ARGV; die "$dsc Dgit $_ ?" unless m/^\w+\b/;' "$val"
241 t-ref-same-val $dsc "$val"
247 (cd $troot/pkg-srcs; debdiff ${p}_${v1}.dsc ${p}_${v2}.dsc) \
252 git config --global "$@"
256 export DGIT_TEST_TROOT=$troot
257 export DGIT_TEST_TMP=$tmp
258 t-git-config dgit-distro.test-dummy.git-url "ext::$troot/drs-git-ext %S "
259 t-git-config dgit-distro.test-dummy.git-check true
260 t-git-config dgit-distro.test-dummy.git-create true
261 cp $root/tests/gnupg/{dd.gpg,dm.gpg,dm.txt} $tmp/.
262 cp $root/tests/suites $tmp/.
268 export DGIT_TEST_TESTNAME="$testname"
270 exec "${0///drs-//}" "$@"