summaryrefslogtreecommitdiff
path: root/tests/tests/unrepresentable
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tests/unrepresentable')
-rwxr-xr-xtests/tests/unrepresentable137
1 files changed, 105 insertions, 32 deletions
diff --git a/tests/tests/unrepresentable b/tests/tests/unrepresentable
index e4b0da8..8f451aa 100755
--- a/tests/tests/unrepresentable
+++ b/tests/tests/unrepresentable
@@ -10,58 +10,131 @@ ln -s $troot/pkg-srcs/${p}_${v%-*}.orig.tar.* .
cd $p
-start () { git checkout quilt-tip-1.1~0; }
-attempt () { t-dgit -wgf --quilt=smash quilt-fixup; }
-good () {
- attempt
+make_singlepatch () {
+ git checkout quilt-tip-1.1
+ echo >debian/source/options single-debian-patch
+ git add debian/source/options
+ git commit -m single-debian-patch debian/source/options
+}
+
+quilt_mode=smash
+case $DGIT_TEST_TESTNAME in
+ *-single-dpkg) make_singlepatch ;;
+ *-single-git) quilt_mode=single ;;
+ *-*) fail 'unknown test name' ;;
+ *) ;;
+esac
+
+quilt-fixup () {
+ t-dgit -wgf --quilt=$quilt_mode quilt-fixup
+}
+build-source () {
t-dgit --quilt=nofix -wgf build-source
- t-dgit -wgf --dry-run push --new
+}
+run-push () {
+ t-dgit -wgf --dry-run push-built --new
+}
+badly-raw () {
+ wrongmsg=$1
+ t-expect-fail "$1" \
+ quilt-fixup
+}
+badly-late-raw () {
+ quilt-fixup
+ build-source
+ t-expect-fail "$1" \
+ run-push
+}
+good () {
+ quilt-fixup
+ build-source
+ run-push
}
-badly-1 () {
- wrongfn=$1
- wrongmsg=$2
- start
+start () {
+ path=$1
+ git checkout quilt-tip-1.1~0;
}
+finish () {
+ case "$DGIT_TEST_TESTNAME" in
+ *-single-dpkg) expected=${2-$1} ;;
+ *) expected=$1 ;;
+ esac
+
+ case "$expected" in
+ NOTHING) ;;
+ *) git commit -m "$expected" ;;
+ esac
-badly-2 () {
- git commit -m "Commit wrongness $wrongfn ($wrongmsg)"
- t-expect-fail E:"cannot represent change: $wrongmsg .*: $wrongfn" \
- attempt
+ case "$expected" in
+ GOOD:*|NOTHING)
+ good
+ ;;
+
+ EP:*)
+ wrongmsg="${expected#*:}"
+ badly-raw E:"cannot represent change: $wrongmsg .*: $path"
+ ;;
+
+ LATE-EP:*)
+ # quilt-fixup and dpkg-source succeeded, but dgit push failed.
+ # This is rather a poor outcome.
+ case "$DGIT_TEST_TESTNAME" in
+ *-single-dpkg) ;;
+ *) fail 'push failure, other than with single-debina-patch' ;;
+ esac
+
+ wrongmsg="${expected#*:}"
+ badly-late-raw "E:$wrongmsg.*: $path"
+ ;;
+
+ E:* | [^A-Z]*)
+ badly-raw "$expected"
+ ;;
+
+ *) fail 'bad pattern' ;;
+
+ esac
}
-badly-1 orig-symlink 'modified symlink'
+start orig-symlink
ln -sf NEWTARGET orig-symlink
git add orig-symlink
-badly-2
+finish EP:'modified symlink' 'new version is symlink'
-badly-1 orig-symlink 'deletion of symlink'
+start orig-symlink
git rm -f orig-symlink
-badly-2
+finish EP:'deletion of symlink' LATE-EP:'Mode change from 20000 to 000000'
+
+start new
+ ln -s hi new
+ git add new
+finish EP:'creation .* symlink' 'new version is symlink'
-start
+start src.c
git rm src.c
- git commit -m deleted
-good
+finish GOOD:deleted
-start
+start orig-exec
git rm orig-exec
+finish GOOD:'deleted exec'
+
+start orig-unwriteable
git rm -f orig-unwriteable
- git commit -m 'deleted funny'
-good
+finish GOOD:'deleted unwritable'
-badly-1 src.c 'mode or type changed'
+start src.c
chmod +x src.c
git add src.c
-badly-2
+finish GOOD:chmod LATE-EP:'Mode change from 644 to 755'
-badly-1 new 'creation with non-default mode'
- echo hi >new
- chmod 755 new
- git add new
-badly-2
+start newx
+ echo hi >newx
+ chmod 755 newx
+ git add newx
+finish GOOD:add-755 LATE-EP:'Mode change from 644 to 755'
-start
-good
+start nothing
+finish NOTHING NOTHING
t-ok