summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2020-11-25 18:02:03 +0000
committerJulian Andres Klode <jak@debian.org>2020-11-25 18:02:03 +0000
commit6530ce64d2337ab309d6c974202243abb09d2d04 (patch)
tree20e5a01e2c7c206ccf8d4d7f72f6416b4118218d /test/integration
parent1077af2e635df738f351d5ea3515804a4de367ea (diff)
parente5bb443cf58cec23503ad0deeeb06a080053da8a (diff)
Merge branch 'feature/rred' into 'master'
Enhance rred for possible external usage See merge request apt-team/apt!136
Diffstat (limited to 'test/integration')
-rwxr-xr-xtest/integration/test-00-commands-have-help6
-rwxr-xr-xtest/integration/test-method-rred51
2 files changed, 56 insertions, 1 deletions
diff --git a/test/integration/test-00-commands-have-help b/test/integration/test-00-commands-have-help
index 4a0cc64d4..f91238d5d 100755
--- a/test/integration/test-00-commands-have-help
+++ b/test/integration/test-00-commands-have-help
@@ -49,7 +49,11 @@ for CMD in 'apt-cache' 'apt-cdrom' 'apt-config' \
checkoptions "$cmd"
done
-for CMD in 'apt-dump-solver' 'apt-internal-solver' 'apt-internal-planner'; do
+
+rred() {
+ runapt "${METHODSDIR}/rred" "$@"
+}
+for CMD in 'apt-dump-solver' 'apt-internal-solver' 'apt-internal-planner' 'rred'; do
checkoptions "$(echo "$CMD" | tr -d '-')"
done
diff --git a/test/integration/test-method-rred b/test/integration/test-method-rred
index 5a885e9d2..fcadac146 100755
--- a/test/integration/test-method-rred
+++ b/test/integration/test-method-rred
@@ -195,3 +195,54 @@ Package: supercoolstuff
failrred 'Wrong order of commands' '7d
17d'
failrred 'End before start' '7,6d'
+
+# deal correctly with patch merging
+mergepatches() {
+ local CONTENT="$1"
+ shift
+ testsuccess runapt "${METHODSDIR}/rred" Packages.ed-* "$@"
+ cp -a rootdir/tmp/testsuccess.output patch.ed
+ if [ "$#" = '0' ]; then
+ testfileequal 'patch.ed' "$CONTENT"
+ fi
+}
+createpatch() {
+ echo "$2"
+}
+
+createpatch 'Change dog to cat + kitties' '19c
+ And a cat!
+
+Package: extra-kittens
+Version: unavailable
+Description: fix later
+.' > Packages.ed-0
+createpatch 'Remove more stuff and fix later' '23d,
+6d' > Packages.ed-1
+testsuccess apthelper cat-file --compress gzip Packages.ed-1
+mv rootdir/tmp/testsuccess.output Packages.ed-1.gz
+testsuccess rm Packages.ed-1
+createpatch 'Remove (old) dog paragraph' '10,19d' > Packages.ed-2
+mergepatches '11,19c
+Package: extra-kittens
+Version: unavailable
+.
+6d' -C 'gzip'
+mv patch.ed patch.ed.gz
+mergepatches '11,19c
+Package: extra-kittens
+Version: unavailable
+.
+6d'
+testfileequal patch.ed "$(apt-helper cat-file patch.ed.gz)"
+testrred 'Apply' 'merged patch' "$(cat patch.ed)" 'Package: coolstuff
+Version: 0.8.15
+Description: collection of stuff
+ A lot, too much to iterate all, but at least this:
+ - stuff
+ - even more stuff
+ .
+ And a cow.
+
+Package: extra-kittens
+Version: unavailable'