summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-10-22 16:53:32 +0200
committerMichael Vogt <mvo@debian.org>2013-10-22 16:53:32 +0200
commitf62f17b489405432a3125e51471d8a00e78c5170 (patch)
treece2a6e077cb0846e75cbb3d583f4152608100adb /test
parent9aa9db9c88fca3a9266427b0d5cc9ad53df7207e (diff)
parentc08cf1dc784a98a253296a51433f6de7d16d3125 (diff)
Merge branch 'debian/sid' into ubuntu/master
Conflicts: cmdline/apt-key configure.ac debian/apt.auto-removal.sh debian/changelog debian/control debian/rules po/apt-all.pot po/ar.po po/ast.po po/bg.po po/bs.po po/ca.po po/cs.po po/cy.po po/da.po po/de.po po/dz.po po/el.po po/es.po po/eu.po po/fi.po po/fr.po po/gl.po po/hu.po po/it.po po/ja.po po/km.po po/ko.po po/ku.po po/lt.po po/mr.po po/nb.po po/ne.po po/nl.po po/nn.po po/pl.po po/pt.po po/pt_BR.po po/ro.po po/ru.po po/sk.po po/sl.po po/sv.po po/th.po po/tl.po po/uk.po po/vi.po po/zh_CN.po po/zh_TW.po
Diffstat (limited to 'test')
-rw-r--r--test/integration/Packages-bug-723705-tagfile-truncates-fields167
-rw-r--r--test/integration/apt.pem49
-rw-r--r--test/integration/framework325
-rw-r--r--test/integration/rexexpired.pubbin0 -> 1200 bytes
-rw-r--r--test/integration/rexexpired.secbin0 -> 2502 bytes
-rwxr-xr-xtest/integration/skip-avoid-avoiding-breaks-predepends2
-rwxr-xr-xtest/integration/skip-bug-601016-description-translation (renamed from test/integration/test-bug-601016-description-translation)0
-rw-r--r--test/integration/status-bug-723705-tagfile-truncates-fields62
-rwxr-xr-xtest/integration/test-apt-cdrom7
-rwxr-xr-xtest/integration/test-apt-get-autoremove30
-rwxr-xr-xtest/integration/test-apt-get-download3
-rwxr-xr-xtest/integration/test-apt-get-upgrade78
-rwxr-xr-xtest/integration/test-apt-key107
-rwxr-xr-xtest/integration/test-apt-progress-fd71
-rwxr-xr-xtest/integration/test-apt-progress-fd-error22
-rwxr-xr-xtest/integration/test-apt-progress-fd-error-postinst22
-rwxr-xr-xtest/integration/test-bug-254770-segfault-if-cache-not-buildable2
-rwxr-xr-xtest/integration/test-bug-407511-fail-invalid-default-release4
-rwxr-xr-xtest/integration/test-bug-507998-dist-upgrade-recommends25
-rwxr-xr-xtest/integration/test-bug-543966-downgrade-below-1000-pin81
-rwxr-xr-xtest/integration/test-bug-596498-trusted-unsigned-repo13
-rwxr-xr-xtest/integration/test-bug-602412-dequote-redirect4
-rwxr-xr-xtest/integration/test-bug-604222-new-and-autoremove2
-rwxr-xr-xtest/integration/test-bug-604401-files-are-directories10
-rwxr-xr-xtest/integration/test-bug-611729-mark-as-manual20
-rwxr-xr-xtest/integration/test-bug-612099-multiarch-conflicts16
-rwxr-xr-xtest/integration/test-bug-612557-garbage-upgrade4
-rwxr-xr-xtest/integration/test-bug-612958-use-dpkg-multiarch-config4
-rwxr-xr-xtest/integration/test-bug-613420-new-garbage-dependency2
-rwxr-xr-xtest/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted63
-rwxr-xr-xtest/integration/test-bug-618288-multiarch-same-lockstep2
-rwxr-xr-xtest/integration/test-bug-624218-Translation-file-handling55
-rwxr-xr-xtest/integration/test-bug-633350-do-not-kill-last-char-in-Release2
-rwxr-xr-xtest/integration/test-bug-64141-install-dependencies-for-on-hold2
-rwxr-xr-xtest/integration/test-bug-673536-pre-depends-breaks-loop4
-rwxr-xr-xtest/integration/test-bug-679371-apt-get-autoclean-multiarch9
-rwxr-xr-xtest/integration/test-bug-686346-package-missing-architecture17
-rwxr-xr-xtest/integration/test-bug-689582-100-char-long-path-names35
-rwxr-xr-xtest/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch136
-rwxr-xr-xtest/integration/test-bug-712435-missing-descriptions78
-rwxr-xr-xtest/integration/test-bug-717891-abolute-uris-for-proxies28
-rwxr-xr-xtest/integration/test-bug-719263-print-uris-removes-authentication41
-rwxr-xr-xtest/integration/test-bug-722207-print-uris-even-if-very-quiet30
-rwxr-xr-xtest/integration/test-bug-723586-any-stripped-in-single-arch54
-rwxr-xr-xtest/integration/test-bug-723705-tagfile-truncates-fields33
-rwxr-xr-xtest/integration/test-compressed-indexes34
-rwxr-xr-xtest/integration/test-cve-2013-1051-InRelease-parsing2
-rwxr-xr-xtest/integration/test-disappearing-packages2
-rwxr-xr-xtest/integration/test-hashsum-verification4
-rwxr-xr-xtest/integration/test-partial-file-support107
-rwxr-xr-xtest/integration/test-pdiff-usage8
-rwxr-xr-xtest/integration/test-policy-pinning8
-rwxr-xr-xtest/integration/test-prevent-markinstall-multiarch-same-versionscrew100
-rwxr-xr-xtest/integration/test-releasefile-valid-until32
-rwxr-xr-xtest/integration/test-releasefile-verification86
-rwxr-xr-xtest/integration/test-sourceslist-arch-plusminus-options85
-rwxr-xr-xtest/integration/test-ubuntu-bug-761175-remove-purge6
-rwxr-xr-xtest/integration/test-ubuntu-bug-784473-InRelease-one-message-only2
-rwxr-xr-xtest/integration/test-ubuntu-bug-859188-multiarch-reinstall7
-rw-r--r--test/interactive-helper/aptwebserver.cc168
-rw-r--r--test/libapt/configuration_test.cc4
-rw-r--r--test/libapt/fileutl_test.cc42
-rw-r--r--test/libapt/hashsums_test.cc32
-rw-r--r--test/libapt/makefile5
-rwxr-xr-xtest/libapt/run-tests20
-rw-r--r--test/libapt/strutil_test.cc27
66 files changed, 2226 insertions, 276 deletions
diff --git a/test/integration/Packages-bug-723705-tagfile-truncates-fields b/test/integration/Packages-bug-723705-tagfile-truncates-fields
new file mode 100644
index 000000000..c42b85072
--- /dev/null
+++ b/test/integration/Packages-bug-723705-tagfile-truncates-fields
@@ -0,0 +1,167 @@
+Package: cdebconf-gtk-udeb
+Source: cdebconf
+Version: 0.185
+Installed-Size: 92
+Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
+Architecture: amd64
+Description: Gtk+ frontend for Debian Configuration Management System
+Description-md5: 75d036e0a245499123544e2254b92e9c
+Section: debian-installer
+Priority: optional
+Filename: pool/main/c/cdebconf/cdebconf-gtk-udeb_0.185_amd64.udeb
+Size: 27278
+MD5sum: a1bbbc1d4fb8e0615b5621abac021924
+SHA1: b1a7ab55a90f61e5337847d02ff1d12d73559def
+SHA256: cd79f3205304a7932b3309c4df9898c9a53929bc651912659858e087ebe1c18a
+
+Package: cdebconf-newt-udeb
+Source: cdebconf
+Version: 0.185
+Installed-Size: 58
+Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
+Architecture: amd64
+Description: Newt frontend for Debian Configuration Management System
+Description-md5: e080be5e38cb8c57bca2f3effe9ee030
+Section: debian-installer
+Priority: optional
+Filename: pool/main/c/cdebconf/cdebconf-newt-udeb_0.185_amd64.udeb
+Size: 19192
+MD5sum: de27807f56dae2f2403b3322d5fe6bd2
+SHA1: 57883e223d46a9f25966f9b986e6a3bc2f67d8ef
+SHA256: 5f8b9c3a5430f2ec879484a7736582b152d76cc8ba9bc19328268f3635759a1b
+
+Package: cdebconf-udeb
+Source: cdebconf
+Version: 0.185
+Installed-Size: 245
+Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
+Architecture: amd64
+Provides: debconf-2.0
+Description: Debian Configuration Management System (C-implementation)
+Description-md5: 9f3579e9d9f86ac89e667a8707d3cbd3
+Section: debian-installer
+Priority: standard
+Filename: pool/main/c/cdebconf/cdebconf-udeb_0.185_amd64.udeb
+Size: 77376
+MD5sum: e3883706fdbf54c2e5ea959c92b2d37f
+SHA1: 0232f1bdf1531db628516ed3a46a27466b267fdc
+SHA256: 96345575417a3e4df8a2cadaa55784ec8f6c042defb1e2fc002d941b6116ceab
+
+Package: cdebconf-gtk-terminal
+Source: cdebconf-terminal
+Version: 0.22
+Installed-Size: 64
+Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
+Architecture: amd64
+Provides: cdebconf-terminal
+Depends: cdebconf-gtk-udeb, libc6-udeb (>= 2.17), libglib2.0-udeb (>= 2.36.4), libgtk2.0-0-udeb (>= 2.24.0), libvte9-udeb (>= 1:0.28.0), cdebconf-udeb, cdebconf-gtk-terminal, cdebconf-gtk-terminal, cdebconf-gtk-terminal, cdebconf-gtk-terminal, cdebconf-gtk-terminal, cdebconf-gtk-terminal, cdebconf-gtk-terminal
+Description: cdebconf gtk plugin displaying a terminal
+Description-md5: 18c4446758aec003eb8cd0a43419f1aa
+Section: debian-installer
+Priority: extra
+Filename: pool/main/c/cdebconf-terminal/cdebconf-gtk-terminal_0.22_amd64.udeb
+Size: 14734
+MD5sum: f9c3a7354560cb88e0396e2b7ba54363
+SHA1: 9c1c93328e758bfd9de2752466b271aaf38c8177
+SHA256: ca749853fc3b93db1d08ccdc6b46de27633de52bc5b880fa65275897ebcaaf69
+
+Package: cdebconf-newt-terminal
+Source: cdebconf-terminal
+Version: 0.22
+Installed-Size: 43
+Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
+Architecture: amd64
+Provides: cdebconf-terminal
+Depends: cdebconf-newt-udeb (>= 0.146), libc6-udeb (>= 2.17), libnewt0.52
+Description: cdebconf newt plugin to provide a clean terminal
+Description-md5: 4109a053022081b573d864d84d6eb16d
+Section: debian-installer
+Priority: extra
+Filename: pool/main/c/cdebconf-terminal/cdebconf-newt-terminal_0.22_amd64.udeb
+Size: 4538
+MD5sum: 20db6152fce5081fcbf49c7c08f21246
+SHA1: fa2a40f777a2f48b9634866bc780fb059e60b2fe
+SHA256: c4d99ef27285f0c9090005313165627e56e0972e687af7e68c2b1d1538e2ae09
+
+Package: libc6-udeb
+Source: eglibc (2.17-92)
+Version: 2.17-92+b1
+Installed-Size: 3126
+Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
+Architecture: amd64
+Provides: glibc-2.17-1, libc-udeb, libc6
+Description: Embedded GNU C Library: Shared libraries - udeb
+Description-md5: 9552ce73b7b3fb466e3d89fe8db9a563
+Section: debian-installer
+Priority: extra
+Filename: pool/main/e/eglibc/libc6-udeb_2.17-92+b1_amd64.udeb
+Size: 1056000
+MD5sum: 7fd7032eeeecf7f76eff79a0543fbd72
+SHA1: 724b6a81b8fbc9d4d2bb43d656c08de73f7ada25
+SHA256: 137d4c001bbfde8161315c36e6cb8653ae2c50a8d6b6d2d27396c492d91a1723
+
+Package: libglib2.0-udeb
+Source: glib2.0
+Version: 2.36.4-1
+Installed-Size: 10070
+Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
+Architecture: amd64
+Description: GLib library of C routines - minimal runtime
+Description-md5: 0244040042870a89aa49f037cce3f1e9
+Section: debian-installer
+Priority: optional
+Filename: pool/main/g/glib2.0/libglib2.0-udeb_2.36.4-1_amd64.udeb
+Size: 1714604
+MD5sum: 72da029f1bbb36057d874f1f82a5d00a
+SHA1: 32bce78a052ef19a620f43ecbe12404fa570c0f1
+SHA256: 8edbc7cb872c0a82705913563f93f9eec5750881e4378c5a48770cde840cd6eb
+
+Package: libgtk2.0-0-udeb
+Source: gtk+2.0
+Version: 2.24.20-1
+Installed-Size: 5035
+Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
+Architecture: amd64
+Provides: gtk2.0-binver-2.10.0
+Description: GTK+ graphical user interface library - minimal runtime
+Description-md5: 32e5112b80c02578837cff4f65dfec84
+Section: debian-installer
+Priority: extra
+Filename: pool/main/g/gtk+2.0/libgtk2.0-0-udeb_2.24.20-1_amd64.udeb
+Size: 1643046
+MD5sum: 25513478eb2e02e5766c0eea0b411ca9
+SHA1: 9274f05bfa930a3406403441ce061bade04e2064
+SHA256: d5f611f48928ae02f759105cf8cff467cde1cb44df56ad31067168b46a80f8bc
+
+Package: libvte9-udeb
+Source: vte
+Version: 1:0.28.2-5
+Installed-Size: 628
+Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
+Architecture: amd64
+Description: Terminal emulator widget for GTK+ 2.0 - minimal runtime
+Description-md5: e7993385c30bae6e96c8cb87795a513c
+Section: debian-installer
+Priority: extra
+Filename: pool/main/v/vte/libvte9-udeb_0.28.2-5_amd64.udeb
+Size: 216968
+MD5sum: 7da7201effaf5ced19abd9d0b45aa2c6
+SHA1: a424cf779e7614d79740c422b6342de04fed3646
+SHA256: 4963033cbda5a8ba7eb8ebf1debae34463b8e63b821259860cfb51c1ab99562d
+
+Package: zlib1g-udeb
+Source: zlib
+Version: 1:1.2.8.dfsg-1
+Installed-Size: 115
+Maintainer: Mark Brown <broonie@debian.org>
+Architecture: amd64
+Description: compression library - runtime for Debian installer
+Description-md5: 9cab974e3eab657c53bc17611b894c7a
+Section: debian-installer
+Priority: optional
+Filename: pool/main/z/zlib/zlib1g-udeb_1.2.8.dfsg-1_amd64.udeb
+Size: 45270
+MD5sum: c02884420f79a3ae4569cf67782f3e74
+SHA1: 7cd1a7c8be4e086de733a0ce76f87d42b8b2173b
+SHA256: 61641ee2b5e185232108333438b72bec71ef549fe0e0df1b2b3afa37174e53a7
+
diff --git a/test/integration/apt.pem b/test/integration/apt.pem
new file mode 100644
index 000000000..f48df054d
--- /dev/null
+++ b/test/integration/apt.pem
@@ -0,0 +1,49 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCt4R1Q2oYF6utL
+19GBhnlHW8L2BI7PRFWge/ZpqIZWsaFcb30FV86Z6aXXZmgfEJ2814ZZYD1IKeCe
+JsJpns7B4vYe1v64r995ZNBQAAKIYjICkKZOBgOphV+ChBfrCctVXgfLbMP6iBdH
+J02wHzSCCdZm0sdVl9tB5l/OyJU8Mb4KB3btBhfZfY2M6lU+FOjcXs1LOduUrv7K
+fZ+DEalvVGkomLtHtD0qb2vkqFrTjVCkziUVWhhxFFflt08oQ01Clxpl+uv7rOQo
+jtkJ1LrMuv7iPfaZ/z3qLiFxZYG1BCGEwTOKCtJo6bgFzXiN3q7Q5FFlmv851x2J
+Dn8C7Qm7AgMBAAECggEAE3q6vAofJZ6Ryadd8zLLd3ESQFl2XkX7icUZb/DPS/sO
+ZrqeuPCDVr7UM3NnisNjyHoktPKRKvp2DYGuGgMOiq4QgJf5ZVten8zpgWze28SU
+cbEe0HLgCifE8Ww2+b/ZJbEpEmMW+YQxh2khzO9SBJdxi4dliXM/vvw+E35pKZsB
+s6glrz6VQAxxa9fY4fLnB2DafHy+pUvRVw8gC6PCM9jXN9tMYAqztsJu7aaanNyT
+HX2UDWa8hxVx6t5UQZuxvst9N+RcEwmVCR2qlfZt/VRBRibBm62crEKbTD00mNHQ
+4AIDn3g6Y3SXpDlgtNpjLyBL3fODPIwqwGdblaSKkQKBgQDYXecu0Eda7kbR5ciW
+IAn8XOxsBIkkh8YVl2gRiiajRVoeiYBHaW9TyuQiaWrftiDQxB/N4G2focTXy/7O
+VJn6e/SUoO/ZGRw2GbTxLUQptgvFsejYCcW9XpC8MCwE/y2swiY7JM0WR8cV2nCk
+a/Cls6f1LjL13aFO0PAorEcahQKBgQDNuth6EHZVwfDgUuqhRw4HIIpfsfiA3UOd
+b5k/NsfQIev1YUqnfucgInNPDq2Jf8eTQw3TKaszo2DCjDffCsEgM09Tym143Bd6
+AsMuqAStsE3IEC7pnmh95l29/7mh4OuG5cp5JUx0Pi5PkuJ6ywA8P1rM1MB9Zf52
+NGJCo1pnPwKBgQCx/n4i+uDYo1DLd/dN2UmdvGwaaJjR3ohMVuQcGcSzaGg82u0W
+0lvtWOnYjVSIeXIBjHaFjW1hd1lSFdWms96AO9z3MHZf6NJWh0tdZNnAXqzMlBFz
+OIbdxJ/Y0OBFtA9FIesFmL7G54GWLr+f49Ry3Jr9jmYJ8au0BRqsux07aQKBgC4q
+CT2KyCMCO/z6XjAGc71hres/UlYIUI3ZZvfqYPfxRLNxO4FOVqq9UEajMomyJKSE
+3WtO5F3YAXRmZnskPKXvHZPdzqbaLGJykD298h7PewSzrPM7WpM1yD9ETPFoOTGy
+CrcYiYlkEpxEh5GqT8k1JjjkXLVG18zKgGoXocedAoGAQyU2DCNfxwzIJfFHKZEG
+zpni72cR68Tu3AhW/38vMR2ZPca4KzXrUA52T+j7vkQC38LHm/mzNXNP7Vya0PJ3
+WoYOcLtg2uFPh0P/35ArEzuNooLsvulgg1jsamPbF8KAvJZKZHr30hlC/JGYSBbV
+bnkzJTShsKzHIUiLtQ8Ja+E=
+-----END PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+MIIDezCCAmOgAwIBAgIJAJ39xapQo0vLMA0GCSqGSIb3DQEBBQUAMFMxCzAJBgNV
+BAYTAkRFMRMwEQYDVQQIDApTb21lLVN0YXRlMRswGQYDVQQKDBJBUFQgVGVzdGNh
+c2VzIEdtYkgxEjAQBgNVBAMMCWxvY2FsaG9zdDAgFw0xMzA5MTYwODQ4MzVaGA80
+NzUxMDgxMzA4NDgzNVowUzELMAkGA1UEBhMCREUxEzARBgNVBAgMClNvbWUtU3Rh
+dGUxGzAZBgNVBAoMEkFQVCBUZXN0Y2FzZXMgR21iSDESMBAGA1UEAwwJbG9jYWxo
+b3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAreEdUNqGBerrS9fR
+gYZ5R1vC9gSOz0RVoHv2aaiGVrGhXG99BVfOmeml12ZoHxCdvNeGWWA9SCngnibC
+aZ7OweL2Htb+uK/feWTQUAACiGIyApCmTgYDqYVfgoQX6wnLVV4Hy2zD+ogXRydN
+sB80ggnWZtLHVZfbQeZfzsiVPDG+Cgd27QYX2X2NjOpVPhTo3F7NSznblK7+yn2f
+gxGpb1RpKJi7R7Q9Km9r5Kha041QpM4lFVoYcRRX5bdPKENNQpcaZfrr+6zkKI7Z
+CdS6zLr+4j32mf896i4hcWWBtQQhhMEzigrSaOm4Bc14jd6u0ORRZZr/OdcdiQ5/
+Au0JuwIDAQABo1AwTjAdBgNVHQ4EFgQUhd26E7ykEYRTDbgMzkYtFtENhSkwHwYD
+VR0jBBgwFoAUhd26E7ykEYRTDbgMzkYtFtENhSkwDAYDVR0TBAUwAwEB/zANBgkq
+hkiG9w0BAQUFAAOCAQEAWcyMKi0Vc4beGV7w4Qft0/2P68jjMlQRdgkz+gGXbMVr
+//KhqR3PbgFmHHpUsZ718AHeerNNdfFzOUptiAiOqH2muyAGdeWCxJ8KcU0sic8x
+/h3TOzMYfEozhgMSJp9YW1z655uHcb15S7jb4zZwXwGyQzxwXT35SKj2mCqSbjIb
+G987DGI+MtyoGRXhIwnBEsGTI1ck3NoeXBJ/tS/Ma8gUUC2xldMSprtHjeUHvZV2
+iz/HTqGlMLGW96AVeZiFNiC1fJ6pvref2XW5MkkvQm8tOi2cSrwJc9CgnCpCxkLp
+liRsbwAduwkA26XzEomMR7yyYS5pm0Eu0cO9X39FKQ==
+-----END CERTIFICATE-----
diff --git a/test/integration/framework b/test/integration/framework
index 7dd7c20a7..20f3487cc 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -88,11 +88,11 @@ msgdone() {
runapt() {
msgdebug "Executing: ${CCMD}$*${CDEBUG} "
if [ -f ./aptconfig.conf ]; then
- APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
- elif [ -f ../aptconfig.conf ]; then
- APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
+ MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
+ elif [ -f ../aptconfig.conf ]; then
+ MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
else
- LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
+ MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
fi
}
aptconfig() { runapt apt-config $*; }
@@ -116,7 +116,7 @@ aptitude() {
}
gdb() {
echo "gdb: run »$*«"
- APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which gdb) ${BUILDDIRECTORY}/$1
+ APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which gdb) ${BUILDDIRECTORY}/$1 --args $*
}
http() {
LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/methods/http
@@ -131,13 +131,23 @@ exitwithstatus() {
exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255));
}
+shellsetedetector() {
+ local exit_status=$?
+ if [ "$exit_status" != '0' ]; then
+ echo >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}"
+ if [ "$EXIT_CODE" = '0' ]; then
+ EXIT_CODE="$exit_status"
+ fi
+ fi
+}
+
addtrap() {
if [ "$1" = 'prefix' ]; then
CURRENTTRAP="$2 $CURRENTTRAP"
else
CURRENTTRAP="$CURRENTTRAP $1"
fi
- trap "$CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+ trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
}
setupenvironment() {
@@ -177,13 +187,14 @@ setupenvironment() {
echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
- if ! $(which dpkg) --assert-multi-arch 2>&1 > /dev/null; then
+ if ! $(which dpkg) --assert-multi-arch >/dev/null 2>&1; then
echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it…
fi
echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
echo 'quiet::NoUpdate "true";' >> aptconfig.conf
export LC_ALL=C
export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
+ configcompression '.' 'gz' #'bz2' 'lzma' 'xz'
msgdone "info"
}
@@ -205,14 +216,13 @@ getarchitectures() {
}
configarchitecture() {
- local CONFFILE=rootdir/etc/apt/apt.conf.d/01multiarch.conf
- rm -f $CONFFILE
- echo "APT::Architecture \"$(getarchitecture $1)\";" > $CONFFILE
- shift
- while [ -n "$1" ]; do
- echo "APT::Architectures:: \"$(getarchitecture $1)\";" >> $CONFFILE
- shift
- done
+ {
+ echo "APT::Architecture \"$(getarchitecture $1)\";"
+ while [ -n "$1" ]; do
+ echo "APT::Architectures:: \"$(getarchitecture $1)\";"
+ shift
+ done
+ } >rootdir/etc/apt/apt.conf.d/01multiarch.conf
configdpkg
}
@@ -225,12 +235,19 @@ configdpkg() {
echo -n > rootdir/var/lib/dpkg/status
fi
fi
- if $(which dpkg) --assert-multi-arch 2>&1 > /dev/null; then
+ rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
+ if $(which dpkg) --assert-multi-arch >/dev/null 2>&1; then
local ARCHS="$(getarchitectures)"
if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
DPKGARCH="$(dpkg --print-architecture)"
for ARCH in ${ARCHS}; do
- if [ "${ARCH}" != "${DPKGARCH}" ]; then dpkg --add-architecture ${ARCH}; fi
+ if [ "${ARCH}" != "${DPKGARCH}" ]; then
+ if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then
+ # old-style used e.g. in Ubuntu-P – and as it seems travis
+ echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
+ echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
+ fi
+ fi
done
if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
# dpkg doesn't really check the version as long as it is fully installed,
@@ -241,13 +258,31 @@ configdpkg() {
fi
}
+configcompression() {
+ while [ -n "$1" ]; do
+ case "$1" in
+ '.') echo ".\t.\tcat";;
+ 'gz') echo "gzip\tgz\tgzip";;
+ 'bz2') echo "bzip2\tbz2\tbzip2";;
+ 'lzma') echo "lzma\tlzma\txz --format=lzma";;
+ 'xz') echo "xz\txz\txz";;
+ *) echo "$1\t$1\t$1";;
+ esac
+ shift
+ done > ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf
+}
+
setupsimplenativepackage() {
local NAME="$1"
local ARCH="$2"
local VERSION="$3"
local RELEASE="${4:-unstable}"
local DEPENDENCIES="$5"
- local DESCRIPTION="$6"
+ local DESCRIPTION="${6:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ If you find such a package installed on your system,
+ something went horribly wrong! They are autogenerated
+ und used only by testcases and surf no other propose…"}"
+
local SECTION="${7:-others}"
local DISTSECTION
if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
@@ -279,14 +314,8 @@ Package: $NAME" > debian/control
echo "Architecture: any" >> debian/control
fi
test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian/control
- if [ -z "$DESCRIPTION" ]; then
- echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
- If you find such a package installed on your system,
- YOU did something horribly wrong! They are autogenerated
- und used only by testcases for APT and surf no other propose…" >> debian/control
- else
- echo "Description: $DESCRIPTION" >> debian/control
- fi
+ echo "Description: $DESCRIPTION" >> debian/control
+
test -e debian/compat || echo "7" > debian/compat
test -e debian/source/format || echo "3.0 (native)" > debian/source/format
test -e debian/rules || cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules
@@ -299,9 +328,14 @@ buildsimplenativepackage() {
local VERSION="$3"
local RELEASE="${4:-unstable}"
local DEPENDENCIES="$5"
- local DESCRIPTION="$6"
+ local DESCRIPTION="${6:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ If you find such a package installed on your system,
+ something went horribly wrong! They are autogenerated
+ und used only by testcases and surf no other propose…"}"
+
local SECTION="${7:-others}"
local PRIORITY="${8:-optional}"
+ local FILE_TREE="$9"
local DISTSECTION
if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
DISTSECTION="main"
@@ -339,14 +373,7 @@ Package: $NAME" >> ${BUILDDIR}/debian/control
fi
local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')"
test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control
- if [ -z "$DESCRIPTION" ]; then
- echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
- If you find such a package installed on your system,
- YOU did something horribly wrong! They are autogenerated
- und used only by testcases for APT and surf no other propose…" >> ${BUILDDIR}/debian/control
- else
- echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control
- fi
+ echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control
echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
(cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' \
@@ -365,9 +392,12 @@ Package: $NAME" >> ${BUILDDIR}/debian/control
mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}
cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}
+ if [ -n "$FILE_TREE" ]; then
+ cp -ar "$FILE_TREE" ${BUILDDIR}/debian/tmp
+ fi
+
(cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch)
(cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
-
dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. 2> /dev/null > /dev/null
echo "pool/${NAME}_${VERSION}_${arch}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist
done
@@ -411,6 +441,8 @@ buildaptarchive() {
}
createaptftparchiveconfig() {
+ local COMPRESSORS="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')"
+ COMPRESSORS="${COMPRESSORS%* }"
local ARCHS="$(find pool/ -name '*.deb' | grep -oE '_[a-z0-9-]+\.deb$' | sort | uniq | sed -e '/^_all.deb$/ d' -e 's#^_\([a-z0-9-]*\)\.deb$#\1#' | tr '\n' ' ')"
if [ -z "$ARCHS" ]; then
# the pool is empty, so we will operate on faked packages - let us use the configured archs
@@ -428,10 +460,10 @@ createaptftparchiveconfig() {
echo -n '";
};
Default {
- Packages::Compress ". gzip bzip2 lzma xz";
- Sources::Compress ". gzip bzip2 lzma xz";
- Contents::Compress ". gzip bzip2 lzma xz";
- Translation::Compress ". gzip bzip2 lzma xz";
+ Packages::Compress "'"$COMPRESSORS"'";
+ Sources::Compress "'"$COMPRESSORS"'";
+ Contents::Compress "'"$COMPRESSORS"'";
+ Translation::Compress "'"$COMPRESSORS"'";
LongDescription "false";
};
TreeDefault {
@@ -493,7 +525,10 @@ insertpackage() {
local VERSION="$4"
local DEPENDENCIES="$5"
local PRIORITY="${6:-optional}"
- local DESCRIPTION="${7}"
+ local DESCRIPTION="${7:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ If you find such a package installed on your system,
+ something went horribly wrong! They are autogenerated
+ und used only by testcases and surf no other propose…"}"
local ARCHS=""
for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
if [ "$arch" = 'all' -o "$arch" = 'none' ]; then
@@ -515,15 +550,7 @@ Maintainer: Joe Sixpack <joe@example.org>" >> $FILE
echo "Version: $VERSION
Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE
test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
- echo -n 'Description: ' >> $FILE
- if [ -z "$DESCRIPTION" ]; then
- echo "an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
- If you find such a package installed on your system,
- YOU did something horribly wrong! They are autogenerated
- und used only by testcases for APT and surf no other propose…" >> $FILE
- else
- echo "$DESCRIPTION" >> $FILE
- fi
+ echo "Description: $DESCRIPTION" >> $FILE
echo >> $FILE
done
done
@@ -558,6 +585,11 @@ insertinstalledpackage() {
local DEPENDENCIES="$4"
local PRIORITY="${5:-optional}"
local STATUS="${6:-install ok installed}"
+ local DESCRIPTION="${7:-"Description: an autogenerated dummy ${NAME}=${VERSION}/installed
+ If you find such a package installed on your system,
+ something went horribly wrong! They are autogenerated
+ und used only by testcases and surf no other propose…"}"
+
local FILE='rootdir/var/lib/dpkg/status'
local INFO='rootdir/var/lib/dpkg/info'
for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
@@ -570,11 +602,8 @@ Maintainer: Joe Sixpack <joe@example.org>
Version: $VERSION" >> $FILE
test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE
test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
- echo "Description: an autogenerated dummy ${NAME}=${VERSION}/installed
- If you find such a package installed on your system,
- YOU did something horribly wrong! They are autogenerated
- und used only by testcases for APT and surf no other propose…
-" >> $FILE
+ echo "Description: $DESCRIPTION" >> $FILE
+ echo >> $FILE
if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then
echo -n > ${INFO}/${NAME}:${arch}.list
else
@@ -601,18 +630,27 @@ buildaptarchivefromfiles() {
msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…"
find aptarchive -name 'Packages' -o -name 'Sources' | while read line; do
msgninfo "\t${line} file… "
- cat ${line} | gzip > ${line}.gz
- cat ${line} | bzip2 > ${line}.bz2
- cat ${line} | xz --format=lzma > ${line}.lzma
- cat ${line} | xz > ${line}.xz
- if [ -n "$1" ]; then
- touch -d "$1" ${line}.gz ${line}.bz2 ${line}.lzma ${line}.xz
- fi
+ compressfile "$line" "$1"
msgdone "info"
done
generatereleasefiles "$@"
}
+compressfile() {
+ cat ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | while read compressor extension command; do
+ if [ "$compressor" = '.' ]; then
+ if [ -n "$2" ]; then
+ touch -d "$2" "$1"
+ fi
+ continue
+ fi
+ cat "$1" | $command > "${1}.${extension}"
+ if [ -n "$2" ]; then
+ touch -d "$2" "${1}.${extension}"
+ fi
+ done
+}
+
# can be overridden by testcases for their pleasure
getcodenamefromsuite() { echo -n "$1"; }
getreleaseversionfromsuite() { true; }
@@ -711,25 +749,55 @@ setupaptarchive() {
signreleasefiles() {
local SIGNER="${1:-Joe Sixpack}"
+ local GPG="gpg --batch --yes --no-default-keyring --trustdb-name rootdir/etc/apt/trustdb.gpg"
msgninfo "\tSign archive with $SIGNER key… "
- local SECKEYS=""
+ local REXKEY='keys/rexexpired'
+ local SECEXPIREBAK="${REXKEY}.sec.bak"
+ local PUBEXPIREBAK="${REXKEY}.pub.bak"
+ if [ "${SIGNER}" = 'Rex Expired' ]; then
+ # the key is expired, so gpg doesn't allow to sign with and the --faked-system-time
+ # option doesn't exist anymore (and using faketime would add a new obscure dependency)
+ # therefore we 'temporary' make the key not expired and restore a backup after signing
+ cp ${REXKEY}.sec $SECEXPIREBAK
+ cp ${REXKEY}.pub $PUBEXPIREBAK
+ local SECUNEXPIRED="${REXKEY}.sec.unexpired"
+ local PUBUNEXPIRED="${REXKEY}.pub.unexpired"
+ if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then
+ cp $SECUNEXPIRED ${REXKEY}.sec
+ cp $PUBUNEXPIRED ${REXKEY}.pub
+ else
+ printf "expire\n1w\nsave\n" | $GPG --keyring ${REXKEY}.pub --secret-keyring ${REXKEY}.sec --command-fd 0 --edit-key "${SIGNER}" >/dev/null 2>&1 || true
+ cp ${REXKEY}.sec $SECUNEXPIRED
+ cp ${REXKEY}.pub $PUBUNEXPIRED
+ fi
+ fi
for KEY in $(find keys/ -name '*.sec'); do
- SECKEYS="$SECKEYS --secret-keyring $KEY"
+ GPG="$GPG --secret-keyring $KEY"
done
- local PUBKEYS=""
for KEY in $(find keys/ -name '*.pub'); do
- PUBKEYS="$PUBKEYS --keyring $KEY"
+ GPG="$GPG --keyring $KEY"
done
for RELEASE in $(find aptarchive/ -name Release); do
- gpg --yes --no-default-keyring $SECKEYS $PUBKEYS --default-key "$SIGNER" -abs -o ${RELEASE}.gpg ${RELEASE}
+ $GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg ${RELEASE}
local INRELEASE="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')"
- gpg --yes --no-default-keyring $SECKEYS $PUBKEYS --default-key "$SIGNER" --clearsign -o $INRELEASE $RELEASE
+ $GPG --default-key "$SIGNER" --clearsign --output $INRELEASE $RELEASE
# we might have set a specific date for the Release file, so copy it
touch -d "$(stat --format "%y" ${RELEASE})" ${RELEASE}.gpg ${INRELEASE}
done
+ if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then
+ mv -f $SECEXPIREBAK ${REXKEY}.sec
+ mv -f $PUBEXPIREBAK ${REXKEY}.pub
+ fi
msgdone "info"
}
+rewritesourceslist() {
+ local APTARCHIVE="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive")"
+ for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
+ sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#http://localhost:4433/#${1}#"
+ done
+}
+
changetowebserver() {
local LOG='/dev/null'
if test -x ${BUILDDIRECTORY}/aptwebserver; then
@@ -741,31 +809,32 @@ changetowebserver() {
fi
addtrap "kill $PID;"
cd - > /dev/null
- elif [ $# -gt 0 ]; then
- msgdie 'Need the aptwebserver when passing arguments for the webserver'
- elif which weborf > /dev/null; then
- weborf -xb aptarchive/ >$LOG 2>&1 &
- addtrap "kill $!;"
- elif which gatling > /dev/null; then
- cd aptarchive
- gatling -p 8080 -F -S >$LOG 2>&1 &
- addtrap "kill $!;"
- cd - > /dev/null
- elif which lighttpd > /dev/null; then
- echo "server.document-root = \"$(readlink -f ./aptarchive)\"
-server.port = 8080
-server.stat-cache-engine = \"disable\"" > lighttpd.conf
- lighttpd -t -f lighttpd.conf >/dev/null || msgdie 'Can not change to webserver: our lighttpd config is invalid'
- lighttpd -D -f lighttpd.conf >$LOG 2>&1 &
- addtrap "kill $!;"
else
msgdie 'You have to build aptwerbserver or install a webserver'
fi
- local APTARCHIVE="file://$(readlink -f ./aptarchive)"
- for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
- sed -i $LIST -e "s#$APTARCHIVE#http://localhost:8080/#"
- done
- return 0
+ if [ "$1" != '--no-rewrite' ]; then
+ rewritesourceslist 'http://localhost:8080/'
+ fi
+}
+
+changetohttpswebserver() {
+ if ! which stunnel4 >/dev/null; then
+ msgdie 'You need to install stunnel4 for https testcases'
+ fi
+ if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then
+ changetowebserver --no-rewrite
+ fi
+ echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid
+cert = ${TESTDIRECTORY}/apt.pem
+
+[https]
+accept = 4433
+connect = 8080
+" > ${TMPWORKINGDIRECTORY}/stunnel.conf
+ stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf"
+ local PID="$(cat ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid)"
+ addtrap 'prefix' "kill ${PID};"
+ rewritesourceslist 'https://localhost:4433/'
}
changetocdrom() {
@@ -783,6 +852,46 @@ changetocdrom() {
find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete
}
+downloadfile() {
+ PROTO="$(echo "$1" | cut -d':' -f 1)"
+ local DOWNLOG="${TMPWORKINGDIRECTORY}/download.log"
+ rm -f "$DOWNLOG"
+ touch "$DOWNLOG"
+ {
+ echo "601 Configuration
+Config-Item: Acquire::https::CaInfo=${TESTDIR}/apt.pem
+Config-Item: Debug::Acquire::${PROTO}=1
+
+600 Acquire URI
+URI: $1
+Filename: ${2}
+"
+ # simple worker keeping stdin open until we are done (201) or error (400)
+ # and requesting new URIs on try-agains/redirects inbetween
+ { tail -n 999 -f "$DOWNLOG" & echo "TAILPID: $!"; } | while read f1 f2; do
+ if [ "$f1" = 'TAILPID:' ]; then
+ TAILPID="$f2"
+ elif [ "$f1" = 'New-URI:' ]; then
+ echo "600 Acquire URI
+URI: $f2
+Filename: ${2}
+"
+ elif [ "$f1" = '201' ] || [ "$f1" = '400' ]; then
+ # tail would only die on next read – which never happens
+ test -z "$TAILPID" || kill -s HUP "$TAILPID"
+ break
+ fi
+ done
+ } | LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/methods/${PROTO} 2>&1 | tee "$DOWNLOG"
+ rm "$DOWNLOG"
+ # only if the file exists the download was successful
+ if [ -e "$2" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
checkdiff() {
local DIFFTEXT="$($(which diff) -u $* | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')"
if [ -n "$DIFFTEXT" ]; then
@@ -828,7 +937,7 @@ testequalor2() {
echo "$2" > $COMPAREFILE2
shift 2
msgtest "Test for equality OR of" "$*"
- $* 2>&1 1> $COMPAREAGAINST
+ $* >$COMPAREAGAINST 2>&1 || true
(checkdiff $COMPAREFILE1 $COMPAREAGAINST 1> /dev/null ||
checkdiff $COMPAREFILE2 $COMPAREAGAINST 1> /dev/null) && msgpass ||
( echo "\n${CINFO}Diff against OR 1${CNORMAL}" "$(checkdiff $COMPAREFILE1 $COMPAREAGAINST)" \
@@ -905,6 +1014,40 @@ testmarkedauto() {
aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
}
+testsuccess() {
+ if [ "$1" = '--nomsg' ]; then
+ shift
+ else
+ msgtest 'Test for successful execution of' "$*"
+ fi
+ local OUTPUT=$(mktemp)
+ addtrap "rm $OUTPUT;"
+ if $@ >${OUTPUT} 2>&1; then
+ msgpass
+ else
+ echo
+ cat $OUTPUT
+ msgfail
+ fi
+}
+
+testfailure() {
+ if [ "$1" = '--nomsg' ]; then
+ shift
+ else
+ msgtest 'Test for failure in execution of' "$*"
+ fi
+ local OUTPUT=$(mktemp)
+ addtrap "rm $OUTPUT;"
+ if $@ >${OUTPUT} 2>&1; then
+ echo
+ cat $OUTPUT
+ msgfail
+ else
+ msgpass
+ fi
+}
+
pause() {
echo "STOPPED execution. Press enter to continue"
local IGNORE
diff --git a/test/integration/rexexpired.pub b/test/integration/rexexpired.pub
new file mode 100644
index 000000000..5ab2e489a
--- /dev/null
+++ b/test/integration/rexexpired.pub
Binary files differ
diff --git a/test/integration/rexexpired.sec b/test/integration/rexexpired.sec
new file mode 100644
index 000000000..dc00168cd
--- /dev/null
+++ b/test/integration/rexexpired.sec
Binary files differ
diff --git a/test/integration/skip-avoid-avoiding-breaks-predepends b/test/integration/skip-avoid-avoiding-breaks-predepends
index a47e8bc2b..ed231bc3f 100755
--- a/test/integration/skip-avoid-avoiding-breaks-predepends
+++ b/test/integration/skip-avoid-avoiding-breaks-predepends
@@ -17,5 +17,5 @@ Pre-Depends: looping (>= 1.15)'
setupaptarchive
-aptget dist-upgrade -y -o Debug::pkgOrderList=1 #-qq 2>&1 > /dev/null
+aptget dist-upgrade -y -o Debug::pkgOrderList=1 #-qq >/dev/null 2>&1
testdpkginstalled looping loop1 loop2
diff --git a/test/integration/test-bug-601016-description-translation b/test/integration/skip-bug-601016-description-translation
index 33c209e9d..33c209e9d 100755
--- a/test/integration/test-bug-601016-description-translation
+++ b/test/integration/skip-bug-601016-description-translation
diff --git a/test/integration/status-bug-723705-tagfile-truncates-fields b/test/integration/status-bug-723705-tagfile-truncates-fields
new file mode 100644
index 000000000..fe18506c8
--- /dev/null
+++ b/test/integration/status-bug-723705-tagfile-truncates-fields
@@ -0,0 +1,62 @@
+Package: libc6
+Status: install ok installed
+Priority: required
+Section: libs
+Installed-Size: 10164
+Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
+Architecture: amd64
+Multi-Arch: same
+Source: eglibc (2.17-92)
+Version: 2.17-92+b1
+Replaces: libc6-amd64
+Provides: glibc-2.17-1
+Suggests: glibc-doc, debconf | debconf-2.0, locales
+Breaks: locales (<< 2.17), locales-all (<< 2.17), lsb-core (<= 3.2-27), nscd (<< 2.17)
+Conflicts: prelink (<= 0.0.20090311-1), tzdata (<< 2007k-1), tzdata-etch
+Conffiles:
+ /etc/ld.so.conf.d/x86_64-linux-gnu.conf 593ad12389ab2b6f952e7ede67b8fbbf
+Description: Embedded GNU C Library: Shared libraries
+ Contains the standard libraries that are used by nearly all programs on
+ the system. This package includes shared versions of the standard C library
+ and the standard math library, as well as many others.
+Homepage: http://www.eglibc.org
+
+Package: libnewt0.52
+Status: install ok installed
+Priority: important
+Section: libs
+Installed-Size: 820
+Maintainer: Alastair McKinstry <mckinstry@debian.org>
+Architecture: amd64
+Multi-Arch: same
+Source: newt
+Version: 0.52.15-3
+Recommends: libfribidi0
+Conffiles:
+ /etc/newt/palette.original d41d8cd98f00b204e9800998ecf8427e
+Description: Not Erik's Windowing Toolkit - text mode windowing with slang
+ Newt is a windowing toolkit for text mode built from the slang library.
+ It allows color text mode applications to easily use stackable windows,
+ push buttons, check boxes, radio buttons, lists, entry fields, labels,
+ and displayable text. Scrollbars are supported, and forms may be nested
+ to provide extra functionality. This package contains the shared library
+ for programs that have been built with newt.
+Homepage: https://fedorahosted.org/newt/
+
+Package: libgcc1
+Status: install ok installed
+Priority: required
+Section: libs
+Installed-Size: 128
+Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
+Architecture: amd64
+Multi-Arch: same
+Source: gcc-4.8 (4.8.1-10)
+Version: 1:4.8.1-10
+Breaks: gcc-4.1, gcc-4.3 (<< 4.3.6-1), gcc-4.4 (<< 4.4.6-4), gcc-4.5 (<< 4.5.3-2)
+Description: GCC support library
+ Shared version of the support library, a library of internal subroutines
+ that GCC uses to overcome shortcomings of particular machines, or
+ special needs for some languages.
+Homepage: http://gcc.gnu.org/
+
diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom
index 6e3533152..cc3483f9b 100755
--- a/test/integration/test-apt-cdrom
+++ b/test/integration/test-apt-cdrom
@@ -18,10 +18,7 @@ echo 'Description-de: automatisch generiertes Testpaket testing=0.8.15/stable
Diese Pakete sind nur für das testen von APT gedacht,
sie erfüllen keinen Zweck auf einem normalen System…
' >> Translation-de
-cat Translation-de | gzip > Translation-de.gz
-cat Translation-de | bzip2 > Translation-de.bz2
-cat Translation-de | xz --format=lzma > Translation-de.lzma
-cat Translation-de | xz > Translation-de.xz
+compressfile Translation-de
rm Translation-en Translation-de
cd - > /dev/null
addtrap 'prefix' "chmod -R +w $PWD/rootdir/media/cdrom/dists/;"
@@ -102,5 +99,5 @@ aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' &&
# check that we really can install from a 'cdrom'
testdpkgnotinstalled testing
-aptget install testing -y > /dev/null 2>&1
+testsuccess aptget install testing -y
testdpkginstalled testing
diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove
index c25ce3f58..68ea1c574 100755
--- a/test/integration/test-apt-get-autoremove
+++ b/test/integration/test-apt-get-autoremove
@@ -11,11 +11,11 @@ buildsimplenativepackage 'po-debconf' 'all' '1.0.16' 'unstable'
buildsimplenativepackage 'debhelper' 'all' '8.0.0' 'unstable' 'Depends: po-debconf'
setupaptarchive
-aptget install unrelated debhelper -qq 2>&1 > /dev/null
+testsuccess aptget install unrelated debhelper -y
testdpkginstalled 'unrelated' 'debhelper' 'po-debconf'
testmarkedauto 'po-debconf'
-aptget remove debhelper -y -qq 2>&1 > /dev/null
+testsuccess aptget remove debhelper -y
testdpkgnotinstalled 'debhelper'
testdpkginstalled 'po-debconf' 'unrelated'
@@ -30,15 +30,15 @@ Remv po-debconf [1.0.16]' aptget autoremove -s
testdpkginstalled 'po-debconf'
echo 'APT::NeverAutoRemove { "^po-debconf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
-aptget autoremove -y -qq 2>&1 > /dev/null
+testsuccess aptget autoremove -y
testdpkginstalled 'po-debconf'
echo 'APT::NeverAutoRemove { "^po-.*$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
-aptget autoremove -y -qq 2>&1 > /dev/null
+testsuccess aptget autoremove -y
testdpkginstalled "po-debconf"
rm rootdir/etc/apt/apt.conf.d/00autoremove
-aptget autoremove -y -qq 2>&1 > /dev/null
+testsuccess aptget autoremove -y
testdpkgnotinstalled 'po-debconf'
testmarkedauto
@@ -49,3 +49,23 @@ Install: unrelated:i386 (1), debhelper:i386 (8.0.0), po-debconf:i386 (1.0.16, au
Remove: debhelper:i386 (8.0.0)
Remove: po-debconf:i386 (1.0.16)'
+
+testsuccess aptget install debhelper -y
+testdpkginstalled 'unrelated' 'debhelper' 'po-debconf'
+testsuccess aptmark auto debhelper
+
+testmarkedauto 'debhelper' 'po-debconf'
+testequal 'Reading package lists...
+Building dependency tree...
+Reading state information...
+The following packages will be REMOVED:
+ debhelper po-debconf
+0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
+Remv debhelper [8.0.0]
+Remv po-debconf [1.0.16]' aptget autoremove -s
+
+testsuccess aptmark hold debhelper
+testequal 'Reading package lists...
+Building dependency tree...
+Reading state information...
+0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget autoremove -s
diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download
index 420b2e380..6eac079f3 100755
--- a/test/integration/test-apt-get-download
+++ b/test/integration/test-apt-get-download
@@ -20,13 +20,14 @@ testdownload() {
fi
msgtest "Test download of package file $1 with" "$APT"
aptget -qq download ${APT} && test -f $1 && msgpass || msgfail
+ rm $1
}
testdownload apt_1.0_all.deb apt stable
testdownload apt_2.0_all.deb apt
DEBFILE="$(readlink -f aptarchive)/pool/apt_2.0_all.deb"
-testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) sha512:$(sha512sum $DEBFILE | cut -d' ' -f 1)" aptget download apt --print-uris
+testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) SHA512:$(sha512sum $DEBFILE | cut -d' ' -f 1)" aptget download apt --print-uris
# deb:677887
testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms
diff --git a/test/integration/test-apt-get-upgrade b/test/integration/test-apt-get-upgrade
new file mode 100755
index 000000000..23446299c
--- /dev/null
+++ b/test/integration/test-apt-get-upgrade
@@ -0,0 +1,78 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+# simple case
+insertpackage 'stable' 'upgrade-simple' 'all' '1.0'
+insertpackage 'unstable' 'upgrade-simple' 'all' '2.0'
+insertinstalledpackage 'upgrade-simple' 'all' '1.0'
+
+# upgrade with a new dependency
+insertpackage 'stable' 'upgrade-with-new-dep' 'all' '1.0'
+insertpackage 'unstable' 'upgrade-with-new-dep' 'all' '2.0' 'Depends: new-dep'
+insertpackage 'stable' 'new-dep' 'all' '1.0'
+insertinstalledpackage 'upgrade-with-new-dep' 'all' '1.0'
+
+# upgrade with conflict and a new pkg with higher priority than conflict
+insertpackage 'stable' 'upgrade-with-conflict' 'all' '1.0'
+insertpackage 'unstable' 'upgrade-with-conflict' 'all' '2.0' 'Conflicts: conflicting-dep' 'standard'
+insertpackage 'stable' 'conflicting-dep' 'all' '1.0'
+insertinstalledpackage 'upgrade-with-conflict' 'all' '1.0'
+insertinstalledpackage 'conflicting-dep' 'all' '1.0'
+
+
+setupaptarchive
+
+# Test if normal upgrade works as expected
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages have been kept back:
+ upgrade-with-conflict upgrade-with-new-dep
+The following packages will be upgraded:
+ upgrade-simple
+1 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
+Inst upgrade-simple [1.0] (2.0 unstable [all])
+Conf upgrade-simple (2.0 unstable [all])' aptget -s upgrade
+
+# Test if apt-get upgrade --with-new-pkgs works
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ new-dep
+The following packages have been kept back:
+ upgrade-with-conflict
+The following packages will be upgraded:
+ upgrade-simple upgrade-with-new-dep
+2 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
+Inst new-dep (1.0 stable [all])
+Inst upgrade-simple [1.0] (2.0 unstable [all])
+Inst upgrade-with-new-dep [1.0] (2.0 unstable [all])
+Conf new-dep (1.0 stable [all])
+Conf upgrade-simple (2.0 unstable [all])
+Conf upgrade-with-new-dep (2.0 unstable [all])' aptget -s upgrade --with-new-pkgs
+
+# Test if apt-get dist-upgrade works
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+ conflicting-dep
+The following NEW packages will be installed:
+ new-dep
+The following packages will be upgraded:
+ upgrade-simple upgrade-with-conflict upgrade-with-new-dep
+3 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv conflicting-dep [1.0]
+Inst upgrade-with-conflict [1.0] (2.0 unstable [all])
+Inst new-dep (1.0 stable [all])
+Inst upgrade-simple [1.0] (2.0 unstable [all])
+Inst upgrade-with-new-dep [1.0] (2.0 unstable [all])
+Conf upgrade-with-conflict (2.0 unstable [all])
+Conf new-dep (1.0 stable [all])
+Conf upgrade-simple (2.0 unstable [all])
+Conf upgrade-with-new-dep (2.0 unstable [all])' aptget -s dist-upgrade
+
diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key
new file mode 100755
index 000000000..68b3f9710
--- /dev/null
+++ b/test/integration/test-apt-key
@@ -0,0 +1,107 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64'
+
+msgtest 'Check that paths in list output are not' 'double-slashed'
+aptkey list 2>&1 | grep -q '//' && msgfail || msgpass
+
+msgtest 'Check that paths in finger output are not' 'double-slashed'
+aptkey finger 2>&1 | grep -q '//' && msgfail || msgpass
+
+echo 'APT::Key::ArchiveKeyring "./keys/joesixpack.pub";
+APT::Key::RemovedKeys "./keys/rexexpired.pub";' > rootdir/etc/apt/apt.conf.d/aptkey.conf
+
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18'
+
+testequal 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed
+gpg: Total number processed: 1
+gpg: unchanged: 1' aptkey --fakeroot update
+
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18'
+
+testsuccess aptkey --fakeroot add ./keys/rexexpired.pub
+
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13]
+pub 2048R/DBAC8DAE 2010-08-18'
+
+msgtest 'Execute update again to trigger removal of' 'Rex Expired key'
+testsuccess --nomsg aptkey --fakeroot update
+
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18'
+
+msgtest "Try to remove a key which exists, but isn't in the" 'forced keyring'
+testsuccess --nomsg aptkey --fakeroot --keyring rootdir/etc/apt/trusted.gpg del DBAC8DAE
+
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18'
+
+testsuccess aptkey --fakeroot del DBAC8DAE
+testempty aptkey list
+
+# start from a clean plate again
+cleanplate() {
+ rm -rf rootdir/etc/apt/trusted.gpg.d/ rootdir/etc/apt/trusted.gpg
+ mkdir rootdir/etc/apt/trusted.gpg.d/
+}
+
+msgtest 'Test key removal with' 'single key in real file'
+cleanplate
+cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
+testempty aptkey list
+testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~
+
+msgtest 'Test key removal with' 'single key in softlink'
+cleanplate
+ln -s $(readlink -f ./keys/joesixpack.pub) rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
+testempty aptkey list
+testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+testsuccess test -L rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~
+
+cleanplate
+testsuccess aptkey --fakeroot add ./keys/joesixpack.pub
+testsuccess aptkey --fakeroot add ./keys/marvinparanoid.pub
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18
+pub 2048R/528144E2 2011-01-16'
+cp -a rootdir/etc/apt/trusted.gpg keys/testcase-multikey.pub # store for reuse
+
+msgtest 'Test key removal with' 'multi key in real file'
+cleanplate
+cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg
+testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16'
+testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~
+
+msgtest 'Test key removal with' 'multi key in softlink'
+cleanplate
+ln -s $(readlink -f ./keys/testcase-multikey.pub) rootdir/etc/apt/trusted.gpg.d/multikey.gpg
+testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16'
+testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~
+testsuccess test ! -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg
+testsuccess test -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg~
+
+msgtest 'Test key removal with' 'multiple files including key'
+cleanplate
+cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg
+testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16'
+testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~
+testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~
diff --git a/test/integration/test-apt-progress-fd b/test/integration/test-apt-progress-fd
new file mode 100755
index 000000000..5f73c8f8c
--- /dev/null
+++ b/test/integration/test-apt-progress-fd
@@ -0,0 +1,71 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+buildsimplenativepackage 'testing' 'amd64' '0.1' 'stable'
+buildsimplenativepackage 'testing' 'amd64' '0.8.15' 'stable'
+buildsimplenativepackage 'testing2' 'amd64,i386' '0.8.15' 'stable'
+setupaptarchive
+
+# install native
+exec 3> apt-progress.log
+testsuccess aptget install testing=0.1 -y -o APT::Status-Fd=3
+testequal "dlstatus:1:0:Retrieving file 1 of 1
+dlstatus:1:0:Retrieving file 1 of 1
+pmstatus:dpkg-exec:0:Running dpkg
+pmstatus:testing:0:Installing testing
+pmstatus:testing:20:Preparing testing
+pmstatus:testing:40:Unpacking testing
+pmstatus:testing:60:Preparing to configure testing
+pmstatus:dpkg-exec:60:Running dpkg
+pmstatus:testing:60:Configuring testing
+pmstatus:testing:80:Configuring testing
+pmstatus:testing:100:Installed testing" cat apt-progress.log
+
+# upgrade
+exec 3> apt-progress.log
+testsuccess aptget install testing=0.8.15 -y -o APT::Status-Fd=3
+testequal "dlstatus:1:0:Retrieving file 1 of 1
+dlstatus:1:0:Retrieving file 1 of 1
+pmstatus:dpkg-exec:0:Running dpkg
+pmstatus:testing:20:Preparing testing
+pmstatus:testing:40:Unpacking testing
+pmstatus:testing:60:Preparing to configure testing
+pmstatus:dpkg-exec:60:Running dpkg
+pmstatus:testing:60:Configuring testing
+pmstatus:testing:80:Configuring testing
+pmstatus:testing:100:Installed testing" cat apt-progress.log
+
+# and remove
+exec 3> apt-progress.log
+testsuccess aptget remove testing -y -o APT::Status-Fd=3
+testequal "pmstatus:dpkg-exec:0:Running dpkg
+pmstatus:testing:0:Removing testing
+pmstatus:testing:33.3333:Preparing for removal of testing
+pmstatus:testing:66.6667:Removing testing
+pmstatus:testing:100:Removed testing" cat apt-progress.log
+
+
+# install non-native and ensure we get proper progress info
+exec 3> apt-progress.log
+testsuccess aptget install testing2:i386 -y -o APT::Status-Fd=3
+
+# and compare
+testequal "dlstatus:1:0:Retrieving file 1 of 1
+dlstatus:1:0:Retrieving file 1 of 1
+pmstatus:dpkg-exec:0:Running dpkg
+pmstatus:testing2:0:Installing testing2
+pmstatus:testing2:20:Preparing testing2
+pmstatus:testing2:40:Unpacking testing2
+pmstatus:testing2:60:Preparing to configure testing2
+pmstatus:dpkg-exec:60:Running dpkg
+pmstatus:testing2:60:Configuring testing2
+pmstatus:testing2:80:Configuring testing2
+pmstatus:testing2:100:Installed testing2" cat apt-progress.log
+
+rm -f apt-progress*.log \ No newline at end of file
diff --git a/test/integration/test-apt-progress-fd-error b/test/integration/test-apt-progress-fd-error
new file mode 100755
index 000000000..96d66371a
--- /dev/null
+++ b/test/integration/test-apt-progress-fd-error
@@ -0,0 +1,22 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+mkdir -p usr/bin
+touch usr/bin/file-conflict
+
+buildsimplenativepackage 'foo1' 'amd64,i386' '0.8.15' 'stable' '' 'pkg with file conflicts' '' '' 'usr/'
+buildsimplenativepackage 'foo2' 'amd64,i386' '0.8.15' 'stable' '' 'pkg with file conflicts' '' '' 'usr/'
+
+setupaptarchive
+
+exec 3> apt-progress.log
+testfailure aptget install foo1 foo2 -y -o APT::Status-Fd=3
+msgtest "Ensure correct error message"
+grep -q "aptarchive/pool/foo2_0.8.15_amd64.deb :40:trying to overwrite '/usr/bin/file-conflict', which is also in package foo1 0.8.15" apt-progress.log && msgpass || (cat apt-progress.log && msgfail)
+
diff --git a/test/integration/test-apt-progress-fd-error-postinst b/test/integration/test-apt-progress-fd-error-postinst
new file mode 100755
index 000000000..0b6e70212
--- /dev/null
+++ b/test/integration/test-apt-progress-fd-error-postinst
@@ -0,0 +1,22 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+mkdir -p DEBIAN/
+echo "#!/bin/sh\nexit 1" > DEBIAN/postinst
+chmod 755 DEBIAN/postinst
+
+buildsimplenativepackage 'postinst-error' 'amd64,i386' '0.8.15' 'stable' '' 'pkg with posinst error' '' '' './DEBIAN'
+
+setupaptarchive
+
+exec 3> apt-progress.log
+testfailure aptget install postinst-error -y -o APT::Status-Fd=3
+msgtest "Ensure correct error message for postinst error"
+grep -q "pmerror:postinst-error :80:subprocess installed post-installation script returned error exit status 2" apt-progress.log && msgpass || msgfail
+
diff --git a/test/integration/test-bug-254770-segfault-if-cache-not-buildable b/test/integration/test-bug-254770-segfault-if-cache-not-buildable
index 8fa337ccc..59102ddc9 100755
--- a/test/integration/test-bug-254770-segfault-if-cache-not-buildable
+++ b/test/integration/test-bug-254770-segfault-if-cache-not-buildable
@@ -18,7 +18,7 @@ testsegfault() {
msgpass
else
echo
- echo $TEST
+ echo "$TEST"
msgfail
fi
}
diff --git a/test/integration/test-bug-407511-fail-invalid-default-release b/test/integration/test-bug-407511-fail-invalid-default-release
index 7f23a1e82..3d3b0ada3 100755
--- a/test/integration/test-bug-407511-fail-invalid-default-release
+++ b/test/integration/test-bug-407511-fail-invalid-default-release
@@ -35,14 +35,14 @@ setupaptarchive
passdist() {
msgtest 'Test that target-release is accepted' $1
- aptget dist-upgrade -t $1 -qq && msgpass || msgfail
+ testsuccess --nomsg aptget dist-upgrade -t $1
msgtest 'Test that target-release pins with' $1
aptcache policy -t $1 | grep -q ' 990' && msgpass || msgfail
}
faildist() {
msgtest 'Test that target-release is refused' $1
- aptget dist-upgrade -t $1 -qq 2> /dev/null && msgfail || msgpass
+ testfailure --nomsg aptget dist-upgrade -t $1
}
msgtest 'Test that no default-release is active in this test' 'setup'
diff --git a/test/integration/test-bug-507998-dist-upgrade-recommends b/test/integration/test-bug-507998-dist-upgrade-recommends
new file mode 100755
index 000000000..513421a94
--- /dev/null
+++ b/test/integration/test-bug-507998-dist-upgrade-recommends
@@ -0,0 +1,25 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+insertinstalledpackage 'tshark' 'amd64' '1.0.4-1' 'Depends: wireshark-common'
+insertinstalledpackage 'wireshark-common' 'amd64' '1.0.4-1' 'Recommends: wireshark (>= 1.0.4-1) | tshark (>= 1.0.4-1)'
+insertpackage 'unstable' 'tshark' 'amd64' '1.2.1-2' 'Depends: wireshark-common (= 1.2.1-2)'
+insertpackage 'unstable' 'wireshark-common' 'amd64' '1.2.1-2' 'Recommends: wireshark (>= 1.2.1-2) | tshark (>= 1.2.1-2)'
+insertpackage 'unstable' 'wireshark' 'amd64' '1.2.1-2' 'Depends: wireshark-common (= 1.2.1-2)'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be upgraded:
+ tshark wireshark-common
+2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst wireshark-common [1.0.4-1] (1.2.1-2 unstable [amd64])
+Inst tshark [1.0.4-1] (1.2.1-2 unstable [amd64])
+Conf wireshark-common (1.2.1-2 unstable [amd64])
+Conf tshark (1.2.1-2 unstable [amd64])' aptget dist-upgrade -s
diff --git a/test/integration/test-bug-543966-downgrade-below-1000-pin b/test/integration/test-bug-543966-downgrade-below-1000-pin
new file mode 100755
index 000000000..f602bea95
--- /dev/null
+++ b/test/integration/test-bug-543966-downgrade-below-1000-pin
@@ -0,0 +1,81 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'i386'
+
+insertpackage 'unstable' 'base-files' 'all' '5.0.0'
+insertinstalledpackage 'base-files' 'all' '5.0.0-1'
+
+setupaptarchive
+
+STATUS=$(readlink -f rootdir/var/lib/dpkg/status)
+APTARCHIVE="$(readlink -f aptarchive)/"
+
+testequal "base-files:
+ Installed: 5.0.0-1
+ Candidate: 5.0.0-1
+ Version table:
+ *** 5.0.0-1 0
+ 100 $STATUS
+ 5.0.0 0
+ 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=0
+
+echo 'Package: base-files
+Pin: release a=unstable
+Pin-Priority: 99' > rootdir/etc/apt/preferences
+
+testequal "base-files:
+ Installed: 5.0.0-1
+ Candidate: 5.0.0-1
+ Package pin: 5.0.0
+ Version table:
+ *** 5.0.0-1 99
+ 100 $STATUS
+ 5.0.0 99
+ 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=99
+
+echo 'Package: base-files
+Pin: release a=unstable
+Pin-Priority: 100' > rootdir/etc/apt/preferences
+
+testequal "base-files:
+ Installed: 5.0.0-1
+ Candidate: 5.0.0-1
+ Package pin: 5.0.0
+ Version table:
+ *** 5.0.0-1 100
+ 100 $STATUS
+ 5.0.0 100
+ 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=100
+
+echo 'Package: base-files
+Pin: release a=unstable
+Pin-Priority: 999' > rootdir/etc/apt/preferences
+
+testequal "base-files:
+ Installed: 5.0.0-1
+ Candidate: 5.0.0-1
+ Package pin: 5.0.0
+ Version table:
+ *** 5.0.0-1 999
+ 100 $STATUS
+ 5.0.0 999
+ 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=999
+
+echo 'Package: base-files
+Pin: release a=unstable
+Pin-Priority: 1000' > rootdir/etc/apt/preferences
+
+testequal "base-files:
+ Installed: 5.0.0-1
+ Candidate: 5.0.0
+ Package pin: 5.0.0
+ Version table:
+ *** 5.0.0-1 1000
+ 100 $STATUS
+ 5.0.0 1000
+ 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=1000
diff --git a/test/integration/test-bug-596498-trusted-unsigned-repo b/test/integration/test-bug-596498-trusted-unsigned-repo
index 6ebc4a3bb..06c9c8285 100755
--- a/test/integration/test-bug-596498-trusted-unsigned-repo
+++ b/test/integration/test-bug-596498-trusted-unsigned-repo
@@ -21,13 +21,16 @@ DEBFILE='rootdir/etc/apt/sources.list.d/apt-test-unstable-deb.list'
testequal "$PKGTEXT
Download complete and in download only mode" aptget install cool --assume-no -d
+testequal "$PKGTEXT
+Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated
+
sed -i -e 's#deb#deb [trusted=no]#' $DEBFILE
aptgetupdate
testequal "$PKGTEXT
WARNING: The following packages cannot be authenticated!
cool
-Install these packages without verification [y/N]? N
+Install these packages without verification? [y/N] N
E: Some packages could not be authenticated" aptget install cool --assume-no -d
find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
@@ -37,9 +40,15 @@ aptgetupdate
testequal "$PKGTEXT
WARNING: The following packages cannot be authenticated!
cool
-Install these packages without verification [y/N]? N
+Install these packages without verification? [y/N] N
E: Some packages could not be authenticated" aptget install cool --assume-no -d
+testequal "$PKGTEXT
+WARNING: The following packages cannot be authenticated!
+ cool
+Authentication warning overridden.
+Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated
+
sed -i -e 's#deb#deb [trusted=yes]#' $DEBFILE
aptgetupdate
diff --git a/test/integration/test-bug-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect
index c20443559..bcebb57b8 100755
--- a/test/integration/test-bug-602412-dequote-redirect
+++ b/test/integration/test-bug-602412-dequote-redirect
@@ -16,7 +16,7 @@ mv aptarchive/pool aptarchive/newpool
mv aptarchive/dists aptarchive/newdists
msgtest 'Test redirection works in' 'apt-get update'
-aptget update -qq && msgpass || msgfail
+testsuccess --nomsg aptget update
# check that I-M-S header is kept in redirections
testequal 'Hit http://localhost:8080 unstable InRelease
@@ -26,4 +26,4 @@ Hit http://localhost:8080 unstable/main Translation-en
Reading package lists...' aptget update #-o debug::pkgacquire=1 -o debug::pkgacquire::worker=1
msgtest 'Test redirection works in' 'package download'
-aptget install unrelated --download-only -qq && msgpass || msgfail
+testsuccess --nomsg aptget install unrelated --download-only -y
diff --git a/test/integration/test-bug-604222-new-and-autoremove b/test/integration/test-bug-604222-new-and-autoremove
index ea73c5775..b29347f64 100755
--- a/test/integration/test-bug-604222-new-and-autoremove
+++ b/test/integration/test-bug-604222-new-and-autoremove
@@ -8,7 +8,7 @@ configarchitecture "i386"
setupaptarchive
touch rootdir/var/lib/apt/extended_states
-aptmark markauto 'libvtk5.4'
+testsuccess aptmark markauto 'libvtk5.4'
testmarkedauto 'libvtk5.4'
testequal "Reading package lists...
diff --git a/test/integration/test-bug-604401-files-are-directories b/test/integration/test-bug-604401-files-are-directories
index aae717a19..e6913edcf 100755
--- a/test/integration/test-bug-604401-files-are-directories
+++ b/test/integration/test-bug-604401-files-are-directories
@@ -11,7 +11,7 @@ test ! -e rootdir/etc/apt/apt.conf || mv rootdir/etc/apt/apt.conf rootdir/etc/ap
msgtest "Directory instead of a file as apt.conf ignored"
mkdir -p rootdir/etc/apt/apt.conf
-aptconfig dump > /dev/null && msgpass || msgfail
+testsuccess --nomsg aptconfig dump
rmdir rootdir/etc/apt/apt.conf
msgtest "Good link instead of a file as apt.conf ignored"
@@ -22,7 +22,7 @@ rm rootdir/etc/apt/apt.conf
msgtest "Broken link instead of a file as apt.conf ignored"
ln -s /tmp/doesnt-exist rootdir/etc/apt/apt.conf
-aptconfig dump > /dev/null && msgpass || msgfail
+testsuccess --nomsg aptconfig dump
rm rootdir/etc/apt/apt.conf
@@ -30,7 +30,7 @@ test ! -e rootdir/etc/apt/sources.list || mv rootdir/etc/apt/sources.list rootdi
msgtest "Directory instead of a file as sources.list ignored"
mkdir -p rootdir/etc/apt/sources.list
-aptget update --print-uris 2> /dev/null && msgpass || msgfail
+testsuccess --nomsg aptget update --print-uris
rmdir rootdir/etc/apt/sources.list
msgtest "Good link instead of a file as sources.list ignored"
@@ -49,7 +49,7 @@ test ! -e rootdir/etc/apt/preferences || mv rootdir/etc/apt/preferences rootdir/
msgtest "Directory instead of a file as preferences ignored"
mkdir -p rootdir/etc/apt/preferences
-aptcache policy > /dev/null 2> /dev/null && msgpass || msgfail
+testsuccess --nomsg aptcache policy
rmdir rootdir/etc/apt/preferences
msgtest "Good link instead of a file as preferences ignored"
@@ -62,5 +62,5 @@ rm rootdir/etc/apt/preferences
msgtest "Broken link instead of a file as preferences ignored"
ln -s /tmp/doesnt-exist rootdir/etc/apt/preferences
-aptcache policy > /dev/null 2> /dev/null && msgpass || msgfail
+testsuccess --nomsg aptcache policy
rm rootdir/etc/apt/preferences
diff --git a/test/integration/test-bug-611729-mark-as-manual b/test/integration/test-bug-611729-mark-as-manual
index 9cf01610c..e3d454f97 100755
--- a/test/integration/test-bug-611729-mark-as-manual
+++ b/test/integration/test-bug-611729-mark-as-manual
@@ -15,21 +15,21 @@ buildsimplenativepackage "c" "all" "1.0" "stable" "Depends: b"
setupaptarchive
# dpkg freaks out if the last package is removed so keep one around
-aptget install peace-dpkg -y -qq 2>&1 > /dev/null
+testsuccess aptget install peace-dpkg -y
testdpkginstalled peace-dpkg
testmarkedauto
-aptget install a -y -qq 2>&1 > /dev/null
+testsuccess aptget install a -y
testdpkginstalled a b
testdpkgnotinstalled c
testmarkedauto 'b'
-aptget remove a -y -qq 2>&1 > /dev/null
+testsuccess aptget remove a -y
testdpkgnotinstalled a c
testdpkginstalled b
testmarkedauto 'b'
-aptget install c -y -qq 2>&1 > /dev/null
+testsuccess aptget install c -y
testdpkgnotinstalled a
testdpkginstalled b c
testmarkedauto 'b'
@@ -50,7 +50,7 @@ testmarkedauto 'b'
rm rootdir/var/log/apt/history.log
-aptget install b --reinstall -y -qq 2>&1 > /dev/null
+testsuccess aptget install b --reinstall -y
testdpkgnotinstalled a
testdpkginstalled b c
testmarkedauto 'b'
@@ -67,24 +67,24 @@ b set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b
testmarkedauto
-aptget remove b -y -qq 2>&1 > /dev/null
+testsuccess aptget remove b -y
testdpkgnotinstalled a b c
testmarkedauto
-aptget install a b -y -qq 2>&1 > /dev/null
+testsuccess aptget install a b -y
testdpkginstalled a b
testdpkgnotinstalled c
testmarkedauto
-aptget purge a b -y -qq 2>&1 > /dev/null
+testsuccess aptget purge a b -y
testdpkgnotinstalled a b c
testmarkedauto
-aptget install b c -y -qq 2>&1 > /dev/null
+testsuccess aptget install b c -y
testdpkgnotinstalled a
testdpkginstalled b c
testmarkedauto
-aptget install a -y -qq 2>&1 > /dev/null
+testsuccess aptget install a -y
testdpkginstalled a b c
testmarkedauto
diff --git a/test/integration/test-bug-612099-multiarch-conflicts b/test/integration/test-bug-612099-multiarch-conflicts
index 530012e5d..20dc3a7e5 100755
--- a/test/integration/test-bug-612099-multiarch-conflicts
+++ b/test/integration/test-bug-612099-multiarch-conflicts
@@ -15,7 +15,7 @@ buildsimplenativepackage 'foobar' 'amd64' '1.0' 'stable' 'Depends: libc6'
setupaptarchive
-aptget install libc6:i386 -t stable -y -qq 2>&1 > /dev/null
+testsuccess aptget install libc6:i386 -t stable -y
testdpkginstalled libc6:i386
testequal 'Reading package lists...
Building dependency tree...
@@ -78,9 +78,9 @@ Conf libc6 (2.0 testing [all])' aptget upgrade -t testing -s
# FIXME: on amd64 systems this test wouldn't run with a real upgrade
# as APT (here i386) disagree about the native architecture, so
# we fake it here:
-#aptget upgrade -y -qq 2>&1 > /dev/null
-aptget purge libc6 -y -qq 2>&1 >/dev/null
-aptget install libc6:i386 -y -qq 2>&1 >/dev/null
+#aptget upgrade -y -qq >/dev/null 2>&1
+testsuccess aptget purge libc6 -y
+testsuccess aptget install libc6:i386 -y
testdpkginstalled libc6:all
testequal 'Reading package lists...
@@ -129,7 +129,7 @@ buildsimplenativepackage 'foobar-same' 'amd64' '1.0' 'stable' 'Depends: libc6-sa
setupaptarchive
-aptget install libc6-same:i386 -t stable -y -qq 2>&1 > /dev/null
+testsuccess aptget install libc6-same:i386 -t stable -y
testdpkginstalled libc6-same:i386
testequal 'Reading package lists...
@@ -176,9 +176,9 @@ Conf libc6-same (2.0 testing [all])' aptget upgrade -t testing -s
# FIXME: on amd64 systems this test wouldn't run with a real upgrade
# as APT (here i386) disagree about the native architecture, so
# we fake it here:
-#aptget upgrade -y -qq 2>&1 > /dev/null
-aptget purge libc6-same -y -qq 2>&1 >/dev/null
-aptget install libc6-same:i386 -y -qq 2>&1 >/dev/null
+#aptget upgrade -y -qq >/dev/null 2>&1
+testsuccess aptget purge libc6-same -y
+testsuccess aptget install libc6-same:i386 -y
testdpkginstalled libc6-same:all
diff --git a/test/integration/test-bug-612557-garbage-upgrade b/test/integration/test-bug-612557-garbage-upgrade
index 8efd1687a..910b3b149 100755
--- a/test/integration/test-bug-612557-garbage-upgrade
+++ b/test/integration/test-bug-612557-garbage-upgrade
@@ -13,7 +13,7 @@ insertpackage 'unstable' 'libreoffice-common' 'all' '1:3.3.0-2' 'Conflicts: open
setupaptarchive
touch rootdir/var/lib/apt/extended_states
-aptmark markauto python-uno openoffice.org-common
+testsuccess aptmark markauto python-uno openoffice.org-common
#aptmark unmarkauto openoffice.org-emailmerge
testmarkedauto python-uno openoffice.org-common
@@ -32,7 +32,7 @@ The following packages will be upgraded:
After this operation, 53.2 MB disk space will be freed.
E: Trivial Only specified but this is not a trivial operation.' aptget --trivial-only install python-uno
-aptmark markauto openoffice.org-emailmerge
+testsuccess aptmark markauto openoffice.org-emailmerge
testmarkedauto python-uno openoffice.org-common openoffice.org-emailmerge
testequal 'Reading package lists...
diff --git a/test/integration/test-bug-612958-use-dpkg-multiarch-config b/test/integration/test-bug-612958-use-dpkg-multiarch-config
index 18b964636..4d1f00ca0 100755
--- a/test/integration/test-bug-612958-use-dpkg-multiarch-config
+++ b/test/integration/test-bug-612958-use-dpkg-multiarch-config
@@ -14,13 +14,13 @@ insertinstalledpackage 'libapt' 'armel' '1.0'
testpass() {
rm rootdir/var/cache/apt/*.bin
msgtest 'Test architecture handling' "$1 with $2"
- aptcache show libapt:$2 2> /dev/null > /dev/null && msgpass || msgfail
+ testsuccess --nomsg aptcache show libapt:$2
}
testfail() {
rm rootdir/var/cache/apt/*.bin
msgtest 'Test architecture handling' "$1 with $2"
- aptcache show libapt:$2 2> /dev/null > /dev/null && msgfail || msgpass
+ testfailure --nomsg aptcache show libapt:$2
}
testpass 'no config' 'i386'
diff --git a/test/integration/test-bug-613420-new-garbage-dependency b/test/integration/test-bug-613420-new-garbage-dependency
index 7a08871ca..9d9f1096a 100755
--- a/test/integration/test-bug-613420-new-garbage-dependency
+++ b/test/integration/test-bug-613420-new-garbage-dependency
@@ -15,7 +15,7 @@ insertpackage 'unstable' 'openoffice.org-officebean' 'all' '1:3.3.0-5' 'Depends:
setupaptarchive
touch rootdir/var/lib/apt/extended_states
-aptmark markauto openoffice.org-officebean
+testsuccess aptmark markauto openoffice.org-officebean
testmarkedauto openoffice.org-officebean
testequal "Reading package lists...
diff --git a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted
new file mode 100755
index 000000000..633c197c0
--- /dev/null
+++ b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted
@@ -0,0 +1,63 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+buildsimplenativepackage 'cool' 'i386' '1.0' 'unstable'
+
+setupaptarchive --no-update
+
+testfileexists() {
+ msgtest 'Test for existance of file' "$1"
+ test -e "$1" && msgpass || msgfail
+ rm -f "$1"
+}
+
+testfilemissing() {
+ msgtest 'Test for non-existance of file' "$1"
+ test -e "$1" && msgfail || msgpass
+ rm -f "$1"
+}
+
+testrun() {
+ rm -rf rootdir/var/lib/apt
+ testsuccess aptget update
+
+ if [ "$1" = 'trusted' ]; then
+ testsuccess aptget download cool
+ testfileexists 'cool_1.0_i386.deb'
+
+ testsuccess aptget download cool --allow-unauthenticated
+ testfileexists 'cool_1.0_i386.deb'
+ else
+ testfailure aptget download cool
+ testfilemissing 'cool_1.0_i386.deb'
+
+ testsuccess aptget download cool --allow-unauthenticated
+ testfileexists 'cool_1.0_i386.deb'
+ fi
+
+ mv aptarchive/pool/cool_1.0_i386.deb aptarchive/pool/cool_1.0_i386.deb.bak
+ echo 'this is not a good package' > aptarchive/pool/cool_1.0_i386.deb
+ testfailure aptget download cool
+ testfilemissing cool_1.0_i386.deb
+
+ testfailure aptget download cool --allow-unauthenticated # unauthenticated doesn't mean unchecked
+ testfilemissing cool_1.0_i386.deb
+
+ rm -f aptarchive/pool/cool_1.0_i386.deb
+ mv aptarchive/pool/cool_1.0_i386.deb.bak aptarchive/pool/cool_1.0_i386.deb
+ testsuccess aptget download cool --allow-unauthenticated
+ testfileexists 'cool_1.0_i386.deb'
+}
+
+testrun 'trusted'
+
+find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
+testrun 'untrusted'
+
+changetowebserver
+testrun 'untrusted'
diff --git a/test/integration/test-bug-618288-multiarch-same-lockstep b/test/integration/test-bug-618288-multiarch-same-lockstep
index fde075172..e0305b64b 100755
--- a/test/integration/test-bug-618288-multiarch-same-lockstep
+++ b/test/integration/test-bug-618288-multiarch-same-lockstep
@@ -16,7 +16,7 @@ buildsimplenativepackage 'apt' 'i386' '2' 'unstable' 'Depends: libsame (= 2)' ''
buildsimplenativepackage 'apt2' 'amd64' '2' 'unstable' 'Depends: libsame (= 2)' '' 'required'
setupaptarchive
-aptget dist-upgrade -s 2>&1 > output.apt
+aptget dist-upgrade -s >output.apt 2>&1
# order in switch libsame:{amd64,i386} are unpacked is irrelevant, as both are installed - but we need to do it together
LS_U_AMD="$(grep -o -n '^Inst libsame ' output.apt | cut -d: -f1)"
diff --git a/test/integration/test-bug-624218-Translation-file-handling b/test/integration/test-bug-624218-Translation-file-handling
index d146b943c..d3c5b08ac 100755
--- a/test/integration/test-bug-624218-Translation-file-handling
+++ b/test/integration/test-bug-624218-Translation-file-handling
@@ -14,34 +14,47 @@ changetowebserver
rm -rf rootdir/var/lib/apt/lists
-msgtest 'No download of non-existent locals' 'with Index'
-LC_ALL="" aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
-rm -rf rootdir/var/lib/apt/lists
+translationslisted() {
+ msgtest 'No download of non-existent locals' "$1"
+ LC_ALL="" aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
+ rm -rf rootdir/var/lib/apt/lists
-msgtest 'Download of existent locals' 'with Index'
-LC_ALL="" aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
-rm -rf rootdir/var/lib/apt/lists
+ msgtest 'Download of existent locals' "$1"
+ LC_ALL="" aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
+ rm -rf rootdir/var/lib/apt/lists
-msgtest 'Download of en in LC_ALL=C' 'with Index'
-LC_ALL=C aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
-rm -rf rootdir/var/lib/apt/lists
+ msgtest 'Download of en in LC_ALL=C' "$1"
+ LC_ALL=C aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
+ rm -rf rootdir/var/lib/apt/lists
-msgtest 'Download of en as forced language' 'with Index'
-aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail
-rm -rf rootdir/var/lib/apt/lists
+ msgtest 'Download of en as forced language' "$1"
+ aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail
+ rm -rf rootdir/var/lib/apt/lists
-msgtest 'Download of nothing else in forced language' 'with Index'
-aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
-rm -rf rootdir/var/lib/apt/lists
+ msgtest 'Download of nothing else in forced language' "$1"
+ aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
+ rm -rf rootdir/var/lib/apt/lists
-msgtest 'Download no Translation- if forced language is non-existent' 'with Index'
-aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass
-rm -rf rootdir/var/lib/apt/lists
+ msgtest 'Download no Translation- if forced language is non-existent' "$1"
+ aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass
+ rm -rf rootdir/var/lib/apt/lists
+
+ msgtest 'Download of nothing if none is forced' "$1"
+ aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
+ rm -rf rootdir/var/lib/apt/lists
+}
+
+translationslisted 'with full Index'
+
+
+# only compressed files available (as it happens on CD-ROM)
+sed -i '/i18n\/Translation-[^.]*$/ d' $(find aptarchive -name 'Release')
+signreleasefiles
+
+translationslisted 'with partial Index'
-msgtest 'Download of nothing if none is forced' 'with Index'
-aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
-rm -rf rootdir/var/lib/apt/lists
+# no records at all about Translation files (fallback to guessing)
sed -i '/i18n\/Translation-.*$/ d' $(find aptarchive -name 'Release')
signreleasefiles
diff --git a/test/integration/test-bug-633350-do-not-kill-last-char-in-Release b/test/integration/test-bug-633350-do-not-kill-last-char-in-Release
index 2aae7cfcc..988f8c9d0 100755
--- a/test/integration/test-bug-633350-do-not-kill-last-char-in-Release
+++ b/test/integration/test-bug-633350-do-not-kill-last-char-in-Release
@@ -8,7 +8,7 @@ configarchitecture 'amd64'
insertpackage 'unstable' 'cool' 'amd64' '1.0'
-setupaptarchive 2> /dev/null
+setupaptarchive --no-update
echo 'NotAutomatic: yes' >> aptarchive/dists/unstable/Release
diff --git a/test/integration/test-bug-64141-install-dependencies-for-on-hold b/test/integration/test-bug-64141-install-dependencies-for-on-hold
index e2d206fdd..9a9e7be10 100755
--- a/test/integration/test-bug-64141-install-dependencies-for-on-hold
+++ b/test/integration/test-bug-64141-install-dependencies-for-on-hold
@@ -31,7 +31,7 @@ The following packages will be upgraded:
After this operation, 0 B of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgrade --trivial-only
-aptmark hold apt -qq
+testsuccess aptmark hold apt
testequal 'Reading package lists...
Building dependency tree...
diff --git a/test/integration/test-bug-673536-pre-depends-breaks-loop b/test/integration/test-bug-673536-pre-depends-breaks-loop
index e9d3c4de6..f6a90b21f 100755
--- a/test/integration/test-bug-673536-pre-depends-breaks-loop
+++ b/test/integration/test-bug-673536-pre-depends-breaks-loop
@@ -15,9 +15,9 @@ setupaptarchive
# we check with 'real' packages here as the simulation reports a 'Conf broken'
# which is technical correct for the simulation, but testing errormsg is ugly
-aptget install basic=1 -qq > /dev/null
+testsuccess aptget install basic=1 -y
testdpkginstalled basic
testdpkgnotinstalled common
-aptget dist-upgrade -qq > /dev/null
+testsuccess aptget dist-upgrade -y
testdpkginstalled basic common
diff --git a/test/integration/test-bug-679371-apt-get-autoclean-multiarch b/test/integration/test-bug-679371-apt-get-autoclean-multiarch
index ba6857b73..3de7d69f9 100755
--- a/test/integration/test-bug-679371-apt-get-autoclean-multiarch
+++ b/test/integration/test-bug-679371-apt-get-autoclean-multiarch
@@ -14,10 +14,13 @@ setupaptarchive
changetowebserver
-aptget update -qq
-aptget install pkgall pkgnative pkgforeign -y -qq > /dev/null
+testsuccess aptget update
+testsuccess aptget install pkgall pkgnative pkgforeign -y
-testdpkginstalled pkgall pkgnative pkgforeign
+# if we work with an old dpkg, pkgforeign will be listed differently,
+# so test with aptcache for install status instead
+testdpkginstalled pkgall pkgnative
+testsuccess aptcache show pkgforeign/installed
testequal 'Reading package lists...
Building dependency tree...
diff --git a/test/integration/test-bug-686346-package-missing-architecture b/test/integration/test-bug-686346-package-missing-architecture
index b2c9ec9ee..dc51861ab 100755
--- a/test/integration/test-bug-686346-package-missing-architecture
+++ b/test/integration/test-bug-686346-package-missing-architecture
@@ -58,13 +58,13 @@ Building dependency tree...
# pkgd has no update with an architecture
testdpkginstalled pkgd
msgtest 'Test apt-get purge' 'pkgd'
-aptget purge pkgd -y >/dev/null 2>&1 && msgpass || msgfail
+testsuccess --nomsg aptget purge pkgd -y
testdpkgnotinstalled pkgd
# there is a pkgb with an architecture
testdpkginstalled pkgb
msgtest 'Test apt-get purge' 'pkgb:none'
-aptget purge pkgb:none -y >/dev/null 2>&1 && msgpass || msgfail
+testsuccess --nomsg aptget purge pkgb:none -y
testdpkgnotinstalled pkgb
# check that dependencies are created after the none package exists in the cache
@@ -73,7 +73,7 @@ insertinstalledpackage 'pkgb' 'none' '1'
insertinstalledpackage 'pkgf' 'none' '1' 'Conflicts: pkgb'
insertinstalledpackage 'pkgg' 'amd64' '1' 'Conflicts: pkgb'
insertinstalledpackage 'pkgb' 'amd64' '2'
-testequal "Reading package lists...
+testequalor2 "Reading package lists...
Building dependency tree...
Reading state information...
You might want to run 'apt-get -f install' to correct these.
@@ -84,6 +84,17 @@ The following packages have unmet dependencies:
Conflicts: pkgb but 2 is installed
pkgg : Conflicts: pkgb but 2 is installed
Conflicts: pkgb:none but 1 is installed
+E: Unmet dependencies. Try using -f." "Reading package lists...
+Building dependency tree...
+Reading state information...
+You might want to run 'apt-get -f install' to correct these.
+The following packages have unmet dependencies:
+ pkgb : Conflicts: pkgb:none but 1 is installed
+ pkgb:none : Conflicts: pkgb but 2 is installed
+ pkgf:none : Conflicts: pkgb but 2 is installed
+ Conflicts: pkgb:none but 1 is installed
+ pkgg : Conflicts: pkgb but 2 is installed
+ Conflicts: pkgb:none but 1 is installed
E: Unmet dependencies. Try using -f." aptget check
# check that dependencies are generated for none-packages
diff --git a/test/integration/test-bug-689582-100-char-long-path-names b/test/integration/test-bug-689582-100-char-long-path-names
new file mode 100755
index 000000000..1b4b172b6
--- /dev/null
+++ b/test/integration/test-bug-689582-100-char-long-path-names
@@ -0,0 +1,35 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+mkdir aptarchive/testpkg
+cd aptarchive/testpkg
+
+for i in $(seq 98 102); do
+ touch "$(printf "%0${i}d" "$i")"
+done
+tar zcf data.tar.gz 00*
+
+echo 'Package: testpkg
+Version: 1-1
+Architecture: all
+Maintainer: Joe Sixpack <joe@example.org>
+Description: Package for test
+Section: debug
+Priority: extra' > control
+tar zcf control.tar.gz control
+
+echo '2.0' > debian-binary
+ar cr ../testpkg.deb debian-binary control.tar.gz data.tar.gz
+
+cd - > /dev/null
+
+testequal '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000102 testpkg
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101 testpkg
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100 testpkg
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000099 testpkg
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000098 testpkg' aptftparchive contents aptarchive/
diff --git a/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch b/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch
new file mode 100755
index 000000000..62355a6b5
--- /dev/null
+++ b/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch
@@ -0,0 +1,136 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+buildsimplenativepackage 'toolkit' 'all' '1' 'stable' 'Multi-Arch: foreign'
+buildsimplenativepackage 'toolkit' 'amd64' '2' 'unstable' 'Multi-Arch: foreign'
+buildsimplenativepackage 'libsame' 'i386,amd64' '1' 'stable' 'Multi-Arch: same'
+buildsimplenativepackage 'libsame' 'i386,amd64' '2' 'unstable' 'Multi-Arch: same'
+buildsimplenativepackage 'stuff' 'i386,amd64' '1' 'stable' 'Depends: libsame (= 1), toolkit (= 1)'
+buildsimplenativepackage 'stuff' 'i386,amd64' '2' 'unstable' 'Depends: libsame (= 2), toolkit (= 2)'
+
+setupsimplenativepackage 'confpkg' 'amd64' '1' 'unstable'
+BUILDDIR='incoming/confpkg-1'
+echo 'foo "bar";' > ${BUILDDIR}/pkg.conf
+echo 'pkg.conf /etc/pkg.conf' >> ${BUILDDIR}/debian/install
+buildpackage "$BUILDDIR" 'unstable' 'main' 'amd64'
+rm -rf "$BUILDDIR"
+
+setupaptarchive
+
+hook='pre-install-pkgs'
+
+enablehookversion() {
+ echo "#!/bin/sh
+FD=0
+echo -n > ${hook}-v${1}.list
+if [ -n \"${2}\" ]; then
+ FD=\$APT_HOOK_INFO_FD
+ if [ "\$FD" != \"${2}\" ]; then echo \"ERROR: Information is not on requested FD: \$FD != ${2}\" >> ${hook}-v${1}.list; fi
+fi
+while read </proc/\$\$/fd/\$FD line; do
+ if echo \"\$line\" | grep -Fq '**'; then
+ echo \"\$line\"
+ fi
+done >> ${hook}-v${1}.list" > ${hook}-v${1}.sh
+ chmod +x ${hook}-v${1}.sh
+ echo "dpkg::${hook}:: \"./${hook}-v${1}.sh --foo -bar\";
+DPkg::Tools::options::\"./${hook}-v${1}.sh\"::Version \"$1\";" > rootdir/etc/apt/apt.conf.d/hook-v$1
+ if [ -n "$2" ]; then
+ echo "DPkg::Tools::options::\"./${hook}-v${1}.sh\"::InfoFD \"${2}\";" >> rootdir/etc/apt/apt.conf.d/hook-v$1
+ fi
+}
+
+observehook() {
+ rm -f ${hook}-v2.list ${hook}-v3.list
+ msgtest 'Observe hooks while' "$*"
+ testsuccess --nomsg aptget "$@" -y --force-yes
+}
+
+testrun() {
+ observehook install stuff -t stable
+ testfileequal "${hook}-v2.list" 'libsame - < 1 **CONFIGURE**
+toolkit - < 1 **CONFIGURE**
+stuff - < 1 **CONFIGURE**'
+ testfileequal "${hook}-v3.list" 'libsame - - none < 1 amd64 same **CONFIGURE**
+toolkit - - none < 1 all foreign **CONFIGURE**
+stuff - - none < 1 amd64 none **CONFIGURE**'
+
+ observehook install stuff -t unstable
+ testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE**
+toolkit 1 < 2 **CONFIGURE**
+stuff 1 < 2 **CONFIGURE**'
+ testfileequal "${hook}-v3.list" 'libsame 1 amd64 same < 2 amd64 same **CONFIGURE**
+toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE**
+stuff 1 amd64 none < 2 amd64 none **CONFIGURE**'
+
+ observehook install stuff:i386 -t unstable
+ testfileequal "${hook}-v2.list" 'stuff 2 > - **REMOVE**
+libsame - < 2 **CONFIGURE**
+stuff - < 2 **CONFIGURE**'
+ testfileequal "${hook}-v3.list" 'stuff 2 amd64 none > - - none **REMOVE**
+libsame - - none < 2 i386 same **CONFIGURE**
+stuff - - none < 2 i386 none **CONFIGURE**'
+
+ observehook remove libsame
+ testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE**'
+ testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**'
+
+ observehook install stuff:i386/stable libsame:i386/stable toolkit/stable
+ testfileequal "${hook}-v2.list" 'libsame 2 > 1 **CONFIGURE**
+toolkit 2 > 1 **CONFIGURE**
+stuff 2 > 1 **CONFIGURE**'
+ testfileequal "${hook}-v3.list" 'libsame 2 i386 same > 1 i386 same **CONFIGURE**
+toolkit 2 amd64 foreign > 1 all foreign **CONFIGURE**
+stuff 2 i386 none > 1 i386 none **CONFIGURE**'
+
+ observehook install 'libsame:*'
+ testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE**
+libsame - < 2 **CONFIGURE**
+toolkit 1 < 2 **CONFIGURE**
+stuff 1 < 2 **CONFIGURE**'
+ testfileequal "${hook}-v3.list" 'libsame 1 i386 same < 2 i386 same **CONFIGURE**
+libsame - - none < 2 amd64 same **CONFIGURE**
+toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE**
+stuff 1 i386 none < 2 i386 none **CONFIGURE**'
+
+ observehook purge stuff:i386 'libsame:*' toolkit
+ testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE**
+stuff 2 > - **REMOVE**
+libsame 2 > - **REMOVE**
+toolkit 2 > - **REMOVE**'
+ testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**
+stuff 2 i386 none > - - none **REMOVE**
+libsame 2 i386 same > - - none **REMOVE**
+toolkit 2 amd64 foreign > - - none **REMOVE**'
+
+ observehook install confpkg
+ testfileequal "${hook}-v2.list" 'confpkg - < 1 **CONFIGURE**'
+ testfileequal "${hook}-v3.list" 'confpkg - - none < 1 amd64 none **CONFIGURE**'
+
+ observehook remove confpkg
+ testfileequal "${hook}-v2.list" 'confpkg 1 > - **REMOVE**'
+ testfileequal "${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**'
+
+ msgtest 'Conffiles of package remained after remove' 'confpkg'
+ dpkg -l confpkg | grep -q '^rc' && msgpass || msgfail
+
+ observehook purge confpkg
+ testfileequal "${hook}-v2.list" 'confpkg 1 > - **REMOVE**'
+ testfileequal "${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**'
+
+ msgtest 'Conffiles are gone after purge' 'confpkg'
+ dpkg -l confpkg 2>/dev/null | grep -q '^rc' && msgfail || msgpass
+}
+
+enablehookversion 2
+enablehookversion 3
+testrun
+
+enablehookversion 2 13
+enablehookversion 3 13
+testrun
diff --git a/test/integration/test-bug-712435-missing-descriptions b/test/integration/test-bug-712435-missing-descriptions
index 9b3c2ee50..53ecbbeb3 100755
--- a/test/integration/test-bug-712435-missing-descriptions
+++ b/test/integration/test-bug-712435-missing-descriptions
@@ -52,7 +52,32 @@ $PACKAGESTANZA
Description-md5: dddddddddddddddddddddddddddddddd
Package: apt-none
-$PACKAGESTANZA" > aptarchive/Packages
+$PACKAGESTANZA
+
+Package: apt-intermixed
+$PACKAGESTANZA
+$DESCRIPTION
+X-Some-Flag: yes
+Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+Package: apt-intermixed2
+$PACKAGESTANZA
+$DESCRIPTION
+X-Some-Flag: yes
+$TRANSDESCRIPTION
+X-Foo-Flag: Something with a Description
+Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+X-Bar-Flag: no
+
+Package: apt-intermixed3
+$PACKAGESTANZA
+$DESCRIPTION
+X-Some-Flag: yes
+$TRANSDESCRIPTION
+X-Foo-Flag: Something with a Description
+X-Bar-Flag: no
+Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" > aptarchive/Packages
+
setupaptarchive
@@ -87,3 +112,54 @@ Description-md5: dddddddddddddddddddddddddddddddd
testequal "Package: apt-none
$PACKAGESTANZA
" aptcache show apt-none
+
+testequal "Package: apt-intermixed
+$PACKAGESTANZA
+$DESCRIPTION
+Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+X-Some-Flag: yes
+" aptcache show apt-intermixed
+
+testequal "Package: apt-intermixed2
+$PACKAGESTANZA
+$DESCRIPTION
+Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+X-Some-Flag: yes
+X-Foo-Flag: Something with a Description
+X-Bar-Flag: no
+" aptcache show apt-intermixed2
+
+testequal "Package: apt-intermixed3
+$PACKAGESTANZA
+$DESCRIPTION
+Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+X-Some-Flag: yes
+X-Foo-Flag: Something with a Description
+X-Bar-Flag: no
+" aptcache show apt-intermixed3
+
+msgtest 'Test that no description does not destroy' 'showpkg'
+aptcache showpkg apt-none | sed 's#/tmp/.*_aptarchive_#/tmp/aptarchive_#' >showpkg.explosion && msgpass || msgfail
+testfileequal showpkg.explosion 'Package: apt-none
+Versions:
+0.9.7.8 (/tmp/aptarchive_Packages)
+
+
+Reverse Depends:
+Dependencies:
+0.9.7.8 -
+Provides:
+0.9.7.8 -
+Reverse Provides: '
+
+testempty aptcache search nonexistentstring
+
+# packages without a description can't be found
+testequal 'apt-normal - commandline package manager
+apt-both-below - commandline package manager
+apt-both-middle - commandline package manager
+apt-both-top - commandline package manager
+apt-trans - commandline package manager
+apt-intermixed - commandline package manager
+apt-intermixed2 - commandline package manager
+apt-intermixed3 - commandline package manager' aptcache search apt
diff --git a/test/integration/test-bug-717891-abolute-uris-for-proxies b/test/integration/test-bug-717891-abolute-uris-for-proxies
new file mode 100755
index 000000000..ac1d6ec11
--- /dev/null
+++ b/test/integration/test-bug-717891-abolute-uris-for-proxies
@@ -0,0 +1,28 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable'
+
+setupaptarchive
+changetowebserver --request-absolute='uri'
+
+msgtest 'Check that absolute paths are' 'not accepted'
+testfailure --nomsg aptget update
+
+echo 'Acquire::http::Proxy "http://localhost:8080";' > rootdir/etc/apt/apt.conf.d/99proxy
+
+msgtest 'Check that requests to proxies are' 'absolute uris'
+testsuccess --nomsg aptget update
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ unrelated
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst unrelated (0.5~squeeze1 unstable [all])
+Conf unrelated (0.5~squeeze1 unstable [all])' aptget install unrelated -s
diff --git a/test/integration/test-bug-719263-print-uris-removes-authentication b/test/integration/test-bug-719263-print-uris-removes-authentication
new file mode 100755
index 000000000..1c1a27ceb
--- /dev/null
+++ b/test/integration/test-bug-719263-print-uris-removes-authentication
@@ -0,0 +1,41 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64'
+
+insertinstalledpackage 'unrelated' 'all' '1'
+buildsimplenativepackage 'unrelated' 'all' '2' 'unstable'
+
+setupaptarchive
+
+testnoact() {
+ cp -a rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup-noact
+ touch rootdir/var/lib/apt/extended_states
+ testequal 'Reading package lists...
+Building dependency tree...
+Reading state information...
+The following packages will be upgraded:
+ unrelated
+1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst unrelated [1] (2 unstable [all])
+Conf unrelated (2 unstable [all])' aptget install unrelated -s
+ testsuccess aptget install unrelated -y
+ testdpkginstalled unrelated
+ cp -a rootdir/var/lib/dpkg/status-backup-noact rootdir/var/lib/dpkg/status
+}
+
+testnoact
+testsuccess aptget update --print-uris
+testnoact
+
+# same thing, just not with InRelease this time
+rm -rf rootdir/var/lib/apt/lists
+testsuccess aptget update -o Acquire::TryInRelease=0
+
+testnoact
+testsuccess aptget update --print-uris -o Acquire::TryInRelease=0
+testnoact
diff --git a/test/integration/test-bug-722207-print-uris-even-if-very-quiet b/test/integration/test-bug-722207-print-uris-even-if-very-quiet
new file mode 100755
index 000000000..f2d95da19
--- /dev/null
+++ b/test/integration/test-bug-722207-print-uris-even-if-very-quiet
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64'
+
+insertinstalledpackage 'apt' 'all' '1'
+insertpackage 'unstable' 'apt' 'all' '2'
+insertsource 'unstable' 'apt' 'all' '2'
+insertsource 'unstable' 'apt2' 'all' '1'
+
+setupaptarchive
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+
+testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 MD5Sum:" aptget upgrade -qq --print-uris
+testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 MD5Sum:" aptget dist-upgrade -qq --print-uris
+testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 MD5Sum:" aptget install apt -qq --print-uris
+testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 MD5Sum:" aptget download apt -qq --print-uris
+testequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source apt -qq --print-uris
+testequal "'http://packages.debian.org/changelogs/pool/main/apt/apt_2/changelog'" aptget changelog apt -qq --print-uris
+
+testequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/apt2_1.dsc' apt2_1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/apt2_1.tar.gz' apt2_1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source apt apt2 -qq --print-uris
diff --git a/test/integration/test-bug-723586-any-stripped-in-single-arch b/test/integration/test-bug-723586-any-stripped-in-single-arch
new file mode 100755
index 000000000..392b88e9f
--- /dev/null
+++ b/test/integration/test-bug-723586-any-stripped-in-single-arch
@@ -0,0 +1,54 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+insertinstalledpackage 'python3' 'all' '3.2.3-6'
+
+insertpackage 'unstable' 'python3' 'amd64' '3.3.2-16' 'Multi-Arch: allowed'
+insertpackage 'stable' 'python3-gnupg' 'all' '0.3.5-2' 'Depends: python3:any (>= 3.2.3-3~)'
+
+insertpackage 'unstable' 'python-mips' 'amd64' '3' 'Depends: python3:mips'
+
+setupaptarchive
+
+INSTALLLOG='Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ python3
+The following NEW packages will be installed:
+ python3-gnupg
+The following packages will be upgraded:
+ python3
+1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst python3 [3.2.3-6] (3.3.2-16 unstable [amd64])
+Inst python3-gnupg (0.3.5-2 stable [all])
+Conf python3 (3.3.2-16 unstable [amd64])
+Conf python3-gnupg (0.3.5-2 stable [all])'
+
+FAILLOG='Reading package lists...
+Building dependency tree...
+Some packages could not be installed. This may mean that you have
+requested an impossible situation or if you are using the unstable
+distribution that some required packages have not yet been created
+or been moved out of Incoming.
+The following information may help to resolve the situation:
+
+The following packages have unmet dependencies:
+ python-mips : Depends: python3:mips but it is not installable
+E: Unable to correct problems, you have held broken packages.'
+
+testequal "$INSTALLLOG" aptget install python3-gnupg -s
+aptcache showpkg python3 > showpkg.log
+testequal "$FAILLOG" aptget install python-mips -s
+
+# same test, but this time in a multi-arch environment
+configarchitecture 'amd64' 'armhf'
+rm rootdir/var/cache/apt/*.bin
+
+testequal "$INSTALLLOG" aptget install python3-gnupg -s
+testequal "$(sed 's#3.3.2-16 - python3#3.3.2-16 - python3:any:armhf python3#' showpkg.log)" aptcache showpkg python3
+testequal "$FAILLOG" aptget install python-mips -s
diff --git a/test/integration/test-bug-723705-tagfile-truncates-fields b/test/integration/test-bug-723705-tagfile-truncates-fields
new file mode 100755
index 000000000..3180e7fc9
--- /dev/null
+++ b/test/integration/test-bug-723705-tagfile-truncates-fields
@@ -0,0 +1,33 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+setupaptarchive
+
+aptget install --print-uris -y cdebconf-newt-terminal cdebconf-gtk-terminal 2>&1 | sed 's#file:///tmp/tmp.[^/]\+#file:///tmp#g' > filename.log
+
+testfileequal filename.log "Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ cdebconf-gtk-udeb cdebconf-newt-udeb cdebconf-udeb libc6-udeb
+ libglib2.0-udeb libgtk2.0-0-udeb libvte9-udeb
+The following NEW packages will be installed:
+ cdebconf-gtk-terminal cdebconf-gtk-udeb cdebconf-newt-terminal
+ cdebconf-newt-udeb cdebconf-udeb libc6-udeb libglib2.0-udeb libgtk2.0-0-udeb
+ libvte9-udeb
+0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
+Need to get 0 B/4774 kB of archives.
+After this operation, 19.8 MB of additional disk space will be used.
+'file:///tmp/aptarchive/pool/main/c/cdebconf/cdebconf-udeb_0.185_amd64.udeb' cdebconf-udeb_0.185_amd64.udeb 77376 MD5Sum:e3883706fdbf54c2e5ea959c92b2d37f
+'file:///tmp/aptarchive/pool/main/c/cdebconf/cdebconf-gtk-udeb_0.185_amd64.udeb' cdebconf-gtk-udeb_0.185_amd64.udeb 27278 MD5Sum:a1bbbc1d4fb8e0615b5621abac021924
+'file:///tmp/aptarchive/pool/main/c/cdebconf/cdebconf-newt-udeb_0.185_amd64.udeb' cdebconf-newt-udeb_0.185_amd64.udeb 19192 MD5Sum:de27807f56dae2f2403b3322d5fe6bd2
+'file:///tmp/aptarchive/pool/main/g/glib2.0/libglib2.0-udeb_2.36.4-1_amd64.udeb' libglib2.0-udeb_2.36.4-1_amd64.udeb 1714604 MD5Sum:72da029f1bbb36057d874f1f82a5d00a
+'file:///tmp/aptarchive/pool/main/e/eglibc/libc6-udeb_2.17-92+b1_amd64.udeb' libc6-udeb_2.17-92+b1_amd64.udeb 1056000 MD5Sum:7fd7032eeeecf7f76eff79a0543fbd72
+'file:///tmp/aptarchive/pool/main/g/gtk+2.0/libgtk2.0-0-udeb_2.24.20-1_amd64.udeb' libgtk2.0-0-udeb_2.24.20-1_amd64.udeb 1643046 MD5Sum:25513478eb2e02e5766c0eea0b411ca9
+'file:///tmp/aptarchive/pool/main/v/vte/libvte9-udeb_0.28.2-5_amd64.udeb' libvte9-udeb_1%3a0.28.2-5_amd64.udeb 216968 MD5Sum:7da7201effaf5ced19abd9d0b45aa2c6
+'file:///tmp/aptarchive/pool/main/c/cdebconf-terminal/cdebconf-gtk-terminal_0.22_amd64.udeb' cdebconf-gtk-terminal_0.22_amd64.udeb 14734 MD5Sum:f9c3a7354560cb88e0396e2b7ba54363
+'file:///tmp/aptarchive/pool/main/c/cdebconf-terminal/cdebconf-newt-terminal_0.22_amd64.udeb' cdebconf-newt-terminal_0.22_amd64.udeb 4538 MD5Sum:20db6152fce5081fcbf49c7c08f21246"
diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes
index a5e885745..c6f5ab49e 100755
--- a/test/integration/test-compressed-indexes
+++ b/test/integration/test-compressed-indexes
@@ -46,10 +46,10 @@ testrun() {
msgpass
fi
msgtest "Check if package is downloadable"
- aptget install -d testpkg -qq && msgpass || msgfail
- msgtest "\tdeb file is present"; test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb && msgpass || msgfail
+ testsuccess --nomsg aptget install -d testpkg
+ msgtest "\tdeb file is present"; testsuccess --nomsg test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb
aptget clean
- msgtest "\tdeb file is gone"; ! test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb && msgpass || msgfail
+ msgtest "\tdeb file is gone"; testfailure --nomsg test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb
fi
rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
testequal "$GOODSHOW" aptcache show testpkg
@@ -62,9 +62,9 @@ testrun() {
testequal "$GOODSHOWSRC" aptcache showsrc testpkg
aptget clean
msgtest "Check if the source is aptgetable"
- aptget source testpkg -qq 2> /dev/null > /dev/null && msgpass || msgfail
- msgtest "\tdsc file is present"; test -f testpkg_1.0.dsc && msgpass || msgfail
- msgtest "\tdirectory is present"; test -d testpkg-1.0 && msgpass || msgfail
+ testsuccess --nomsg aptget source testpkg
+ msgtest "\tdsc file is present"; testsuccess --nomsg test -f testpkg_1.0.dsc
+ msgtest "\tdirectory is present"; testsuccess --nomsg test -d testpkg-1.0
rm -rf testpkg-1.0
}
@@ -72,11 +72,11 @@ echo 'Acquire::GzipIndexes "false";' > rootdir/etc/apt/apt.conf.d/02compressinde
msgmsg "File: Test with uncompressed indexes"
testrun
-aptget update -qq -o Acquire::Pdiffs=1
+testsuccess aptget update -o Acquire::Pdiffs=1
msgmsg "File: Test with uncompressed indexes (update unchanged with pdiffs)"
testrun
-aptget update -qq -o Acquire::Pdiffs=0
+testsuccess aptget update -o Acquire::Pdiffs=0
msgmsg "File: Test with uncompressed indexes (update unchanged without pdiffs)"
testrun
@@ -84,21 +84,21 @@ rm -rf rootdir/var/lib/apt/lists
echo 'Acquire::CompressionTypes::Order:: "gz";
Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex
-aptget update -qq
+testsuccess aptget update
msgmsg "File: Test with compressed indexes"
testrun "compressed"
-aptget update -qq -o Acquire::Pdiffs=1
+testsuccess aptget update -o Acquire::Pdiffs=1
msgmsg "File: Test with compressed indexes (update unchanged with pdiffs)"
testrun "compressed"
-aptget update -qq -o Acquire::Pdiffs=0
+testsuccess aptget update -o Acquire::Pdiffs=0
msgmsg "File: Test with compressed indexes (update unchanged without pdiffs)"
testrun "compressed"
rm rootdir/etc/apt/apt.conf.d/02compressindex
changetowebserver
-aptget update -qq
+testsuccess aptget update
GOODPOLICY="$(aptcache policy testpkg)"
test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4
testequal "$GOODPOLICY" aptcache policy testpkg
@@ -106,11 +106,11 @@ testequal "$GOODPOLICY" aptcache policy testpkg
msgmsg "HTTP: Test with uncompressed indexes"
testrun
-aptget update -qq -o Acquire::Pdiffs=1
+testsuccess aptget update -o Acquire::Pdiffs=1
msgmsg "HTTP: Test with uncompressed indexes (update unchanged with pdiffs)"
testrun
-aptget update -qq -o Acquire::Pdiffs=0
+testsuccess aptget update -o Acquire::Pdiffs=0
msgmsg "HTTP: Test with uncompressed indexes (update unchanged without pdiffs)"
testrun
@@ -118,14 +118,14 @@ rm -rf rootdir/var/lib/apt/lists
echo 'Acquire::CompressionTypes::Order:: "gz";
Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex
-aptget update -qq
+testsuccess aptget update
msgmsg "HTTP: Test with compressed indexes"
testrun "compressed"
-aptget update -qq -o Acquire::Pdiffs=1
+testsuccess aptget update -o Acquire::Pdiffs=1
msgmsg "HTTP: Test with compressed indexes (update unchanged with pdiffs)"
testrun "compressed"
-aptget update -qq -o Acquire::Pdiffs=0
+testsuccess aptget update -o Acquire::Pdiffs=0
msgmsg "HTTP: Test with compressed indexes (update unchanged without pdiffs)"
testrun "compressed"
diff --git a/test/integration/test-cve-2013-1051-InRelease-parsing b/test/integration/test-cve-2013-1051-InRelease-parsing
index 6764fefff..41b27f691 100755
--- a/test/integration/test-cve-2013-1051-InRelease-parsing
+++ b/test/integration/test-cve-2013-1051-InRelease-parsing
@@ -14,7 +14,7 @@ setupaptarchive
changetowebserver
ARCHIVE='http://localhost:8080/'
msgtest 'Initial apt-get update should work with' 'InRelease'
-aptget update -qq && msgpass || msgfail
+testsuccess --nomsg aptget update
# check that the setup is correct
testequal "good-pkg:
diff --git a/test/integration/test-disappearing-packages b/test/integration/test-disappearing-packages
index d2ac4edc6..09dbf7014 100755
--- a/test/integration/test-disappearing-packages
+++ b/test/integration/test-disappearing-packages
@@ -29,7 +29,7 @@ rm -rf "$BUILDDIR"
setupaptarchive
-aptget install old-pkg=1.0 --trivial-only -qq 2>&1 > /dev/null
+testsuccess aptget install old-pkg=1.0 --trivial-only
testmarkedauto # old-pkg is manual installed
diff --git a/test/integration/test-hashsum-verification b/test/integration/test-hashsum-verification
index 99ea8bffa..e77efb46e 100755
--- a/test/integration/test-hashsum-verification
+++ b/test/integration/test-hashsum-verification
@@ -21,9 +21,7 @@ prepare() {
done
cp $1 aptarchive/Packages
find aptarchive -name 'Release' -delete
- cat aptarchive/Packages | gzip > aptarchive/Packages.gz
- cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2
- cat aptarchive/Packages | xz --format=lzma > aptarchive/Packages.lzma
+ compressfile aptarchive/Packages
# create Release file with incorret checksums
cat > aptarchive/Release <<EOF
Date: Fri, 05 Aug 2011 09:22:08 UTC
diff --git a/test/integration/test-partial-file-support b/test/integration/test-partial-file-support
new file mode 100755
index 000000000..8d1c51ae0
--- /dev/null
+++ b/test/integration/test-partial-file-support
@@ -0,0 +1,107 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+changetowebserver
+
+copysource() {
+ dd if="$1" bs=1 count="$2" of="$3" 2>/dev/null
+ touch -d "$(stat --format '%y' "${TESTFILE}")" "$3"
+}
+
+testdownloadfile() {
+ local DOWNLOG='download-testfile.log'
+ rm -f "$DOWNLOG"
+ msgtest "Testing download of file $2 with" "$1"
+ if ! downloadfile "$2" "$3" > "$DOWNLOG"; then
+ cat "$DOWNLOG"
+ msgfail
+ else
+ msgpass
+ fi
+ cat "$DOWNLOG" | while read field hash; do
+ local EXPECTED
+ case "$field" in
+ 'MD5Sum-Hash:') EXPECTED="$(md5sum "$TESTFILE" | cut -d' ' -f 1)";;
+ 'SHA1-Hash:') EXPECTED="$(sha1sum "$TESTFILE" | cut -d' ' -f 1)";;
+ 'SHA256-Hash:') EXPECTED="$(sha256sum "$TESTFILE" | cut -d' ' -f 1)";;
+ 'SHA512-Hash:') EXPECTED="$(sha512sum "$TESTFILE" | cut -d' ' -f 1)";;
+ *) continue;;
+ esac
+ if [ "$4" = '=' ]; then
+ msgtest 'Test downloaded file for correct' "$field"
+ else
+ msgtest 'Test downloaded file does not match in' "$field"
+ fi
+ if [ "$EXPECTED" "$4" "$hash" ]; then
+ msgpass
+ else
+ cat "$DOWNLOG"
+ msgfail "expected: $EXPECTED ; got: $hash"
+ fi
+ done
+}
+
+testwebserverlaststatuscode() {
+ STATUS="$(mktemp)"
+ addtrap "rm $STATUS;"
+ msgtest 'Test last status code from the webserver was' "$1"
+ downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" >/dev/null
+ if [ "$(cat "$STATUS")" = "$1" ]; then
+ msgpass
+ else
+ cat download-testfile.log
+ msgfail "Status was $(cat "$STATUS")"
+ fi
+}
+
+
+TESTFILE='aptarchive/testfile'
+cp -a ${TESTDIR}/framework $TESTFILE
+
+testrun() {
+ downloadfile "$1/_config/set/aptwebserver::support::range/true" '/dev/null' >/dev/null
+ testwebserverlaststatuscode '200'
+
+ copysource $TESTFILE 0 ./testfile
+ testdownloadfile 'no data' "${1}/testfile" './testfile' '='
+ testwebserverlaststatuscode '200'
+
+ copysource $TESTFILE 20 ./testfile
+ testdownloadfile 'valid partial data' "${1}/testfile" './testfile' '='
+ testwebserverlaststatuscode '206'
+
+ copysource /dev/zero 20 ./testfile
+ testdownloadfile 'invalid partial data' "${1}/testfile" './testfile' '!='
+ testwebserverlaststatuscode '206'
+
+ copysource $TESTFILE 1M ./testfile
+ testdownloadfile 'completely downloaded file' "${1}/testfile" './testfile' '='
+ testwebserverlaststatuscode '416'
+
+ copysource /dev/zero 1M ./testfile
+ testdownloadfile 'too-big partial file' "${1}/testfile" './testfile' '='
+ testwebserverlaststatuscode '200'
+
+ copysource /dev/zero 20 ./testfile
+ touch ./testfile
+ testdownloadfile 'old data' "${1}/testfile" './testfile' '='
+ testwebserverlaststatuscode '200'
+
+ downloadfile "$1/_config/set/aptwebserver::support::range/false" '/dev/null' >/dev/null
+ testwebserverlaststatuscode '200'
+
+ copysource $TESTFILE 20 ./testfile
+ testdownloadfile 'no server support' "${1}/testfile" './testfile' '='
+ testwebserverlaststatuscode '200'
+}
+
+testrun 'http://localhost:8080'
+
+changetohttpswebserver
+
+testrun 'https://localhost:4433'
diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage
index e45326970..ac0563b7f 100755
--- a/test/integration/test-pdiff-usage
+++ b/test/integration/test-pdiff-usage
@@ -11,7 +11,7 @@ buildaptarchive
setupflataptarchive
changetowebserver
signreleasefiles
-aptget update -qq
+testsuccess aptget update
testnopackage newstuff
PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
@@ -19,9 +19,7 @@ testequal "$(cat ${PKGFILE})
" aptcache show apt oldstuff
cp ${PKGFILE}-new aptarchive/Packages
-cat aptarchive/Packages | gzip > aptarchive/Packages.gz
-cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2
-cat aptarchive/Packages | xz --format=lzma > aptarchive/Packages.lzma
+compressfile 'aptarchive/Packages'
rm -rf aptarchive/Packages.diff
mkdir -p aptarchive/Packages.diff
PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
@@ -38,7 +36,7 @@ SHA1-Patches:
generatereleasefiles '+1hour'
signreleasefiles
find aptarchive -name 'Packages*' -type f -delete
-aptget update -qq
+testsuccess aptget update
testnopackage oldstuff
testequal "$(cat ${PKGFILE}-new)
diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning
index 9e1ea4ac5..8eb4bcbad 100755
--- a/test/integration/test-policy-pinning
+++ b/test/integration/test-policy-pinning
@@ -228,16 +228,16 @@ testequalpolicycoolstuff "" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test=ButAutomat
testequalpolicycoolstuff "" "1.0" 100 990 600 "2.0~bpo1" -o Test=ButAutomaticUpgrades -t stable
rm rootdir/etc/apt/preferences
-aptget install coolstuff -qq > /dev/null 2> /dev/null
+testsuccess aptget install coolstuff -y
testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades
-aptget dist-upgrade -qq > /dev/null 2> /dev/null
+testsuccess aptget dist-upgrade -y
testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades
testequalpolicycoolstuff "1.0" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable
testequalpolicycoolstuff "1.0" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports
-aptget install coolstuff -t backports -qq > /dev/null 2> /dev/null
+testsuccess aptget install coolstuff -t backports -y
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades
-aptget dist-upgrade -qq > /dev/null 2> /dev/null
+testsuccess aptget dist-upgrade -y
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports
diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew
new file mode 100755
index 000000000..fed12dad0
--- /dev/null
+++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew
@@ -0,0 +1,100 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386' 'armel'
+
+insertpackage 'stable' 'allarchs' 'all' '1'
+insertpackage 'unstable' 'allarchs' 'all' '2'
+
+insertinstalledpackage 'fine' 'i386,amd64' '1' 'Multi-Arch: same'
+insertpackage 'stable' 'fine' 'i386,amd64' '1' 'Multi-Arch: same'
+insertpackage 'unstable' 'fine' 'amd64,i386' '2' 'Multi-Arch: same'
+
+insertinstalledpackage 'fine-installed' 'i386,amd64' '1' 'Multi-Arch: same'
+insertpackage 'stable' 'fine-installed' 'i386,amd64,armel' '1' 'Multi-Arch: same'
+insertpackage 'unstable' 'fine-installed' 'i386,amd64' '2' 'Multi-Arch: same'
+
+insertinstalledpackage 'out-of-sync-native' 'i386,amd64' '1' 'Multi-Arch: same'
+insertpackage 'stable' 'out-of-sync-native' 'i386,amd64' '1' 'Multi-Arch: same'
+insertpackage 'unstable' 'out-of-sync-native' 'amd64' '2' 'Multi-Arch: same'
+
+insertinstalledpackage 'out-of-sync-foreign' 'i386,amd64' '1' 'Multi-Arch: same'
+insertpackage 'stable' 'out-of-sync-foreign' 'i386,amd64' '1' 'Multi-Arch: same'
+insertpackage 'unstable' 'out-of-sync-foreign' 'i386' '2' 'Multi-Arch: same'
+
+insertinstalledpackage 'out-of-sync-gone-native' 'i386,amd64' '1' 'Multi-Arch: same'
+insertpackage 'stable' 'out-of-sync-gone-native' 'i386' '1' 'Multi-Arch: same'
+insertpackage 'unstable' 'out-of-sync-gone-native' 'i386' '2' 'Multi-Arch: same'
+
+insertinstalledpackage 'out-of-sync-gone-foreign' 'i386,amd64' '1' 'Multi-Arch: same'
+insertpackage 'stable' 'out-of-sync-gone-foreign' 'amd64' '1' 'Multi-Arch: same'
+insertpackage 'unstable' 'out-of-sync-gone-foreign' 'amd64' '2' 'Multi-Arch: same'
+
+insertpackage 'stable' 'libsame2' 'i386' '1' 'Multi-Arch: same'
+insertpackage 'unstable' 'libsame2' 'amd64' '2' 'Multi-Arch: same'
+insertpackage 'unstable' 'depender2' 'all' '2' 'Depends: libsame2 (= 2)'
+insertpackage 'stable' 'libsame3' 'i386' '1' 'Multi-Arch: same'
+insertpackage 'unstable' 'libsame3' 'i386,amd64' '3' 'Multi-Arch: same'
+insertpackage 'unstable' 'depender3' 'all' '3' 'Depends: libsame3 (= 3)'
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+ out-of-sync-gone-foreign:i386 out-of-sync-gone-native
+The following packages have been kept back:
+ out-of-sync-foreign:i386 out-of-sync-native
+The following packages will be upgraded:
+ fine fine:i386 fine-installed fine-installed:i386 out-of-sync-gone-foreign
+ out-of-sync-gone-native:i386
+6 upgraded, 0 newly installed, 2 to remove and 2 not upgraded.
+Remv out-of-sync-gone-foreign:i386 [1]
+Remv out-of-sync-gone-native [1]
+Inst fine [1] (2 unstable [amd64]) [fine:amd64 on fine:i386] [fine:i386 on fine:amd64] [fine:i386 ]
+Inst fine:i386 [1] (2 unstable [i386])
+Conf fine (2 unstable [amd64])
+Conf fine:i386 (2 unstable [i386])
+Inst fine-installed [1] (2 unstable [amd64]) [fine-installed:amd64 on fine-installed:i386] [fine-installed:i386 on fine-installed:amd64] [fine-installed:i386 ]
+Inst fine-installed:i386 [1] (2 unstable [i386])
+Conf fine-installed (2 unstable [amd64])
+Conf fine-installed:i386 (2 unstable [i386])
+Inst out-of-sync-gone-foreign [1] (2 unstable [amd64])
+Inst out-of-sync-gone-native:i386 [1] (2 unstable [i386])
+Conf out-of-sync-gone-foreign (2 unstable [amd64])
+Conf out-of-sync-gone-native:i386 (2 unstable [i386])' aptget dist-upgrade -s #-o Debug::pkgDepCache::Marker=1
+
+rm rootdir/var/lib/dpkg/status
+insertinstalledpackage 'libsame2' 'i386' '1' 'Multi-Arch: same'
+insertinstalledpackage 'libsame3' 'i386' '1' 'Multi-Arch: same'
+
+# the error message isn't great, but better than nothing, right?
+testequal 'Reading package lists...
+Building dependency tree...
+Some packages could not be installed. This may mean that you have
+requested an impossible situation or if you are using the unstable
+distribution that some required packages have not yet been created
+or been moved out of Incoming.
+The following information may help to resolve the situation:
+
+The following packages have unmet dependencies:
+ depender2 : Depends: libsame2 (= 2) but it is not going to be installed
+E: Unable to correct problems, you have held broken packages.' aptget install depender2 -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ libsame3:i386 libsame3
+The following NEW packages will be installed:
+ depender3 libsame3
+The following packages will be upgraded:
+ libsame3:i386
+1 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame3:i386 [1] (3 unstable [i386])
+Inst libsame3 (3 unstable [amd64])
+Inst depender3 (3 unstable [all])
+Conf libsame3:i386 (3 unstable [i386])
+Conf libsame3 (3 unstable [amd64])
+Conf depender3 (3 unstable [all])' aptget install depender3 -s
diff --git a/test/integration/test-releasefile-valid-until b/test/integration/test-releasefile-valid-until
index 680a370cb..e673d5f71 100755
--- a/test/integration/test-releasefile-valid-until
+++ b/test/integration/test-releasefile-valid-until
@@ -32,64 +32,64 @@ aptgetupdate() {
setupreleasefile
msgtest 'Release file is accepted as it has' 'no Until'
-aptgetupdate && msgpass || msgfail
+testsuccess --nomsg aptgetupdate
setupreleasefile
msgtest 'Release file is accepted as it has' 'no Until and good Max-Valid'
-aptgetupdate -o Acquire::Max-ValidTime=3600 && msgpass || msgfail
+testsuccess --nomsg aptgetupdate -o Acquire::Max-ValidTime=3600
setupreleasefile 'now - 2 days'
msgtest 'Release file is rejected as it has' 'no Until, but bad Max-Valid'
-aptgetupdate -o Acquire::Max-ValidTime=3600 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=3600
setupreleasefile 'now - 3 days' 'now + 1 day'
msgtest 'Release file is accepted as it has' 'good Until'
-aptgetupdate && msgpass || msgfail
+testsuccess --nomsg aptgetupdate
setupreleasefile 'now - 7 days' 'now - 4 days'
msgtest 'Release file is rejected as it has' 'bad Until'
-aptgetupdate && msgfail || msgpass
+testfailure --nomsg aptgetupdate
setupreleasefile 'now - 7 days' 'now - 4 days'
msgtest 'Release file is rejected as it has' 'bad Until (ignore good Max-Valid)'
-aptgetupdate -o Acquire::Max-ValidTime=1209600 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=1209600
setupreleasefile 'now - 7 days' 'now - 4 days'
msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until)'
-aptgetupdate -o Acquire::Max-ValidTime=86400 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400
setupreleasefile 'now - 7 days' 'now + 4 days'
msgtest 'Release file is rejected as it has' 'bad Max-Valid (good Until)'
-aptgetupdate -o Acquire::Max-ValidTime=86400 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400
setupreleasefile 'now - 7 days' 'now + 4 days'
msgtest 'Release file is accepted as it has' 'good labeled Max-Valid'
-aptgetupdate -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 && msgpass || msgfail
+testsuccess --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600
setupreleasefile 'now - 7 days' 'now + 4 days'
msgtest 'Release file is rejected as it has' 'bad labeled Max-Valid'
-aptgetupdate -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400
setupreleasefile 'now - 7 days' 'now + 1 days'
msgtest 'Release file is accepted as it has' 'good Until (good Min-Valid, no Max-Valid)'
-aptgetupdate -o Acquire::Min-ValidTime=1209600 && msgpass || msgfail
+testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600
setupreleasefile 'now - 7 days' 'now - 4 days'
msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, no Max-Valid)'
-aptgetupdate -o Acquire::Min-ValidTime=1209600 && msgpass || msgfail
+testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600
setupreleasefile 'now - 7 days' 'now - 2 days'
msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, good Max-Valid) <'
-aptgetupdate -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200 && msgpass || msgfail
+testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200
setupreleasefile 'now - 7 days' 'now - 2 days'
msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, good Min-Valid) >'
-aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200
setupreleasefile 'now - 7 days' 'now - 2 days'
msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) <'
-aptgetupdate -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920
setupreleasefile 'now - 7 days' 'now - 2 days'
msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) >'
-aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920
diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification
index e56f458d3..9d34a521a 100755
--- a/test/integration/test-releasefile-verification
+++ b/test/integration/test-releasefile-verification
@@ -11,20 +11,24 @@ buildaptarchive
setupflataptarchive
changetowebserver
+downloadfile "http://localhost:8080/_config/set/aptwebserver::support::range/false" '/dev/null' >/dev/null
+
prepare() {
local DATE="${2:-now}"
- if [ "$DATE" = 'now' -a "$1" = "${PKGFILE}-new" ]; then
- DATE='now + 6 days'
+ if [ "$DATE" = 'now' ]; then
+ if [ "$1" = "${PKGFILE}-new" ]; then
+ DATE='now - 1 day'
+ else
+ DATE='now - 7 day'
+ fi
fi
for release in $(find rootdir/var/lib/apt/lists 2> /dev/null); do
- touch -d 'now - 6 hours' $release
+ touch -d 'now - 1 year' $release
done
aptget clean
cp $1 aptarchive/Packages
find aptarchive -name 'Release' -delete
- cat aptarchive/Packages | gzip > aptarchive/Packages.gz
- cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2
- cat aptarchive/Packages | xz --format=lzma > aptarchive/Packages.lzma
+ compressfile 'aptarchive/Packages' "$DATE"
generatereleasefiles "$DATE"
}
@@ -87,13 +91,34 @@ touch aptarchive/apt.deb
PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
+updatesuccess() {
+ local LOG='update.log'
+ if aptget update >$LOG 2>&1 || grep -q -E '^(W|E): ' $LOG; then
+ msgpass
+ else
+ cat $LOG
+ msgfail
+ fi
+}
+
+updatefailure() {
+ local LOG='update.log'
+ aptget update >$LOG 2>&1 || true
+ if grep -q -E "$1" $LOG; then
+ msgpass
+ else
+ cat $LOG
+ msgfail
+ fi
+}
+
runtest() {
prepare ${PKGFILE}
rm -rf rootdir/var/lib/apt/lists
signreleasefiles 'Joe Sixpack'
find aptarchive/ -name "$DELETEFILE" -delete
msgtest 'Cold archive signed by' 'Joe Sixpack'
- aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
+ updatesuccess
testequal "$(cat ${PKGFILE})
" aptcache show apt
installaptold
@@ -102,18 +127,29 @@ runtest() {
signreleasefiles 'Joe Sixpack'
find aptarchive/ -name "$DELETEFILE" -delete
msgtest 'Good warm archive signed by' 'Joe Sixpack'
- aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
+ updatesuccess
testequal "$(cat ${PKGFILE}-new)
" aptcache show apt
installaptnew
+ prepare ${PKGFILE}
+ rm -rf rootdir/var/lib/apt/lists
+ cp keys/rexexpired.pub rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
+ signreleasefiles 'Rex Expired'
+ find aptarchive/ -name "$DELETEFILE" -delete
+ msgtest 'Cold archive signed by' 'Rex Expired'
+ updatefailure '^W: .* KEYEXPIRED'
+ testequal "$(cat ${PKGFILE})
+" aptcache show apt
+ failaptold
+ rm rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
prepare ${PKGFILE}
rm -rf rootdir/var/lib/apt/lists
signreleasefiles 'Marvin Paranoid'
find aptarchive/ -name "$DELETEFILE" -delete
msgtest 'Cold archive signed by' 'Marvin Paranoid'
- aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgpass || msgfail
+ updatefailure '^W: .* NO_PUBKEY'
testequal "$(cat ${PKGFILE})
" aptcache show apt
failaptold
@@ -127,7 +163,7 @@ runtest() {
signreleasefiles 'Joe Sixpack'
find aptarchive/ -name "$DELETEFILE" -delete
msgtest 'Bad warm archive signed by' 'Joe Sixpack'
- aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
+ updatesuccess
testequal "$(cat ${PKGFILE}-new)
" aptcache show apt
installaptnew
@@ -138,7 +174,7 @@ runtest() {
signreleasefiles 'Joe Sixpack'
find aptarchive/ -name "$DELETEFILE" -delete
msgtest 'Cold archive signed by' 'Joe Sixpack'
- aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
+ updatesuccess
testequal "$(cat ${PKGFILE})
" aptcache show apt
installaptold
@@ -147,10 +183,30 @@ runtest() {
signreleasefiles 'Marvin Paranoid'
find aptarchive/ -name "$DELETEFILE" -delete
msgtest 'Good warm archive signed by' 'Marvin Paranoid'
- aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgpass || msgfail
+ updatefailure '^W: .* NO_PUBKEY'
testequal "$(cat ${PKGFILE})
" aptcache show apt
installaptold
+
+ prepare ${PKGFILE}-new
+ cp keys/rexexpired.pub rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
+ signreleasefiles 'Rex Expired'
+ find aptarchive/ -name "$DELETEFILE" -delete
+ msgtest 'Good warm archive signed by' 'Rex Expired'
+ updatefailure '^W: .* KEYEXPIRED'
+ testequal "$(cat ${PKGFILE})
+" aptcache show apt
+ installaptold
+ rm rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
+
+ prepare ${PKGFILE}-new
+ signreleasefiles
+ find aptarchive/ -name "$DELETEFILE" -delete
+ msgtest 'Good warm archive signed by' 'Joe Sixpack'
+ updatesuccess
+ testequal "$(cat ${PKGFILE}-new)
+" aptcache show apt
+ installaptnew
}
runtest2() {
@@ -158,7 +214,7 @@ runtest2() {
rm -rf rootdir/var/lib/apt/lists
signreleasefiles 'Joe Sixpack'
msgtest 'Cold archive signed by' 'Joe Sixpack'
- aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
+ updatesuccess
# New .deb but now an unsigned archive. For example MITM to circumvent
# package verification.
@@ -166,7 +222,7 @@ runtest2() {
find aptarchive/ -name InRelease -delete
find aptarchive/ -name Release.gpg -delete
msgtest 'Warm archive signed by' 'nobody'
- aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
+ updatesuccess
testequal "$(cat ${PKGFILE}-new)
" aptcache show apt
failaptnew
@@ -174,7 +230,7 @@ runtest2() {
# Unsigned archive from the beginning must also be detected.
rm -rf rootdir/var/lib/apt/lists
msgtest 'Cold archive signed by' 'nobody'
- aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
+ updatesuccess
testequal "$(cat ${PKGFILE}-new)
" aptcache show apt
failaptnew
diff --git a/test/integration/test-sourceslist-arch-plusminus-options b/test/integration/test-sourceslist-arch-plusminus-options
new file mode 100755
index 000000000..0d4d7448f
--- /dev/null
+++ b/test/integration/test-sourceslist-arch-plusminus-options
@@ -0,0 +1,85 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+testbinaries() {
+ msgtest 'Test acquired archs for' "$1"
+ shift
+ rm -f gotarchs.list
+ aptget update --print-uris | grep -o '/binary-[a-z0-9-]\+/Packages' | sort > gotarchs.list
+ while [ -n "$1" ]; do
+ echo "/binary-${1}/Packages"
+ shift
+ done | sort | checkdiff - gotarchs.list && msgpass || msgfail
+}
+
+echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'default & native' 'amd64'
+configarchitecture 'amd64' 'i386'
+testbinaries 'default & native + foreign' 'amd64' 'i386'
+configarchitecture 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel'
+testbinaries 'default & native + many foreigns' 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel'
+
+echo 'deb [arch=amd64] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch=native' 'amd64'
+
+echo 'deb [arch=mips] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch=foreign' 'mips'
+
+echo 'deb [arch=kfreebsd-armel] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch=unknown' 'kfreebsd-armel'
+
+echo 'deb [arch=amd64,i386] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch=native,foreign' 'amd64' 'i386'
+
+echo 'deb [arch=mips,armhf] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch=foreign,foreign' 'mips' 'armhf'
+
+echo 'deb [arch=kfreebsd-armel,hurd-powerpc,mipsel,armel] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch=unknown,unknown,foreign,foreign' 'kfreebsd-armel' 'hurd-powerpc' 'mipsel' 'armel'
+
+echo 'deb [arch+=amd64] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch+=native' 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel'
+
+echo 'deb [arch+=mips] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch+=foreign' 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel'
+
+echo 'deb [arch+=mips,armhf,i386] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch+=foreign,foreign,foreign' 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel'
+
+echo 'deb [arch+=hurd-powerpc] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch+=unknown' 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel' 'hurd-powerpc'
+
+echo 'deb [arch+=mips,hurd-powerpc,i386] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch+=foreign,unknown,foreign' 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel' 'hurd-powerpc'
+
+echo 'deb [arch-=amd64] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch-=native' 'i386' 'armel' 'armhf' 'mips' 'mipsel'
+
+echo 'deb [arch-=mips] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch-=foreign' 'amd64' 'i386' 'armel' 'armhf' 'mipsel'
+
+echo 'deb [arch-=mips,armhf,i386] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch-=foreign,foreign,foreign' 'amd64' 'armel' 'mipsel'
+
+echo 'deb [arch-=hurd-powerpc] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch-=unknown' 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel'
+
+echo 'deb [arch-=mips,hurd-powerpc,i386] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'arch-=foreign,unknown,foreign' 'amd64' 'armel' 'armhf' 'mipsel'
+
+echo 'deb [arch=mips,i386 arch-=mips] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'substract from a arch-set' 'i386'
+
+echo 'deb [arch=mips,i386 arch-=mips] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'useless substract from a arch-set' 'i386'
+
+echo 'deb [arch=mips,i386 arch+=armhf] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'addition to a arch-set' 'i386' 'mips' 'armhf'
+
+echo 'deb [arch=mips,i386 arch+=mips] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
+testbinaries 'useless addition to a arch-set' 'i386' 'mips'
diff --git a/test/integration/test-ubuntu-bug-761175-remove-purge b/test/integration/test-ubuntu-bug-761175-remove-purge
index f55c6e909..14648e9b8 100755
--- a/test/integration/test-ubuntu-bug-761175-remove-purge
+++ b/test/integration/test-ubuntu-bug-761175-remove-purge
@@ -18,12 +18,10 @@ setupaptarchive
testdpkgnotinstalled compiz-core
-msgtest 'Install package' 'compiz-core'
-aptget install compiz-core -qq 2>&1 >/dev/null && msgpass || msgfail
+testsuccess aptget install compiz-core
testdpkginstalled compiz-core
-msgtest 'Remove package' 'compiz-core'
-aptget remove compiz-core -y -qq 2>&1 >/dev/null && msgpass || msgfail
+testsuccess aptget remove compiz-core -y
testdpkgnotinstalled compiz-core
msgtest 'Check that conffiles are still around for' 'compiz-core'
diff --git a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only
index fad5488fb..e9d684309 100755
--- a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only
+++ b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only
@@ -28,7 +28,7 @@ MD5Sum:
done
msgtest 'The unsigned garbage before signed block is' 'ignored'
-aptget update -qq > /dev/null 2>&1 && msgpass || msgfail
+testsuccess --nomsg aptget update
ROOTDIR="$(readlink -f .)"
testequal "Package files:
diff --git a/test/integration/test-ubuntu-bug-859188-multiarch-reinstall b/test/integration/test-ubuntu-bug-859188-multiarch-reinstall
index 0fdf97485..be86f2e91 100755
--- a/test/integration/test-ubuntu-bug-859188-multiarch-reinstall
+++ b/test/integration/test-ubuntu-bug-859188-multiarch-reinstall
@@ -8,14 +8,13 @@ configarchitecture 'amd64' 'i386' 'armel'
buildsimplenativepackage 'libsame' 'amd64,i386,armel' '1.0' 'unstable' 'Multi-Arch: same'
-# FIXME: hack around dpkg's current inability to handle multiarch, a clean install would be better…
-insertinstalledpackage 'libsame' 'amd64,i386' '1.0' 'Multi-Arch: same'
-sed -e 's#/installed#/unstable#' -e 's#Installed-Size: 42#Installed-Size: 1#' -i rootdir/var/lib/dpkg/status
-
setupaptarchive
+testsuccess aptget install libsame libsame:i386
+
REINSTALL='Reading package lists...
Building dependency tree...
+Reading state information...
0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded.
Inst libsame [1.0] (1.0 unstable [amd64])
Inst libsame:i386 [1.0] (1.0 unstable [i386])
diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc
index a8d191d0e..4dae342dd 100644
--- a/test/interactive-helper/aptwebserver.cc
+++ b/test/interactive-helper/aptwebserver.cc
@@ -100,8 +100,13 @@ bool sendHead(int const client, int const httpcode, std::list<std::string> &head
std::string response("HTTP/1.1 ");
response.append(httpcodeToStr(httpcode));
headers.push_front(response);
+ _config->Set("APTWebserver::Last-Status-Code", httpcode);
- headers.push_back("Server: APT webserver");
+ std::stringstream buffer;
+ _config->Dump(buffer, "aptwebserver::response-header", "%t: %v%n", false);
+ std::vector<std::string> addheaders = VectorizeString(buffer.str(), '\n');
+ for (std::vector<std::string>::const_iterator h = addheaders.begin(); h != addheaders.end(); ++h)
+ headers.push_back(*h);
std::string date("Date: ");
date.append(TimeRFC1123(time(NULL)));
@@ -156,15 +161,29 @@ void sendError(int const client, int const httpcode, std::string const &request,
std::string response("<html><head><title>");
response.append(httpcodeToStr(httpcode)).append("</title></head>");
response.append("<body><h1>").append(httpcodeToStr(httpcode)).append("</h1>");
- if (error.empty() == false)
- response.append("<p><em>Error</em>: ").append(error).append("</p>");
- response.append("This error is a result of the request: <pre>");
+ if (httpcode != 200)
+ {
+ if (error.empty() == false)
+ response.append("<p><em>Error</em>: ").append(error).append("</p>");
+ response.append("This error is a result of the request: <pre>");
+ }
+ else
+ {
+ if (error.empty() == false)
+ response.append("<p><em>Success</em>: ").append(error).append("</p>");
+ response.append("The successfully executed operation was requested by: <pre>");
+ }
response.append(request).append("</pre></body></html>");
addDataHeaders(headers, response);
sendHead(client, httpcode, headers);
if (content == true)
sendData(client, response);
}
+void sendSuccess(int const client, std::string const &request,
+ bool content, std::string const &error = "")
+{
+ sendError(client, 200, request, content, error);
+}
/*}}}*/
void sendRedirect(int const client, int const httpcode, std::string const &uri,/*{{{*/
std::string const &request, bool content)
@@ -319,6 +338,33 @@ bool parseFirstLine(int const client, std::string const &request, /*{{{*/
sendError(client, 500, request, sendContent, "Filename contains an unencoded space");
return false;
}
+
+ std::string host = LookupTag(request, "Host", "");
+ if (host.empty() == true)
+ {
+ // RFC 2616 §14.23 requires Host
+ sendError(client, 400, request, sendContent, "Host header is required");
+ return false;
+ }
+ host = "http://" + host;
+
+ // Proxies require absolute uris, so this is a simple proxy-fake option
+ std::string const absolute = _config->Find("aptwebserver::request::absolute", "uri,path");
+ if (strncmp(host.c_str(), filename.c_str(), host.length()) == 0)
+ {
+ if (absolute.find("uri") == std::string::npos)
+ {
+ sendError(client, 400, request, sendContent, "Request is absoluteURI, but configured to not accept that");
+ return false;
+ }
+ // strip the host from the request to make it an absolute path
+ filename.erase(0, host.length());
+ }
+ else if (absolute.find("path") == std::string::npos)
+ {
+ sendError(client, 400, request, sendContent, "Request is absolutePath, but configured to not accept that");
+ return false;
+ }
filename = DeQuoteString(filename);
// this is not a secure server, but at least prevent the obvious …
@@ -338,10 +384,54 @@ bool parseFirstLine(int const client, std::string const &request, /*{{{*/
return true;
}
/*}}}*/
+bool handleOnTheFlyReconfiguration(int const client, std::string const &request, std::vector<std::string> const &parts)/*{{{*/
+{
+ size_t const pcount = parts.size();
+ if (pcount == 4 && parts[1] == "set")
+ {
+ _config->Set(parts[2], parts[3]);
+ sendSuccess(client, request, true, "Option '" + parts[2] + "' was set to '" + parts[3] + "'!");
+ return true;
+ }
+ else if (pcount == 4 && parts[1] == "find")
+ {
+ std::list<std::string> headers;
+ std::string response = _config->Find(parts[2], parts[3]);
+ addDataHeaders(headers, response);
+ sendHead(client, 200, headers);
+ sendData(client, response);
+ return true;
+ }
+ else if (pcount == 3 && parts[1] == "find")
+ {
+ std::list<std::string> headers;
+ if (_config->Exists(parts[2]) == true)
+ {
+ std::string response = _config->Find(parts[2]);
+ addDataHeaders(headers, response);
+ sendHead(client, 200, headers);
+ sendData(client, response);
+ return true;
+ }
+ sendError(client, 404, request, "Requested Configuration option doesn't exist.");
+ return false;
+ }
+ else if (pcount == 3 && parts[1] == "clear")
+ {
+ _config->Clear(parts[2]);
+ sendSuccess(client, request, true, "Option '" + parts[2] + "' was cleared.");
+ return true;
+ }
+
+ sendError(client, 400, request, true, "Unknown on-the-fly configuration request");
+ return false;
+}
+ /*}}}*/
int main(int const argc, const char * argv[])
{
CommandLine::Args Args[] = {
{0, "port", "aptwebserver::port", CommandLine::HasArg},
+ {0, "request-absolute", "aptwebserver::request::absolute", CommandLine::HasArg},
{'c',"config-file",0,CommandLine::ConfigFile},
{'o',"option",0,CommandLine::ArbItem},
{0,0,0,0}
@@ -427,6 +517,9 @@ int main(int const argc, const char * argv[])
listen(sock, 1);
/*}}}*/
+ _config->CndSet("aptwebserver::response-header::Server", "APT webserver");
+ _config->CndSet("aptwebserver::response-header::Accept-Ranges", "bytes");
+
std::vector<std::string> messages;
int client;
while ((client = accept(sock, NULL, NULL)) != -1)
@@ -447,12 +540,15 @@ int main(int const argc, const char * argv[])
if (parseFirstLine(client, *m, filename, sendContent, closeConnection) == false)
continue;
- std::string host = LookupTag(*m, "Host", "");
- if (host.empty() == true)
+ // special webserver command request
+ if (filename.length() > 1 && filename[0] == '_')
{
- // RFC 2616 §14.23 requires Host
- sendError(client, 400, *m, sendContent, "Host header is required");
- continue;
+ std::vector<std::string> parts = VectorizeString(filename, '/');
+ if (parts[0] == "_config")
+ {
+ handleOnTheFlyReconfiguration(client, *m, parts);
+ continue;
+ }
}
// string replacements in the requested filename
@@ -512,6 +608,60 @@ int main(int const argc, const char * argv[])
}
}
+ if (_config->FindB("aptwebserver::support::range", true) == true)
+ condition = LookupTag(*m, "Range", "");
+ else
+ condition.clear();
+ if (condition.empty() == false && strncmp(condition.c_str(), "bytes=", 6) == 0)
+ {
+ time_t cache;
+ std::string ifrange;
+ if (_config->FindB("aptwebserver::support::if-range", true) == true)
+ ifrange = LookupTag(*m, "If-Range", "");
+ bool validrange = (ifrange.empty() == true ||
+ (RFC1123StrToTime(ifrange.c_str(), cache) == true &&
+ cache <= data.ModificationTime()));
+
+ // FIXME: support multiple byte-ranges (APT clients do not do this)
+ if (condition.find(',') == std::string::npos)
+ {
+ size_t start = 6;
+ unsigned long long filestart = strtoull(condition.c_str() + start, NULL, 10);
+ // FIXME: no support for last-byte-pos being not the end of the file (APT clients do not do this)
+ size_t dash = condition.find('-') + 1;
+ unsigned long long fileend = strtoull(condition.c_str() + dash, NULL, 10);
+ unsigned long long filesize = data.FileSize();
+ if ((fileend == 0 || (fileend == filesize && fileend >= filestart)) &&
+ validrange == true)
+ {
+ if (filesize > filestart)
+ {
+ data.Skip(filestart);
+ std::ostringstream contentlength;
+ contentlength << "Content-Length: " << (filesize - filestart);
+ headers.push_back(contentlength.str());
+ std::ostringstream contentrange;
+ contentrange << "Content-Range: bytes " << filestart << "-"
+ << filesize - 1 << "/" << filesize;
+ headers.push_back(contentrange.str());
+ sendHead(client, 206, headers);
+ if (sendContent == true)
+ sendFile(client, data);
+ continue;
+ }
+ else
+ {
+ headers.push_back("Content-Length: 0");
+ std::ostringstream contentrange;
+ contentrange << "Content-Range: bytes */" << filesize;
+ headers.push_back(contentrange.str());
+ sendHead(client, 416, headers);
+ continue;
+ }
+ }
+ }
+ }
+
addFileHeaders(headers, data);
sendHead(client, 200, headers);
if (sendContent == true)
diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc
index 87d5699ef..2c974ee0a 100644
--- a/test/libapt/configuration_test.cc
+++ b/test/libapt/configuration_test.cc
@@ -98,6 +98,10 @@ int main(int argc,const char *argv[]) {
equals(Cnf.FindDir("Dir::State"), "/rootdir/dev/null");
equals(Cnf.FindDir("Dir::State::lists"), "/rootdir/dev/null");
+ Cnf.Set("Moo::Bar", "1");
+ Cnf.Clear();
+ equals(Cnf.Find("Moo::Bar"), "");
+
//FIXME: Test for configuration file parsing;
// currently only integration/ tests test them implicitly
diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc
new file mode 100644
index 000000000..b6b8ac579
--- /dev/null
+++ b/test/libapt/fileutl_test.cc
@@ -0,0 +1,42 @@
+#include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
+
+#include "assert.h"
+#include <string>
+#include <vector>
+
+#include <stdio.h>
+#include <iostream>
+#include <stdlib.h>
+
+
+int main(int argc,char *argv[])
+{
+ std::vector<std::string> files;
+
+ // normal match
+ files = Glob("*.lst");
+ if (files.size() != 1)
+ {
+ _error->DumpErrors();
+ return 1;
+ }
+
+ // not there
+ files = Glob("xxxyyyzzz");
+ if (files.size() != 0 || _error->PendingError())
+ {
+ _error->DumpErrors();
+ return 1;
+ }
+
+ // many matches (number is a bit random)
+ files = Glob("*.cc");
+ if (files.size() < 10)
+ {
+ _error->DumpErrors();
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc
index e2d0aec5b..3da89052b 100644
--- a/test/libapt/hashsums_test.cc
+++ b/test/libapt/hashsums_test.cc
@@ -3,6 +3,7 @@
#include <apt-pkg/sha2.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/hashes.h>
+#include <apt-pkg/fileutl.h>
#include <iostream>
#include <stdio.h>
@@ -108,55 +109,54 @@ int main(int argc, char** argv)
Test<SHA512Summation>("The quick brown fox jumps over the lazy dog.", "91ea1245f20d46ae9a037a989f54f1f790f0a47607eeb8a14d12890cea77a1bb"
"c6c7ed9cf205e67b7f2b8fd4c7dfd3a7a8617e45f3c463d481c7e586c39ac1ed");
- FILE* fd = fopen(argv[1], "r");
- if (fd == NULL) {
+ FileFd fd(argv[1], FileFd::ReadOnly);
+ if (fd.IsOpen() == false) {
std::cerr << "Can't open file for 1. testing: " << argv[1] << std::endl;
return 1;
}
{
Hashes hashes;
- hashes.AddFD(fileno(fd));
+ hashes.AddFD(fd.Fd());
equals(argv[2], hashes.MD5.Result().Value());
equals(argv[3], hashes.SHA1.Result().Value());
equals(argv[4], hashes.SHA256.Result().Value());
equals(argv[5], hashes.SHA512.Result().Value());
}
- fseek(fd, 0L, SEEK_END);
- unsigned long sz = ftell(fd);
- fseek(fd, 0L, SEEK_SET);
+ unsigned long sz = fd.FileSize();
+ fd.Seek(0);
{
Hashes hashes;
- hashes.AddFD(fileno(fd), sz);
+ hashes.AddFD(fd.Fd(), sz);
equals(argv[2], hashes.MD5.Result().Value());
equals(argv[3], hashes.SHA1.Result().Value());
equals(argv[4], hashes.SHA256.Result().Value());
equals(argv[5], hashes.SHA512.Result().Value());
}
- fseek(fd, 0L, SEEK_SET);
+ fd.Seek(0);
{
MD5Summation md5;
- md5.AddFD(fileno(fd));
+ md5.AddFD(fd.Fd());
equals(argv[2], md5.Result().Value());
}
- fseek(fd, 0L, SEEK_SET);
+ fd.Seek(0);
{
SHA1Summation sha1;
- sha1.AddFD(fileno(fd));
+ sha1.AddFD(fd.Fd());
equals(argv[3], sha1.Result().Value());
}
- fseek(fd, 0L, SEEK_SET);
+ fd.Seek(0);
{
SHA256Summation sha2;
- sha2.AddFD(fileno(fd));
+ sha2.AddFD(fd.Fd());
equals(argv[4], sha2.Result().Value());
}
- fseek(fd, 0L, SEEK_SET);
+ fd.Seek(0);
{
SHA512Summation sha2;
- sha2.AddFD(fileno(fd));
+ sha2.AddFD(fd.Fd());
equals(argv[5], sha2.Result().Value());
}
- fclose(fd);
+ fd.Close();
// test HashString code
{
diff --git a/test/libapt/makefile b/test/libapt/makefile
index 1b67cba9d..73403b24c 100644
--- a/test/libapt/makefile
+++ b/test/libapt/makefile
@@ -98,6 +98,11 @@ include $(PROGRAM_H)
PROGRAM = IndexCopyToSourceList${BASENAME}
SLIBS = -lapt-pkg
SOURCE = indexcopytosourcelist_test.cc
+
+# test fileutls
+PROGRAM = FileUtl${BASENAME}
+SLIBS = -lapt-pkg
+SOURCE = fileutl_test.cc
include $(PROGRAM_H)
# test tagfile
diff --git a/test/libapt/run-tests b/test/libapt/run-tests
index f18be6d2b..a056f31f9 100755
--- a/test/libapt/run-tests
+++ b/test/libapt/run-tests
@@ -2,9 +2,11 @@
set -e
DIR=$(readlink -f $(dirname $0))
-echo "Compiling the tests …"
-(cd $DIR && make)
-echo "Running all testcases …"
+if [ -z "$MAKELEVEL" ]; then
+ echo 'Compiling the tests …'
+ (cd $DIR && make)
+ echo 'Running all testcases …'
+fi
LDPATH="$DIR/../../build/bin"
EXT="_libapt_test"
EXIT_CODE=0
@@ -70,9 +72,11 @@ do
"${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-tlh%5fDE"
elif [ $name = "HashSums${EXT}" ]; then
TMP="$(readlink -f "./${0}")"
- echo -n "Testing with ${NAME} "
- LD_LIBRARY_PATH=${LDPATH} ${testapp} $TMP $(md5sum $TMP | cut -d' ' -f 1) $(sha1sum $TMP | cut -d' ' -f 1) $(sha256sum $TMP | cut -d' ' -f 1) $(sha512sum $TMP | cut -d' ' -f 1) && echo "$TESTOKAY" || echo "$TESTFAIL"
- continue
+ tmppath="$TMP"
+ tmppath="${tmppath} $(md5sum $TMP | cut -d' ' -f 1)"
+ tmppath="${tmppath} $(sha1sum $TMP | cut -d' ' -f 1)"
+ tmppath="${tmppath} $(sha256sum $TMP | cut -d' ' -f 1)"
+ tmppath="${tmppath} $(sha512sum $TMP | cut -d' ' -f 1)"
elif [ $name = "CompareVersion${EXT}" ]; then
tmppath="${DIR}/versions.lst"
elif [ $name = "CdromFindPackages${EXT}" ]; then
@@ -107,8 +111,8 @@ do
fi
echo -n "Testing with ${NAME} "
- if LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} ; then
- echo "$TESTOKAY"
+ if MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} ; then
+ echo "$TESTOKAY"
else
echo "$TESTFAIL"
EXIT_CODE=1
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc
index bfe0d7222..110a20d27 100644
--- a/test/libapt/strutil_test.cc
+++ b/test/libapt/strutil_test.cc
@@ -42,5 +42,32 @@ int main(int argc,char *argv[])
output = DeEscapeString(input);
equals(output, expected);
+ // Split
+ input = "status: libnet1:amd64: unpacked";
+ vector<std::string> result = StringSplit(input, ": ");
+ equals(result[0], "status");
+ equals(result[1], "libnet1:amd64");
+ equals(result[2], "unpacked");
+ equals(result.size(), 3);
+
+ input = "status: libnet1:amd64: unpacked";
+ result = StringSplit(input, "xxx");
+ equals(result[0], input);
+ equals(result.size(), 1);
+
+ input = "status: libnet1:amd64: unpacked";
+ result = StringSplit(input, "");
+ equals(result.size(), 0);
+
+ input = "x:y:z";
+ result = StringSplit(input, ":", 2);
+ equals(result.size(), 2);
+ equals(result[0], "x");
+ equals(result[1], "y:z");
+
+ input = "abc";
+ result = StringSplit(input, "");
+ equals(result.size(), 0);
+
return 0;
}