summaryrefslogtreecommitdiffstats
path: root/test/integration/test-allow
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtest/integration/test-allow98
-rwxr-xr-xtest/integration/test-allow-scores-for-all-dependency-types155
2 files changed, 253 insertions, 0 deletions
diff --git a/test/integration/test-allow b/test/integration/test-allow
new file mode 100755
index 0000000..2cc57bc
--- /dev/null
+++ b/test/integration/test-allow
@@ -0,0 +1,98 @@
+#!/bin/sh
+#
+# Test for --allow-remove-essential and friends replacing --force-yes
+#
+set -e
+
+TESTDIR="$(readlink -f "$(dirname $0)")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'amd64'
+
+insertpackage 'unstable' 'downgrade' 'all' '1'
+insertinstalledpackage 'downgrade' 'all' '2'
+
+insertpackage 'unstable' 'hold' 'all' '2'
+insertinstalledpackage 'hold' 'all' '1'
+
+insertinstalledpackage 'essential' 'all' '1' 'Essential: yes'
+
+setupaptarchive
+
+testsuccess aptmark hold hold
+
+# Test --allow-remove--essential
+
+testfailureequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+ essential
+WARNING: The following essential packages will be removed.
+This should NOT be done unless you know exactly what you are doing!
+ essential
+0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
+E: Essential packages were removed and -y was used without --allow-remove-essential.' aptget remove essential -y -s
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+ essential
+WARNING: The following essential packages will be removed.
+This should NOT be done unless you know exactly what you are doing!
+ essential
+0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
+Remv essential [1]' aptget remove essential -y --allow-remove-essential -s
+
+# Test --allow-change-held-packages (should not influence dist-upgrade, but an install)
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages have been kept back:
+ hold
+0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.' aptget dist-upgrade --allow-change-held-packages -s
+
+testfailureequal 'Reading package lists...
+Building dependency tree...
+The following held packages will be changed:
+ hold
+The following packages will be upgraded:
+ hold
+1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+E: Held packages were changed and -y was used without --allow-change-held-packages.' aptget install hold -y -s
+
+testfailureequal 'Reading package lists...
+Building dependency tree...
+The following held packages will be changed:
+ hold
+The following packages will be upgraded:
+ hold
+1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+E: Held packages were changed and -y was used without --allow-change-held-packages.' aptget install hold -y -s
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following held packages will be changed:
+ hold
+The following packages will be upgraded:
+ hold
+1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst hold [1] (2 unstable [all])
+Conf hold (2 unstable [all])' aptget install hold -y -s --allow-change-held-packages
+
+# Test --allow-downgrades
+
+testfailureequal 'Reading package lists...
+Building dependency tree...
+The following packages will be DOWNGRADED:
+ downgrade
+0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 1 not upgraded.
+E: Packages were downgraded and -y was used without --allow-downgrades.' aptget install downgrade=1 -y -s
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following packages will be DOWNGRADED:
+ downgrade
+0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 1 not upgraded.
+Inst downgrade [2] (1 unstable [all])
+Conf downgrade (1 unstable [all])' aptget install downgrade=1 --allow-downgrades -y -s
diff --git a/test/integration/test-allow-scores-for-all-dependency-types b/test/integration/test-allow-scores-for-all-dependency-types
new file mode 100755
index 0000000..b8a9ed3
--- /dev/null
+++ b/test/integration/test-allow-scores-for-all-dependency-types
@@ -0,0 +1,155 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'amd64'
+
+insertpackage 'unversioned' 'libdb-dev' 'amd64' '5.3.0' 'Depends: libdb5.3-dev
+Conflicts: libdb5.1-dev'
+insertpackage 'unversioned' 'libdb5.1-dev' 'amd64' '5.1.29-7'
+insertpackage 'unversioned' 'libdb5.3-dev' 'amd64' '5.3.28-3' 'Conflicts: libdb5.1-dev'
+
+insertpackage 'unversioned' 'foo' 'amd64' '1'
+insertpackage 'unversioned' 'bar' 'amd64' '1'
+insertpackage 'unversioned' 'foo' 'amd64' '2' 'Conflicts: bar'
+insertpackage 'unversioned' 'bar' 'amd64' '2' 'Conflicts: foo'
+insertpackage 'unversioned' 'baz' 'amd64' '2' 'Depends: bar | foo'
+
+insertpackage 'versioned' 'libdb-dev' 'amd64' '5.3.0' 'Depends: libdb5.3-dev
+Conflicts: libdb5.1-dev (<< 5.2)'
+insertpackage 'versioned' 'libdb5.3-dev' 'amd64' '5.3.28-3' 'Conflicts: libdb5.1-dev (<< 5.2)'
+
+insertpackage 'versioned' 'foo' 'amd64' '2' 'Conflicts: bar (<= 2)'
+insertpackage 'versioned' 'bar' 'amd64' '2' 'Conflicts: foo (<= 2)'
+insertpackage 'versioned' 'baz' 'amd64' '2' 'Depends: bar (>= 2) | foo (>= 2)'
+
+insertpackage 'multipleno' 'foo' 'amd64' '2.1' 'Conflicts: bar (<= 3)'
+insertpackage 'multipleno' 'bar' 'amd64' '2.1' 'Conflicts: foo (<= 3), foo (<= 1)'
+
+insertpackage 'multipleyes' 'foo' 'amd64' '2.2' 'Conflicts: bar (<= 3)'
+# having foo multiple times as conflict is a non-advisable hack in general
+insertpackage 'multipleyes' 'bar' 'amd64' '2.2' 'Conflicts: foo (<= 3), foo (<= 3)'
+
+#774924 - slightly simplified
+insertpackage 'jessie' 'login' 'amd64' '2' 'Pre-Depends: libaudit1 (>= 0)'
+insertpackage 'jessie' 'libaudit1' 'amd64' '2' 'Depends: libaudit-common (>= 0)'
+insertpackage 'jessie' 'libaudit-common' 'amd64' '2' 'Breaks: libaudit0, libaudit1 (<< 2)'
+
+cp rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup
+setupaptarchive
+
+insertinstalledpackage 'libdb-dev' 'amd64' '5.1.7' 'Depends: libdb5.1-dev'
+insertinstalledpackage 'libdb5.1-dev' 'amd64' '5.1.29-7'
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages will be REMOVED:
+ libdb5.1-dev
+The following NEW packages will be installed:
+ libdb5.3-dev
+The following packages will be upgraded:
+ libdb-dev
+1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv libdb5.1-dev [5.1.29-7] [libdb-dev:amd64 ]
+Inst libdb-dev [5.1.7] (5.3.0 unversioned [amd64]) []
+Inst libdb5.3-dev (5.3.28-3 unversioned [amd64])
+Conf libdb-dev (5.3.0 unversioned [amd64])
+Conf libdb5.3-dev (5.3.28-3 unversioned [amd64])' aptget dist-upgrade -st unversioned
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages will be REMOVED:
+ libdb5.1-dev
+The following NEW packages will be installed:
+ libdb5.3-dev
+The following packages will be upgraded:
+ libdb-dev
+1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv libdb5.1-dev [5.1.29-7] [libdb-dev:amd64 ]
+Inst libdb-dev [5.1.7] (5.3.0 versioned [amd64]) []
+Inst libdb5.3-dev (5.3.28-3 versioned [amd64])
+Conf libdb-dev (5.3.0 versioned [amd64])
+Conf libdb5.3-dev (5.3.28-3 versioned [amd64])' aptget dist-upgrade -st versioned
+
+cp -f rootdir/var/lib/dpkg/status-backup rootdir/var/lib/dpkg/status
+insertinstalledpackage 'foo' 'amd64' '1'
+insertinstalledpackage 'bar' 'amd64' '1'
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages have been kept back:
+ bar foo
+0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st unversioned
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages have been kept back:
+ bar foo
+0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st versioned
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages have been kept back:
+ bar foo
+0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st multipleno
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages will be REMOVED:
+ foo
+The following packages will be upgraded:
+ bar
+1 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
+Remv foo [1]
+Inst bar [1] (2.2 multipleyes [amd64])
+Conf bar (2.2 multipleyes [amd64])' aptget dist-upgrade -st multipleyes
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ baz
+0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
+Inst baz (2 unversioned [amd64])
+Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following additional packages will be installed:
+ bar
+The following packages will be REMOVED:
+ foo
+The following NEW packages will be installed:
+ baz
+The following packages will be upgraded:
+ bar
+1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv foo [1]
+Inst bar [1] (2 versioned [amd64])
+Inst baz (2 versioned [amd64])
+Conf bar (2 versioned [amd64])
+Conf baz (2 versioned [amd64])' aptget install baz -st versioned
+
+# recreating the exact situation is hard, so we pull tricks to get the score
+cp -f rootdir/var/lib/dpkg/status-backup rootdir/var/lib/dpkg/status
+insertinstalledpackage 'gdm3' 'amd64' '1' 'Depends: libaudit0, libaudit0'
+insertinstalledpackage 'login' 'amd64' '1' 'Essential: yes'
+insertinstalledpackage 'libaudit0' 'amd64' '1'
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages will be REMOVED:
+ gdm3 libaudit0
+The following NEW packages will be installed:
+ libaudit-common libaudit1
+The following packages will be upgraded:
+ login
+1 upgraded, 2 newly installed, 2 to remove and 0 not upgraded.
+Remv gdm3 [1]
+Remv libaudit0 [1]
+Inst libaudit-common (2 jessie [amd64])
+Conf libaudit-common (2 jessie [amd64])
+Inst libaudit1 (2 jessie [amd64])
+Conf libaudit1 (2 jessie [amd64])
+Inst login [1] (2 jessie [amd64])
+Conf login (2 jessie [amd64])' aptget dist-upgrade -st jessie