summaryrefslogtreecommitdiff
path: root/tests/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tests')
-rwxr-xr-xtests/tests/checkout59
-rwxr-xr-xtests/tests/gdr-makepatches79
-rwxr-xr-xtests/tests/gdr-newupstream8
-rwxr-xr-xtests/tests/gdr-viagit1
-rwxr-xr-xtests/tests/import-native2
-rwxr-xr-xtests/tests/manpages-format78
-rwxr-xr-xtests/tests/overwrite-splitbrains2
-rwxr-xr-xtests/tests/push-newrepeat21
-rwxr-xr-xtests/tests/sourceonlypolicy38
-rwxr-xr-xtests/tests/trustingpolicy-replay5
10 files changed, 219 insertions, 4 deletions
diff --git a/tests/tests/checkout b/tests/tests/checkout
new file mode 100755
index 0000000..756c49b
--- /dev/null
+++ b/tests/tests/checkout
@@ -0,0 +1,59 @@
+#!/bin/bash
+set -e
+. tests/lib
+t-tstunt-parsechangelog
+
+t-setup-import examplegit
+
+now-on () {
+ local branch=$(git symbolic-ref HEAD)
+ test "$branch" = "refs/heads/$1"
+}
+
+p=example
+
+mkdir $p.2
+cd $p.2
+
+git init
+t-dgit setup-new-tree
+t-dgit checkout -p $p unstable
+
+now-on dgit/sid
+t-refs-same-start
+t-ref-head
+t-ref-same refs/tags/test-dummy/$v
+
+t-dgit checkout -p $p stable
+now-on dgit/stable
+
+t-dgit checkout -d no-such-distro sid
+t-ref-head
+now-on dgit/sid
+
+t-dgit checkout stable
+now-on dgit/stable
+
+git branch -D dgit/sid
+t-dgit checkout -d no-such-distro sid
+t-ref-head
+now-on dgit/sid
+
+git reflog --pretty=tformat:%gs >../reflog.got
+cat >../reflog.expect <<END
+dgit checkout sid
+dgit checkout stable
+dgit checkout sid
+dgit checkout stable
+dgit checkout unstable
+END
+diff -u ../reflog.{expect,got}
+
+git for-each-ref --format='%(refname)' refs/heads | t-sort >../refs.got
+cat >../refs.expect <<END
+refs/heads/dgit/sid
+refs/heads/dgit/stable
+END
+diff -u ../refs.{expect,got}
+
+t-ok
diff --git a/tests/tests/gdr-makepatches7 b/tests/tests/gdr-makepatches7
index 9c39710..02ea7ab 100755
--- a/tests/tests/gdr-makepatches7
+++ b/tests/tests/gdr-makepatches7
@@ -8,6 +8,15 @@ t-setup-import gdr-convert-gbp
cd $p
+git checkout upstream/2.0
+echo '*patch*' >>.gitignore
+git commit -m nasty .gitignore
+git tag v2.1
+GZIP=-1 git archive -o ../${p}_2.1.orig.tar.gz --prefix ${p}/ v2.1
+
+git checkout master
+t-git-debrebase new-upstream 2.1-1
+
t-some-changes for-rebase-fixup m
t-git-debrebase
diff --git a/tests/tests/gdr-newupstream b/tests/tests/gdr-newupstream
index 536f49c..39ed24b 100755
--- a/tests/tests/gdr-newupstream
+++ b/tests/tests/gdr-newupstream
@@ -1,5 +1,6 @@
#!/bin/bash
set -e
+autoimport=
. tests/lib
t-dependencies NO-DGIT GDR
@@ -35,8 +36,10 @@ t-git-debrebase new-upstream $v
git tag v2.1 upstream
-t-git-debrebase new-upstream $v
+t-git-debrebase new-upstream ${v%-*}
+
t-gdr-good laundered
+git reflog | egrep 'debrebase new-upstream.*checkout'
t-git-debrebase stitch
t-gdr-good stitched
@@ -54,8 +57,11 @@ anchor=$(perl <../anal.anch -ne '
exit;
')
+GIT_REFLOG_ACTION='STUNT-RLA' \
t-git-debrebase --anchor=$anchor -fanchor-treated new-upstream $v upstream
t-gdr-good laundered
+git reflog | egrep 'STUNT-RLA: debrebase new-upstream'
+git reflog | egrep 'STUNT-RLA: debrebase: launder for new upstream'
t-git-debrebase stitch
t-gdr-good stitched
diff --git a/tests/tests/gdr-viagit b/tests/tests/gdr-viagit
index 644d2d4..a83e622 100755
--- a/tests/tests/gdr-viagit
+++ b/tests/tests/gdr-viagit
@@ -1,5 +1,6 @@
#!/bin/bash
set -e
+autoimport=
. tests/lib
t-dependencies NO-DGIT GDR
diff --git a/tests/tests/import-native b/tests/tests/import-native
index 1e09343..0766841 100755
--- a/tests/tests/import-native
+++ b/tests/tests/import-native
@@ -8,7 +8,7 @@ t-tstunt-parsechangelog
mkdir $tmp/aside
versions=""
-for f in $(find $tmp/mirror -name \*.dsc | sort); do
+for f in $(find $tmp/mirror -name \*.dsc | t-sort); do
perl -i -pe '
$_="" if m/^-----BEGIN PGP SIGNED/..!m/\S/;
$_="" if m/^-----BEGIN PGP SIGNATURE/..0;
diff --git a/tests/tests/manpages-format b/tests/tests/manpages-format
new file mode 100755
index 0000000..7ba2f9d
--- /dev/null
+++ b/tests/tests/manpages-format
@@ -0,0 +1,78 @@
+#!/bin/bash
+set -e
+autoimport=
+. tests/lib
+
+t-dependencies man-db make groff git-debrebase
+
+cd $root
+
+printenv |grep MAKE ||: |t-sort
+manpages=$(MAKEFLAGS= MAKELEVEL= make list-manpages)
+
+export MANWIDTH=80
+
+run_man () {
+ if [ "x${DGIT_MANPAGES_SOURCE_DIR}" = x ]; then
+ cmd='man "$@" $section $page'
+ else
+ make $roff >&2
+ cmd='man "$@" -l $roff'
+ fi
+ eval "$cmd 2>&1 >/dev/null |tee $errs"
+}
+
+for roff in $manpages; do
+ for fmt in txt ps; do
+ >$tmp/$roff.$fmt-expected
+ done
+done
+
+expected () {
+ cat >$tmp/$2.$1-expected
+}
+
+not_egrep_vxPf () {
+ # egrep -vxPf does not work, so we reimplement it
+ perl -ne '
+ BEGIN () {
+ open PATS, shift @ARGV or die $!;
+ $re = join "|", map { chomp; qr{^(?:$_)$} }
+ qr{^(?=a)b}, <PATS>;
+ print STDERR "RE $re\n";
+ }
+ next if m{$re};
+ print STDERR "unexpected: $_";
+ $bad = 1;
+ END { die "unexpected errors\n" if $bad; }
+ ' "$@"
+}
+
+expected txt dgit.1 <<'END'
+.* # table wider than line width
+END
+
+prep () {
+ fmt=$1
+ errs=$tmp/$roff.$fmt-errs
+}
+
+check () {
+ perl -0777 -i~ -pe 's/\n[ \t]+/ # /' $errs
+ not_egrep_vxPf $tmp/$roff.$fmt-expected $errs
+}
+
+for roff in $manpages; do
+ section=${roff##*.}
+ page=${roff%.*}
+
+ prep txt
+ run_man
+ check
+
+ prep ps
+ run_man -Tps
+ check
+done
+
+t-ok
diff --git a/tests/tests/overwrite-splitbrains b/tests/tests/overwrite-splitbrains
index 0ef03f6..06d1a98 100755
--- a/tests/tests/overwrite-splitbrains
+++ b/tests/tests/overwrite-splitbrains
@@ -14,7 +14,7 @@ t-dgit fetch
t-refs-same-start
t-ref-head
-t-expect-fail 'check failed (maybe --overwrite is needed' \
+t-expect-fail 'maybe --overwrite is needed' \
t-dgit --quilt=gbp --dgit-view-save=split.p push
t-refs-same-start
diff --git a/tests/tests/push-newrepeat b/tests/tests/push-newrepeat
new file mode 100755
index 0000000..87fcb35
--- /dev/null
+++ b/tests/tests/push-newrepeat
@@ -0,0 +1,21 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+t-tstunt-parsechangelog
+
+t-prep-newpackage example 1.0
+
+cd $p
+git checkout quilt-tip
+cp $troot/pkg-srcs/${p}_1.0.orig.tar.gz ..
+
+t-dgit --quilt=smash build-source
+
+t-expect-fail E:'Push failed, while updating the remote git repository' \
+t-dgit -cdgit-distro.test-dummy.git-url=file:///dev/enoent/fail \
+ push --new
+
+t-dgit push --new
+
+t-ok
diff --git a/tests/tests/sourceonlypolicy b/tests/tests/sourceonlypolicy
new file mode 100755
index 0000000..b0569c3
--- /dev/null
+++ b/tests/tests/sourceonlypolicy
@@ -0,0 +1,38 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+t-tstunt-parsechangelog
+
+t-prep-newpackage example 1.0
+
+cd $p
+revision=1
+
+dgit-with-policy () {
+ local policy=$1; shift
+ t-dgit -cdgit-distro.test-dummy.source-only-uploads=$policy "$@"
+}
+
+t-expect-fail E:'source-only.*entirely NEW' \
+dgit-with-policy not-wholly-new push-source --new
+
+t-expect-fail E:'source-only.*requires \.debs' \
+dgit-with-policy never push-source --new
+
+dgit-with-policy always push-source --new
+
+t-archive-process-incoming sid
+
+t-commit 'Now with binaries'
+
+t-dgit -wgf build
+
+t-expect-fail E:'uploading binaries.*source only' \
+dgit-with-policy always push --new
+
+t-commit 'Source-only not NEW'
+
+dgit-with-policy not-wholly-new push-source --new
+
+t-ok
diff --git a/tests/tests/trustingpolicy-replay b/tests/tests/trustingpolicy-replay
index ad731f5..2a1012b 100755
--- a/tests/tests/trustingpolicy-replay
+++ b/tests/tests/trustingpolicy-replay
@@ -4,6 +4,8 @@ set -e
t-tstunt-parsechangelog
+t-dependencies dput-ng
+
t-git-config dgit.default.dep14tag no
t-dsd
@@ -17,11 +19,12 @@ git tag start
t-dgit build
t-dgit push --new
+t-rm-dput-dropping
+
t-commit 'Prep v1.1 which will be rewound'
t-dgit build
t-dgit push
-t-rm-dput-dropping
git checkout $tagpfx/1.0
t-dgit build
t-dgit push --deliberately-fresh-repo