summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/integration/framework15
-rwxr-xr-xtest/integration/run-tests3
-rwxr-xr-xtest/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings104
-rw-r--r--test/libapt/assert.h2
-rwxr-xr-xtest/libapt/run-tests9
5 files changed, 129 insertions, 4 deletions
diff --git a/test/integration/framework b/test/integration/framework
index 1c4872c8e..4a70573c8 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -1,5 +1,7 @@
#!/bin/sh -- # no runable script, just for vi
+EXIT_CODE=0
+
# we all like colorful messages
if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null && \
expr match "$(readlink -f /proc/$$/fd/2)" '/dev/pts/[0-9]\+' > /dev/null; then
@@ -36,7 +38,7 @@ msgtest() {
}
msgpass() { echo "${CPASS}PASS${CNORMAL}" >&2; }
msgskip() { echo "${CWARNING}SKIP${CNORMAL}" >&2; }
-msgfail() { echo "${CFAIL}FAIL${CNORMAL}" >&2; }
+msgfail() { echo "${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE=$((EXIT_CODE+1)); }
# enable / disable Debugging
MSGLEVEL=${MSGLEVEL:-3}
@@ -113,9 +115,18 @@ gdb() {
APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which gdb) ${BUILDDIRECTORY}/$1
}
+exitwithstatus() {
+ # error if we about to overflow, but ...
+ # "255 failures ought to be enough for everybody"
+ if [ $EXIT_CODE -gt 255 ]; then
+ msgdie "Total failure count $EXIT_CODE too big"
+ fi
+ exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255));
+}
+
addtrap() {
CURRENTTRAP="$CURRENTTRAP $1"
- trap "$CURRENTTRAP exit;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+ trap "$CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
}
setupenvironment() {
diff --git a/test/integration/run-tests b/test/integration/run-tests
index 75f2ad662..18474b20f 100755
--- a/test/integration/run-tests
+++ b/test/integration/run-tests
@@ -37,4 +37,5 @@ for testcase in $(run-parts --list $DIR | grep '/test-'); do
done
echo "failures: $FAIL"
-exit $FAIL
+# ensure we don't overflow
+exit $((FAIL <= 255 ? FAIL : 255))
diff --git a/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings b/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings
new file mode 100755
index 000000000..af6b7b504
--- /dev/null
+++ b/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings
@@ -0,0 +1,104 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+insertpackage 'stable' 'libmesa' 'amd64,i386' '1' 'Multi-Arch: same'
+insertpackage 'stable' 'libmesa-lts' 'amd64,i386' '1' 'Provides: libmesa
+Conflicts: libmesa
+Multi-Arch: same'
+insertpackage 'stable' 'steam' 'i386' '1' 'Depends: libmesa'
+
+insertpackage 'unstable' 'libmesa' 'amd64,i386' '2' 'Multi-Arch: same'
+insertpackage 'unstable' 'libmesa-lts' 'amd64,i386' '2' 'Provides: libmesa
+Conflicts: libmesa
+Multi-Arch: same'
+insertpackage 'unstable' 'steam' 'i386' '2' 'Depends: libmesa'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ libmesa:i386
+The following NEW packages will be installed:
+ libmesa:i386 steam:i386
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libmesa:i386 (1 stable [i386])
+Inst steam:i386 (1 stable [i386])
+Conf libmesa:i386 (1 stable [i386])
+Conf steam:i386 (1 stable [i386])' aptget install steam -st stable
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ libmesa:i386
+The following NEW packages will be installed:
+ libmesa:i386 steam:i386
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libmesa:i386 (2 unstable [i386])
+Inst steam:i386 (2 unstable [i386])
+Conf libmesa:i386 (2 unstable [i386])
+Conf steam:i386 (2 unstable [i386])' aptget install steam -st unstable
+
+cp rootdir/var/lib/dpkg/status default-status.dpkg
+insertinstalledpackage 'libmesa' 'amd64' '1' 'Multi-Arch: same'
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ libmesa:i386
+The following NEW packages will be installed:
+ libmesa:i386 steam:i386
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libmesa:i386 (1 stable [i386])
+Inst steam:i386 (1 stable [i386])
+Conf libmesa:i386 (1 stable [i386])
+Conf steam:i386 (1 stable [i386])' aptget install steam -st stable
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ libmesa libmesa:i386
+The following NEW packages will be installed:
+ libmesa:i386 steam:i386
+The following packages will be upgraded:
+ libmesa
+1 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libmesa [1] (2 unstable [amd64])
+Inst libmesa:i386 (2 unstable [i386])
+Inst steam:i386 (2 unstable [i386])
+Conf libmesa (2 unstable [amd64])
+Conf libmesa:i386 (2 unstable [i386])
+Conf steam:i386 (2 unstable [i386])' aptget install steam -st unstable
+
+cp default-status.dpkg rootdir/var/lib/dpkg/status
+insertinstalledpackage 'libmesa-lts' 'amd64' '1' 'Provides: libmesa
+Conflicts: libmesa
+Multi-Arch: same'
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ libmesa-lts:i386
+The following NEW packages will be installed:
+ libmesa-lts:i386 steam:i386
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libmesa-lts:i386 (1 stable [i386])
+Inst steam:i386 (1 stable [i386])
+Conf libmesa-lts:i386 (1 stable [i386])
+Conf steam:i386 (1 stable [i386])' aptget install steam -st stable
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ libmesa-lts libmesa-lts:i386
+The following NEW packages will be installed:
+ libmesa-lts:i386 steam:i386
+The following packages will be upgraded:
+ libmesa-lts
+1 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libmesa-lts [1] (2 unstable [amd64])
+Inst libmesa-lts:i386 (2 unstable [i386])
+Inst steam:i386 (2 unstable [i386])
+Conf libmesa-lts (2 unstable [amd64])
+Conf libmesa-lts:i386 (2 unstable [i386])
+Conf steam:i386 (2 unstable [i386])' aptget install steam -st unstable
diff --git a/test/libapt/assert.h b/test/libapt/assert.h
index fdf6740c6..113c057ed 100644
--- a/test/libapt/assert.h
+++ b/test/libapt/assert.h
@@ -1,4 +1,5 @@
#include <iostream>
+#include <cstdlib>
#define equals(x,y) assertEquals(y, x, __LINE__)
#define equalsNot(x,y) assertEqualsNot(y, x, __LINE__)
@@ -6,6 +7,7 @@
template < typename X, typename Y >
void OutputAssertEqual(X expect, char const* compare, Y get, unsigned long const &line) {
std::cerr << "Test FAILED: »" << expect << "« " << compare << " »" << get << "« at line " << line << std::endl;
+ std::exit(EXIT_FAILURE);
}
template < typename X, typename Y >
diff --git a/test/libapt/run-tests b/test/libapt/run-tests
index 45a3157f7..f18be6d2b 100755
--- a/test/libapt/run-tests
+++ b/test/libapt/run-tests
@@ -7,6 +7,7 @@ echo "Compiling the tests …"
echo "Running all testcases …"
LDPATH="$DIR/../../build/bin"
EXT="_libapt_test"
+EXIT_CODE=0
# detect if output is on a terminal (colorful) or better not
if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then
@@ -106,9 +107,15 @@ do
fi
echo -n "Testing with ${NAME} "
- LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} && echo "$TESTOKAY" || echo "$TESTFAIL"
+ if LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} ; then
+ echo "$TESTOKAY"
+ else
+ echo "$TESTFAIL"
+ EXIT_CODE=1
+ fi
if [ -n "$tmppath" -a -d "$tmppath" ]; then
rm -rf "$tmppath"
fi
done
+exit $EXIT_CODE