summaryrefslogtreecommitdiff
path: root/tests/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tests')
-rwxr-xr-xtests/tests/gbp-orig75
-rwxr-xr-xtests/tests/import-dsc99
-rwxr-xr-xtests/tests/inarchivecopy34
-rwxr-xr-xtests/tests/orig-include-exclude25
-rwxr-xr-xtests/tests/orig-include-exclude-chkquery33
-rwxr-xr-xtests/tests/overwrite-splitbrains6
-rwxr-xr-xtests/tests/quilt-gbp9
-rwxr-xr-xtests/tests/quilt-splitbrains10
8 files changed, 274 insertions, 17 deletions
diff --git a/tests/tests/gbp-orig b/tests/tests/gbp-orig
new file mode 100755
index 0000000..ffc145f
--- /dev/null
+++ b/tests/tests/gbp-orig
@@ -0,0 +1,75 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+t-tstunt-parsechangelog
+
+t-archive-none example
+t-git-none
+t-worktree 1.0
+
+cd $p
+
+: '----- construct an unpatched branch with patches -----'
+
+git checkout patch-queue/quilt-tip
+gbp pq export
+: 'now on quilt-tip'
+git add debian/patches
+git commit -m 'Commit patch queue'
+
+: '----- construct an upstream branch -----'
+
+git checkout --orphan upstream
+git reset --hard
+git clean -xdf
+
+tar --strip-components=1 -xf $troot/pkg-srcs/${p}_1.0.orig.tar.gz
+
+mkdir docs
+cd docs
+tar --strip-components=1 -xf $troot/pkg-srcs/${p}_1.0.orig-docs.tar.gz
+cd ..
+
+git add -Af .
+git commit -m 'Import 1.0'
+git tag upstream/1.0
+
+git checkout quilt-tip
+t-git-pseudo-merge upstream
+
+v=1.0-1
+
+: '----- let gbp build a .orig for comparison -----'
+
+gbp buildpackage --git-ignore-branch --git-no-sign-tags -us -uc
+
+mkdir ../gbp-output
+mv ../*1.0* ../gbp-output/.
+rm -f ../*.changes
+
+: '----- now do it ourselves -----'
+
+t-dgit -wgf --dgit-view-save=split.b gbp-build --git-ignore-branch
+
+t-dgit -wgf --quilt=gbp clean # gbp leaves dirty trees :-/
+
+t-dgit -wgf --dgit-view-save=split.p --quilt=gbp push --new
+
+t-gbp-pushed-good
+
+: '----- check .origs are the same -----'
+
+# if gbp weren't weird about .gitignore we could just debdiff the .dscs
+
+for d in . gbp-output; do
+ cd $tmp/$d
+ mkdir tar-x
+ cd tar-x
+ tar zxf ../${p}_${v%-*}.orig.tar.gz
+done
+
+cd $tmp
+diff -ruN gbp-output/tar-x tar-x
+
+echo done.
diff --git a/tests/tests/import-dsc b/tests/tests/import-dsc
new file mode 100755
index 0000000..9d3d9b7
--- /dev/null
+++ b/tests/tests/import-dsc
@@ -0,0 +1,99 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+t-setup-import examplegit
+
+p=example
+
+check-import () {
+ path=$1
+ v=$2
+ opts=$3
+ branch=t.$v
+
+ dsc=${path}/${p}_${v}.dsc
+ t-dgit $opts import-dsc $dsc $branch
+
+ git checkout $branch
+
+ check-imported $dsc
+}
+
+check-imported () {
+ local dsc=$1
+ (
+ rm -rf ../t.unpack
+ mkdir ../t.unpack
+ cd ../t.unpack
+ dpkg-source -x $dsc
+ )
+
+ git checkout HEAD~0
+ git branch -D u.$v ||:
+ git checkout -b u.$v $branch
+ git rm -rf .
+ git clean -xdf
+ cp -al ../t.unpack/*/. .
+ git add -Af .
+
+ git diff --stat --exit-code
+}
+
+cd $p
+
+check-import ../mirror/pool/main 1.2
+
+dgit12=`git rev-parse HEAD`
+
+dsc2=../mirror/pool/main/${p}_2.0.dsc
+
+git checkout $branch
+t-expect-fail 'is checked out - will not update' \
+t-dgit import-dsc $dsc2 $branch
+
+git checkout HEAD~0
+
+t-expect-fail 'Not fast forward' \
+t-dgit import-dsc $dsc2 $branch
+
+t-expect-fail 'Not fast forward' \
+t-dgit import-dsc $dsc2 ..$branch
+
+t-dgit import-dsc $dsc2 +$branch
+check-imported $dsc2
+
+cd ..
+mkdir $p.2
+cd $p.2
+
+git init
+
+check-import ../../../pkg-srcs 1.0-1
+
+t-expect-fail "Your git tree does not have that object" \
+check-import ../mirror/pool/main 1.2
+
+check-import ../mirror/pool/main 1.2 --force-import-dsc-with-dgit-field
+
+v=1.0-1.100
+dsc2=../../../pkg-srcs/${p}_${v}.dsc
+
+t-expect-fail E:'Branch.*already exists' \
+t-dgit import-dsc $dsc2 $branch
+
+git branch merge-reset
+t-dgit import-dsc $dsc2 ..$branch
+t-has-ancestor merge-reset $branch
+
+git push . +merge-reset:$branch
+
+t-dgit import-dsc $dsc2 +$branch
+
+mb=$(t-git-merge-base merge-reset $branch)
+test "x$mb" = x
+
+t-expect-fail 'signature check failed' \
+t-dgit import-dsc --require-valid-signature $dsc2 +$branch
+
+echo ok.
diff --git a/tests/tests/inarchivecopy b/tests/tests/inarchivecopy
index e87baaf..632d420 100755
--- a/tests/tests/inarchivecopy
+++ b/tests/tests/inarchivecopy
@@ -14,34 +14,34 @@ t-inarchive-copy () {
local from=${2:-sid}
local to=${3:-stable}
egrep "^${vm//./\\.}" aq/package.$from.$p >>aq/package.$to.$p
- t-archive-updated stable $p
+ t-archive-updated $to $p
}
copy-check-good () {
git diff $vtag
- t-refs-same refs/remotes/dgit/dgit/stable
+ t-refs-same refs/remotes/dgit/dgit/$tosuite
t-ref-head
+ t-has-parent-or-is HEAD $vtag
}
copy-check () {
local vm=$1
- t-inarchive-copy $vm
+ local tosuite=${2:-stable}
+ t-inarchive-copy $vm '' $tosuite
vtag=$(v=$vm t-v-tag)
cd $p
t-refs-same-start
- t-ref-same $vtag^1
-
- t-dgit fetch stable
- git merge --ff-only dgit/dgit/stable
+ t-dgit fetch $tosuite
+ git merge --ff-only dgit/dgit/$tosuite
copy-check-good
local fetched=$(t-sametree-parent HEAD)
cd ..
rm -rf example.cloned
- t-dgit clone $p stable example.cloned
+ t-dgit clone $p $tosuite example.cloned
cd example.cloned
t-refs-same-start
@@ -49,13 +49,31 @@ copy-check () {
local cloned=$(t-sametree-parent HEAD)
cd ..
+ rm -rf example.initd
+ mkdir example.initd
+ cd example.initd
+ git init
+ t-refs-same-start
+ t-dgit -p $p fetch $tosuite
+ git reset --hard refs/remotes/dgit/dgit/$tosuite
+ copy-check-good
+ local initd=$(t-sametree-parent HEAD)
+ cd ..
+
t-refs-same-start
t-ref-same-val fetched $fetched
t-ref-same-val cloned $cloned
+ t-ref-same-val initd $initd
}
copy-check 2.0
copy-check 2.1
+cd $p
+git checkout -b dgit/testing $(v=1.1 t-v-tag)
+cd ..
+
+copy-check 2.1 testing
+
echo ok.
diff --git a/tests/tests/orig-include-exclude b/tests/tests/orig-include-exclude
new file mode 100755
index 0000000..96bf4f2
--- /dev/null
+++ b/tests/tests/orig-include-exclude
@@ -0,0 +1,25 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+suitespecs+=' stable'
+
+. $troot/lib-orig-include-exclude
+
+ofb=example_1.1.orig.tar
+zcat $ofb.gz >$ofb.SPONG
+gzip -1Nv $ofb.SPONG
+mv $ofb.SPONG.gz $ofb.gz
+
+#suite=stable
+#t-archive-none $p
+#t-archive-updated stable $p
+
+cd $p
+
+test-push-1 1.1-1.3 '' stable
+
+t-expect-fail E:'archive contains .* with different checksum' \
+test-push-2 --new
+
+echo done.
diff --git a/tests/tests/orig-include-exclude-chkquery b/tests/tests/orig-include-exclude-chkquery
new file mode 100755
index 0000000..59fc80f
--- /dev/null
+++ b/tests/tests/orig-include-exclude-chkquery
@@ -0,0 +1,33 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+t-git-config dgit-distro.test-dummy.archive-query ftpmasterapi:
+# ^ that will crash if it gets unexpected file_in_archive queries
+
+# orig-include-exclude will set origs and usvsns
+update-files_in_archive () {
+ for o in $origs; do for usvsn in $usvsns; do \
+ of=${p}_${v%-*}.${o}.tar.gz
+ pat="%/${of//_/\\_}"
+ # curl url-decodes these things so we have to have literals
+ find $tmp/mirror -name $of | \
+ xargs -r sha256sum | \
+ perl -pe '
+ BEGIN { print "["; }
+ chomp;
+ s/^/{"sha256sum":"/;
+ s/ /","filename":"/;
+ s/$/"}$delim/;
+ $delim=",";
+ END { print "]\n"; }
+ ' \
+ >$tmp/aq/"file_in_archive/$pat"
+ done; done
+}
+
+test_push_2_hook=update-files_in_archive
+
+. $troot/lib-orig-include-exclude
+
+echo done.
diff --git a/tests/tests/overwrite-splitbrains b/tests/tests/overwrite-splitbrains
index c0c7470..725357d 100755
--- a/tests/tests/overwrite-splitbrains
+++ b/tests/tests/overwrite-splitbrains
@@ -7,7 +7,7 @@ t-tstunt-parsechangelog
t-gbp-example-prep-no-ff
t-newtag
-t-dgit --quilt=gbp build-source
+t-dgit --quilt=gbp --dgit-view-save=split.b build-source
t-dgit fetch
@@ -15,12 +15,12 @@ t-refs-same-start
t-ref-head
t-expect-fail 'check failed (maybe --overwrite is needed' \
-t-dgit --quilt=gbp push
+t-dgit --quilt=gbp --dgit-view-save=split.p push
t-refs-same-start
t-ref-head
-t-dgit --quilt=gbp --overwrite push
+t-dgit --quilt=gbp --dgit-view-save=split.p --overwrite push
t-gbp-pushed-good
diff --git a/tests/tests/quilt-gbp b/tests/tests/quilt-gbp
index 21e396b..38d2489 100755
--- a/tests/tests/quilt-gbp
+++ b/tests/tests/quilt-gbp
@@ -14,7 +14,8 @@ t-expect-fail 'requires split view so server needs to support' \
t-dgit -wgf --quilt=gbp build-source
t-newtag
-t-dgit --quilt=gbp build-source
+t-dgit --quilt=gbp --dgit-view-save=split.b1 build-source
+git rev-parse split.b1
t-dgit --quilt=gbp --gbp-pq=no-such-command-gbp build-source
@@ -31,14 +32,14 @@ test-push-1 () {
}
test-push-2 () {
- t-dgit --quilt=gbp push
+ t-dgit --quilt=gbp --dgit-view-save=split.p push
t-gbp-pushed-good
}
test-push-1
-t-dgit --quilt=gbp --clean=git build-source
+t-dgit --quilt=gbp --clean=git --dgit-view-save=split.b build-source
t-expect-fail "HEAD specifies a different tree to $p" \
t-dgit push
@@ -53,7 +54,7 @@ t-commit 'Check pseudomerge' 1.0-3
test-push-1
-t-dgit --quilt=gbp --clean=git build-source
+t-dgit --quilt=gbp --clean=git --dgit-view-save=split.b build-source
test-push-2
diff --git a/tests/tests/quilt-splitbrains b/tests/tests/quilt-splitbrains
index 1e853f3..112bc39 100755
--- a/tests/tests/quilt-splitbrains
+++ b/tests/tests/quilt-splitbrains
@@ -2,6 +2,8 @@
set -e
. tests/lib
+suitespecs+=' stable'
+
# This test script tests each of the split brain quilt modes, and
# --quilt=linear, with a tree suitable for each of those, and pushes
# them in sequence. The idea is to check that each tree is rejected
@@ -24,9 +26,9 @@ want-success () {
t-refs-same-start
t-ref-head
- t-dgit "$@" --quilt=$qmode build-source
+ t-dgit "$@" --quilt=$qmode --dgit-view-save=split.b build-source
- t-dgit "$@" --quilt=$qmode push
+ t-dgit "$@" --quilt=$qmode --dgit-view-save=split.p push
t-$qmode-pushed-good
}
@@ -130,5 +132,9 @@ t-dgit -wgf build-source
want-success dpm
+suite=stable
+t-commit dpmish-stable 1.0-6 $suite
+
+want-success dpm --new
echo ok.