summaryrefslogtreecommitdiffstats
path: root/test/integration/test-bug-lp1550741-heisestate
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:14:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:14:41 +0000
commit549a391d6438e828001eeeaf235b080c054a7bf3 (patch)
tree1bb6b1ea5987fa167a1d13abe82209cc882dd94b /test/integration/test-bug-lp1550741-heisestate
parentInitial commit. (diff)
downloadapt-549a391d6438e828001eeeaf235b080c054a7bf3.tar.xz
apt-549a391d6438e828001eeeaf235b080c054a7bf3.zip
Adding upstream version 2.2.4.upstream/2.2.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/test-bug-lp1550741-heisestate')
-rwxr-xr-xtest/integration/test-bug-lp1550741-heisestate48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/integration/test-bug-lp1550741-heisestate b/test/integration/test-bug-lp1550741-heisestate
new file mode 100755
index 0000000..76fdcb8
--- /dev/null
+++ b/test/integration/test-bug-lp1550741-heisestate
@@ -0,0 +1,48 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+
+setupenvironment
+configarchitecture 'amd64'
+
+insertpackage 'unstable' 'module-init-tools' 'amd64' '1.0' 'Depends: libkmod2 (= 21-1)'
+insertpackage 'unstable' 'libkmod2' 'amd64' '0.22-1'
+insertinstalledpackage 'module-init-tools' 'amd64' '0.1'
+
+setupaptarchive
+
+# this test only works if the python-apt is build against the same
+# ABI version as the apt we are testing here
+PYAPT_LIB_VER=$(runpython3 -c 'import apt_pkg;print(apt_pkg.LIB_VERSION)' 2>/dev/null || true)
+if [ ! -f $LIBRARYPATH/libapt-pkg.so.$PYAPT_LIB_VER ]; then
+ msgskip "python-apt build with the wrong library version: $PYAPT_LIB_VER"
+ exit 0
+fi
+
+# we can not test this using our normal sh tests
+cat > test.py <<EOF
+#!/usr/bin/python3
+import sys
+import apt
+def in_valid_state(pkg):
+ return (pkg.marked_keep or
+ pkg.marked_install or
+ pkg.marked_upgrade or
+ pkg.marked_delete or
+ pkg.marked_downgrade or
+ pkg.marked_reinstall)
+# main
+cache=apt.Cache()
+pkgname="module-init-tools"
+if not in_valid_state(cache[pkgname]):
+ print("the test is broken, %s should be in a valid state" % pkgname)
+ sys.exit(99)
+cache.upgrade(True)
+if not in_valid_state(cache[pkgname]):
+ print("package %s is in a heisen-state" % pkgname)
+ sys.exit(2)
+
+EOF
+testsuccess runpython3 test.py