summaryrefslogtreecommitdiff
path: root/test/integration/test-kernel-helper-autoremove
Commit message (Collapse)AuthorAgeFilesLines
* Support kernel images with + in uname in kernel autoremove testDavid Kalnischkies2025-09-021-1/+1
| | | | | | | | | autopkgtest run on stable can have an uname like "6.12.41+deb13-amd64". The +deb13 being relatively new in the package name. The code doing the autoremoval has no problem with it and its a legal package name, but the test that wants to check if the right regexes are generated does not escape the + correctly (aka at all) so it isn't finding the regex it is looking for failing the test.
* Show command in test failure messages if default is overriddenDavid Kalnischkies2025-09-021-2/+2
| | | | | | | | Tests usually print the command they run, but it can be overridden with a chosen message to make clearer what is actually tested. To debug failures it can be useful to know the command run through especially if its a partly generated command depending on the test environment (like in the kernel autoremove test).
* Drop sudo-related envvars in testing frameworkDavid Kalnischkies2024-04-241-7/+3
| | | | | | | | | | | | | 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.
* Only protect two kernels, not last installed oneJulian Andres Klode2022-04-071-16/+6
| | | | | | | | | | | | The kernel autoremoval algorithm was written to accomodate for Ubuntu's boot partition sizing, which was written to accomodate 3 kernels - 2 installed ones + a new one being unpacked. It seems that when the algorithm was designed, it was overlooked that it actually kept 3 kernels. LP: #1968154
* Determine autoremovable kernels at run-timeJulian Andres Klode2021-01-041-8/+7
| | | | | | | | | | | | | | | | | | | | | | | Our kernel autoremoval helper script protects the currently booted kernel, but it only runs whenever we install or remove a kernel, causing it to protect the kernel that was booted at that point in time, which is not necessarily the same kernel as the one that is running right now. Reimplement the logic in C++ such that we can calculate it at run-time: Provide a function to produce a regular expression that matches all kernels that need protecting, and by changing the default root set function in the DepCache to make use of that expression. Note that the code groups the kernels by versions as before, and then marks all kernel packages with the same version. This optimized version inserts a virtual package $kernel into the cache when building it to avoid having to iterate over all packages in the cache to find the installed ones, significantly improving performance at a minor cost when building the cache. LP: #1615381
* Widen regular expressions for versioned kernel packagesJulian Andres Klode2020-01-301-6/+6
| | | | | | | | | | Since we append a concrete kernel version to each pattern, and then anchor the pattern, let's just pick any package starting with a kernel name (linux-, kfreebsd-, gnumach-), and not worry about linux-headers, linux-tools, etc specifically, as they'll be caught by the generic pattern. LP: #1607845
* support COLUMNS environment variable in apt toolsDavid Kalnischkies2017-11-191-4/+13
| | | | | | | apt usually gets the width of the window from the terminal or failing that has a default value, but especially for testing it can be handy to control the size as you can't be sure that variable sized content will always be linebreaked as expected in the testcases.
* Lower-case uname -r output in kernel autoremove helperJulian Andres Klode2016-08-261-2/+2
| | | | | This is needed on FreeBSD which has versions like 11.0-RC1, otherwise the tests would fail.
* Add kernels with "+" in the package name to APT::NeverAutoRemoveAndrew Patterson2016-07-081-3/+9
| | | | | | | | | Escape "+" in kernel package names when generating APT::NeverAutoRemove list so it is not treated as a regular expression meta-character. [Changed by David Kalnischkies: let test actually test the change] Closes: #830159
* tests: support spaces in path and TMPDIRDavid Kalnischkies2015-12-191-2/+2
| | | | | | | 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
* suggest 'apt autoremove' to get right of unneeded packagesDavid Kalnischkies2015-11-041-3/+7
| | | | | | | | | | The bugreport is more conservative in asking for a conditional, but given that this is a message intended to be read by users to be run by users we should suggest using a command intended to be used by users. And while we are at, add sudo to the message – conditional of course. Closes: 801571
* tests: try to support spaces in TMPDIRDavid Kalnischkies2015-09-141-1/+1
| | | | | | | | Not all tests work yet, most notable the cdrom tests, but those require changes in libapt itself to have a proper fix and what we have fixed so far is good enough progress for now. Git-Dch: Ignore
* select kernels to protect from autoremove based on Debian versionDavid Kalnischkies2015-09-141-40/+92
| | | | | | | | | | | | | | | | | | This is basically a rewrite of the script with the general idea of finding the Debian version of the installed kernels – as multiple flavours will have the same Debian version – select the two newest of them and translate them back to versions found in package names. This way we avoid e.g. kernel and kernel-rt to use up the protected slots even through they are basically the same kernel (just a different flavour) so it is likely that if kernel doesn't work for some reason, kernel-rt will not either. This also deals with foreign kernel packages, kernels on hold and partly installed kernels (in case multiple kernels are installed in the same apt run) in a hopefully sensible way. Closes: 787827
* implement a more generic ShowList methodDavid Kalnischkies2015-08-101-0/+16
| | | | | | | | | | | | | | | apt-get is displaying various lists of package names, which until now it was building as a string before passing it to ShowList, which inserted linebreaks at fitting points and showed a title if needed, but it never really understood what it was working with. With the help of C++11 the new generic knows not only what it works with, but generates the list on the fly rather than asking for it and potentially discarding parts of the input (= the non-default verbose display). It also doubles as a test for how usable the CacheSets are with C++11. (Not all callers are adapted yet.) Git-Dch: Ignore
* test exitcode as well as string equalityDavid Kalnischkies2015-03-161-3/+3
| | | | | | | | 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
* merge debian/sid into debian/experimentalDavid Kalnischkies2015-03-161-7/+0
|\
* | fix apt-config test now that PATH changed in 8c617819David Kalnischkies2014-05-081-1/+1
|/ | | | Git-Dch: Ignore
* only consider versioned kernel packages in autoremoveDavid Kalnischkies2014-03-211-0/+1
| | | | | | | | | | | | Metapackages like "linux-image-amd64" are otherwise matched by our extraction as well, which later on can't be successfully compared via dpkg --compare-versions as the 'amd64' bit isn't a version number. (Luckily none of our architectures starts with a digit.) This was broken by me in 0.9.16 as I moved a shell-glob matcher to a regex-based one which has slightly different semantics regarding '*'. Closes: 741962
* ensure that a dot is a dot in the hookDavid Kalnischkies2014-03-131-9/+17
| | | | | | As we deal with regex matchers here the dots are treated as wildcards if we don't take care of escaping them. Not very likely that this could be a real-world problem, but just to be sure.
* support kfreebsd and hurd in the kernel hookDavid Kalnischkies2014-03-131-10/+34
| | | | | | kfreebsd as well as hurd kernel packages call the postinst script as well so we just need to enable the correct parsing for installed packages and disable the "protect every version" hammer for them.
* use a configurable list of versioned kernel packagesDavid Kalnischkies2014-03-131-39/+52
| | | | | | With APT::VersionedKernelPackages users have the option of adding packages like pre-build out-of-tree modules to the list of automatically protected from being autoremoved.
* fix the test-kernel-helper-autoremove testcaseMichael Vogt2014-02-141-6/+6
|
* Additional test for the case when installed version != newest versionSteve Langasek2014-02-141-2/+15
|
* Make the test more verbose and check for the negative case of a kernel thatSteve Langasek2014-02-141-4/+11
| | | | should not be marked not-for-autoremoval
* typo fixSteve Langasek2014-02-141-1/+1
|
* also check that the running kernel is keptMichael Vogt2014-02-141-1/+3
|
* add testcase for the autoremove featureMichael Vogt2014-02-141-0/+33
Conflicts: debian/apt.auto-removal.sh