summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/framework27
-rwxr-xr-xtest/integration/run-tests3
-rwxr-xr-xtest/integration/test-apt-cli-list18
-rwxr-xr-xtest/integration/test-apt-cli-search7
-rwxr-xr-xtest/integration/test-failing-maintainer-scripts2
-rwxr-xr-xtest/integration/test-ubuntu-bug-1304403-obsolete-priority-standard48
-rwxr-xr-xtest/integration/test-ubuntu-bug-365611-long-package-names6
7 files changed, 106 insertions, 5 deletions
diff --git a/test/integration/framework b/test/integration/framework
index fae21eac4..eda3cebad 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -193,7 +193,13 @@ setupenvironment() {
touch var/lib/dpkg/available
mkdir -p usr/lib/apt
ln -s ${METHODSDIR} usr/lib/apt/methods
- ln -s ${BUILDDIRECTORY}/../../debian/apt.conf.autoremove etc/apt/apt.conf.d/01autoremove
+ # use the autoremove from the BUILDDIRECTORY if its there, otherwise
+ # system
+ if [ -e ${BUILDDIRECTORY}/../../debian/apt.conf.autoremove ]; then
+ ln -s ${BUILDDIRECTORY}/../../debian/apt.conf.autoremove etc/apt/apt.conf.d/01autoremove
+ else
+ ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove
+ fi
cd ..
local PACKAGESFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/')
if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then
@@ -882,6 +888,20 @@ rewritesourceslist() {
done
}
+# wait for up to 10s for a pid file to appear to avoid possible race
+# when a helper is started and dosn't write the PID quick enough
+waitforpidfile() {
+ local PIDFILE="$1"
+ for i in $(seq 10); do
+ if test -s "$PIDFILE"; then
+ return 0
+ fi
+ sleep 1
+ done
+ msgdie "waiting for $PIDFILE failed"
+ return 1
+}
+
changetowebserver() {
if [ "$1" != '--no-rewrite' ]; then
rewritesourceslist 'http://localhost:8080/'
@@ -895,6 +915,7 @@ changetowebserver() {
cat $LOG
false
fi
+ waitforpidfile aptwebserver.pid
local PID="$(cat aptwebserver.pid)"
if [ -z "$PID" ]; then
msgdie 'Could not fork aptwebserver successfully'
@@ -922,7 +943,11 @@ accept = 4433
connect = 8080
" > ${TMPWORKINGDIRECTORY}/stunnel.conf
stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf"
+ waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid"
local PID="$(cat ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid)"
+ if [ -z "$PID" ]; then
+ msgdie 'Could not fork stunnel4 successfully'
+ fi
addtrap 'prefix' "kill ${PID};"
rewritesourceslist 'https://localhost:4433/'
}
diff --git a/test/integration/run-tests b/test/integration/run-tests
index 79d5d1a29..d700cc3fc 100755
--- a/test/integration/run-tests
+++ b/test/integration/run-tests
@@ -36,11 +36,12 @@ else
CRESET=''
fi
+TOTAL="$(run-parts --list $DIR | grep '/test-' | wc -l)"
for testcase in $(run-parts --list $DIR | grep '/test-'); do
if [ "$MSGLEVEL" -le 2 ]; then
echo -n "${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: "
else
- echo "${CTEST}Run Testcase ${CHIGH}$(basename ${testcase})${CRESET}"
+ echo "${CTEST}Run Testcase ($(($ALL+1))/${TOTAL}) ${CHIGH}$(basename ${testcase})${CRESET}"
fi
if ! ${testcase}; then
FAIL=$((FAIL+1))
diff --git a/test/integration/test-apt-cli-list b/test/integration/test-apt-cli-list
index 47cfb624a..40bf81a39 100755
--- a/test/integration/test-apt-cli-list
+++ b/test/integration/test-apt-cli-list
@@ -19,12 +19,17 @@ insertinstalledpackage 'bar' 'i386' '1.0'
insertinstalledpackage 'foobar' 'i386' '1.0'
insertpackage 'unstable' 'foobar' 'i386' '2.0'
+insertinstalledpackage 'baz' 'all' '0.1'
+insertpackage 'testing' 'baz' 'all' '1.0'
+insertpackage 'unstable' 'baz' 'all' '2.0'
+
setupaptarchive
APTARCHIVE=$(readlink -f ./aptarchive)
testequal "Listing...
bar/now 1.0 i386 [installed,local]
+baz/unstable 2.0 all [upgradable from: 0.1]
foo/unstable 1.0 all
foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list
@@ -33,12 +38,14 @@ foo/unstable 1.0 all
foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list "foo*"
testequal "Listing...
+baz/unstable 2.0 all [upgradable from: 0.1]
foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list --upgradable
# FIXME: hm, hm - does it make sense to have this different? shouldn't
# we use "installed,upgradable" consitently?
testequal "Listing...
bar/now 1.0 i386 [installed,local]
+baz/now 0.1 all [installed,upgradable to: 2.0]
foobar/now 1.0 i386 [installed,upgradable to: 2.0]" apt list --installed
testequal "Listing...
@@ -51,3 +58,14 @@ bar/now 1.0 i386 [installed,local]
an autogenerated dummy bar=1.0/installed
" apt list bar --verbose
+# test for dpkg ^rc state
+insertinstalledpackage 'conf-only' 'i386' '1.0' '' '' 'deinstall ok config-files'
+testequal "Listing...
+conf-only/now 1.0 i386 [residual-config]" apt list conf-only
+
+# ensure that the users learns about multiple versions too
+testequal "Listing...
+baz/unstable 2.0 all [upgradable from: 0.1]
+N: There are 2 additional versions. Please use the '-a' switch to see them." apt list baz -o quiet=0
+
+
diff --git a/test/integration/test-apt-cli-search b/test/integration/test-apt-cli-search
index 84650b366..58613717b 100755
--- a/test/integration/test-apt-cli-search
+++ b/test/integration/test-apt-cli-search
@@ -13,7 +13,7 @@ if [ ! -x ${BUILDDIRECTORY}/apt ]; then
exit 0
fi
-DESCR='Some description that has a unusual word xxyyzz and aabbcc'
+DESCR='Some description that has a unusual word xxyyzz and aabbcc and a UPPERCASE'
DESCR2='Some other description with the unusual aabbcc only'
insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR"
insertpackage 'testing' 'bar' 'i386' '2.0' '' '' "$DESCR2"
@@ -39,6 +39,11 @@ testequal "foo/unstable 1.0 all
$DESCR
" apt search -qq aabbcc xxyyzz
+# search is not case-sensitive by default
+testequal "foo/unstable 1.0 all
+ $DESCR
+" apt search -qq uppercase
+
# output is sorted and search word finds both package
testequal "bar/testing 2.0 i386
$DESCR2
diff --git a/test/integration/test-failing-maintainer-scripts b/test/integration/test-failing-maintainer-scripts
index cb82ebc7a..3dd7d643e 100755
--- a/test/integration/test-failing-maintainer-scripts
+++ b/test/integration/test-failing-maintainer-scripts
@@ -86,7 +86,7 @@ testmyfailure() {
testfailure "$@" -o APT::Status-Fd=3
msgtest 'Test for failure message of maintainerscript in' 'console log'
local TEST='rootdir/tmp/testfailure.output'
- if grep -q 'exit status 29$' "$TEST"; then
+ if grep -q 'exit status 29' "$TEST"; then
msgpass
else
cat $TEST
diff --git a/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard b/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard
new file mode 100755
index 000000000..2f2d384e1
--- /dev/null
+++ b/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard
@@ -0,0 +1,48 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'i386'
+
+# Regression test for LP: #1304403
+#
+# The issue here is that libkadm5srv-mit8 (priority standard) is replaced
+# by a new libkadm5srv-mit9 and libkbd5-7 breaks on the old -mit8 package.
+# The -mit8 package is no longer downloadable (and hence not upgradeable)
+
+# normal upradable pkg
+# (libkdb5-7 that breaks on libkadm5srv-mit8 (<< 1.11+dfsg~)
+insertinstalledpackage 'upgradable' 'all' '1.0' '' 'extra'
+insertpackage 'unstable' 'upgradable' 'all' '2.0' 'Breaks: not-downloadable (<< 1.1)' 'optional'
+
+# no longer downloadable pkg (libkadm5srv-mit8, replaced by libkadm5srv-mit9)
+# but priority standard pushes it higher
+insertinstalledpackage 'not-downloadable' 'all' '1.0' '' 'standard'
+
+setupaptarchive
+
+# discourage keeping obsolete high-priority packages …
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+ not-downloadable
+The following packages will be upgraded:
+ upgradable
+1 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
+Remv not-downloadable [1.0]
+Inst upgradable [1.0] (2.0 unstable [all])
+Conf upgradable (2.0 unstable [all])' aptget -s dist-upgrade
+
+# … but if it has dependencies we want to keep it as usual
+for i in $(seq 1 10); do
+insertinstalledpackage "depender$i" 'all' '1.0' 'Depends: not-downloadable'
+done
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages have been kept back:
+ upgradable
+0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.' aptget -s dist-upgrade
diff --git a/test/integration/test-ubuntu-bug-365611-long-package-names b/test/integration/test-ubuntu-bug-365611-long-package-names
index 894c8dc97..f22986e21 100755
--- a/test/integration/test-ubuntu-bug-365611-long-package-names
+++ b/test/integration/test-ubuntu-bug-365611-long-package-names
@@ -4,8 +4,12 @@ set -e
TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
-configarchitecture "i386"
+configarchitecture 'i386'
setupaptarchive
aptget install $(for i in $(seq 0 1000); do echo -n 'a'; done) 2> longpackagename.log > /dev/null || true
testfileequal 'longpackagename.log' "E: Unable to locate package $(for i in $(seq 0 1000); do echo -n 'a'; done)"
+
+# … and the opposite of long:
+aptget install "" -s >longpackagename.log 2>&1 || true
+testfileequal 'longpackagename.log' "$(aptget install -s)"