diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/framework | 5 | ||||
-rwxr-xr-x | test/integration/test-allow-scores-for-all-dependency-types | 29 | ||||
-rwxr-xr-x | test/integration/test-apt-download-progress | 40 | ||||
-rwxr-xr-x | test/integration/test-apt-ftparchive-src-cachedb | 4 | ||||
-rwxr-xr-x | test/integration/test-apt-get-install-deb | 19 | ||||
-rwxr-xr-x | test/integration/test-apt-helper | 43 | ||||
-rwxr-xr-x | test/integration/test-bug-769609-triggers-still-pending-after-run | 3 | ||||
-rwxr-xr-x | test/integration/test-kernel-helper-autoremove | 7 | ||||
-rwxr-xr-x | test/integration/test-no-fds-leaked-to-maintainer-scripts | 32 | ||||
-rw-r--r-- | test/interactive-helper/aptwebserver.cc | 3 |
10 files changed, 132 insertions, 53 deletions
diff --git a/test/integration/framework b/test/integration/framework index 2c794d1f3..5f13df1c0 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -248,7 +248,7 @@ setupenvironment() { echo "Dir::Bin::apt-key \"${BUILDDIRECTORY}/apt-key\";" >> aptconfig.conf fi - cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <<EOF + cat << EOF > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" #!/bin/sh set -e if [ -r "${TMPWORKINGDIRECTORY}/noopchroot.so" ]; then @@ -262,7 +262,6 @@ exec fakeroot dpkg --root="${TMPWORKINGDIRECTORY}/rootdir" \\ --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log \\ --force-not-root --force-bad-path "\$@" EOF - cat "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" chmod +x "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" echo "Dir::Bin::dpkg \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg\";" > rootdir/etc/apt/apt.conf.d/99dpkg @@ -827,7 +826,7 @@ buildaptarchivefromincoming() { [ -e ftparchive.conf ] || createaptftparchiveconfig [ -e dists ] || buildaptftparchivedirectorystructure msgninfo "\tGenerate Packages, Sources and Contents files… " - aptftparchive -qq generate ftparchive.conf + testsuccess aptftparchive generate ftparchive.conf cd - > /dev/null msgdone "info" generatereleasefiles "$@" diff --git a/test/integration/test-allow-scores-for-all-dependency-types b/test/integration/test-allow-scores-for-all-dependency-types index d1bcf1130..e1d805ce9 100755 --- a/test/integration/test-allow-scores-for-all-dependency-types +++ b/test/integration/test-allow-scores-for-all-dependency-types @@ -32,6 +32,11 @@ insertpackage 'multipleyes' 'foo' 'amd64' '2.2' 'Conflicts: bar (<= 3)' # having foo multiple times as conflict is a non-advisable hack in general insertpackage 'multipleyes' 'bar' 'amd64' '2.2' 'Conflicts: foo (<= 3), foo (<= 3)' +#774924 - slightly simplified +insertpackage 'jessie' 'login' 'amd64' '2' 'Pre-Depends: libaudit1 (>= 0)' +insertpackage 'jessie' 'libaudit1' 'amd64' '2' 'Depends: libaudit-common (>= 0)' +insertpackage 'jessie' 'libaudit-common' 'amd64' '2' 'Breaks: libaudit0, libaudit1 (<< 2)' + cp rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup setupaptarchive @@ -148,3 +153,27 @@ Inst foo [1] (2 versioned [amd64]) Inst baz (2 versioned [amd64]) Conf foo (2 versioned [amd64]) Conf baz (2 versioned [amd64])' aptget install baz -st versioned + +# recreating the exact situation is hard, so we pull tricks to get the score +cp -f rootdir/var/lib/dpkg/status-backup rootdir/var/lib/dpkg/status +insertinstalledpackage 'gdm3' 'amd64' '1' 'Depends: libaudit0, libaudit0' +insertinstalledpackage 'login' 'amd64' '1' 'Essential: yes' +insertinstalledpackage 'libaudit0' 'amd64' '1' +testequal 'Reading package lists... +Building dependency tree... +Calculating upgrade... +The following packages will be REMOVED: + gdm3 libaudit0 +The following NEW packages will be installed: + libaudit-common libaudit1 +The following packages will be upgraded: + login +1 upgraded, 2 newly installed, 2 to remove and 0 not upgraded. +Remv gdm3 [1] +Remv libaudit0 [1] +Inst libaudit-common (2 jessie [amd64]) +Conf libaudit-common (2 jessie [amd64]) +Inst libaudit1 (2 jessie [amd64]) +Conf libaudit1 (2 jessie [amd64]) +Inst login [1] (2 jessie [amd64]) +Conf login (2 jessie [amd64])' aptget dist-upgrade -st jessie diff --git a/test/integration/test-apt-download-progress b/test/integration/test-apt-download-progress new file mode 100755 index 000000000..b2c9effe6 --- /dev/null +++ b/test/integration/test-apt-download-progress @@ -0,0 +1,40 @@ +#!/bin/sh +# +# ensure downloading sends progress as a regression test for commit 9127d7ae +# +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +changetohttpswebserver + +assertprogress() { + T="$1" + testsuccess grep "dlstatus:1:0:Retrieving file 1 of 1" "$T" + if ! egrep -q "dlstatus:1:[1-9][0-9](\..*)?:Retrieving file 1 of 1" "$T"; then + cat "$T" + msgfail "Failed to detect download progress" + fi + testsuccess grep "dlstatus:1:100:Retrieving file 1 of 1" "$T" +} + +# we need to ensure the file is reasonable big so that apt has a chance to +# actually report progress - but not too big to ensure its not delaying the +# test too much +TESTFILE=testfile.big +testsuccess dd if=/dev/zero of=./aptarchive/$TESTFILE bs=800k count=1 + +msgtest 'download progress works via' 'http' +exec 3> apt-progress.log +testsuccess --nomsg apthelper download-file "http://localhost:8080/$TESTFILE" http-$TESTFILE -o APT::Status-Fd=3 -o Acquire::http::Dl-Limit=800 +assertprogress apt-progress.log + +msgtest 'download progress works via' 'https' +exec 3> apt-progress.log +testsuccess --nomsg apthelper download-file "https://localhost:4433/$TESTFILE" https-$TESTFILE -o APT::Status-Fd=3 -o Acquire::https::Dl-Limit=800 +assertprogress apt-progress.log + +# cleanup +rm -f apt-progress*.log diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb index 6e857c0cb..28321e3c5 100755 --- a/test/integration/test-apt-ftparchive-src-cachedb +++ b/test/integration/test-apt-ftparchive-src-cachedb @@ -180,10 +180,6 @@ testequal " E: Could not find a Source entry in the DSC 'aptarchive/pool/invalid/invalid_1.0.dsc'" aptftparchive sources aptarchive/pool/invalid rm -f aptarchive/pool/invalid/invalid_1.0.dsc -dd if=/dev/zero of="aptarchive/pool/invalid/toobig_1.0.dsc" bs=1k count=129 2>/dev/null -testequal " -E: DSC file 'aptarchive/pool/invalid/toobig_1.0.dsc' is too large!" aptftparchive sources aptarchive/pool/invalid - # ensure clean works rm -f aptarchive/pool/main/* testsuccess aptftparchive clean apt-ftparchive.conf -q=0 -o Debug::APT::FTPArchive::Clean=1 diff --git a/test/integration/test-apt-get-install-deb b/test/integration/test-apt-get-install-deb index 700009da5..f2e5229cd 100755 --- a/test/integration/test-apt-get-install-deb +++ b/test/integration/test-apt-get-install-deb @@ -14,17 +14,14 @@ testequal 'E: Unable to locate package /dev/null' aptget install -qq /dev/null cat > foo.deb <<EOF I'm not a deb, I'm a teapot. EOF -testequal 'E: Sub-process Popen returned an error code (100) -E: Encountered a section with no Package: header +testfailure aptget install ./foo.deb +testsuccess grep '^E: Sub-process Popen returned an error code' rootdir/tmp/testfailure.output +testequal 'E: Encountered a section with no Package: header E: Problem with MergeLister for ./foo.deb -E: The package lists or status file could not be parsed or opened.' aptget install -qq ./foo.deb +E: The package lists or status file could not be parsed or opened.' tail -n 3 rootdir/tmp/testfailure.output # fakeroot is currently not found, framwork needs updating -# -#buildsimplenativepackage 'foo' 'all' '1.0' -# -#testequal 'Selecting previously unselected package foo. -#(Reading database ... 0 files and directories currently installed.) -# Preparing to unpack .../incoming/foo_1.0_all.deb ... -#Unpacking foo (1.0) ... -#Setting up foo (1.0) ...' aptget install -qq ./incoming/foo_1.0_all.deb +buildsimplenativepackage 'foo' 'all' '1.0' +testdpkgnotinstalled 'foo' +testsuccess aptget install ./incoming/foo_1.0_all.deb +testdpkginstalled 'foo' diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper index 3c1d393a6..ff5d506b5 100755 --- a/test/integration/test-apt-helper +++ b/test/integration/test-apt-helper @@ -11,34 +11,35 @@ changetohttpswebserver test_apt_helper_download() { echo 'foo' > aptarchive/foo + echo 'bar' > aptarchive/foo2 - msgtest 'apt-file download-file' 'md5sum' - apthelper -qq download-file http://localhost:8080/foo downloaded/foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 && msgpass || msgfail - testfileequal downloaded/foo2 'foo' + msgtest 'apt-file download-file md5sum' + testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 + testfileequal foo2 'foo' - msgtest 'apt-file download-file' 'sha1' - apthelper -qq download-file http://localhost:8080/foo downloaded/foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 && msgpass || msgfail - testfileequal downloaded/foo1 'foo' + msgtest 'apt-file download-file sha1' + testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 + testfileequal foo1 'foo' - msgtest 'apt-file download-file' 'sha256' - apthelper -qq download-file http://localhost:8080/foo downloaded/foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c && msgpass || msgfail - testfileequal downloaded/foo3 'foo' + msgtest 'apt-file download-file sha256' + testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c + testfileequal foo3 'foo' - msgtest 'apt-file download-file' 'no-hash' - apthelper -qq download-file http://localhost:8080/foo downloaded/foo4 && msgpass || msgfail - testfileequal downloaded/foo4 'foo' + msgtest 'apt-file download-file no-hash' + testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo4 + testfileequal foo4 'foo' - msgtest 'apt-file download-file' 'wrong hash' - if ! apthelper -qq download-file http://localhost:8080/foo downloaded/foo5 MD5Sum:aabbcc 2>&1 2> download.stderr; then - msgpass - else - msgfail - fi - testfileequal download.stderr 'E: Failed to fetch http://localhost:8080/foo Hash Sum mismatch + msgtest 'apt-file download-file wrong hash' + testfailure --nomsg apthelper -qq download-file http://localhost:8080/foo foo5 MD5Sum:aabbcc + testfileequal rootdir/tmp/testfailure.output 'E: Failed to fetch http://localhost:8080/foo Hash Sum mismatch E: Download Failed' - testfileequal downloaded/foo5.FAILED 'foo' - testfailure test -e downloaded/foo5 + testfileequal foo5.FAILED 'foo' + + msgtest 'apt-file download-file md5sum sha1' + testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo6 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 http://localhost:8080/foo2 foo7 SHA1:e242ed3bffccdf271b7fbaf34ed72d089537b42f + testfileequal foo6 'foo' + testfileequal foo7 'bar' } test_apt_helper_detect_proxy() { diff --git a/test/integration/test-bug-769609-triggers-still-pending-after-run b/test/integration/test-bug-769609-triggers-still-pending-after-run index 0588b793f..146fa766b 100755 --- a/test/integration/test-bug-769609-triggers-still-pending-after-run +++ b/test/integration/test-bug-769609-triggers-still-pending-after-run @@ -32,13 +32,10 @@ EOF buildsimplenativepackage "trigdepends-$TYPE" 'all' '1.0' 'unstable' } -# FIXME: implement test with activate-style triggers #buildtriggerpackages 'interest' buildtriggerpackages 'interest-noawait' - buildsimplenativepackage "trigstuff" 'all' '1.0' 'unstable' - setupaptarchive runtests() { diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove index 22c36890b..1524ed4c7 100755 --- a/test/integration/test-kernel-helper-autoremove +++ b/test/integration/test-kernel-helper-autoremove @@ -26,13 +26,6 @@ insertinstalledpackage 'linux-headers-1000000-1-generic' 'amd64' '100.0.0-1' testsuccess aptmark auto "$CURRENTKERNEL" 'linux-image-1.0.0-2-generic' 'linux-image-100.0.0-1-generic' 'linux-headers-1000000-1-generic' -cat > ./fake-dpkg <<EOF -#!/bin/sh -exec $(aptconfig dump --no-empty --format='%v ' 'DPKG::options') "\$@" -EOF -chmod +x ./fake-dpkg -echo 'Dir::Bin::dpkg "./fake-dpkg";' > rootdir/etc/apt/apt.conf.d/99fakedpkg - # install fake-dpkg into it catfail() { echo >&2 diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts index a7d556b87..41c057042 100755 --- a/test/integration/test-no-fds-leaked-to-maintainer-scripts +++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts @@ -11,14 +11,20 @@ configdpkgnoopchroot setupsimplenativepackage "fdleaks" 'all' '1.0' 'unstable' BUILDDIR="incoming/fdleaks-1.0" for script in 'preinst' 'postinst' 'prerm' 'postrm'; do - echo '#!/bin/sh -ls -l /proc/self/fd/' > ${BUILDDIR}/debian/$script + cat > ${BUILDDIR}/debian/$script << EOF +#!/bin/sh +if [ -e "$(pwd)/rootdir/tmp/read_stdin" ]; then + read line; + echo "STDIN: -\$line-" +fi +ls -l /proc/self/fd/ +EOF done buildpackage "$BUILDDIR" 'unstable' 'main' 'native' rm -rf "$BUILDDIR" PKGNAME='fdleaks:all' -if ! dpkg-checkbuilddeps -d 'dpkg (>= 1.16.2)' /dev/null; then +if ! dpkg-checkbuilddeps -d 'dpkg (>= 1.16.2)' /dev/null >/dev/null 2>&1; then PKGNAME='fdleaks' fi @@ -84,6 +90,14 @@ startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log } checkpurge +msgtest 'setsid provided is new enough to support' '-w' +if dpkg-checkbuilddeps -d 'util-linux (>= 2.24.2-1)' /dev/null >/dev/null 2>&1; then + msgpass +else + msgskip "$(command dpkg -l util-linux)" + exit +fi + rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" install -y fdleaks -qq < /dev/null checkinstall @@ -91,3 +105,15 @@ checkinstall rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" purge -y fdleaks -qq checkpurge + +touch rootdir/tmp/read_stdin + +rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log +for i in $(seq 1 10); do echo "$i"; done | testsuccess aptget install -y fdleaks -qq +checkinstall +testequal '2' grep -c '^STDIN: ' rootdir/var/log/apt/term.log + +rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log +yes '' | testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" purge -y fdleaks -qq +checkpurge +testequal '3' grep -c '^STDIN: ' rootdir/var/log/apt/term.log diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index ca6f88c58..3403bbdd2 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -861,7 +861,8 @@ int main(int const argc, const char * argv[]) std::clog << "Serving ANY file on port: " << port << std::endl; - int const slaves = _config->FindB("aptwebserver::slaves", SOMAXCONN); + int const slaves = _config->FindI("aptwebserver::slaves", SOMAXCONN); + std::cerr << "SLAVES: " << slaves << std::endl; listen(sock, slaves); /*}}}*/ |