aboutsummaryrefslogtreecommitdiff
path: root/scripts/testing/maint-scenarios/21-cache-uninstalled.sh
blob: ea788e8a80492356fb2f2e49120f2d020e30d3ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# shellcheck shell=bash disable=SC2034  # sourced by run-maint-scenarios.sh
# Scenario: paccache -ruk0 drops every cached version of uninstalled packages.
#
# Fake versions of a package that is NOT installed disappear entirely, while
# an installed package's cached version survives the uninstalled-only pass.
SCENARIO_DESC="cached versions of uninstalled packages dropped"
SCENARIO_GROUP="packages"
SCENARIO_PROFILES="any"

scenario_break() {
    mexec "touch /var/cache/pacman/pkg/maintghostpkg-2.1-1-x86_64.pkg.tar.zst /var/cache/pacman/pkg/maintghostpkg-2.2-1-x86_64.pkg.tar.zst /var/cache/pacman/pkg/bash-9.9-1-x86_64.pkg.tar.zst"
}

scenario_fix() {
    mfix cache_clean_uninstalled
}

scenario_assert() {
    mexec "test ! -e /var/cache/pacman/pkg/maintghostpkg-2.1-1-x86_64.pkg.tar.zst && test ! -e /var/cache/pacman/pkg/maintghostpkg-2.2-1-x86_64.pkg.tar.zst && test -e /var/cache/pacman/pkg/bash-9.9-1-x86_64.pkg.tar.zst"
}