diff options
Diffstat (limited to 'tests/tests')
-rwxr-xr-x | tests/tests/dpkgsourceignores-correct | 53 | ||||
-rwxr-xr-x | tests/tests/dpkgsourceignores-docs | 54 | ||||
-rwxr-xr-x | tests/tests/gitworktree | 29 | ||||
-rwxr-xr-x | tests/tests/sbuild-gitish | 47 |
4 files changed, 183 insertions, 0 deletions
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 |