summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2022-09-03 16:14:51 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2022-09-03 17:45:52 +0100
commit46400709f1dbcb4ca5ba9c7787c099a36e0bbeeb (patch)
tree0f1d9c73bb47b0633f14634bcada02ef5e5346e6
parentd0e9a6a62239582302d4571393ebe18c3e4015e4 (diff)
tests: unrepresentable: Prep for richer bahviours
We are going to want to run these tests in different modes, and the results might vary between mode. So encode the expected results in the *arguments* to the sub-test finish subroutine (which we rename). The filenames go on the sub-test start subroutine. finish is going to gain features. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-xtests/tests/unrepresentable118
1 files changed, 87 insertions, 31 deletions
diff --git a/tests/tests/unrepresentable b/tests/tests/unrepresentable
index fb1cf61..fba0014 100755
--- a/tests/tests/unrepresentable
+++ b/tests/tests/unrepresentable
@@ -10,60 +10,116 @@ 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
+quilt_mode=smash
+
+quilt-fixup () {
+ t-dgit -wgf --quilt=$quilt_mode quilt-fixup
+}
+build-source () {
t-dgit --quilt=nofix -wgf build-source
+}
+run-push () {
t-dgit -wgf --dry-run push --new
}
-
-badly-1 () {
- wrongfn=$1
- wrongmsg=$2
- start
+badly-raw () {
+ wrongmsg=$1
+ t-expect-fail "$1" \
+ quilt-fixup
}
-
-badly-2-raw () {
- git commit -m "Commit wrongness $wrongfn ($wrongmsg)"
+badly-build-raw () {
+ quilt-fixup
+ t-expect-fail "$1" \
+ build-source
+}
+badly-late-raw () {
+ quilt-fixup
+ build-source
t-expect-fail "$1" \
- attempt
+ run-push
+}
+good () {
+ quilt-fixup
+ build-source
+ run-push
}
-badly-2 () {
- badly-2-raw E:"cannot represent change: $wrongmsg .*: $wrongfn"
+
+start () {
+ path=$1
+ git checkout quilt-tip-1.1~0;
}
+finish () {
+ expected=$1
+
+ case "$expected" in
+ NOTHING) ;;
+ *) git commit -m "$expected" ;;
+ esac
+
+ case "$expected" in
+ GOOD:*|NOTHING)
+ good
+ ;;
+
+ EP:*)
+ wrongmsg="${expected#*:}"
+ badly-raw E:"cannot represent change: $wrongmsg .*: $path"
+ ;;
+
+ BUILD:*)
+ # quilt-fixup succeeded, but dpkg-source failed.
+ # This is rather a poor outcome.
+ wrongmsg="${expected#*:}"
+ badly-build-raw "E:$wrongmsg"
+ ;;
+
+ LATE-EP:*)
+ # quilt-fixup and dpkg-source succeeded, but dgit push failed.
+ # This is rather a poor outcome.
+ wrongmsg="${expected#*:}"
+ badly-late-raw "E:$wrongmsg.*: $path"
+ ;;
-badly-1 orig-symlink 'modified symlink'
+ E:* | [^A-Z]*)
+ badly-raw "$expected"
+ ;;
+
+ *) fail 'bad pattern' ;;
+
+ esac
+}
+
+start orig-symlink
ln -sf NEWTARGET orig-symlink
git add orig-symlink
-badly-2
+finish EP:'modified symlink'
-badly-1 orig-symlink 'deletion of symlink'
+start orig-symlink
git rm -f orig-symlink
-badly-2
+finish EP:'deletion of symlink'
-badly-1
+start new
ln -s hi new
git add new
-badly-2-raw 'new version is symlink'
+finish '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 'EP:mode or type changed'
-start
-good
+start nothing
+finish NOTHING
t-ok