]> git.saurik.com Git - apt.git/blob - test/integration/test-bug-lp1550741-heisestate
Fix bug where the problemresolve can put a pkg into a heisenstate
[apt.git] / test / integration / test-bug-lp1550741-heisestate
1 #!/bin/sh
2 set -e
3
4 TESTDIR="$(readlink -f "$(dirname "$0")")"
5 . "$TESTDIR/framework"
6
7 setupenvironment
8 configarchitecture 'amd64'
9
10 insertpackage 'unstable' 'module-init-tools' 'amd64' '1.0' 'Depends: libkmod2 (= 21-1)'
11 insertpackage 'unstable' 'libkmod2' 'amd64' '0.22-1'
12 insertinstalledpackage 'module-init-tools' 'amd64' '0.1'
13
14 setupaptarchive
15
16 # this test only works if the python-apt is build against the same
17 # ABI version as the apt we are testing here
18 PYAPT_LIB_VER=$(runpython3 -c 'import apt_pkg;print(apt_pkg.LIB_VERSION)' 2>/dev/null || true)
19 if [ ! -f $LIBRARYPATH/libapt-pkg.so.$PYAPT_LIB_VER ]; then
20 msgskip "python-apt build with the wrong library version: $PYAPT_LIB_VER"
21 exit 0
22 fi
23
24 # we can not test this using our normal sh tests
25 cat > test.py <<EOF
26 #!/usr/bin/python3
27 import sys
28 import apt
29 def in_valid_state(pkg):
30 return (pkg.marked_keep or
31 pkg.marked_install or
32 pkg.marked_upgrade or
33 pkg.marked_delete or
34 pkg.marked_downgrade or
35 pkg.marked_reinstall)
36 # main
37 cache=apt.Cache()
38 pkgname="module-init-tools"
39 if not in_valid_state(cache[pkgname]):
40 print("the test is broken, %s should be in a valid state" % pkgname)
41 sys.exit(99)
42 cache.upgrade(True)
43 if not in_valid_state(cache[pkgname]):
44 print("package %s is in a heisen-state" % pkgname)
45 sys.exit(2)
46
47 EOF
48 testsuccess runpython3 test.py