summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2020-11-07 21:23:57 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2020-11-07 21:48:21 +0100
commit9e1398b164f55238990907f63dfdef60588d9b24 (patch)
tree1d0976f1eea0c74711a60ed069c0232fbb55f284 /test
parent645ad0c97334265bbfef82a4bdfdc8337cdd0630 (diff)
Prepare rred binary for external usage
Merging patches is a bit of non-trivial code we have for client-side work, but as we support also server-side merging we can export this functionality so that server software can reuse it. Note that this just cleans up and makes rred behave a bit more like all our other binaries by supporting setting configuration at runtime and supporting --help and --version. If you can make due without this, the now advertised functionality is provided already in earlier versions.
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-00-commands-have-help6
-rwxr-xr-xtest/integration/test-method-rred37
2 files changed, 42 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..00b4b7c0b 100755
--- a/test/integration/test-method-rred
+++ b/test/integration/test-method-rred
@@ -195,3 +195,40 @@ Package: supercoolstuff
failrred 'Wrong order of commands' '7d
17d'
failrred 'End before start' '7,6d'
+
+# deal correctly with patch merging
+mergepatches() {
+ testsuccess runapt "${METHODSDIR}/rred" Packages.ed-*
+ cp -a rootdir/tmp/testsuccess.output patch.ed
+ testfileequal 'patch.ed' "$1"
+}
+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
+createpatch 'Remove (old) dog paragraph' '10,19d' > Packages.ed-2
+mergepatches '11,19c
+Package: extra-kittens
+Version: unavailable
+.
+6d'
+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'