summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-08-24 16:21:12 +0200
committerJulian Andres Klode <jak@debian.org>2016-08-26 22:22:47 +0200
commit03ae49aca57b499f8ef497c2777b3eaef2516d1a (patch)
treee5e360821ddc4b2f76071e3d898aae9806cf7e37
parent71e22da91ff888cf645e5083fbac7839846111d2 (diff)
test: More portable check for dpkg versions
This check should work regardless if dpkg was installed by dpkg or by a native package manager like RPM or pkg. Gbp-Dch: ignore
-rw-r--r--test/integration/framework3
-rwxr-xr-xtest/integration/test-bug-661537-build-profiles-support2
-rwxr-xr-xtest/integration/test-bug-769609-triggers-still-pending-after-run2
-rwxr-xr-xtest/integration/test-no-fds-leaked-to-maintainer-scripts2
4 files changed, 6 insertions, 3 deletions
diff --git a/test/integration/framework b/test/integration/framework
index 677c40711..ec57a23c3 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -195,6 +195,9 @@ aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; }
dpkg() {
"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@"
}
+dpkg_version() {
+ command perl -MDpkg -E 'say $Dpkg::PROGVERSION'
+}
dpkgcheckbuilddeps() {
command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@"
}
diff --git a/test/integration/test-bug-661537-build-profiles-support b/test/integration/test-bug-661537-build-profiles-support
index 91115ea18..d24484de9 100755
--- a/test/integration/test-bug-661537-build-profiles-support
+++ b/test/integration/test-bug-661537-build-profiles-support
@@ -76,7 +76,7 @@ Building dependency tree...
}
msgtest 'Check if version of installed dpkg is high enough for' 'build profiles support'
-if dpkg --compare-versions "$(command dpkg-query --showformat='${Version}' --show dpkg)" 'ge' '1.17.14'; then
+if dpkg --compare-versions "$(dpkg_version)" 'ge' '1.17.14'; then
msgpass
testwithdpkg() {
msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'"
diff --git a/test/integration/test-bug-769609-triggers-still-pending-after-run b/test/integration/test-bug-769609-triggers-still-pending-after-run
index b44ebf74f..ce2c193dd 100755
--- a/test/integration/test-bug-769609-triggers-still-pending-after-run
+++ b/test/integration/test-bug-769609-triggers-still-pending-after-run
@@ -8,7 +8,7 @@ setupenvironment
configarchitecture 'amd64'
msgtest 'Check if installed dpkg supports' 'noawait trigger'
-if dpkg-checkbuilddeps -d 'dpkg (>= 1.16.1)' /dev/null; then
+if dpkg --compare-versions "$(dpkg_version)" 'ge' '1.16.1'; then
msgpass
else
msgskip 'dpkg version too old'
diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts
index ca93f78b4..7b5d6727e 100755
--- a/test/integration/test-no-fds-leaked-to-maintainer-scripts
+++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts
@@ -29,7 +29,7 @@ buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
rm -rf "$BUILDDIR"
PKGNAME='fdleaks:all'
-if ! dpkg-checkbuilddeps -d 'dpkg (>= 1.16.2)' /dev/null >/dev/null 2>&1; then
+if dpkg --compare-versions "$(dpkg_version)" 'lt' '1.16.2'; then
PKGNAME='fdleaks'
fi