]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-lp1550741-heisestate
apt-key: warn instead of fail on unreadable keyrings
[apt.git] / test / integration / test-bug-lp1550741-heisestate
CommitLineData
0390edd5
MV
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6
7setupenvironment
8configarchitecture 'amd64'
9
10insertpackage 'unstable' 'module-init-tools' 'amd64' '1.0' 'Depends: libkmod2 (= 21-1)'
11insertpackage 'unstable' 'libkmod2' 'amd64' '0.22-1'
12insertinstalledpackage 'module-init-tools' 'amd64' '0.1'
13
14setupaptarchive
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
18PYAPT_LIB_VER=$(runpython3 -c 'import apt_pkg;print(apt_pkg.LIB_VERSION)' 2>/dev/null || true)
19if [ ! -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
22fi
23
24# we can not test this using our normal sh tests
25cat > test.py <<EOF
26#!/usr/bin/python3
27import sys
28import apt
29def 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
37cache=apt.Cache()
38pkgname="module-init-tools"
39if not in_valid_state(cache[pkgname]):
40 print("the test is broken, %s should be in a valid state" % pkgname)
41 sys.exit(99)
42cache.upgrade(True)
43if not in_valid_state(cache[pkgname]):
44 print("package %s is in a heisen-state" % pkgname)
45 sys.exit(2)
46
47EOF
48testsuccess runpython3 test.py