summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lib15
-rwxr-xr-xtests/run-all2
-rwxr-xr-xtests/tests/dpkgsourceignores-correct53
-rwxr-xr-xtests/tests/dpkgsourceignores-docs54
-rwxr-xr-xtests/tests/gitworktree29
-rwxr-xr-xtests/tests/sbuild-gitish47
-rwxr-xr-xtests/tstunt/gpg28
-rw-r--r--tests/worktrees/example_1.0.tarbin71680 -> 81920 bytes
8 files changed, 225 insertions, 3 deletions
diff --git a/tests/lib b/tests/lib
index 3c04155..8fd3514 100644
--- a/tests/lib
+++ b/tests/lib
@@ -389,7 +389,7 @@ t-fscks () {
(
shopt -s nullglob
for d in $tmp/*/.git $tmp/git/*.git; do
- cd "$d"
+ cd "${d%/.git}"
t-git-fsck
done
)
@@ -407,7 +407,7 @@ t-rm-dput-dropping () {
t-dgit () {
local dgit=${DGIT_TEST-dgit}
- pwd
+ pwd >&2
: '
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{'
$dgit --dgit=$dgit --dget:-u --dput:--config=$tmp/dput.cf \
@@ -419,6 +419,17 @@ t-dgit () {
'
}
+t-dgit-manpage () {
+ local section=$1
+ local page=$2
+ (export LC_ALL=C.UTF-8
+ if [ "$DGIT_TEST_INTREE" ]; then
+ make -C $DGIT_TEST_INTREE $page.$section.view
+ else
+ man $section $page
+ fi)
+}
+
t-diff-nogit () {
diff --exclude=.git --exclude=.pc -ruN $*
}
diff --git a/tests/run-all b/tests/run-all
index 3877c76..cfa5ce2 100755
--- a/tests/run-all
+++ b/tests/run-all
@@ -15,6 +15,8 @@ fi
mkdir -p tests/tmp
+export DGIT_GNUPG_STUNT_ERRLOG=$( tty -s ||: )
+
(
set -x
exec make $jcpus -k -f tests/Makefile "$@"
diff --git a/tests/tests/dpkgsourceignores-correct b/tests/tests/dpkgsourceignores-correct
new file mode 100755
index 0000000..33de95e
--- /dev/null
+++ b/tests/tests/dpkgsourceignores-correct
@@ -0,0 +1,53 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+t-tstunt-parsechangelog
+
+t-archive example 1.0-1
+t-git-none
+
+t-dgit --no-rm-on-error clone $p
+
+cd $p
+
+bad-dpkg-source () {
+ t-expect-fail E:"dpkg-source:.*unexpected upstream changes" \
+ t-dgit --quilt=nofix -wgf build-source
+ find * -name .git -print0 | xargs -0r rm --
+}
+
+ignores=$(t-dgit print-dpkg-source-ignores)
+
+spurious-git-must-be-excluded () {
+ dpkg-source $ignores -b .
+ mkdir check
+ cd check
+ dpkg-source -x ../../${p}_${v}.dsc
+ cd ${p}-${v%-*}
+ find -name .git >../bad
+ diff /dev/null ../bad
+ cd ../..
+ find * -name .git -print0 | xargs -0r rm -rf --
+ git clean -xdff
+}
+
+mkdir docs/.git
+echo hi >docs/.git/ho
+spurious-git-must-be-excluded
+
+echo hi >docs/.git
+spurious-git-must-be-excluded
+
+mkdir not-really.git
+echo fee >not-really.git/something
+echo fi >not-really.gitfoo
+echo fo >some.git
+echo fum >some.gitfoo
+git add .
+git commit -m 'want these'
+
+t-dgit --quilt=smash -wgf build-source
+t-dgit -wgf push
+
+t-ok
diff --git a/tests/tests/dpkgsourceignores-docs b/tests/tests/dpkgsourceignores-docs
new file mode 100755
index 0000000..a71e7f9
--- /dev/null
+++ b/tests/tests/dpkgsourceignores-docs
@@ -0,0 +1,54 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+t-restrict x-dgit-intree-only
+# we need the .pod source, which is not shipped
+
+cd $tmp
+
+: ----- extract args from document -----
+
+perl -ne '
+ BEGIN { print "\n=head1 dgit-test-title\n\n"; }
+ next unless
+ m/^=for dgit-test dpkg-source-ignores begin/..
+ m/^=for dgit-test dpkg-source-ignores end/;
+ next unless m/dpkg-buildpackage.*-i.*-I/;
+ s/\s*dpkg-buildpackage\s+//;
+ s/\s+-S\s*//;
+ print;
+' $root/dgit-maint-merge.7.pod >doc.pod
+
+pod2text doc.pod >doc.txt
+
+perl -ne '
+ next unless m/\S/;
+ next if m/dgit-test-title/;
+ print "for arg in ";
+ print;
+ print " do\n";
+' doc.txt >doc.sh
+
+cat >>doc.sh <<'END'
+ printf "%s\n" "$arg"
+done
+END
+
+chmod +x doc.sh
+./doc.sh >doc.args
+
+: ----- extract args from dgit -----
+
+args=$( t-dgit print-dpkg-source-ignores )
+
+>dgit.args
+for arg in $args; do
+ printf >>dgit.args "%s\n" "$arg"
+done
+
+: ----- compare -----
+
+diff -u dgit.args doc.args
+
+t-ok
diff --git a/tests/tests/gitworktree b/tests/tests/gitworktree
new file mode 100755
index 0000000..e675a0a
--- /dev/null
+++ b/tests/tests/gitworktree
@@ -0,0 +1,29 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+t-archive example 1.0-1
+t-git-none
+
+t-dgit --no-rm-on-error clone $p
+
+mv $p maintree
+cd maintree
+git branch -m maintree-head
+git worktree add ../$p
+cd ../$p
+
+t-dgit fetch
+
+t-dgit setup-new-tree
+
+echo hi >>modification
+git add modification
+git commit -m 'want this'
+t-dgit -wgf quilt-fixup
+
+t-dgit -wgf --quilt=nofix build
+
+t-dgit -wgf push
+
+t-ok
diff --git a/tests/tests/sbuild-gitish b/tests/tests/sbuild-gitish
new file mode 100755
index 0000000..6e497b2
--- /dev/null
+++ b/tests/tests/sbuild-gitish
@@ -0,0 +1,47 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+t-dependencies sbuild man-db
+t-restrict x-dgit-schroot-build
+
+t-tstunt-parsechangelog
+
+t-prep-newpackage example 1.1
+
+buildrune=$(
+ t-dgit-manpage 7 dgit-user | \
+ perl -ne '
+ next unless m/^ +Using sbuild$/ .. 0;
+ next unless m/^ +\%/ .. 0;
+ next if !m/\S/ .. 0;
+ s/^ +\%//;
+ $fixchr += s/(\s-c\s*)jessie(\s|$)/$1build$2/;
+ print or die $!;
+ END { $fixchr == 1 or die $fixchr; }
+ '
+)
+
+cd $p
+
+build () {
+ eval "$buildrune"
+}
+
+git checkout quilt-tip-1.1~0
+
+build
+
+git checkout gitish-only~0
+
+cat <<'END' >clean-target-hook
+#!/bin/sh
+set -ex
+test "$SCHROOT_SESSION_ID"
+END
+git add clean-target-hook
+git commit -m 'insist on schroot'
+
+build
+
+t-ok
diff --git a/tests/tstunt/gpg b/tests/tstunt/gpg
index d71aa63..a108267 100755
--- a/tests/tstunt/gpg
+++ b/tests/tstunt/gpg
@@ -1,6 +1,32 @@
#!/bin/sh
set -e
-exec \
+
+for attempt in '' exec; do
+
+set +e
+$attempt \
$DGIT_TEST_REAL_GPG \
--agent-program=$DGIT_STUNT_AGENT \
"$@"
+rc=$?
+set -e
+
+if [ $rc != 2 ]; then exit $rc; fi
+
+echo >&2 "WARNING - GNUPG FAILED $rc - STUNT GNUPG $attempt $*"
+
+sh -ec '
+ if [ "x$DGIT_GNUPG_STUNT_ERRLOG" != x ]; then
+ exec >"$DGIT_GNUPG_STUNT_ERRLOG"
+ else
+ exec 2>/dev/null
+ fi
+ exec >/dev/tty
+ printf "%s\n" "$*"
+' x "GNUPG WRAPPER - TROUBLE - $HOME $GNUPGHOME - FAILED $rc $attempt $*"
+
+sleep 10
+
+done
+
+exit 127
diff --git a/tests/worktrees/example_1.0.tar b/tests/worktrees/example_1.0.tar
index 6f66a91..fe108d1 100644
--- a/tests/worktrees/example_1.0.tar
+++ b/tests/worktrees/example_1.0.tar
Binary files differ