summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Only enable pipelining if server is HTTP/1.1Julian Andres Klode2016-01-121-2/+3
| | | | | | | Just enabling it for anyone breaks with HTTP/1.0 servers and proxies sometimes. Closes: #810796
* remove uncompressed leftover partial file before pdiff bootstrapDavid Kalnischkies2016-01-081-0/+6
| | | | | | | The code already deals with compressed leftovers, but forgot the uncompressed files. The opertunity is picked to reorder this code and add debug messages about the actions taken as well as produce such a leftover file in the associated testcase.
* use filesize of compressed pdiffs for the limit if possibleDavid Kalnischkies2016-01-081-2/+6
| | | | | | | | | | | | With the addition of the $HASH-Download field in the .diff/Index we got the size of the compressed patches for 'free', so if that information is available we can use it for a more fitting calculation of the size requirements of the patches vs. the complete file. Note that this predicts a too small size in the transition case in which the information isn't available for all patches, but figuring this out would be a lot of code for practically nothing as only one update can ever be in such a transition phase.
* tests: limit autotest-functionname generation to sane charactersDavid Kalnischkies2016-01-081-3/+3
| | | | | | | | Some (older) versions of bash seem to be allergic to a method named "aptautotest_grep_^apt" (note the caret). Unlikely that we are going to write autotests for such commands so we could just skip those, but lets instead just use "normal" characters in the names and strip the rest as we already did with the (arguable more common) '-'.
* support '-' and no parameter for stdin in apt-helper cat-fileDavid Kalnischkies2016-01-081-19/+5
| | | | | | This way it works more similar to the compressor binaries, which we can relief in this way from their job in the test framework avoiding the need of adding e.g. liblz4-tool to the test dependencies.
* keep compressed indexes in a low-cost formatDavid Kalnischkies2016-01-086-20/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | Downloading and storing are two different operations were different compression types can be preferred. For downloading we provide the choice via Acquire::CompressionTypes::Order as there is a choice to be made between download size and speed – and limited by whats available in the repository. Storage on the other hand has all compressions currently supported by apt available and to reduce runtime of tools accessing these files the compression type should be a low-cost format in terms of decompression. apt traditionally stores its indexes uncompressed on disk, but has options to keep them compressed. Now that apt downloads additional files we also deal with files which simply can't be stored uncompressed as they are just too big (like Contents for apt-file). Traditionally they are downloaded in a low-cost format (gz) as repositories do not provide other formats, but there might be even lower-cost formats and for download we could introduce higher-cost in the repositories. Downloading an entire index potentially requires recompression to another format, so an update takes potentially longer – but big files are usually updated via pdiffs which has to de- and re-compress anyhow and does it on the fly anyhow, so there is no extra time needed and in general it seems to be benefitial to invest the time in update to save time later on file access.
* tests: try to pick up compressors from config automaticallyDavid Kalnischkies2016-01-083-18/+20
| | | | | | Less hardcoding should help while introducing new compressors. Git-Dch: Ignore
* allow pdiff bootstrap from all supported compressorsDavid Kalnischkies2016-01-082-10/+29
| | | | | | | There is no reason to enforce that the file we start the bootstrap with is compressed with a compressor which is available online. This allows us to change the on-disk format as well as deals with repositories adding/removing support for a specific compressor.
* use one 'store' method to rule all (de)compressorsDavid Kalnischkies2016-01-081-2/+2
| | | | | | | | | | | Adding a new compressor method meant adding a new method as well – even if that boilt down to just linking to our generalized decompressor with a new name. That is unneeded busywork if we can instead just call the generalized decompressor and let it figure out which compressor to use based on the filenames rather than by program name. For compatibility we ship still 'gzip', 'bzip2' and co, but they are just links to our "new" 'store' method.
* test-apt-cache: Adjust for hashtable size changeJulian Andres Klode2016-01-031-3/+3
| | | | Gbp-Dch: ignore
* Add new APT::Keep-Downloaded-Packages optionMichael Vogt2016-01-021-0/+43
| | | | | | | | | | This option controls if downloaded packages should be kept after a successful install or if they should be deleted. The default for "apt-get" is that they are kept (just like before). However the default for "apt" is that they get deleted. Closes: #160743
* properly parse comments in apt_preferences and deb822-style sourcesDavid Kalnischkies2016-01-022-0/+27
| | | | | | | | | | apt_preferences and deb822-style sources used the specialized class pkgUserTagSection to deal with comments before/after a given stanza, but it couldn't deal with comments in the stanza at all. codesearch suggests that nobody else does and a vastely superior way of working with potentially commented files is implemented now, so we can officially discourage the use of the old incomplete hack class.
* support comments in debian/control parsingDavid Kalnischkies2016-01-021-0/+35
| | | | | | | | | Now (55153bf94ff28a23318e79aa48242244c4d82b3c) that pkgTagFile can be told to deal with all sorts of comments we can use this mode to parse dsc (as by catch) and debian/control files properly even in the wake of multiline fields spliced with comments like Build-Depends. Closes: 806775
* add optional support for comments in pkgTagFileDavid Kalnischkies2016-01-021-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | APT usually deals with perfectly formatted files generated automatically be other programs – and as it has to parse multiple MBs of such files it tries to be fast rather than forgiving. This was always a problem if we reused this parser for files with a deb822 syntax which are mostly written by hand however, like apt_preferences or the deb822-style sources as these can include stray newlines and more importantly comments all over the place. As a stopgap we had pkgUserTagSection which deals at least with comments before and after a given stanza, but comments in between weren't really supported and now that we support parsing debian/control for e.g. build-dep we face the full comment problem e.g. with comments inbetween multi-line fields (like Build-Depends). We can't easily deal with this on the pkgTagSection level as the interface gives access to 'raw' char-pointers for performance reasons so we would need to optionally add a buffer here on which we could remove comments to hand out pointers into this buffer instead. The interface is quite large already and supports writing stanzas as well, which does not support comments at all either. So while in future it might make sense to have a parser setup which deals with and keeps comments in this commit we opt for the simpler solution for now: We officially declare that pkgTagSection does not support comments and instead expect the caller to deal with them, which in our case is pkgTagFile: pkgTagFile is extended with an additional mode which can deal with comments by dropping them from the buffer which will later form the input of pkgTagSection. The actual implementation is slightly more complex than this sentence suggests at first on one hand to have good performance and on the other to allow jumping directly to stanzas with offsets collected in a previous run (like our cache generation does it for example).
* Fix test case that was broken by switch of hash functionJulian Andres Klode2015-12-291-5/+5
| | | | This test relies on the ordering of the hash function.
* deal with empty values properly in deb822 parserDavid Kalnischkies2015-12-271-1/+4
| | | | | | | | Regression introduced in 8710a36a01c0cb1648926792c2ad05185535558e, but such fields are unlikely in practice as it is just as simple to not have a field at all with the same result of not having a value. Closes: 808102
* allow repositories to forbid arch:all for specific index targetsDavid Kalnischkies2015-12-271-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | Debian has a Packages file for arch:all already, but the arch:any files contain arch:all packages as well, so downloading it would be a total waste of resources. Getting this solved is on the list of things to do, but it is also the hardest part – for index targets like Contents the situation is much easier and less server/client implementations are involved so we might not want to stall them. A repository can now declare via: No-Support-for-Architecture-all: Packages that even if an arch:all Packages exists, it shouldn't be downloaded, so that support for Contents files can be added now. See also 1dd20368486820efb6ef4476ad739e967174bec4 for the implementation of downloading arch:all index targets, which this is limiting. The field uses the name of the target from the apt configuration for simplicity and is negative by design as this field is intended to be supported/needed only for a "short" time (one or two Debian releases). While this commit theoretically supports any target, its expected to only see "Packages" as a value in reality.
* ensure we got a lock in clean operationDavid Kalnischkies2015-12-231-0/+10
| | | | | | We try to acquired the locks, but we didn't stop if we failed to get it… Closes: 808561
* tests: support gpg2 properly in all testcasesDavid Kalnischkies2015-12-194-44/+48
| | | | | | | | | The output changes slightly between different versions, which we already dealt with in the main testcase for apt-key, but there are two more which do not test both versions explicitly and so still had gpg1 output to check against as this is the default at the moment. Git-Dch: Ignore
* avoid evaluating shell in paths used in apt-keyDavid Kalnischkies2015-12-192-3/+21
| | | | | | | | | | | | apt-key creates internally a script (since ~1.1) which it will call to avoid dealing with an array of different options in the code itself, but while writing this script it wraps the values in "", which will cause the shell to evaluate its content upon execution. To make 'use' of this either set a absolute gpg command or TMPDIR to something as interesting as: "/tmp/This is fü\$\$ing cràzy, \$(man man | head -n1 | cut -d' ' -f1)\$!" If such paths can be encountered in reality is a different question…
* tests: support spaces in path and TMPDIRDavid Kalnischkies2015-12-19207-518/+495
| | | | | | | This doesn't allow all tests to run cleanly, but it at least allows to write tests which could run successfully in such environments. Git-Dch: Ignore
* Fix FileUtlTest.GetTempDir failure when run as rootPino Toscano2015-12-191-3/+7
| | | | | | | | | | | Testing /usr as TMPDIR assumes that GetTempDir() cannot use it because it cannot write to it; this is true for non-root users, but not so much for root. Since root can access everything, perform this particular test case only when not running as root. Closes: #808383
* test-apt-download-progress: Run the https test multiple timesJulian Andres Klode2015-12-141-2/+7
| | | | | This filters out errors due to timing issues. Early exits if enough pulses occured.
* pkgcache: Make hash arch-independent using fixed size integerJulian Andres Klode2015-12-141-1/+1
| | | | | | | | This helps writing test cases. Also adapt the test case that expected 64-bit. Nothing changes performance wise, the distribution of the hash values remains intact.
* tagfile: Hardcode error message for out of range integer valuesJulian Andres Klode2015-12-141-1/+1
| | | | | | This makes the test suite work on 32 bit-long platforms. Gbp-Dch: ignore
* test framework: More noopchroot fixesJulian Andres Klode2015-12-141-6/+11
| | | | | | | | | | | Use asprintf() so we have easy error detection and do not depend on PATH_MAX. Do not add another separator to the generated path, in both cases the path inside the chroot is guaranteed to have a leading / already. Also pass -Wall to gcc.
* test framework: Unset no_proxy as wellJulian Andres Klode2015-12-141-1/+1
| | | | | | This caused test-bug-717891-abolute-uris-for-proxies to fail Gbp-Dch: ignore
* test framework: Unset http proxy variables in setupenvironmentJulian Andres Klode2015-12-141-0/+1
| | | | | | This breaks a lot of test cases Gbp-Dch: ignore
* test framework: Correctly generate new paths in noopchrootJulian Andres Klode2015-12-141-6/+5
| | | | | | The allocated buffer was one byte too small. Allocate a buffer of PATH_MAX instead and use snprintf(), as suggested by Martin Pitt.
* test-apt-download-progress: Limit rate to 600kJulian Andres Klode2015-12-141-2/+2
| | | | | | This reduces the chance that the test fails. Gbp-Dch: ignore
* test-apt-download-progress: Allow smaller progress changeJulian Andres Klode2015-12-141-1/+1
| | | | | | | Instead of checking for [10%, 100%), check for (0%, 100%), that is everything < 100% and >0%. Gbp-Dch: ignore
* test-sourceslist-lang-plusminus-options: Use amd64 architectureJulian Andres Klode2015-12-141-1/+1
| | | | | | This should make the test work on non-amd64 systems Gbp-Dch: ignore
* non-existing directories don't need to be cleanedDavid Kalnischkies2015-12-142-2/+27
| | | | | | | | | | Trying to clean up directories which do not exist seems rather silly if you think about it, so let apt think about it and stop it. Depends a bit on the caller if this is fixing anything for them as they might try to acquire a lock or doing other clever things as apt does. Closes: 807477
* support regex and co in 'apt-cache policy $pkg' againDavid Kalnischkies2015-12-141-0/+9
| | | | | | | | | | Regression of 1e064088bf7b3e29cd36d30760fb3e4143a1a49a (1.1~exp4) which moved code around and renamed methods heavily ending up calling the wrong method matching packagenames only instead of calling the full array. Most commands work with versions, so this managed to fly under the radar for quite a while. Closes: 807870
* show a more descriptive error for weak Release filesDavid Kalnischkies2015-12-142-0/+53
| | | | | | | | | | | | | | If we can't work with the hashes we parsed from the Release file we display now an error message if the Release file includes only weak hashes instead of downloading the indexes and failing to verify them with "Hash Sum mismatch" even through the hashes didn't mismatch (they were just weak). If for some (unlikely) reason we have got weak hashes only for individual targets we will show a warning to this effect (again, befor downloading and failing the index itself). Closes: 806459
* Convert package names from Packages files to lower caseJulian Andres Klode2015-12-111-0/+21
| | | | | | | | | dpkg does that when reading package files, so we should do the same. This only deals with parsing names from binary package paragraphs, it does not look at source package names and/or the list of binaries in a dsc file. Closes: #807012
* test: Fix testcases relying on mixed case package namesJulian Andres Klode2015-12-111-23/+23
| | | | Gbp-Dch: ignore
* Do not swap required and important in pkgCache::Priority()Julian Andres Klode2015-12-101-0/+16
| | | | | | | | required and important were swapped, leading to wrong output. Closes: #807523 Thanks: Manuel A. Fernandez Montecelo for discovering this
* replace run-parts with find|sort to avoid debianutils usageDavid Kalnischkies2015-12-061-1/+1
| | | | | | | After e75e5879 the reason for an implicit dependency on debianutils (which is essential for debian, but likely not on other systems) was just two uses of run-parts, which can be replaced with the a lot more portable find-piped-into-sort duo.
* replace "which" with "command -v" for portabilityDavid Kalnischkies2015-12-061-1/+1
| | | | | | | | which is a debian specific tool packaged in debianutils (essential) while command is a shell builtin defined by POSIX. Closes: 807144 Thanks: Mingye Wang for the suggestion.
* use @CHANGEPATH@ as placeholder in changelog URI templatesDavid Kalnischkies2015-12-022-9/+9
| | | | | | | | | This should make it more obvious that CHANGEPATH is a placeholder which apt will replace with a package specific path rather than a string constant. Mail-Reference: <87d1upgvaf.fsf@deep-thought.43-1.org> Mail-Archive: https://lists.debian.org/debian-dak/2015/12/msg00005.html
* tests: apt build-dep actually reports no depends correctlyDavid Kalnischkies2015-12-022-2/+14
| | | | | | | | | | 'Regression' of 7d19ee92f2368a40e739cb27d22d6d28f37ebf45, just that it now works more as expected than previously. Of course, build-essentials are implicitly also build dependencies, so by definition all packages have build dependencies, but that isn't what this message wants to say and it isn't what the user expects. Git-Dch: Ignore
* require explicit paths to dsc/control as we do for deb filesDavid Kalnischkies2015-12-012-3/+13
| | | | | | | | | | | | | | Otherwise a user is subject to unexpected content-injection depending on which directory she happens to start apt in. This also cleans up the code requiring less implementation details in build-dep which is always good. Technically, this is an ABI break as we override virtual methods, but that they weren't overridden was a mistake resulting in pure classes, which shouldn't be pure, so they were unusable – and as they are new in 1.1 nobody is using them yet (and hopefully ever as they are borderline implementation details). Closes: 806693
* accept ../ on the cmdline as start for a deb file as wellDavid Kalnischkies2015-11-291-1/+5
| | | | | | Regression of 14341a7ee1ca3dbcdcdbe10ad19b947ce23d972d. Reported-By: Julian Andres Klode <jak@debian.org>
* tests: fix typos, correct helpmsgs and test testsDavid Kalnischkies2015-11-292-6/+11
| | | | Git-Dch: Ignore
* do not override exact targetrelease matches with lesser matchesAndreas Cadhalpun2015-11-291-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The relevant testcases are in test/integration/test-apt-get-source. There is a test for #731853 that is supposed to "ensure that apt will pick the higher version number" of 0.0.1 (stable) and 0.1 (stable). However, this works by pure chance, as simply reversing the order of the two insertsource lines makes the test fail. So #731853 isn't really fixed, yet. Actually, that's related to the problem I reported, as the underlying issue for both is the same: In the FindSrc function apt chooses a new 'best hit', if either * there is a target release and it matches the release of the package, * or the version of the package is higher than the last best hit. Consider having 1.0 (stable), 2.0 (unstable) and 1.5 (unstable), in this order. Looking for the version in stable, apt first selects 1.0, because the release matches the target release, but then subsequently selects 2.0, because the version is higher. Looking for the version in unstable, apt first selects 2.0, because the release matches the target release, but then subsequently selects 1.5, because the release also matches the target release. The correct way would be to choose a new 'best hit', if either * there is a target release and it matches the release of the package, * or there is no target release and the version is higher than the last best hit. Closes: 746412 Mail-Reference: <565A604B.7090104@googlemail.com> Mail-Archive: https://lists.debian.org/debian-devel/2015/11/msg00470.html
* disable privilege-drop verification by default as fakeroot trips over itDavid Kalnischkies2015-11-281-0/+2
| | | | | | | | | | | | | Dropping privileges is an involved process for code and system alike so ideally we want to verify that all the work wasn't in vain. Stuff designed to sidestep the usual privilege checks like fakeroot (and its many alternatives) have their problem with this through, partly through missing wrapping (#806521), partly as e.g. regaining root from an unprivileged user is in their design. This commit therefore disables most of these checks by default so that apt runs fine again in a fakeroot environment. Closes: 806475
* tests: use id to get user/group instead of environmentDavid Kalnischkies2015-11-281-2/+2
| | | | | | | debci seems to have a cleaner environment now and even if not we could never guess nogroup, so figure it out properly via 'id'. Git-Dch: Ignore
* outsmart gcc -O3 over-optimization in pkgCdrom::FindPackagesDavid Kalnischkies2015-11-271-0/+2
| | | | | | | | Seems like a simpler workaround than forcing a lower optimization level just for this for all of apt. See also: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1473674
* slightly rephrase notice shown for insecure repositoriesJustin B Rye2015-11-253-5/+5
| | | | Git-Dch: Ignore