diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile | 2 | ||||
-rw-r--r-- | tests/lib-gdr | 3 | ||||
-rwxr-xr-x | tests/setup/gdr-convert-gbp | 8 | ||||
-rwxr-xr-x | tests/tests/gdr-diverge-nmu | 1 | ||||
-rwxr-xr-x | tests/tests/gdr-edits | 1 | ||||
-rwxr-xr-x | tests/tests/gdr-import-dgit | 1 | ||||
-rwxr-xr-x | tests/tests/gdr-import-dgitview | 45 | ||||
-rwxr-xr-x | tests/tests/gdr-makepatches7 | 1 | ||||
-rwxr-xr-x | tests/tests/gdr-newupstream | 1 | ||||
-rwxr-xr-x | tests/tests/gdr-subcommands | 12 | ||||
-rwxr-xr-x | tests/tests/gdr-unprocessable | 61 | ||||
-rwxr-xr-x | tests/tests/gdr-viagit | 15 |
12 files changed, 146 insertions, 5 deletions
diff --git a/tests/Makefile b/tests/Makefile index 8494284..88bc0a0 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -9,7 +9,7 @@ TESTNAMES := $(notdir $(TESTSCRIPTS)) all: $(foreach t,$(TESTNAMES),tests/tmp/$t.ok) @echo "ALL PASSED$${DGIT_TESTS_PROGRESSIVE+ AT SOME POINT}" -tests/tmp/%.ok: +tests/tmp/%.ok: tests/tests/% ifeq ($(DGIT_TEST_RETRY_COUNT),) tests/tests/$* >tests/tmp/$*.log 2>&1 else diff --git a/tests/lib-gdr b/tests/lib-gdr index 95d2330..479ef41 100644 --- a/tests/lib-gdr +++ b/tests/lib-gdr @@ -7,7 +7,8 @@ t-git-debrebase () { local gdr=${DGIT_GITDEBREBASE_TEST-git-debrebase} : ' {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{' - $gdr $GDR_TEST_OPTS $GDR_TEST_DEBUG $t_gdr_xopts "$@" + $gdr "--dgit=${DGIT_TEST-dgit}" $GDR_TEST_OPTS \ + $GDR_TEST_DEBUG $t_gdr_xopts "$@" : '}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} ' } diff --git a/tests/setup/gdr-convert-gbp b/tests/setup/gdr-convert-gbp index 6ec374d..a3baf2d 100755 --- a/tests/setup/gdr-convert-gbp +++ b/tests/setup/gdr-convert-gbp @@ -11,6 +11,7 @@ t-dependencies GDR t-tstunt-parsechangelog not-gdr-processable () { + git branch gdr-unprocessable/$1 t-git-debrebase analyse | grep 'Unknown Unprocessable' } @@ -37,7 +38,7 @@ gbp pq export git add debian/patches git commit -m "patch queue update ($0)" -not-gdr-processable +not-gdr-processable origin : 'fake up an upstream 2.0' git branch make-upstream upstream @@ -61,7 +62,7 @@ done git checkout master gbp import-orig --upstream-version=2.0 ../$ust -not-gdr-processable +not-gdr-processable merge t-dch-commit -v 2.0-1 -m 'new upstream (did gbp import-orig)' t-dch-commit-r @@ -80,6 +81,9 @@ git push --set-upstream origin master # debian/2.0-1 archive/debian/2.0-1 # remotes/origin/master remotes/dgit/dgit/sid +t-expect-fail E:'identical in upstream files' \ +t-git-debrebase -fupstream-has-debian convert-from-gbp upstream/2.0~ + t-git-debrebase -fupstream-has-debian convert-from-gbp v=2.0-2 diff --git a/tests/tests/gdr-diverge-nmu b/tests/tests/gdr-diverge-nmu index 15bf901..82aeaa5 100755 --- a/tests/tests/gdr-diverge-nmu +++ b/tests/tests/gdr-diverge-nmu @@ -4,6 +4,7 @@ set -e t-dependencies GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp cd $p diff --git a/tests/tests/gdr-edits b/tests/tests/gdr-edits index 52c083b..124de29 100755 --- a/tests/tests/gdr-edits +++ b/tests/tests/gdr-edits @@ -4,6 +4,7 @@ set -e t-dependencies GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp cd $p diff --git a/tests/tests/gdr-import-dgit b/tests/tests/gdr-import-dgit index c18c097..e58ff32 100755 --- a/tests/tests/gdr-import-dgit +++ b/tests/tests/gdr-import-dgit @@ -4,6 +4,7 @@ set -e t-dependencies GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp cd $p diff --git a/tests/tests/gdr-import-dgitview b/tests/tests/gdr-import-dgitview new file mode 100755 index 0000000..3670deb --- /dev/null +++ b/tests/tests/gdr-import-dgitview @@ -0,0 +1,45 @@ +#!/bin/bash +set -e +. tests/lib +. $troot/lib-gdr + +t-dependencies GDR + +t-tstunt-parsechangelog + +t-archive example 1.0-1 +t-git-none + +t-dgit clone $p + +cd $p + +t-git-debrebase status + +t-expect-fail E:'bare dgit dsc import' \ +t-git-debrebase + +LC_MESSAGES=C t-git-debrebase status |tee ../bare-output +grep 'bare dgit dsc import with no prior history' ../bare-output + +git branch before + +t-expect-fail E:'Could not find or construct a suitable upstream commit' \ +t-git-debrebase convert-from-dgit-view --no-origs + +t-git-debrebase convert-from-dgit-view +t-gdr-good laundered + +t-expect-fail E:'already seems to be in git-debrebase format' \ +t-git-debrebase convert-from-dgit-view + +t-refs-same-start +t-ref-head +t-git-debrebase --noop-ok convert-from-dgit-view +t-ref-head + +t-git-debrebase convert-from-dgit-view --always-convert-anyway +t-expect-fail E:'ref varies' t-ref-head +t-gdr-good laundered + +t-ok diff --git a/tests/tests/gdr-makepatches7 b/tests/tests/gdr-makepatches7 index 02ea7ab..52462d4 100755 --- a/tests/tests/gdr-makepatches7 +++ b/tests/tests/gdr-makepatches7 @@ -4,6 +4,7 @@ set -e t-dependencies GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp cd $p diff --git a/tests/tests/gdr-newupstream b/tests/tests/gdr-newupstream index 39ed24b..ada5516 100755 --- a/tests/tests/gdr-newupstream +++ b/tests/tests/gdr-newupstream @@ -5,6 +5,7 @@ autoimport= t-dependencies NO-DGIT GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp-noarchive cd $p diff --git a/tests/tests/gdr-subcommands b/tests/tests/gdr-subcommands index e59fc07..b4d8f44 100755 --- a/tests/tests/gdr-subcommands +++ b/tests/tests/gdr-subcommands @@ -4,6 +4,7 @@ set -e t-dependencies GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp cd $p @@ -34,10 +35,12 @@ mix-it git checkout -b unstitched-laundered master mix-it +git branch before-unstitch/unstitched-laundered t-git-debrebase t-gdr-good laundered git checkout -b unstitched-mixed master +git branch before-unstitch/unstitched-mixed t-git-debrebase mix-it @@ -172,6 +175,12 @@ make_check () { f*) t-has-ancestor HEAD refs/heads/$before ;; + Z*) + t-refs-same-start + t-refs-same refs/heads/$work + t-refs-same refs/heads/before-unstitch/$startbranch + t-ref-head + ;; *) fail "$1" ;; @@ -194,8 +203,8 @@ subcmd stitch Ns Nu Sltf Stf subcmd prepush Ns Nu Sltf Stf subcmd quick ns Sl Sltf Sl subcmd conclude "$Ec" "$Ec" Sltf Sl +subcmd scrap Ns Ns Z Z subcmd make-patches sPft "$Ep" uPft "$Ep" -#subcmd dgit-upload-hook Psft "$Ep" SPft "$Ep" # # result codes, each one is a check: # E:$pat } this is an error (must come first) @@ -214,6 +223,7 @@ subcmd make-patches sPft "$Ep" uPft "$Ep" # V ffq-prev remains unchanged; implies also u # s result is stitched, debrebase-last exists and is unchanged # S result is stitch just made, remaining letters apply to result~ +# Z result is rewind to before changes made # # P result is add-patches, remaining letters apply to result~ # diff --git a/tests/tests/gdr-unprocessable b/tests/tests/gdr-unprocessable new file mode 100755 index 0000000..14d1e8e --- /dev/null +++ b/tests/tests/gdr-unprocessable @@ -0,0 +1,61 @@ +#!/bin/bash +set -e +. tests/lib + +t-dependencies GDR + +t-tstunt-parsechangelog +t-setup-import gdr-convert-gbp + +cd $p + +t-dgit setup-mergechangelogs + +subcmd () { + cmd=("$@") + + branch merge 'complex merge' + branch origin 'origin commit' +} + +branch () { + branch=$1 + git checkout gdr-unprocessable/$branch + msgcore=$2 + expected-$expected +} + +cmd () { + t-git-debrebase "${cmd[@]}" +} + +expected- () { + t-expect-fail E:"$(printf "$mfmt" "$msgcore")" \ + cmd +} + +expected-ok () { + f=../out.$branch."${cmd/[^-a-zA-Z//_}" + cmd | tee $f + for mfmt in "${mfmts[@]}"; do + grep "$(printf "$mfmt" "$msgcore")" $f + done +} + +mfmt='found unprocessable commit.*%s' +subcmd +subcmd quick +subcmd new-upstream 2.0 upstream/2.0 +subcmd make-patches +subcmd breakwater +subcmd anchor + +expected=ok +mfmts=(' Unprocessable (%s)') +subcmd analyse + +mfmts=('branch not in git-debrebase form' + 'found unprocessable commit, cannot cope: %s') +subcmd status + +t-ok diff --git a/tests/tests/gdr-viagit b/tests/tests/gdr-viagit index a83e622..0495eb1 100755 --- a/tests/tests/gdr-viagit +++ b/tests/tests/gdr-viagit @@ -5,6 +5,7 @@ autoimport= t-dependencies NO-DGIT GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp-noarchive : 'set up so t-git-debrebase runs gdr via git' @@ -38,4 +39,18 @@ t-gdr-good laundered t-git-debrebase stitch --prose=wombat t-gdr-good stitched +: ----- test scrap ----- + +t-refs-same-start +t-ref-head + +t-git-debrebase +t-gdr-good laundered + +t-some-changes +t-git-debrebase scrap +t-gdr-good stitched + +t-ref-head + t-ok |