summaryrefslogtreecommitdiff
path: root/test/integration
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'json-config' into 'main'Julian Andres Klode2024-11-141-42/+1088
|\ | | | | | | | | JSON: Pass options to hooks in hello message See merge request apt-team/apt!389
| * json: Add "options" array to JSON hooksJulian Andres Klode2024-11-121-0/+120
| | | | | | | | | | See the attached documentation. Note that defaults are missing, so using this is not particularly easy so far.
| * test: Prettify JSON tests using jqJulian Andres Klode2024-11-121-42/+968
| | | | | | | | | | | | | | | | This also ensures that our JSON is actually correct JSON. echo may fail now with EPIPE, given that it is multiline, so wrap it in 2>/dev/null
* | Only run valgrind in tests if valgrind available on hostнаб2024-11-112-7/+7
| |
* | Merge branch 'keep-more' into 'main'Julian Andres Klode2024-11-112-0/+48
|\ \ | | | | | | | | | | | | Fix keeping back removals of obsolete packages See merge request apt-team/apt!373
| * | Return an error if ResolveByKeep() is unsuccessfulJulian Andres Klode2024-11-111-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | In case of held packages or packages that otherwise can't be kept back, we should return an error and not require the client to check the broken_count after calling us. LP: #2078720
| * | Fix keeping back removals of obsolete packagesJulian Andres Klode2024-11-112-0/+30
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | ResolveByKeepInternal() inadvertently considered packages that were marked for removals as not being possible to keep back, but that's not true, all they need is to have a currently installed version. The test case is a bit awkward to construct because our upgrade code doesn't get into a place where this happens that we know off. Or maybe it does with phased upgrades, but here we simplify this by using a helper binary that dumps state, marks for removal, and then calls ResolveByKeep and checks the removal is undone. LP: #2078720
* / solver3: Introduce new Assume() and Enqueue() helpers and use themJulian Andres Klode2024-11-024-0/+14
|/ | | | | | | | | | | | | These are taken roughly from the MiniSAT paper. We still have a bit to go in actually encoding all clauses so the reasons are still variables, and Assume() isn't fully working yet. Adjust the existing Install()/Reject() code to use these functions, we already see additional lines in the log that we failed to log before, and this ensures more consistency. This is sort of still the wrong direction: Install()/Reject() do the propagation too; but that is tbd.
* test: Check that apt-ftparchive handles deep pathsJulian Andres Klode2024-10-151-0/+49
| | | | | | | | | This checks for the previous boundaries for path sizes; but we also added a check for many files in a directory, limited to 4096. Sadly the directory check did not fail with the old code either, it's hard to actually get it to fail correctly.
* test framework: Improve valgrind supportJulian Andres Klode2024-10-151-1/+4
| | | | | | Add support for testing apt-ftparchive, set valgrind to quiet such that we can check program output, and pass --error-exitcode=7 to get an (should be unused) magic error code if it detects errors.
* Implement 'Pin: source-version <foo>'Julian Andres Klode2024-08-221-1/+16
| | | | As wondered about by Paride some minutes ago.
* Merge branch 'main' into 'main'Julian Andres Klode2024-08-121-0/+48
|\ | | | | | | | | Do not return error if `Signed-By` value in source list is empty See merge request apt-team/apt!364
| * Do not return error if `Signed-By` value in source list is emptyAristo Chen2024-07-121-0/+48
| | | | | | | | Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
* | Fix obsoleted-by handling for experimentalJulian Andres Klode2024-08-121-0/+87
| | | | | | | | | | | | | | | | | | | | Basically this boils down to checking that the priority of the source candidate candidate is higher or equal than the priority of the package's candidate that is being under consideration. It stands to reason if we maybe we should actually calculate a source candidate version; this will look similar but may perhaps perform slightly different.
* | Merge branch 'deprecate-pubkey-algos' into 'main'Julian Andres Klode2024-07-301-0/+43
|\ \ | |/ |/| | | | | Only revoke weak RSA keys now, add 'next' and 'future' levels See merge request apt-team/apt!365
| * Only revoke weak RSA keys for now, add 'next' and 'future' levelsJulian Andres Klode2024-07-151-0/+43
| | | | | | | | | | | | | | | | | | | | | | Algorithms not in the next level give a warning, algorithms in not in the future level introduce an audit message for the --audit flag. next: >=rsa2048,ed25519,ed448,nistp256,nistp384,nistp512 future: >=rsa3072,ed25519,ed448 LP: #2073126
* | Parse snapshot option for apt show/listDavid Kalnischkies2024-07-082-7/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | The option is supported by the command (as this is done by a bit more low level code), but the command line parsing did not expect them to be used for the apt show & list command, so that it would report error. As such, a workaround for this issue is to use: -o APT::Snapshot=BANANA instead of e.g. -S BANANA Closes: #1075819
* | Show installed version (not candidate version) while removing a packagesid2024-07-051-0/+42
|/ | | | | Showing a package version which was never installed in removals is confusing.
* solver3: Refactor (rewrite) FromDepCache()Julian Andres Klode2024-07-014-5/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the various Install requests into a single one and move some stuff around, this should be a bit easier to maintain and we don't repeat ourselves all the time. This accidentally uncovered some bugs in the code, that get fixed by this: - The UpgradeManual and InstallManual groups did not work correctly, Essential packages were Install and others were Upgrade. - Automatically installed packages falsely got promoted to the manual groups as they got promoted into the manual code path, whenever we ran without allowing their removal. - The combination of --mark-auto --auto-remove now works correctly We previously skipped the installation of automatically installed packages when we did autoremoval, but we did not consider if the action was protected, that is specified on the command-line. Now we do not autoremove protected actions, and have added a test case for it. - The AllowRemoveManual option no longer is applied if removals are generally denied. Closes: #1071519
* solver3: Do not accidentally promote Replaces and Enhances to dependenciesJulian Andres Klode2024-07-011-0/+65
| | | | | | | | | | As part of the refactoring, we allowed the code to work on unimportant dependencies as we needed to promote Suggests to Depends if they are currently satisfied. However, Replaces and Enhances were not considered properly and both are not negative dependencies so they were accidentally promoted to Depends too if they were currently satisfied.
* solver3: Order obsolete choices lastJulian Andres Klode2024-06-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | This has two aspects: 1. For a dependency A | B | C we order the obsolete packages last, that is, if A is obsolete, this gets reordered to B | C | A, such that we try to pick non-obsolete packages first to ease upgrade calculation. 2. When comparing two dependencies, we order dependencies into three groups: First we satisfy dependencies mentioning only non-installed (NEW) packages, then we satisfy "normal" dependencies, and finally we satisfy any dependencies mentioning obsolete packages. This means for example if you have obsolete libfoo1 and a new libfoo1t64, that we will see Depends: libfoo1t64 before any Depends: libfoo1 (which may expand to libfoo1 | libfoo1t64), so we effectively will have selected "replacement" packages this way already before getting to older packages where we would have to choose between the obsolete package and its replacement.
* Make the failure mode for non-executable tests strongerJulian Andres Klode2024-06-131-1/+1
| | | | | | | | | When a test-* file is created but not executable, we'd ignore the argument and then our subprocess would run the entire test suite itself, sequentially. Silly. Let's just see if the file exists instead, then the test will fail.
* Fix test cases for non-amd64 architecturesJulian Andres Klode2024-05-282-5/+7
| | | | | | These got broken by the recent solver3 changes by accident, and we did not notice as I also broke the test suite detection with the new statistics feature, hooray.
* solver3: Fix translations of removals for marked installJulian Andres Klode2024-05-242-1/+1
| | | | | | | | | We also need to issue a MarkDelete() if the package is marked for installation currently but should not be, not only if it did not have a previous version. This fixes the final test in test-multiarch-barbarian, the others only needed adjustments to mark all packages as automatic.
* solver3: Actually restore unsolved items rather than solved onesJulian Andres Klode2024-05-242-8/+1
| | | | | | | | | | | | | | | | | | | | | | | When restoring previously solved items, we try to restore items that have become unsolved again by skipping items that have a solved solution. Well at least we thought we did, but we accidentally had a "not" in there that inverted the meaning, hence we lost work items on backtracking. This mostly did not seem to have caused any issues, I stumbled over it while trying to add `autoremove` listings to `upgrade`, but fixing it also fixes: test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings This used to say "E: Broken packages", meaning the solver lost a non-optional install request and the 2nd stage solver caught an incomplete solution. Also test-bug-735967-lib32-to-i386-unavailable restores the legacy solver behavior, so win win?
* solver3: Solve optional dependencies before optional packagesJulian Andres Klode2024-05-242-1/+1
| | | | | | | This somewhat improves reliability of not breaking Recommends, e.g. if the Recommends gets tightened. One test case enabled by this now is the test-resolver-provider-exchange, which with a simple change to allow removal of automatically installed packages works now.
* solver3: Promote satisfied Suggests to RecommendsJulian Andres Klode2024-05-242-3/+2
| | | | | | As per the test-suggests-promoted-to-recommends test. This is still a bit messy as we ignore alternative choices and only check the last one, but um seems useful?
* test-bug-758153-versioned-provides-support: Solver 3.0 supportJulian Andres Klode2024-05-242-2/+9
| | | | | The previous commit basically fixes this, it just requires some minor small adjustments
* solver3: Try candidate before installed version on upgradeJulian Andres Klode2024-05-241-0/+51
| | | | | | | | | | This fixes --no-strict-pinning attempting to upgrade all the versions on the system. Adjust the upgrade test case accordingly: 1) no-strict-pinning pulls in systemd despite it being pinned down due to a dependenc (this was true before this fix) 2) no-strict-pinning does not pull in the upgrade-simple because nothing depends on it (this is what the test fixes)
* test: Support the 3.0 solver in most existing test casesJulian Andres Klode2024-05-2448-115/+492
| | | | | | | | | | | | | | | | | | | | | | | | | | | Highlights: - test-bug-618848-always-respect-user-requests: (Do not) Support 3.0 solver A manually installed package is never removed just because we request the removal of its dependency in solver3. - test-bug-657695-resolver-breaks-on-virtuals: Support 3.0 solver For manually installed packages, solver 3.0 would require some new xserver-xorg-video-driver to Conflict+Replace+Provides the old one (once the logic is implemented), but that does seem reasonable. - test-bug-720597-build-dep-purge: Support 3.0 solver This needs a simple aptmark auto because pkga is removed by the build-dep. But further adjustments are necessary because it weirdly tested for no autoremovable packages before installing pkgc. - test-bug-960705-*: Support 3.0 solver Bit awkward to deal with; notably the protect to conflict doesn't actually work anymore and that is a feature these days.
* test: Show statistics for parallel tests tooJulian Andres Klode2024-05-241-1/+26
| | | | | | | | This makes things a bit nicer. We also include a list of passed tests here, to use with --only to validate solver3 changes, as well as the list of skipped tests. But too lazy to implement these for the non-parallel case.
* test: Temporarily ignore autoremovable lists for solver3Julian Andres Klode2024-05-242-2/+11
| | | | | We do not show them yet, so let's ignore them so we can focus on getting the rest of the tests to work.
* test: Run working tests against the 3.0 solverJulian Andres Klode2024-05-243-4/+121
| | | | | Implement --solver, --only, -skip flags for the test suite, and run the test suite with the broken tests skipped against solver3.
* solver3: Implement APT::Solver::RemoveManual to allow removing manual packagesJulian Andres Klode2024-05-241-0/+3
| | | | | | This is mostly going to be useful for the test suite for now, implement a function there to set it up so we can use it to improve test suite correctness.
* edsp: solver3: Show some progressJulian Andres Klode2024-05-241-0/+1
| | | | | Ignore the Solving dependencies... line in the testing framework for compatibility with the existing test cases.
* Do not save new if we have already installed providersDavid Kalnischkies2024-05-161-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | Companion of the previous commit that uses the same reasoning, but from the other side of the logic (as we start from reverse deps here) so that we are dropping the useless NEW from the solution. Ideally this code would not live in -private, but in -pkg, but there is not really a pre-existent good central place for this currently as a sort-of fixup for our default resolver given this is the result of resolver decision to not do something which had ripple effects that aren't reverted along with it. It is a bit unlikely that this is fixing all instances that this bug has given we have dealt with a few instances of it already as they are relatively obscure situations to clean up after and the cost of being wrong (= autoremover generating breaks) is much higher than being correct (= no pointless install – that is likely installed later anyhow after the temporary automatic hold is lifted). And by virtue of being the result of mostly temporary situations its also unlikely to be debugable in hindsight months later; so if there is another situation, its better to deal with it in a new bugreport. Closes: #839546
* Do not mark new if we have already installed providersDavid Kalnischkies2024-05-161-3/+14
| | | | | | | | | | | The test is actually documenting another bug hidden a bit by this one as we do not need to install a NEW package in this situation as the upgrade needing it was kept back, but it was protected from considering it to be autoremoveable as all providers tend to be considered protected, but by limiting us to installed providers if we have some we can drag those new packages out of hiding. Now, we "just" have to get right of the NEW package in a next step.
* Fix accidental silencing of output differences in testsDavid Kalnischkies2024-05-162-13/+39
| | | | | | | | | | Removing every line with at least three characters at the end makes comparisons for output differences rather easy to pass. The intend was to match for '\.\.\.' but given we have to adapt the strings to include autoremove remarks we can also include the string that appeared now that state information is provided (in the form of autobits). Regession-Of: 734eb9ac3f65e38ac3ba7f2d50ea206743a6f611
* test-allow-scores-for-all-dependency-types: Adjust for solver3Julian Andres Klode2024-05-141-0/+3
| | | | | | It relies on removing packages, so we must allow it to. To see if it does the right thing, mark all packages automatically installed.
* test: Ignore progress output in comparing output..Julian Andres Klode2024-05-141-0/+1
|
* Merge branch 'src-specifier' into 'main'Julian Andres Klode2024-04-292-0/+120
|\ | | | | | | | | showsrc, source, build-dep: Support src:name See merge request apt-team/apt!346
| * source, build-dep: Allow specifying src:nameJulian Andres Klode2024-04-291-0/+114
| | | | | | | | This has the same behavior as --only-source name.
| * showsrc: Support querying src:nameJulian Andres Klode2024-04-291-0/+6
| | | | | | | | This has the same meaning as --only-source name
* | Allow parsing an empty Provides lineDavid Kalnischkies2024-04-262-2/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | If dpkg-gencontrol was involved in the creation of a package we will not usually encounter empty or otherwise useless fields, but apparently not everyone is using it. It isn't recommended to have these empty lines, but it isn't too hard to ignore for Provides as we did for dependencies already and apt-ftparchive can be convinced to produce empty files (if you feed it such a package) as well, so lets be nice and provide users with a more accepting parser. Closes: #1069874
* | Add test for dealing with unsat Suggests promoted to RecommendsDavid Kalnischkies2024-04-241-0/+65
| | | | | | | | | | Our code does the right thing currently, so lets add a test to ensure this keeps being the case in the future.
* | Drop sudo-related envvars in testing frameworkDavid Kalnischkies2024-04-248-56/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | Our autoremoval-advertisment is modified by SUDO_USER as if the current apt call was made with sudo it seems a good idea to show the ad with sudo as well. That is annoying for our tests through as normally the tests are run locally or by autopkgtest without sudo, but in Gitlab CI we use it (to run our tests as user… as we are already root) and so individual tests had to deal with this. That is annoying and really not needed as we can have our autoremove test check that this ad gets displayed the right way and ignore it the rest of the time.
* | Do not upgrade rev-deps ear-marked for removalDavid Kalnischkies2024-04-241-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | We schedule reverse dependencies for an upgrade, but we shouldn't do it if we have ear-marked this package for removal later on. Usually the solver will end up doing the right thing like it already did in the included testcase in the end, but given that before it reaches the right end it explored a bad path which can lead to more installs and removals influencing later decisions or are just too hard for the resolver to undo later on, we can just not explore this path to begin with. References: e077370ffcb3669a50a600e80356c2002e6b176d
* | Match version constraints before saving garbage packagesDavid Kalnischkies2024-04-241-4/+17
|/ | | | | | | | | We remove new garbage packages from the solution if we can as installing a new package which is at the same time considered garbage looks silly, but it could also be a new dependency of another garbage package, so we have a second round trying to save such packages. In this round we weren't considering versioned constraints on dependency relations through so even an unsatisfied old recommends could save which it shouldn't.
* Only show Recommends/Suggests for new installs, not upgradesJulian Andres Klode2024-04-122-6/+0
| | | | | | This makes things more useful in combination with the upgrade command, but introduces a subtle change seen in the test suite when you use the install command to upgrade packages.
* apt: Introduce the new terse apt output format 3.0Julian Andres Klode2024-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The key talking points here are: 1. Instead of long sentences, we use short concise messages, e.g. "The following NEW packages will be installed" becomes "Installing". 2. Dependencies are only listed once. We removed the "The following additional packages will be installed" section in favor of splitting up the "Installing" section into "Installing" and "Installing dependencies" (like dnf) 3. The order of the output is different: 1. Packages to be installed manually 2. Packages to be installed automatically 4. Weak dependencies of new packages not installed 3. Packages to be upgraded 4. Packages to be downgraded 5. Packages that have been kept back / are on hold 6. Removals 7. Essential removals i.e. we logically show you the action that is being done, followed by lists related to the action. 4. As requested by popey, we have colorful UI, with green for packages being installed and red for packages being removed. Caveats: - The list of recommends and suggests has not been updated yet, it should move to after the packages being installed (as they are what triggers them) This also introduces output format versioning, configured by the APT::Output-Format option. The default value is 0, except for the apt(8) binary where it is 30 - which enables the new style.