17 lines: ${BASH_LINENO[*]}
18 files: ${BASH_SOURCE[*]}
28 [ "x$DGIT_TEST_TMP" = x ] || rm -rf $DGIT_TEST_TMP/must-clean
30 test $rc = 0 || t-report-failure
33 t-filter-out-git-hyphen-dir
37 : ${DGIT_TEST_DEBUG=-D}
38 export DGIT_TEST_DEBUG
40 : ${DGIT_TEST_DEBPUSH_DEBUG=x}
41 export DGIT_TEST_DEBPUSH_DEBUG
43 : ${DGIT_TEST_DISTRO+ ${distro=${DGIT_TEST_DISTRO}}}
45 export GIT_COMMITTER_DATE='1530000000 +0100'
46 export GIT_AUTHOR_DATE='1530000000 +0100'
48 export LC_CTYPE=C.UTF-8
53 testname="${DGIT_TEST_TESTNAME-${0##*/}}"
54 export DGIT_TEST_TROOT=$troot
58 if [ x"$tmp" = x ]; then
59 export DGIT_TEST_BYHAND=1
62 tmp=tests/tmp/$testname
65 elif [ "x$DGIT_TEST_TMPBASE" != x ]; then
66 tmpbase="$DGIT_TEST_TMPBASE"
74 test -f $tmp/.save-env || \
75 env -0 >$tmp/.save-env
79 export DEBCHANGE_VENDOR=dpkg
83 mkdir -p $tmp/must-clean
84 # must-clean is usually removed after each test, on success or failure.
85 # But this must not be relied on for correctness, only for garbage
88 mkdir -p $tmp/incoming
89 cat <<END >$tmp/dput.cf
92 incoming = $tmp/incoming
96 schroot=${DGIT_SCHROOT_CHROOT:-build}
97 # Pretty much any Debian sid snapshot schroot will do.
99 : ${t_archive_method:=aq}
100 : ${tagpfx:=archive/test-dummy}
101 : ${suitespecs:=sid:unstable}
104 GIT_COMMITTER_DATE="$(( ${GIT_COMMITTER_DATE%% *} + 1 )) ${GIT_COMMITTER_DATE#* }"
105 GIT_AUTHOR_DATE="$GIT_COMMITTER_DATE"
109 local mpat="$1"; shift
112 LC_MESSAGES=${expect_fail_lcmessages-C} \
113 LANGUAGE=${expect_fail_lcmessages-C} \
114 "$@" 2>&1 | tee $tmp/t.output
115 local ps="${PIPESTATUS[*]}"
119 "0 0") fail "command unexpectedly succeeded (instead of: $mpat)" ;;
121 *) fail "tee failed" ;;
124 t-grep-mpat "$mpat" $tmp/t.output
135 E:*) grepper=egrep ;;
136 F:*) grepper=fgrep ;;
137 *) fail "bad mpat prefix in $mpat";;
143 $grepper -e "$mpat" "$file" ||
144 fail "message not found"
147 t-expect-push-fail () {
148 local mpat="$1"; shift
150 local triedpush; triedpush=`git rev-parse HEAD`
153 t-expect-fail "$mpat" "$@"
155 diff $tmp/show-refs.{pre,post}-push
157 t-git-objects-not-present '' $triedpush
159 eval "$t_expect_push_fail_hook"
162 t-git-objects-not-present () {
163 # t-git-objects-not-present GITDIR|'' OBJID [...]
164 # specifying '' means the repo for package $p
165 local gitdir="${1-$dgitrepo}"
167 if ! [ -e "$gitdir" ]; then return; fi
170 t-expect-fail 'unable to find' \
176 local whichoutput=$1; shift
177 local whichrepo=${1-$dgitrepo}
178 local outputfile="$tmp/show-refs.$whichoutput"
181 if test -d $whichrepo; then
189 local edittree=$1.edit
190 if test -d "$edittree"; then
191 cp -a "$edittree"/* .
199 t-untar $troot/worktrees/${p}_$1
202 t-select-package () {
204 dgitrepo=$tmp/git/$p.git
211 local gs=$troot/git-srcs/${p}_$v.git
212 (set -e; cd $tmp/git; t-untar $gs)
217 (set -e; cd $tmp/git; tar xf $troot/git-template.tar)
220 t-salsa-add-remote () {
221 local d=$tmp/salsa/$p
223 (set -e; cd $d; git init --bare)
224 git remote add ${1-origin} $d
227 t-git-merge-base () {
228 git merge-base $1 $2 || test $? = 1
232 # t-has-ancestor ANCESTOR
233 # (CHILD is implicit, HEAD)
234 local now; now=`git rev-parse HEAD`
235 local ancestor; ancestor=`git rev-parse $1^{}`
236 local mbase; mbase=`t-git-merge-base $ancestor $now`
237 if [ x$mbase != x$ancestor ]; then
238 fail "not ff $ancestor..$now, $mbase != $ancestor"
242 t-has-parent-or-is () {
243 # t-has-parent-or-is CHILD PARENT
247 parents=$(git show --pretty=format:' %P %H ' "$child")
248 parent=$(git rev-parse "$parent~0")
251 *) fail "child $child lacks parent $parent" ;;
255 t-prep-newpackage () {
262 if ! git show-ref --verify --quiet refs/heads/master; then
263 git branch -m dgit/sid master
271 t-archive-none-$t_archive_method
273 t-archive-none-aq () {
274 mkdir -p $tmp/aq/dsc_in_suite $tmp/mirror/pool/main
280 for suitespec in $suitespecs; do
281 local suite=${suitespec%%:*}
282 local sname=${suitespec#*:}
284 >$tmp/aq/package.$suite.$p
285 t-aq-archive-updated $suite $p
287 >$tmp/aq/package.new.$p
288 t-aq-archive-updated new $p
290 ln -sf $suite $tmp/aq/dsc_in_suite/$sname
292 cat <<END >>$tmp/aq/suites
295 "archive" : "ftp-master",
296 "codename" : "$suite",
309 cat <<END >>$tmp/aq/suites
315 t-aq-archive-updated () {
318 local suitedir=$tmp/aq/dsc_in_suite/$suite
320 perl <$tmp/aq/package.$suite.$p >$suitedir/$p -wne '
324 m{^(\S+) (\w+) ([^ \t/]+)/(\S+)} or die;
332 my $json = JSON->new->canonical();
333 print $json->encode(\@v) or die $!;
338 t-archive-process-incoming () {
340 mv $tmp/incoming/${p}_* $tmp/mirror/pool/main/
341 t-archive-query "$suite"
346 local dscf=main/${p}_${v}.dsc
347 t-archive-query-$t_archive_method "$suite" "$p" "$v" "$dscf"
349 t-archive-query-aq () {
354 local sha; sha=`sha256sum <$tmp/mirror/pool/$dscf`
355 echo "${v} ${sha% -} $dscf" >>$tmp/aq/package.$suite.${p}
356 t-aq-archive-updated $suite $p
362 local dscf=${p}_$2.dsc
363 rm -f $tmp/mirror/pool/main/${p}_*
364 ln -s $troot/pkg-srcs/${p}_${2%-*}* $tmp/mirror/pool/main/
365 t-archive-query $suite
368 (set -e; cd $tmp/extract; dpkg-source -x ../mirror/pool/main/$dscf)
371 t-git-dir-time-passes () {
372 touch -d 'last year' $dgitrepo
376 local gitdir=$dgitrepo
379 if test -e "$gitdir"; then fail "$gitdir exists"; fi
382 public) wantstat='7[75]5' ;;
383 secret) wantstat='7[70]0' ;;
384 *) fail "$1 t-git-dir-check ?" ;;
386 gotstat=`stat -c%a $gitdir`
388 *$wantstat) return ;;
389 *) fail "$gitdir has mode $gotstat, expected $wantstat" ;;
393 t-expect-fsck-fail () {
394 echo >>$tmp/fsck.expected-errors "$1"
398 local fsckerrs=$(git rev-parse --git-dir)/dgit-test-fsck.errs
401 LC_MESSAGES=C git fsck --no-dangling --strict 2>&1 \
403 ps="${PIPESTATUS[*]}"
407 if [ -f $tmp/fsck.expected-errors ]; then
408 pats=(-w -f $tmp/fsck.expected-errors)
412 pats+=(-e 'notice: HEAD points to an unborn branch')
413 pats+=(-e 'notice: No default references')
416 grep -v "${pats[@]}" $fsckerrs
420 1) ;; # no unexpected errors
421 0) fail "unexpected messages from git-fsck" ;;
422 *) fail "grep of git-fsck failed" ;;
426 t-check-only-bpd () {
427 if [ "$bpd" = .. ]; then return; fi
429 $tmp/*.{deb,changes,dsc,buildinfo} \
436 for d in $tmp/*/.git $tmp/git/*.git; do
444 : '========================================'
451 t-save-artifacts () {
452 artifacts="$AUTOPKGTEST_ARTIFACTS"
453 if [ x"$artifacts" = x ]; then return; fi
454 if [ x"tmp" = x ]; then return; fi
455 GZIP=-1v tar -C "$tmp" -zc -f "$artifacts/${0##*/}.tar.gz" \
459 t-rm-dput-dropping () {
460 rm -f $tmp/${p}_${v}_*.upload
464 local dgit=${DGIT_TEST-dgit}
467 {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{'
468 $dgit --dgit=$dgit --dget:-u --dput:--config=$tmp/dput.cf \
469 ${dgit_config_debian_alias-"--config-lookup-explode=dgit-distro.debian.alias-canon"} \
470 ${DGIT_GITDEBREBASE_TEST+--git-debrebase=}${DGIT_GITDEBREBASE_TEST} \
471 ${distro+${distro:+-d}}${distro--dtest-dummy} \
472 $DGIT_TEST_OPTS $DGIT_TEST_DEBUG \
473 -kBCD22CD83243B79D3DFAC33EA3DBCBC039B13D8A $t_dgit_xopts "$@"
474 : '}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
481 (export LC_ALL=C.UTF-8
482 if [ "$DGIT_TEST_INTREE" ]; then
483 make -C $DGIT_TEST_INTREE $page.$section.view
490 diff --exclude=.git --exclude=.pc -ruN $*
493 t-files-notexist () {
502 t-cloned-fetched-good () {
503 t-diff-nogit ../extract/$p-${v%-*} .
504 t-clean-on-branch dgit/sid
507 refs/heads/dgit/sid \
508 refs/remotes/dgit/dgit/sid
509 t-refs-notexist refs/dgit/unstable refs/remotes/dgit/dgit/unstable
513 printf "%s${1:+\n}" "$1" >$tmp/t.want
516 diff $tmp/t.want $tmp/t.got
519 t-clean-on-branch () {
520 t-output "## $1" git status -b --porcelain
528 local import=IMPORT.${DGIT_TEST_TESTNAME-${0##*/}}
529 exec 4>$tmp/$import.new
532 for vn in $savevars; do
533 perl >&4 -"I$root" -MDebian::Dgit -e '
534 printf "%s=%s\n", $ARGV[0], shellquote $ARGV[1]
535 ' $vn "$(eval "printf '%s\n' \"\$$vn\"")"
538 perl >&4 -"I$root" -MDebian::Dgit -we '
539 foreach my $vn (grep m/^DGIT_TEST_REAL_/, keys %ENV) {
540 print STDERR "saving-exporting $vn\n";
541 printf "export %s=%s\n", $vn, shellquote $ENV{$vn}
546 (set -e; cd $tmp; tar cf $import.tar $savedirs)
548 printf >&4 "\n%s\n" "$importeval"
550 mv -f $tmp/$import.new $tmp/$import
558 if [ "x$tmpbase" = x ]; then
559 # ADTTMP was set on entry to tests/lib, so we
560 # are not sharing tmp area between tests
562 lock="$tmp/.dummy.lock"
564 setupsrc="$tmpbase/$setupname"
565 lock="$setupsrc.lock"
568 local simport="$setupsrc/IMPORT.$setupname"
570 if ! [ -e "$simport" ]; then
571 with-lock-ex -w "$lock" \
572 xargs -0 -a $tmp/.save-env \
575 setupname="$1"; shift
577 if [ -e "$simport" ]; then exit 0; fi
579 "tests/setup/$setupname"
580 ' x "$root" "$setupname" "$simport"
583 if [ "x$setupsrc" != "x$tmp" ]; then
584 (set -e; cd $tmp; tar xf "$simport.tar")
587 mkdir -p $tmp/must-clean
592 t-git-get-ref-exact () {
594 # does not dereference, unlike t-git-get-ref
597 *) fail "t-git-get-ref-exact bad $ref" ;;
599 git for-each-ref --format='%(objectname)' "[r]efs/${ref#refs/}"
606 *) fail "t-git-get-ref bad $ref" ;;
608 (git show-ref -d $1 || test $? = 1) | perl -ne '
609 $x = $1 if m#^(\w+) \Q'$1'\E(?:\^\{\})?$#;
610 END { print "$x\n" if length $x; }
614 t-ref-same-exact () {
616 local val; val=`t-git-get-ref-exact $name`
617 t-ref-same-val "$name" $val
622 local val; val=`t-git-get-ref $name`
623 t-ref-same-val "$name" $val
627 local val; val=`git rev-parse HEAD`
628 t-ref-same-val HEAD $val
634 case "${t_ref_val-unset}" in
637 *) fail "ref varies: ($name)\
638 ${val:-nothing} != ${t_ref_val:-nothing} (${t_ref_names[*]})" ;;
641 t_ref_names+=("$name")
644 t-refs-same-start () {
659 val=`t-git-get-ref $g`
660 if [ "x$val" != x ]; then
661 fail "ref $g unexpectedly exists ($val)"
667 echo refs/tags/$tagpfx/${v//\~/_}
671 git log -n1 --pretty=format:"$1" "$2"
674 t-sametree-parent () {
677 local ctree; ctree=$(t-format-ref '%T' "$ref")
680 for parent in $(t-format-ref '%P' "$ref"); do
681 local ptree; ptree=$(t-format-ref '%T' "$parent")
682 if [ "x$ptree" = "x$ctree" ]; then
686 case "$psame" in ""|" * *") break ;; esac
692 t-check-pushed-master () {
693 local master; master=`t-git-get-ref refs/heads/master`
694 if [ x$master = x$t_ref_val ]; then return; fi
695 if [ x$master = x ]; then fail "failed to push master"; fi
696 # didn't update master, it must be not FF
697 local mbase; mbase=`t-git-merge-base $master $t_ref_val`
698 if [ x$mbase = x$master ]; then fail "failed to ff master"; fi
701 t-push-was-source-only () {
703 t-files-notexist $tmp/incoming/${p}_${v}_*.deb \
704 $tmp/incoming/${p}_${v}_*.udeb
705 # we permit _source.buildinfo files; see test_changes_source_only()
706 for f in $tmp/incoming/${p}_${v}_*.buildinfo; do
709 *_source.buildinfo) ;;
710 *) fail "non-source-only file $f exists!" ;;
718 stat $tmp/incoming/$f
724 local suite=${2:-sid}
730 t-pushed-good-core () {
734 refs/remotes/dgit/dgit/$suite
736 refs/heads/dgit/unstable \
737 refs/remotes/dgit/dgit/unstable
738 (set -e; cd $dgitrepo
742 ${t_check_pushed_master:- : NOT-DRS-NO-CHECK-PUSHED-MASTER}
746 git verify-tag `t-v-tag`
749 t-pushed-good-check-changes () {
750 changes_filename="$tmp/incoming/${p}_${v}_*.changes"
751 grep -E "^Distribution: $suite" $changes_filename
752 grep -E "^Version: $v" $changes_filename
755 t-splitbrain-pushed-good--unpack () {
760 ln -s $tmp/mirror/pool/main/*.orig*.tar* .
761 ln -s $tmp/incoming/*.orig*.tar* . ||:
762 ln -s $incoming_dsc .
763 ln -s ${incoming_dsc/.dsc/.debian.tar}* .
764 ln -s ${incoming_dsc/.dsc/.tar}* . ||:
765 dpkg-source "$@" -x *.dsc
768 git fetch ../../$p "refs/tags/*:refs/tags/*"
771 t-splitbrain-pushed-good--checkprep () {
773 git rm --cached -r --ignore-unmatch .pc
776 t-splitbrain-pushed-good--checkdiff () {
778 t-splitbrain-pushed-good--checkprep
779 t-output "" git diff --stat --cached $tag
782 t-splitbrain-pushed-good-start () {
783 dep14tag=refs/tags/test-dummy/${v//\~/_}
785 t-output "" git status --porcelain
787 t-refs-same $dep14tag
788 (set -e; cd $dgitrepo; t-refs-same $dep14tag)
789 git merge-base --is-ancestor $dep14tag $dgittag
792 t-ref-same refs/heads/split.p
793 local split_b=$(t-git-get-ref refs/heads/split.b)
796 "$(git rev-parse refs/heads/split.p^0)") ;;
797 "$(git rev-parse refs/heads/split.p^1)") ;;
798 *) fail "bad b/p (b=$split_b)" ;;
804 t-splitbrain-pushed-good--unpack
805 t-splitbrain-pushed-good--checkdiff $dgittag
807 t-splitbrain-pushed-good-end-made-dep14 () {
808 t-splitbrain-pushed-good--checkdiff $dep14tag
812 t-splitbrain-rm-1-patch () {
815 next unless $_ eq "'"$patchname"'\n";
818 rename "debian/patches/$_", "../t-'"$patchname"'" or die $!;
820 ' debian/patches/series
823 t-splitbrain-rm-gitignore-patch () {
824 t-splitbrain-rm-1-patch auto-gitignore
827 t-gbp-pushed-good () {
828 local suite=${1:-sid}
829 t-splitbrain-pushed-good-start
831 # Right, now we want to check that the maintainer tree and
832 # the dgit tree differ in exactly the ways we expect. We
833 # achieve this by trying to reconstruct the maintainer tree
834 # from the dgit tree.
836 # So, unpack it withut the patches applied
837 t-splitbrain-pushed-good--unpack --skip-patches
839 # dgit might have added a .gitignore patch, which we need to
841 t-splitbrain-rm-gitignore-patch
843 # Now the result should differ only in non-debian/ .gitignores
844 t-splitbrain-pushed-good--checkprep
845 git diff --cached --name-only $dep14tag >../changed
847 next if !m#^debian/# && m#(^|/)\.gitignore#;
851 # If we actually apply the gitignore patch by hand, it
853 if [ -f ../t-auto-gitignore ]; then
854 patch --backup-if-mismatch -p1 -u <../t-auto-gitignore
857 t-splitbrain-pushed-good-end-made-dep14
860 t-unapplied-pushed-good () {
861 local suite=${1:-sid}
862 t-splitbrain-pushed-good-start
863 t-splitbrain-pushed-good--unpack --skip-patches
864 t-splitbrain-pushed-good-end-made-dep14
867 t-dpm-pushed-good () {
868 local suite=${1:-sid}
869 t-splitbrain-pushed-good-start
870 t-splitbrain-pushed-good--unpack
871 t-splitbrain-rm-gitignore-patch
872 t-splitbrain-pushed-good-end-made-dep14
875 t-split-unchanged-pushed-good () {
876 local suite=${1:-sid}
877 t-splitbrain-pushed-good-start
878 t-splitbrain-pushed-good--unpack
879 t-splitbrain-pushed-good-end-made-dep14
882 t-commit-build-push-expect-log () {
888 t-dgit push --new 2>&1 |tee $tmp/push.log
889 t-grep-mpat "$mpat" $tmp/push.log
896 use Dpkg::Control::Hash;
897 my $h = new Dpkg::Control::Hash allow_pgp=>1;
898 $h->parse(\*STDIN,"'"$file"'");
899 my $val = $h->{"'$field'"},"\n";
900 die "'"$file $field"'" unless defined $val;
906 export DGIT_TEST_DISTRO=''
908 t-git-config dgit-suite.unstable.distro test-dummy
918 "") '$var'="$tstunt" ;;
919 *) '$var'="$tstunt:$'$var'" ;;
925 t-tstunt--save-real () {
936 p="${p/:"$tmp/tstunt":/:}"
948 *) fail "did not find $f on PATH $PATH" ;;
951 local varname=${f//[^_0-9a-zA-Z]/_}
952 varname=DGIT_TEST_REAL_${varname^^}
955 : \${$varname:=\$real}
961 local tstunt=$tmp/tstunt
962 t-stunt-envvar PATH $tstunt
963 t-stunt-envvar PERLLIB $tstunt
966 t-tstunt--save-real $f
968 local d="$tstunt/${f%/*}"
970 ln -sf "$troot/tstunt/$f" "$d"/.
974 t-tstunt-parsechangelog () {
975 t-tstunt dpkg-parsechangelog Dpkg/Changelog/Parse.pm
978 t-tstunt-lintian () {
982 t-tstunt-debuild () {
987 local dsc=${p}_${v}.dsc
988 incoming_dsc=$tmp/incoming/$dsc
993 local val; val=`t-822-field $incoming_dsc Dgit`
996 die "Dgit $_ ?" unless m/^\w+\b/;
997 print $&,"\n" or die $!;
999 t-ref-same-val $incoming_dsc "$val"
1005 (cd $troot/pkg-srcs;
1006 debdiff ${p}_${v1}.dsc ${p}_${v2}.dsc || test $? = 1) \
1010 t-gbp-unapplied-pq2qc () {
1011 # does `gbp pq export'
1012 # commits the resulting debian/patches on qc/BRANCH
1013 # leaves us on qc/BRANCH (eg "qc/quilt-tip"))
1014 # qc/BRANCH is not fast-forwarding
1018 branch=`git symbolic-ref HEAD`
1019 branch=${branch#refs/heads/}
1022 */*) fail "unexpected branch $branch" ;;
1025 git branch -f qc/$branch
1026 git checkout qc/$branch
1027 git add debian/patches
1028 git commit -m 'Commit patch queue'
1031 t-git-pseudo-merge () {
1032 # like git merge -s ours
1033 if [ ! "$git_pseuomerge_opts" ]; then
1034 if git merge --help \
1035 | grep -q allow-unrelated-histories; then
1036 git_pseuomerge_opts='--allow-unrelated-histories'
1038 git_pseuomerge_opts+=' -s ours'
1040 git merge $git_pseuomerge_opts "$@"
1043 t-gbp-example-prep-no-ff () {
1044 t-archive example 1.0-1
1052 git checkout -b patch-queue/quilt-tip-2 patch-queue/quilt-tip
1055 echo '/* some comment */' >>src.c
1057 git commit -m 'Add a comment to an upstream file'
1059 t-gbp-unapplied-pq2qc
1061 t-commit 'some updates' 1.0-2
1064 t-gbp-example-prep () {
1065 t-gbp-example-prep-no-ff
1067 t-git-pseudo-merge \
1068 -m 'Pseudo-merge to make descendant of archive' \
1069 remotes/dgit/dgit/sid
1072 t-make-badcommit () {
1074 git cat-file commit HEAD | \
1075 perl -pe 's/^committer /commiter /' | \
1076 git hash-object -w -t commit --stdin
1078 t-expect-fsck-fail $badcommit
1082 # leaves ust set to filename of orig tarball
1086 ust=${p}_${v}.orig.tar.gz
1087 GZIP=-1 git archive -o $bpd/$ust --prefix=${p}-${v}/ $tag
1090 t-merge-conflicted-stripping-conflict-markers () {
1091 local otherbranch=$1
1094 t-expect-fail F:"Merge conflict in $file" \
1095 git merge $otherbranch
1097 perl -i~ -ne 'print unless m{^(?:\<\<\<|\>\>\>|===)}' "$file"
1099 git commit --no-edit
1104 v=${2:-${majorv:-1}.$revision}
1105 $troot/tstunt/debchange \
1106 --force-distribution -v$v --distribution ${3:-unstable} "$1"
1107 git add debian/changelog
1109 revision=$(( ${revision-0} + 1 ))
1113 local cmd="$1"; shift
1114 local suite=${1-unstable}
1115 $cmd -r -D "$suite" ''
1119 t-dch-r-rune t-dch-commit "$@"
1123 $troot/tstunt/debchange "$@"
1124 git commit -m "dch $*" debian/changelog
1128 git config --global "$@"
1132 t-git-config dgit-distro.test-dummy.git-url "ext::$troot/drs-git-ext %S "
1133 t-git-config dgit-distro.test-dummy.git-check true
1134 t-git-config dgit-distro.test-dummy.git-create true
1135 cp $troot/gnupg/{dd.gpg,dm.gpg,dm.txt} $tmp/.
1136 cp $troot/suites $tmp/.
1137 cp $troot/suites $tmp/suites-master
1139 export t_check_pushed_master=t-check-pushed-master
1141 drs_dispatch=$tmp/distro=test-dummy
1144 if [ "x$DGIT_TEST_INTREE" != x ]; then
1145 ln -sf "$DGIT_TEST_INTREE" $drs_dispatch/dgit-live
1148 ln -sf $tmp/git $drs_dispatch/repos
1149 ln -sf $tmp/suites $tmp/suites-master $tmp/dm.txt $drs_dispatch/
1150 mkdir -p $drs_dispatch/keyrings
1151 ln -sf $tmp/dd.gpg $drs_dispatch/keyrings/debian-keyring.gpg
1152 ln -sf $tmp/dm.gpg $drs_dispatch/keyrings/debian-maintainers.gpg
1153 ln -sf /bin/true $drs_dispatch/policy-hook
1158 t-git-config dgit-distro.test-dummy.ssh "$troot/dsd-ssh"
1159 t-git-config dgit-distro.test-dummy.git-check ssh-cmd
1160 t-git-config dgit-distro.test-dummy.git-create true
1161 t-git-config dgit-distro.test-dummy.git-url \
1162 "ext::$troot/dsd-ssh X %S /dgit/test-dummy/repos"
1164 t-git-config dgit-distro.test-dummy.diverts.drs /drs
1165 t-git-config dgit-distro.test-dummy/drs.ssh "$troot/ssh"
1166 t-git-config dgit-distro.test-dummy/drs.git-url $tmp/git
1167 t-git-config dgit-distro.test-dummy/drs.git-check ssh-cmd
1168 t-git-config dgit-distro.test-dummy/drs.git-create ssh-cmd
1170 echo 'no-such-package* drs' >$drs_dispatch/diverts
1174 : '(((((((((((((((((((((((((((((((((((((((('
1175 ${DGIT_INFRA_PFX}dgit-repos-admin-debian --repos $tmp/git "$@"
1176 : '))))))))))))))))))))))))))))))))))))))))'
1179 t-policy-nonexist () {
1180 ln -sf no-such-file-or-directory $drs_dispatch/policy-hook
1183 t-make-hook-link () {
1184 local hook=$1 # in infra/
1186 hook=${DGIT_INFRA_PFX}$hook
1189 *) hook=`type -P $hook` ;;
1191 ln -sf "$hook" $linkpath
1196 t-make-hook-link $policyhook $drs_dispatch/policy-hook
1201 t-policy dgit-repos-policy-debian
1204 t-policy-admin create-db
1207 t-policy-periodic () {
1208 : '(((((((((((((((((((((((((((((((((((((((('
1209 ${DGIT_REPOS_SERVER_TEST-dgit-repos-server} \
1210 test-dummy $drs_dispatch '' --cron
1211 : '))))))))))))))))))))))))))))))))))))))))'
1214 t-tagupl-settings () {
1215 export DGIT_DRS_EMAIL_NOREPLY=noreply@example.org
1216 export DGIT_DRS_SENDMAIL=$troot/tstunt/sendmail
1217 export DGIT_DRS_DGIT=$troot/tstunt/dgit
1218 t-chain-test-somehow
1220 mkdir ../pretend-salsa
1221 (set -e; cd ../pretend-salsa; git init --bare)
1222 git remote add salsa $tmp/pretend-salsa
1223 # git branch --set-upstream-to complains, so
1224 git config branch.master.remote salsa
1225 git config branch.master.merge refs/heads/master
1228 t-tagupl-run-drs () {
1233 DGIT_DRS_ANY_URL=1 \
1234 DGIT_DRS_MODE="tag2upload $source $tagname" \
1241 ${DGIT_DEBPUSH_TEST-git debpush} \
1242 --distro=test-dummy -u Senatus "$@"
1245 t-tagupl-run-drs $tmp/pretend-salsa
1248 t-refs-same refs/heads/master
1254 t-buildproductsdir-config () {
1256 t-git-config dgit.default.build-products-dir $bpd
1258 cat <<END >>$tmp/.gbp.conf
1265 local restriction=$1
1266 (cd $root; t-restriction-$restriction >&2)
1270 : "Hopefully installed: $*"
1273 t-chain-test-somehow () {
1274 export DGIT_TEST_TESTNAME="$testname"
1275 export DGIT_TEST_TMPBASE="$tmpbase"
1280 t-chain-test-somehow
1290 t-chain-test "${t#*-}"
1293 t-git-config dgit.default.old-dsc-distro test-dummy
1295 for import in ${autoimport-gnupg}; do
1299 t-setup-import $import