summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* stop displaying time of build in online helpJérémy Bobbio2015-03-161-1/+1
| | | | | | | | | | | | | | | | | | As part of the “reproducible builds” effort [1], we have noticed that apt could not be built reproducibly. One issue is that it uses the __DATE__ and __TIME__ macros of the C preprocessor to display the time of build in the online help. We believe this information not to be really useful to users as they can always look at the package data and metadata to figure it out. The attached patch simply removes this information. All non-documentation packages can then be built reproducibly with our current experimental framework. [David: changed the string slightly to be untranslateable as well] Closes: 774342
* test exitcode as well as string equalityDavid Kalnischkies2015-03-16126-617/+697
| | | | | | | | We use test{success,failure} now all over the place in the framework, so its only consequencial to do this in the situations in which we test for a specific output as well. Git-Dch: Ignore
* derive more of https from http methodDavid Kalnischkies2015-03-162-44/+84
| | | | | | | | | Bug #778375 uncovered that https wasn't properly integrated in the class family tree of http as it was supposed to be leading to a NULL pointer dereference. Fixing this 'properly' was deemed to much diff for practically no gain that late in the release, so commit 0c2dc43d4fe1d026650b5e2920a021557f9534a6 just fixed the synptom, while this commit here is fixing the cause plus adding a test.
* merge debian/sid into debian/experimentalDavid Kalnischkies2015-03-1610-53/+132
|\
| * award points for positive dependencies againDavid Kalnischkies2015-01-101-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 9ec748ff103840c4c65471ca00d3b72984131ce4 from Feb 23 last year adds a version check after 8daf68e366fa9fa2794ae667f51562663856237c added 8 days earlier negative points for breaks/conflicts with the intended that only dependencies which are satisfied propagate points (aka: old conflicts do not). The implementation was needlessly complex and flawed through preventing positive dependencies from gaining points like they did before these commits making library transitions harder instead of simpler. It worked out anyhow most of the time out of pure 'luck' (and other ways of gaining points) or got miss attributed to being a temporary hick-up. Closes: 774924
| * 128 KiB DSC files ought to be enough for everyoneDavid Kalnischkies2015-01-102-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Your mileage may vary, but don't worry: There is more than one way to do it, but our one size fits all is not a bigger hammer, but an entire roundhouse kick! So brace yourself for the tl;dr: The limit is gone.* Beware: This fixes also the problem that a double newline is unconditionally added 'later' which is an overcommitment in case the dsc filesize is limit-2 <= x <= limit. * limited to numbers fitting into an unsigned long long. Closes: 774893
| * Add regression test for the previous commitMichael Vogt2015-01-061-0/+43
| | | | | | | | | | | | | | | | The issue was that https.cc never called URIStart(), one way to detect this is that no download progress is generated without this call. The test now checks for this and as a side-effect will also ensure that we do not break download progress reporting and Acquire::{http,https}::Dl-Limit accidently.
| * pass-through stdin fd instead of content if not a terminalDavid Kalnischkies2014-12-231-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 299aea924ccef428219ed6f1a026c122678429e6 fixes the problem of not logging terminal in case stdin & stdout are not a terminal. The problem is that we are then trying to pass-through stdin content by reading from the apt-process stdin and writing it to the stdin of the child (dpkg), which works great for users who can control themselves, but pipes and co are a bit less forgiving causing us to pass everything to the first child process, which if the sending part of the pipe is e.g. 'yes' we will never see the end of it (as the pipe is full at some point and further writing blocks). There is a simple solution for that of course: If stdin isn't a terminal, we us the apt-process stdin as stdin for the child directly (We don't do this if it is a terminal to be able to save the typed input in the log). Closes: 773061
| * always run 'dpkg --configure -a' at the end of our dpkg callingsDavid Kalnischkies2014-12-236-54/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dpkg checks now for dependencies before running triggers, so that packages can now end up in trigger states (especially those we are not touching at all with our calls) after apt is done running. The solution to this is trivial: Just tell dpkg to configure everything after we have (supposely) configured everything already. In the worst case this means dpkg will have to run a bunch of triggers, usually it will just do nothing though. The code to make this happen was already available, so we just flip a config option here to cause it to be run. This way we can keep pretending that triggers are an implementation detail of dpkg. --triggers-only would supposely work as well, but --configure is more robust in regards to future changes to dpkg and something we will hopefully make use of in future versions anyway (as it was planed at the time this and related options were implemented). Note that dpkg currently has a workaround implemented to allow upgrades to jessie to be clean, so that the test works before and after. Also note that test (compared to the one in the bug) drops the await test as its is considered a loop by dpkg now. Closes: 769609
| * do not make PTY slave the controlling terminalDavid Kalnischkies2014-12-232-43/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we have no controlling terminal opening a terminal will make this terminal our controller, which is a serious problem if this happens to be the pseudo terminal we created to run dpkg in as we will close this terminal at the end hanging ourself up in the process… The offending open is the one we do to have at least one slave fd open all the time, but for good measure, we apply the flag also to the slave fd opening in the child process as we set the controlling terminal explicitely here. This is a regression from 150bdc9ca5d656f9fba94d37c5f4f183b02bd746 with the slight twist that this usecase was silently broken before in that it wasn't logging the output in term.log (as a pseudo terminal wasn't created). Closes: 772641
| * dispose http(s) 416 error page as non-contentDavid Kalnischkies2014-12-224-85/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Real webservers (like apache) actually send an error page with a 416 response, but our client didn't expect it leaving the page on the socket to be parsed as response for the next request (http) or as file content (https), which isn't what we want at all… Symptom is a "Bad header line" as html usually doesn't parse that well to an http-header. This manifests itself e.g. if we have a complete file (or larger) in partial/ which isn't discarded by If-Range as the server doesn't support it (or it is just newer, think: mirror rotation). It is a sort-of regression of 78c72d0ce22e00b194251445aae306df357d5c1a, which removed the filesize - 1 trick, but this had its own problems… To properly test this our webserver gains the ability to reply with transfer-encoding: chunked as most real webservers will use it to send the dynamically generated error pages. (The tests and their binary helpers had to be slightly modified to apply, but the patch to fix the issue itself is unchanged.) Closes: 768797
| * support long keyids in "apt-key del" instead of ignoring themJames McCoy2014-11-281-0/+6
| | | | | | | | | | | | | | | | | | | | | | apt-key given a long keyid reports just "OK" all the time, but doesn't delete the mentioned key as it doesn't find the key. Note: In debian/experimental this was closed with 29f1b977100aeb6d6ebd38923eeb7a623e264ffe which just added the testcase as the rewrite of apt-key had fixed this as well. Closes: 754436
| * fix PTY interaction on linux and kfreebsdDavid Kalnischkies2014-11-281-3/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We run dpkg on its own pty, so we can log its output and have our own output around it (like the progress bar), while also allowing debconf and configfile prompts to happen. In commit 223ae57d468fdcac451209a095047a07a5698212 we changed to constantly reopening the slave for kfreebsd. This has the sideeffect though that in some cases slave and master will lose their connection on linux, so that no output is passed along anymore. We fix this by having always an fd referencing the slave open (linux), but we don't use it (kfreebsd). Failing to get our PTY up and running has many (bad) consequences including (not limited to, nor all at ones or in any case) garbled ouput, no output, no logging, a (partial) mixture of the previous items, … This commit is therefore also reshuffling quiet a bit of the creation code to get especially the output part up and running on linux and the logging for kfreebsd. Note that the testcase tries to cover some cases, but this is an interactivity issue so only interactive usage can really be a good test. Closes: 765687
| * close leaking slave fd after setting up pty magicDavid Kalnischkies2014-11-283-59/+105
| | | | | | | | | | | | | | The fd moves out of scope here anyway, so we should close it properly instead of leaking it which will tickle down to dpkg maintainer scripts. Closes: 767774
| * reenable support for -s (and co) in apt-get sourceDavid Kalnischkies2014-11-101-0/+4
| | | | | | | | | | | | | | | | The conversion to accept only relevant options for commands has forgotten another one, so adding it again even through the usecase might very well be equally good served by --print-uris. Closes: 742578
| * allow options between command and -- on commandlineDavid Kalnischkies2014-11-102-2/+70
| | | | | | | | | | | | | | This used to work before we implemented a stricter commandline parser and e.g. the dd-schroot-cmd command constructs commandlines like this. Reported-By: Helmut Grohne
| * use 'best' hash for source authenticationDavid Kalnischkies2014-11-101-0/+260
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Collect all hashes we can get from the source record and put them into a HashStringList so that 'apt-get source' can use it instead of using always the MD5sum. We therefore also deprecate the MD5 struct member in favor of the list. While at it, the parsing of the Files is enhanced so that records which miss "Files" (aka MD5 checksums) are still searched for other checksums as they include just as much data, just not with a nice and catchy name. This is a cherry-pick of 1262d35 with some dirty tricks to preserve ABI. LP: 1098738
| * add a simple container for HashStringsDavid Kalnischkies2014-11-101-12/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | APT supports more than just one HashString and even allows to enforce the usage of a specific hash. This class is intended to help with storage and passing around of the HashStrings. The cherry-pick here the un-const-ification of HashType() compared to f4c3850ea335545e297504941dc8c7a8f1c83358. The point of this commit is adding infrastructure for the next one. All by itself, it just adds new symbols. Git-Dch: Ignore
* | rework dpkg-wrapping in test frameworkDavid Kalnischkies2015-03-081-19/+25
| | | | | | | | | | | | | | | | We are able to run maintainer scripts if needed before, but we need to set ADMINDIR to be able to call dpkg tools like dpkg-trigger inside of them. Git-Dch: Ignore
* | do not make PTY slave the controlling terminalDavid Kalnischkies2014-12-101-24/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we have no controlling terminal opening a terminal will make this terminal our controller, which is a serious problem if this happens to be the pseudo terminal we created to run dpkg in as we will close this terminal at the end hanging ourself up in the process… The offending open is the one we do to have at least one slave fd open all the time, but for good measure, we apply the flag also to the slave fd opening in the child process as we set the controlling terminal explicitely here. This is a regression from 150bdc9ca5d656f9fba94d37c5f4f183b02bd746 with the slight twist that this usecase was silently broken before in that it wasn't logging the output in term.log (as a pseudo terminal wasn't created). Closes: 772641
* | dispose http(s) 416 error page as non-contentDavid Kalnischkies2014-12-093-79/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Real webservers (like apache) actually send an error page with a 416 response, but our client didn't expect it leaving the page on the socket to be parsed as response for the next request (http) or as file content (https), which isn't what we want at all… Symptom is a "Bad header line" as html usually doesn't parse that well to an http-header. This manifests itself e.g. if we have a complete file (or larger) in partial/ which isn't discarded by If-Range as the server doesn't support it (or it is just newer, think: mirror rotation). It is a sort-of regression of 78c72d0ce22e00b194251445aae306df357d5c1a, which removed the filesize - 1 trick, but this had its own problems… To properly test this our webserver gains the ability to reply with transfer-encoding: chunked as most real webservers will use it to send the dynamically generated error pages. Closes: 768797
* | always run 'dpkg --configure -a' at the end of our dpkg callingsDavid Kalnischkies2014-12-076-54/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dpkg checks now for dependencies before running triggers, so that packages can now end up in trigger states (especially those we are not touching at all with our calls) after apt is done running. The solution to this is trivial: Just tell dpkg to configure everything after we have (supposely) configured everything already. In the worst case this means dpkg will have to run a bunch of triggers, usually it will just do nothing though. The code to make this happen was already available, so we just flip a config option here to cause it to be run. This way we can keep pretending that triggers are an implementation detail of dpkg. --triggers-only would supposely work as well, but --configure is more robust in regards to future changes to dpkg and something we will hopefully make use of in future versions anyway (as it was planed at the time this and related options were implemented). Closes: 769609
* | correct architecture detection for 'rc' packages for purgeDavid Kalnischkies2014-12-072-27/+59
| | | | | | | | | | | | | | | | | | We were already considering these cases, but the code was flawed, so that packages changing architectures are incorrectly handled and hence the wrong architecture is used to call dpkg with, so that dpkg says the package isn't installed (which it isn't for the requested architecture). Closes: 770898
* | properly handle already reinstall pkgs in orderingDavid Kalnischkies2014-12-071-0/+98
| | | | | | | | | | | | | | | | | | | | | | The bugreport itself describes the case of the ordering code detecting a loop where none is present, but the testcase finds also cases in which there is actually a loop and we fail to realize it. --reinstall can be considered an interactive command through and it usually doesn't encounter such "hard" problems (= looping essentials), so this is less serious than it sounds at first. Closes: 770291
* | use dpkg --merge-avail only if needed in apt-markDavid Kalnischkies2014-11-191-0/+9
| | | | | | | | | | | | | | | | | | | | | | Only "recent" versions of dpkg support stdin for merge instead of a file, so as a quick fix we delay calling it until we really need it which fixes most of the problem already. Checking for a specific dpkg version here is deemed too much work, just like using a temporary file here and depends a too high requirement for this minor usecase. After all, it didn't work at all before, so we break nobody here and can fix it if someone complains (with a patch).
* | fix test to support non-multiarch dpkg versionsDavid Kalnischkies2014-11-191-23/+28
| | | | | | | | | | | | | | On travis we work with a pre-multiarch version of dpkg, so the output is slightly different in regards to package names. Git-Dch: Ignore
* | fix PTY interaction on linux and kfreebsdDavid Kalnischkies2014-11-191-3/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We run dpkg on its own pty, so we can log its output and have our own output around it (like the progress bar), while also allowing debconf and configfile prompts to happen. In commit 223ae57d468fdcac451209a095047a07a5698212 we changed to constantly reopening the slave for kfreebsd. This has the sideeffect though that in some cases slave and master will lose their connection on linux, so that no output is passed along anymore. We fix this by having always an fd referencing the slave open (linux), but we don't use it (kfreebsd). Failing to get our PTY up and running has many (bad) consequences including (not limited to, nor all at ones or in any case) garbled ouput, no output, no logging, a (partial) mixture of the previous items, … This commit is therefore also reshuffling quiet a bit of the creation code to get especially the output part up and running on linux and the logging for kfreebsd. Note that the testcase tries to cover some cases, but this is an interactivity issue so only interactive usage can really be a good test. Closes: 765687
* | close leaking slave fd after setting up pty magicDavid Kalnischkies2014-11-183-58/+99
| | | | | | | | | | | | | | The fd moves out of scope here anyway, so we should close it properly instead of leaking it which will tickle down to dpkg maintainer scripts. Closes: 767774
* | fix file ownership tests to work on kfreebsdDavid Kalnischkies2014-11-185-9/+16
| | | | | | | | | | | | While on linux files are created in /tmp with $USER:$USER, on my kfreebsd testmachine they are created with $USER:root, so we pull some strings here to make it work on both.
* | create our cache and lib directory always with mode 755David Kalnischkies2014-11-183-8/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | We autocreate for a while now the last two directories in /var/lib/apt/lists (similar for /var/cache/apt/archives) which is very nice for systems having any of those on tmpfs or other non-persistent storage. This also means though that this creation is effected by the default umask, so for people with aggressive umasks like 027 the directories will be created with 750, which means all non-root users are left out, which is usually exactly what we want then this umask is set, but the cache and lib directories contain public knowledge. There isn't any need to protect them from viewers and they render apt completely useless if not readable.
* | various small additional tests and testcasesDavid Kalnischkies2014-11-1811-17/+261
| | | | | | | | | | | | | | | | | | Usually they don't provide a lot in terms of what they test, but they help in covering many lines from strictly anecdotal commands (stats, moo) and error messages, so that stuff which really needs to be tested, but isn't is better visible in coverage reports. Git-Dch: Ignore
* | disable the lock disabling in the testsDavid Kalnischkies2014-11-094-5/+7
| | | | | | | | | | | | | | We create our own directories here and work without root in them, so we can also test the locking with them as it is how we usually operate. Git-Dch: Ignore
* | allow uninstalled packages to be put on holdDavid Kalnischkies2014-11-091-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | dpkg wants to know about a package before it can be put on hold, so we have to at least hint about its existance in the available file it "maintaince" to know about such stuff. The simple thing would probably be to just feed all Packages files into dpkg as well, but what would be the point really? Exactly, so we take a shortcut here and just create dummies in the available file if we need to which isn't going to be that common as usually you are holding packages back and not off. Who would have thought that a simple feature like setting a package on hold requires more than 200 lines of code… at least with the testcase it is now explicitly tested code.
* | fix test to not spoil output with warningsDavid Kalnischkies2014-11-091-18/+39
| | | | | | | | Git-Dch: Ignore
* | enhance apt-extracttemplates testDavid Kalnischkies2014-11-092-22/+48
| | | | | | | | | | | | | | | | | | The tool checks for debconf version before printing the info it extracts, so that it doesn't extract data which can't be interpreted before debconf is upgraded. It is only fair to check for this behaviour in the tests. Git-Dch: Ignore
* | use the same code to detect quiet setting in all toolsDavid Kalnischkies2014-11-092-44/+46
| | | | | | | | Git-Dch: Ignore
* | streamline display of --help in all toolsDavid Kalnischkies2014-11-092-0/+54
| | | | | | | | | | | | | | By convention, if I run a tool with --help or --version I expect it to exit successfully with the usage, while if I do call it wrong (like without any parameters) I expect the usage message shown with a non-zero exit.
* | fix variable naming typo used in debug outputDavid Kalnischkies2014-11-081-1/+1
| | | | | | | | Git-Dch: Ignore
* | (style) Variable 'res' is assigned a value that is never usedDavid Kalnischkies2014-11-081-13/+16
| | | | | | | | | | | | | | | | Checking the return value of this (and many other calls) in this testcase is a good idea, so we do it now. Reported-By: cppcheck Git-Dch: Ignore
* | Division by result of sizeof(). memset() expects a size in bytesDavid Kalnischkies2014-11-081-2/+7
| | | | | | | | | | | | | | | | | | "did you intend to multiply instead?" is what cppcheck helpful says and it is absolutely right. Doesn't make a whole lot of a difference though as we are talking about 'char' in this testcase, but just to be sure. Reported-By: cppcheck Git-Dch: Ignore
* | tests: silence clang on uninitilized variablesDavid Kalnischkies2014-11-082-2/+3
| | | | | | | | | | | | | | | | The testcases have far worse problems if these ever end up being NULL and/or are not given a value by the method called, but clang is right to warn about it, just that we don't want to fix it in testcases… Git-Dch: Ignore
* | reenable patchsize limit option for pdiffsDavid Kalnischkies2014-11-081-0/+34
| | | | | | | | | | | | | | | | One word: "doh!" Commit f6d4ab9ad8a2cfe52737ab620dd252cf8ceec43d disabled the check to prevent apt from downloading bigger patches than the index it tries to patch. Happens rarly of course, but still. Detected by scan-build complaining about a dead assignment. To make up for the mistake a test is included as well.
* | Merge remote-tracking branch 'upstream/debian/experimental' into ↵Michael Vogt2014-11-0628-175/+615
|\ \ | | | | | | | | | | | | | | | | | | feature/no-more-acquire-guessing Conflicts: apt-pkg/acquire-item.cc
| * | test/integration/test-apt-update-filesize-mismatch: use "basename file ↵Michael Vogt2014-11-041-1/+1
| | | | | | | | | | | | suffix" instead of -s for compatibility with older systems
| * | tests: enhance output of grep and test failsDavid Kalnischkies2014-10-266-42/+64
| | | | | | | | | | | | Git-Dch: Ignore
| * | rewrite ReadMessages()David Kalnischkies2014-10-261-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Central methods of our infrastructure like this one responsible for communication with our methods shouldn't be more complicated then they have to and not claim to have (albeit unlikely) bugs. While I am not sure about having improved the first part, the bug is now gone and a few explicit tests check that it stays that way, so nobody will notice the difference (hopefully) – expect that this should a very tiny bit faster as well as we don't manually proceed through the string. Git-Dch: Ignore
| * | promote filesize to a hashstringDavid Kalnischkies2014-10-245-8/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | It is a very simple hashstring, which is why it isn't contributing to the usability of a list of them, but it is also trivial to check and calculate, so it doesn't hurt checking it either as it can combined even with the simplest other hashes greatly complicate attacks on them as you suddenly need a same-size hash collision, which is usually a lot harder to achieve.
| * | tests: support 'installed' release in insertpackageDavid Kalnischkies2014-10-236-45/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is sometimes handy to have an installed package also in the archive, but this was until now harder than it should as you had to duplicate the lines, which is especially dangerous while writing the tests as it easily happens that these two lines divert and so the same-but-different version detection kicks in. Git-Dch: Ignore
| * | switch tests to Translation-en usageDavid Kalnischkies2014-10-231-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | We can use either and some tests exercise this, but the default should be what we want to use and that is a split out long description file which is properly mentioned in the Release file. Git-Dch: Ignore
| * | add test for Basic Authentication schemeDavid Kalnischkies2014-10-235-16/+219
| | | | | | | | | | | | Git-Dch: Ignore