17 lines: ${BASH_LINENO[*]}
18 files: ${BASH_SOURCE[*]}
28 [ "x$DGIT_TEST_KEEP_MUSTCLEAN" != x ] || \
29 [ "x$DGIT_TEST_TMP" = x ] || rm -rf $DGIT_TEST_TMP/must-clean
31 test $rc = 0 || t-report-failure
34 t-filter-out-git-hyphen-dir
38 : ${DGIT_TEST_DEBUG=-D}
39 export DGIT_TEST_DEBUG
41 : ${DGIT_TEST_DEBPUSH_DEBUG=x}
42 export DGIT_TEST_DEBPUSH_DEBUG
44 : ${DGIT_TEST_DISTRO+ ${distro=${DGIT_TEST_DISTRO}}}
46 export GIT_COMMITTER_DATE='1530000000 +0100'
47 export GIT_AUTHOR_DATE='1530000000 +0100'
49 export LC_CTYPE=C.UTF-8
54 testname="${DGIT_TEST_TESTNAME-${0##*/}}"
55 export DGIT_TEST_TROOT=$troot
59 if [ x"$tmp" = x ]; then
60 export DGIT_TEST_BYHAND=1
63 tmp=tests/tmp/$testname
66 elif [ "x$DGIT_TEST_TMPBASE" != x ]; then
67 tmpbase="$DGIT_TEST_TMPBASE"
75 test -f $tmp/.save-env || \
76 env -0 >$tmp/.save-env
80 export DEBCHANGE_VENDOR=dpkg
84 mkdir -p $tmp/must-clean
85 # must-clean is usually removed after each test, on success or failure.
86 # But this must not be relied on for correctness, only for garbage
89 mkdir -p $tmp/incoming
90 cat <<END >$tmp/dput.cf
93 incoming = $tmp/incoming
97 schroot=${DGIT_SCHROOT_CHROOT:-build}
98 # Pretty much any Debian sid snapshot schroot will do.
100 : ${t_archive_method:=aq}
101 : ${tagpfx:=archive/test-dummy}
102 : ${suitespecs:=sid:unstable}
105 GIT_COMMITTER_DATE="$(( ${GIT_COMMITTER_DATE%% *} + 1 )) ${GIT_COMMITTER_DATE#* }"
106 GIT_AUTHOR_DATE="$GIT_COMMITTER_DATE"
110 local mpat="$1"; shift
113 LC_MESSAGES=${expect_fail_lcmessages-C} \
114 LANGUAGE=${expect_fail_lcmessages-C} \
115 "$@" 2>&1 | tee $tmp/t.output
116 local ps="${PIPESTATUS[*]}"
120 "0 0") fail "command unexpectedly succeeded (instead of: $mpat)" ;;
122 *) fail "tee failed" ;;
125 t-grep-mpat "$mpat" $tmp/t.output
136 E:*) grepper=egrep ;;
137 F:*) grepper=fgrep ;;
138 *) fail "bad mpat prefix in $mpat";;
144 $grepper -e "$mpat" "$file" ||
145 fail "message not found"
148 t-expect-push-fail () {
149 local mpat="$1"; shift
151 local triedpush; triedpush=`git rev-parse HEAD`
154 t-expect-fail "$mpat" "$@"
156 diff $tmp/show-refs.{pre,post}-push
158 t-git-objects-not-present '' $triedpush
160 eval "$t_expect_push_fail_hook"
163 t-git-objects-not-present () {
164 # t-git-objects-not-present GITDIR|'' OBJID [...]
165 # specifying '' means the repo for package $p
166 local gitdir="${1-$dgitrepo}"
168 if ! [ -e "$gitdir" ]; then return; fi
171 t-expect-fail 'unable to find' \
177 local whichoutput=$1; shift
178 local whichrepo=${1-$dgitrepo}
179 local outputfile="$tmp/show-refs.$whichoutput"
182 if test -d $whichrepo; then
190 local edittree=$1.edit
191 if test -d "$edittree"; then
192 cp -a "$edittree"/* .
200 t-untar $troot/worktrees/${p}_$1
203 t-select-package () {
205 dgitrepo=$tmp/git/$p.git
212 local gs=$troot/git-srcs/${p}_$v.git
213 (set -e; cd $tmp/git; t-untar $gs)
218 (set -e; cd $tmp/git; tar xf $troot/git-template.tar)
221 t-salsa-add-remote () {
222 local d=$tmp/salsa/$p
224 (set -e; cd $d; git init --bare)
225 git remote add ${1-origin} $d
228 t-git-merge-base () {
229 git merge-base $1 $2 || test $? = 1
233 # t-has-ancestor ANCESTOR
234 # (CHILD is implicit, HEAD)
235 local now; now=`git rev-parse HEAD`
236 local ancestor; ancestor=`git rev-parse $1^{}`
237 local mbase; mbase=`t-git-merge-base $ancestor $now`
238 if [ x$mbase != x$ancestor ]; then
239 fail "not ff $ancestor..$now, $mbase != $ancestor"
243 t-has-parent-or-is () {
244 # t-has-parent-or-is CHILD PARENT
248 parents=$(git show --pretty=format:' %P %H ' "$child")
249 parent=$(git rev-parse "$parent~0")
252 *) fail "child $child lacks parent $parent" ;;
256 t-prep-newpackage () {
263 if ! git show-ref --verify --quiet refs/heads/master; then
264 git branch -m dgit/sid master
272 t-archive-none-$t_archive_method
274 t-archive-none-aq () {
275 mkdir -p $tmp/aq/dsc_in_suite $tmp/mirror/pool/main
281 for suitespec in $suitespecs; do
282 local suite=${suitespec%%:*}
283 local sname=${suitespec#*:}
285 >$tmp/aq/package.$suite.$p
286 t-aq-archive-updated $suite $p
288 >$tmp/aq/package.new.$p
289 t-aq-archive-updated new $p
291 ln -sf $suite $tmp/aq/dsc_in_suite/$sname
293 cat <<END >>$tmp/aq/suites
296 "archive" : "ftp-master",
297 "codename" : "$suite",
310 cat <<END >>$tmp/aq/suites
316 t-aq-archive-updated () {
319 local suitedir=$tmp/aq/dsc_in_suite/$suite
321 perl <$tmp/aq/package.$suite.$p >$suitedir/$p -wne '
325 m{^(\S+) (\w+) ([^ \t/]+)/(\S+)} or die;
333 my $json = JSON->new->canonical();
334 print $json->encode(\@v) or die $!;
339 t-archive-process-incoming () {
341 mv $tmp/incoming/${p}_* $tmp/mirror/pool/main/
342 t-archive-query "$suite"
347 local dscf=main/${p}_${v}.dsc
348 t-archive-query-$t_archive_method "$suite" "$p" "$v" "$dscf"
350 t-archive-query-aq () {
355 local sha; sha=`sha256sum <$tmp/mirror/pool/$dscf`
356 echo "${v} ${sha% -} $dscf" >>$tmp/aq/package.$suite.${p}
357 t-aq-archive-updated $suite $p
363 local dscf=${p}_$2.dsc
364 rm -f $tmp/mirror/pool/main/${p}_*
365 ln -s $troot/pkg-srcs/${p}_${2%-*}* $tmp/mirror/pool/main/
366 t-archive-query $suite
369 (set -e; cd $tmp/extract; dpkg-source -x ../mirror/pool/main/$dscf)
372 t-git-dir-time-passes () {
373 touch -d 'last year' $dgitrepo
377 local gitdir=$dgitrepo
380 if test -e "$gitdir"; then fail "$gitdir exists"; fi
383 public) wantstat='7[75]5' ;;
384 secret) wantstat='7[70]0' ;;
385 *) fail "$1 t-git-dir-check ?" ;;
387 gotstat=`stat -c%a $gitdir`
389 *$wantstat) return ;;
390 *) fail "$gitdir has mode $gotstat, expected $wantstat" ;;
394 t-expect-fsck-fail () {
395 echo >>$tmp/fsck.expected-errors "$1"
399 local fsckerrs=$(git rev-parse --git-dir)/dgit-test-fsck.errs
402 LC_MESSAGES=C git fsck --no-dangling --strict 2>&1 \
404 ps="${PIPESTATUS[*]}"
408 if [ -f $tmp/fsck.expected-errors ]; then
409 pats=(-w -f $tmp/fsck.expected-errors)
413 pats+=(-e 'notice: HEAD points to an unborn branch')
414 pats+=(-e 'notice: No default references')
417 grep -v "${pats[@]}" $fsckerrs
421 1) ;; # no unexpected errors
422 0) fail "unexpected messages from git-fsck" ;;
423 *) fail "grep of git-fsck failed" ;;
427 t-check-only-bpd () {
428 if [ "$bpd" = .. ]; then return; fi
430 $tmp/*.{deb,changes,dsc,buildinfo} \
437 for d in $tmp/*/.git $tmp/git/*.git; do
445 : '========================================'
452 t-save-artifacts () {
453 artifacts="$AUTOPKGTEST_ARTIFACTS"
454 if [ x"$artifacts" = x ]; then return; fi
455 if [ x"tmp" = x ]; then return; fi
456 GZIP=-1v tar -C "$tmp" -zc -f "$artifacts/${0##*/}.tar.gz" \
460 t-rm-dput-dropping () {
461 rm -f $tmp/${p}_${v}_*.upload
465 local dgit=${DGIT_TEST-dgit}
468 {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{'
469 $dgit --dgit=$dgit --dget:-u --dput:--config=$tmp/dput.cf \
470 ${dgit_config_debian_alias-"--config-lookup-explode=dgit-distro.debian.alias-canon"} \
471 ${DGIT_GITDEBREBASE_TEST+--git-debrebase=}${DGIT_GITDEBREBASE_TEST} \
472 ${distro+${distro:+-d}}${distro--dtest-dummy} \
473 $DGIT_TEST_OPTS $DGIT_TEST_DEBUG \
474 -kBCD22CD83243B79D3DFAC33EA3DBCBC039B13D8A $t_dgit_xopts "$@"
475 : '}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
482 (export LC_ALL=C.UTF-8
483 if [ "$DGIT_TEST_INTREE" ]; then
484 make -C $DGIT_TEST_INTREE $page.$section.view
491 diff --exclude=.git --exclude=.pc -ruN $*
494 t-files-notexist () {
503 t-cloned-fetched-good () {
504 t-diff-nogit ../extract/$p-${v%-*} .
505 t-clean-on-branch dgit/sid
508 refs/heads/dgit/sid \
509 refs/remotes/dgit/dgit/sid
510 t-refs-notexist refs/dgit/unstable refs/remotes/dgit/dgit/unstable
514 printf "%s${1:+\n}" "$1" >$tmp/t.want
517 diff $tmp/t.want $tmp/t.got
520 t-clean-on-branch () {
521 t-output "## $1" git status -b --porcelain
529 local import=IMPORT.${DGIT_TEST_TESTNAME-${0##*/}}
530 exec 4>$tmp/$import.new
533 for vn in $savevars; do
534 perl >&4 -"I$root" -MDebian::Dgit -e '
535 printf "%s=%s\n", $ARGV[0], shellquote $ARGV[1]
536 ' $vn "$(eval "printf '%s\n' \"\$$vn\"")"
539 perl >&4 -"I$root" -MDebian::Dgit -we '
540 foreach my $vn (grep m/^DGIT_TEST_REAL_/, keys %ENV) {
541 print STDERR "saving-exporting $vn\n";
542 printf "export %s=%s\n", $vn, shellquote $ENV{$vn}
547 (set -e; cd $tmp; tar cf $import.tar $savedirs)
549 printf >&4 "\n%s\n" "$importeval"
551 mv -f $tmp/$import.new $tmp/$import
559 if [ "x$tmpbase" = x ]; then
560 # ADTTMP was set on entry to tests/lib, so we
561 # are not sharing tmp area between tests
563 lock="$tmp/.dummy.lock"
565 setupsrc="$tmpbase/$setupname"
566 lock="$setupsrc.lock"
569 local simport="$setupsrc/IMPORT.$setupname"
571 if ! [ -e "$simport" ]; then
572 with-lock-ex -w "$lock" \
573 xargs -0 -a $tmp/.save-env \
576 setupname="$1"; shift
578 if [ -e "$simport" ]; then exit 0; fi
580 "tests/setup/$setupname"
581 ' x "$root" "$setupname" "$simport"
584 if [ "x$setupsrc" != "x$tmp" ]; then
585 (set -e; cd $tmp; tar xf "$simport.tar")
588 mkdir -p $tmp/must-clean
593 t-git-get-ref-exact () {
595 # does not dereference, unlike t-git-get-ref
598 *) fail "t-git-get-ref-exact bad $ref" ;;
600 git for-each-ref --format='%(objectname)' "[r]efs/${ref#refs/}"
607 *) fail "t-git-get-ref bad $ref" ;;
609 (git show-ref -d $1 || test $? = 1) | perl -ne '
610 $x = $1 if m#^(\w+) \Q'$1'\E(?:\^\{\})?$#;
611 END { print "$x\n" if length $x; }
615 t-ref-same-exact () {
617 local val; val=`t-git-get-ref-exact $name`
618 t-ref-same-val "$name" $val
623 local val; val=`t-git-get-ref $name`
624 t-ref-same-val "$name" $val
628 local val; val=`git rev-parse HEAD`
629 t-ref-same-val HEAD $val
635 case "${t_ref_val-unset}" in
638 *) fail "ref varies: ($name)\
639 ${val:-nothing} != ${t_ref_val:-nothing} (${t_ref_names[*]})" ;;
642 t_ref_names+=("$name")
645 t-refs-same-start () {
660 val=`t-git-get-ref $g`
661 if [ "x$val" != x ]; then
662 fail "ref $g unexpectedly exists ($val)"
668 echo refs/tags/$tagpfx/${v//\~/_}
672 git log -n1 --pretty=format:"$1" "$2"
675 t-sametree-parent () {
678 local ctree; ctree=$(t-format-ref '%T' "$ref")
681 for parent in $(t-format-ref '%P' "$ref"); do
682 local ptree; ptree=$(t-format-ref '%T' "$parent")
683 if [ "x$ptree" = "x$ctree" ]; then
687 case "$psame" in ""|" * *") break ;; esac
693 t-check-pushed-master () {
694 local master; master=`t-git-get-ref refs/heads/master`
695 if [ x$master = x$t_ref_val ]; then return; fi
696 if [ x$master = x ]; then fail "failed to push master"; fi
697 # didn't update master, it must be not FF
698 local mbase; mbase=`t-git-merge-base $master $t_ref_val`
699 if [ x$mbase = x$master ]; then fail "failed to ff master"; fi
702 t-push-was-source-only () {
704 t-files-notexist $tmp/incoming/${p}_${v}_*.deb \
705 $tmp/incoming/${p}_${v}_*.udeb
706 # we permit _source.buildinfo files; see test_changes_source_only()
707 for f in $tmp/incoming/${p}_${v}_*.buildinfo; do
710 *_source.buildinfo) ;;
711 *) fail "non-source-only file $f exists!" ;;
719 stat $tmp/incoming/$f
725 local suite=${2:-sid}
731 t-pushed-good-core () {
735 refs/remotes/dgit/dgit/$suite
737 refs/heads/dgit/unstable \
738 refs/remotes/dgit/dgit/unstable
739 (set -e; cd $dgitrepo
743 ${t_check_pushed_master:- : NOT-DRS-NO-CHECK-PUSHED-MASTER}
747 git verify-tag `t-v-tag`
750 t-pushed-good-check-changes () {
751 changes_filename="$tmp/incoming/${p}_${v}_*.changes"
752 grep -E "^Distribution: $suite" $changes_filename
753 grep -E "^Version: $v" $changes_filename
756 t-splitbrain-pushed-good--unpack () {
761 ln -s $tmp/mirror/pool/main/*.orig*.tar* .
762 ln -s $tmp/incoming/*.orig*.tar* . ||:
763 ln -s $incoming_dsc .
764 ln -s ${incoming_dsc/.dsc/.debian.tar}* .
765 ln -s ${incoming_dsc/.dsc/.tar}* . ||:
766 dpkg-source "$@" -x *.dsc
769 git fetch ../../$p "refs/tags/*:refs/tags/*"
772 t-splitbrain-pushed-good--checkprep () {
774 git rm --cached -r --ignore-unmatch .pc
777 t-splitbrain-pushed-good--checkdiff () {
779 t-splitbrain-pushed-good--checkprep
780 t-output "" git diff --stat --cached $tag
783 t-splitbrain-pushed-good-start () {
784 dep14tag=refs/tags/test-dummy/${v//\~/_}
786 t-output "" git status --porcelain
788 t-refs-same $dep14tag
789 (set -e; cd $dgitrepo; t-refs-same $dep14tag)
790 git merge-base --is-ancestor $dep14tag $dgittag
793 t-ref-same refs/heads/split.p
794 local split_b=$(t-git-get-ref refs/heads/split.b)
797 "$(git rev-parse refs/heads/split.p^0)") ;;
798 "$(git rev-parse refs/heads/split.p^1)") ;;
799 *) fail "bad b/p (b=$split_b)" ;;
805 t-splitbrain-pushed-good--unpack
806 t-splitbrain-pushed-good--checkdiff $dgittag
808 t-splitbrain-pushed-good-end-made-dep14 () {
809 t-splitbrain-pushed-good--checkdiff $dep14tag
813 t-splitbrain-rm-1-patch () {
816 next unless $_ eq "'"$patchname"'\n";
819 rename "debian/patches/$_", "../t-'"$patchname"'" or die $!;
821 ' debian/patches/series
824 t-splitbrain-rm-gitignore-patch () {
825 t-splitbrain-rm-1-patch auto-gitignore
828 t-gbp-pushed-good () {
829 local suite=${1:-sid}
830 t-splitbrain-pushed-good-start
832 # Right, now we want to check that the maintainer tree and
833 # the dgit tree differ in exactly the ways we expect. We
834 # achieve this by trying to reconstruct the maintainer tree
835 # from the dgit tree.
837 # So, unpack it withut the patches applied
838 t-splitbrain-pushed-good--unpack --skip-patches
840 # dgit might have added a .gitignore patch, which we need to
842 t-splitbrain-rm-gitignore-patch
844 # Now the result should differ only in non-debian/ .gitignores
845 t-splitbrain-pushed-good--checkprep
846 git diff --cached --name-only $dep14tag >../changed
848 next if !m#^debian/# && m#(^|/)\.gitignore#;
852 # If we actually apply the gitignore patch by hand, it
854 if [ -f ../t-auto-gitignore ]; then
855 patch --backup-if-mismatch -p1 -u <../t-auto-gitignore
858 t-splitbrain-pushed-good-end-made-dep14
861 t-unapplied-pushed-good () {
862 local suite=${1:-sid}
863 t-splitbrain-pushed-good-start
864 t-splitbrain-pushed-good--unpack --skip-patches
865 t-splitbrain-pushed-good-end-made-dep14
868 t-dpm-pushed-good () {
869 local suite=${1:-sid}
870 t-splitbrain-pushed-good-start
871 t-splitbrain-pushed-good--unpack
872 t-splitbrain-rm-gitignore-patch
873 t-splitbrain-pushed-good-end-made-dep14
876 t-split-unchanged-pushed-good () {
877 local suite=${1:-sid}
878 t-splitbrain-pushed-good-start
879 t-splitbrain-pushed-good--unpack
880 t-splitbrain-pushed-good-end-made-dep14
883 t-commit-build-push-expect-log () {
889 t-dgit push --new 2>&1 |tee $tmp/push.log
890 t-grep-mpat "$mpat" $tmp/push.log
897 use Dpkg::Control::Hash;
898 my $h = new Dpkg::Control::Hash allow_pgp=>1;
899 $h->parse(\*STDIN,"'"$file"'");
900 my $val = $h->{"'$field'"},"\n";
901 die "'"$file $field"'" unless defined $val;
907 export DGIT_TEST_DISTRO=''
909 t-git-config dgit-suite.unstable.distro test-dummy
919 "") '$var'="$tstunt" ;;
920 *) '$var'="$tstunt:$'$var'" ;;
926 t-tstunt--save-real () {
937 p="${p/:"$tmp/tstunt":/:}"
949 *) fail "did not find $f on PATH $PATH" ;;
952 local varname=${f//[^_0-9a-zA-Z]/_}
953 varname=DGIT_TEST_REAL_${varname^^}
956 : \${$varname:=\$real}
962 local tstunt=$tmp/tstunt
963 t-stunt-envvar PATH $tstunt
964 t-stunt-envvar PERLLIB $tstunt
967 t-tstunt--save-real $f
969 local d="$tstunt/${f%/*}"
971 ln -sf "$troot/tstunt/$f" "$d"/.
975 t-tstunt-parsechangelog () {
976 t-tstunt dpkg-parsechangelog Dpkg/Changelog/Parse.pm
979 t-tstunt-lintian () {
983 t-tstunt-debuild () {
988 local dsc=${p}_${v}.dsc
989 incoming_dsc=$tmp/incoming/$dsc
994 local val; val=`t-822-field $incoming_dsc Dgit`
997 die "Dgit $_ ?" unless m/^\w+\b/;
998 print $&,"\n" or die $!;
1000 t-ref-same-val $incoming_dsc "$val"
1006 (cd $troot/pkg-srcs;
1007 debdiff ${p}_${v1}.dsc ${p}_${v2}.dsc || test $? = 1) \
1011 t-gbp-unapplied-pq2qc () {
1012 # does `gbp pq export'
1013 # commits the resulting debian/patches on qc/BRANCH
1014 # leaves us on qc/BRANCH (eg "qc/quilt-tip"))
1015 # qc/BRANCH is not fast-forwarding
1019 branch=`git symbolic-ref HEAD`
1020 branch=${branch#refs/heads/}
1023 */*) fail "unexpected branch $branch" ;;
1026 git branch -f qc/$branch
1027 git checkout qc/$branch
1028 git add debian/patches
1029 git commit -m 'Commit patch queue'
1032 t-git-pseudo-merge () {
1033 # like git merge -s ours
1034 if [ ! "$git_pseuomerge_opts" ]; then
1035 if git merge --help \
1036 | grep -q allow-unrelated-histories; then
1037 git_pseuomerge_opts='--allow-unrelated-histories'
1039 git_pseuomerge_opts+=' -s ours'
1041 git merge $git_pseuomerge_opts "$@"
1044 t-gbp-example-prep-no-ff () {
1045 t-archive example 1.0-1
1053 git checkout -b patch-queue/quilt-tip-2 patch-queue/quilt-tip
1056 echo '/* some comment */' >>src.c
1058 git commit -m 'Add a comment to an upstream file'
1060 t-gbp-unapplied-pq2qc
1062 t-commit 'some updates' 1.0-2
1065 t-gbp-example-prep () {
1066 t-gbp-example-prep-no-ff
1068 t-git-pseudo-merge \
1069 -m 'Pseudo-merge to make descendant of archive' \
1070 remotes/dgit/dgit/sid
1073 t-make-badcommit () {
1075 git cat-file commit HEAD | \
1076 perl -pe 's/^committer /commiter /' | \
1077 git hash-object -w -t commit --stdin
1079 t-expect-fsck-fail $badcommit
1083 # leaves ust set to filename of orig tarball
1087 ust=${p}_${v}.orig.tar.gz
1088 GZIP=-1 git archive -o $bpd/$ust --prefix=${p}-${v}/ $tag
1091 t-merge-conflicted-stripping-conflict-markers () {
1092 local otherbranch=$1
1095 t-expect-fail F:"Merge conflict in $file" \
1096 git merge $otherbranch
1098 perl -i~ -ne 'print unless m{^(?:\<\<\<|\>\>\>|===)}' "$file"
1100 git commit --no-edit
1105 v=${2:-${majorv:-1}.$revision}
1106 $troot/tstunt/debchange \
1107 --force-distribution -v$v --distribution ${3:-unstable} "$1"
1108 git add debian/changelog
1110 revision=$(( ${revision-0} + 1 ))
1114 local cmd="$1"; shift
1115 local suite=${1-unstable}
1116 $cmd -r -D "$suite" ''
1120 t-dch-r-rune t-dch-commit "$@"
1124 $troot/tstunt/debchange "$@"
1125 git commit -m "dch $*" debian/changelog
1129 git config --global "$@"
1133 t-git-config dgit-distro.test-dummy.git-url "ext::$troot/drs-git-ext %S "
1134 t-git-config dgit-distro.test-dummy.git-check true
1135 t-git-config dgit-distro.test-dummy.git-create true
1136 cp $troot/gnupg/{dd.gpg,dm.gpg,dm.txt} $tmp/.
1137 cp $troot/suites $tmp/.
1138 cp $troot/suites $tmp/suites-master
1140 export t_check_pushed_master=t-check-pushed-master
1142 drs_dispatch=$tmp/distro=test-dummy
1145 if [ "x$DGIT_TEST_INTREE" != x ]; then
1146 ln -sf "$DGIT_TEST_INTREE" $drs_dispatch/dgit-live
1149 ln -sf $tmp/git $drs_dispatch/repos
1150 ln -sf $tmp/suites $tmp/suites-master $tmp/dm.txt $drs_dispatch/
1151 mkdir -p $drs_dispatch/keyrings
1152 ln -sf $tmp/dd.gpg $drs_dispatch/keyrings/debian-keyring.gpg
1153 ln -sf $tmp/dm.gpg $drs_dispatch/keyrings/debian-maintainers.gpg
1154 ln -sf /bin/true $drs_dispatch/policy-hook
1159 t-git-config dgit-distro.test-dummy.ssh "$troot/dsd-ssh"
1160 t-git-config dgit-distro.test-dummy.git-check ssh-cmd
1161 t-git-config dgit-distro.test-dummy.git-create true
1162 t-git-config dgit-distro.test-dummy.git-url \
1163 "ext::$troot/dsd-ssh X %S /dgit/test-dummy/repos"
1165 t-git-config dgit-distro.test-dummy.diverts.drs /drs
1166 t-git-config dgit-distro.test-dummy/drs.ssh "$troot/ssh"
1167 t-git-config dgit-distro.test-dummy/drs.git-url $tmp/git
1168 t-git-config dgit-distro.test-dummy/drs.git-check ssh-cmd
1169 t-git-config dgit-distro.test-dummy/drs.git-create ssh-cmd
1171 echo 'no-such-package* drs' >$drs_dispatch/diverts
1175 : '(((((((((((((((((((((((((((((((((((((((('
1176 ${DGIT_INFRA_PFX}dgit-repos-admin-debian --repos $tmp/git "$@"
1177 : '))))))))))))))))))))))))))))))))))))))))'
1180 t-policy-nonexist () {
1181 ln -sf no-such-file-or-directory $drs_dispatch/policy-hook
1184 t-make-hook-link () {
1185 local hook=$1 # in infra/
1187 hook=${DGIT_INFRA_PFX}$hook
1190 *) hook=`type -P $hook` ;;
1192 ln -sf "$hook" $linkpath
1197 t-make-hook-link $policyhook $drs_dispatch/policy-hook
1202 t-policy dgit-repos-policy-debian
1205 t-policy-admin create-db
1208 t-policy-periodic () {
1209 : '(((((((((((((((((((((((((((((((((((((((('
1210 ${DGIT_REPOS_SERVER_TEST-dgit-repos-server} \
1211 test-dummy $drs_dispatch '' --cron
1212 : '))))))))))))))))))))))))))))))))))))))))'
1215 t-tagupl-settings () {
1216 export DGIT_DRS_EMAIL_NOREPLY=noreply@example.org
1217 export DGIT_DRS_SENDMAIL=$troot/tstunt/sendmail
1218 export DGIT_DRS_DGIT=$troot/tstunt/dgit
1219 t-chain-test-somehow
1221 mkdir ../pretend-salsa
1222 (set -e; cd ../pretend-salsa; git init --bare)
1223 git remote add salsa $tmp/pretend-salsa
1224 # git branch --set-upstream-to complains, so
1225 git config branch.master.remote salsa
1226 git config branch.master.merge refs/heads/master
1229 t-tagupl-run-drs () {
1234 DGIT_DRS_ANY_URL=1 \
1235 DGIT_DRS_MODE="tag2upload $source $tagname" \
1242 ${DGIT_DEBPUSH_TEST-git debpush} \
1243 --distro=test-dummy -u Senatus "$@"
1246 t-tagupl-run-drs $tmp/pretend-salsa
1249 t-refs-same refs/heads/master
1255 t-buildproductsdir-config () {
1257 t-git-config dgit.default.build-products-dir $bpd
1259 cat <<END >>$tmp/.gbp.conf
1266 local restriction=$1
1267 (cd $root; t-restriction-$restriction >&2)
1271 : "Hopefully installed: $*"
1274 t-chain-test-somehow () {
1275 export DGIT_TEST_TESTNAME="$testname"
1276 export DGIT_TEST_TMPBASE="$tmpbase"
1281 t-chain-test-somehow
1291 t-chain-test "${t#*-}"
1294 t-git-config dgit.default.old-dsc-distro test-dummy
1296 for import in ${autoimport-gnupg}; do
1300 t-setup-import $import