summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2024-01-08 09:15:34 +0000
committerJulian Andres Klode <jak@debian.org>2024-01-08 09:15:34 +0000
commit6e43eef9ca8250eb561f2c9af2f4890d674f3911 (patch)
tree94e31c8f341cc886f55f87b7a6e8048187994934 /test
parent7a9a7c1025a5a9dcb27b0e8b5a2d40327fd3b911 (diff)
parentafcdbcf895284efd76903b2b3ba5cc849059ce50 (diff)
Merge branch 'fix/dontstorediffindex' into 'main'
Do not store .diff_Index files in update See merge request apt-team/apt!316
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-apt-get-clean40
-rwxr-xr-xtest/integration/test-pdiff-usage23
2 files changed, 46 insertions, 17 deletions
diff --git a/test/integration/test-apt-get-clean b/test/integration/test-apt-get-clean
index d05073218..32dd3e852 100755
--- a/test/integration/test-apt-get-clean
+++ b/test/integration/test-apt-get-clean
@@ -13,13 +13,27 @@ insertpackage 'experimental' 'foo' 'all' '1:1'
insertinstalledpackage 'foo' 'all' '3'
setupaptarchive --no-update
+mkdir -p rootdir/var/lib/apt/lists/partial
+testsuccess test -d rootdir/var/lib/apt/lists/partial
+
+# nothing to do always works (part 1)
+for cmd in aptget apt; do
+ for sub in distclean dist-clean; do
+ testsuccess $cmd $sub
+ testsuccess $cmd $sub -s
+ done
+done
+testsuccess test -d rootdir/var/lib/apt/lists/partial
-mkdir -p rootdir/var/lib/apt/lists/lost+found
testsuccess apt update
-# nothing to do always works
-testsuccess aptget clean
-testsuccess aptget clean -s
+# nothing to do always works (part 2)
+for cmd in aptget apt; do
+ for sub in clean autoclean auto-clean; do
+ testsuccess $cmd $sub
+ testsuccess $cmd $sub -s
+ done
+done
# generate some dirt and clean it up
generatedirt() {
@@ -63,6 +77,23 @@ if [ "$(id -u)" != '0' ]; then
chmod 644 rootdir/var/cache/apt/archives/lock
fi
+msgmsg 'distclean'
+listcurrentlistsdirectory > aptdistclean.before
+testsuccessequal '3' grep -c -e 'Release$' aptdistclean.before
+testsuccess grep -e 'Packages$' -e 'Sources$' -e 'Translation-*$' aptdistclean.before
+testsuccess apt distclean
+listcurrentlistsdirectory > aptdistclean.after
+testfailure cmp aptdistclean.before aptdistclean.after
+testsuccessequal '3' grep -c -e 'Release$' aptdistclean.after
+testfailureequal '0' grep -c -e 'Packages$' -e 'Sources$' -e 'Translation-*$' aptdistclean.after
+for dirt in Packages.gz Sources.xz Release2gpg Release_Packages; do
+ touch "rootdir/var/lib/apt/lists/_foo_bar_$dirt"
+done
+listcurrentlistsdirectory > aptdistclean.before
+testsuccess apt distclean
+listcurrentlistsdirectory > aptdistclean.cleaned
+testsuccess cmp aptdistclean.after aptdistclean.cleaned
+
directorygone() {
rm -rf "$1"
testsuccess apt autoclean
@@ -86,3 +117,4 @@ directorygone 'rootdir/var/lib/apt/lists'
msgmsg 'apt directory missing'
directorygone 'rootdir/var/cache/apt'
directorygone 'rootdir/var/lib/apt'
+
diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage
index 38e455b00..cf3a2f2d9 100755
--- a/test/integration/test-pdiff-usage
+++ b/test/integration/test-pdiff-usage
@@ -38,14 +38,7 @@ wasmergeused() {
#apt update "$@" 2>&1 | tee rootdir/tmp/testsuccess.output
msgtest 'No intermediate patch files' 'still exist'
- local EDS="$(find rootdir/var/lib/apt/lists -name '*.ed' -o -name '*.ed.*')"
- if [ -z "$EDS" ]; then
- msgpass
- else
- echo
- echo "$EDS"
- msgfail
- fi
+ testempty --nomsg find rootdir/var/lib/apt/lists -name '*.ed' -o -name '*.ed.*' -o -name '*.diff_Index' -o -name '*.diff_Index.xz'
if echo "$*" | grep -q -- '-o test::cannot-use-pdiff=1'; then
msgtest 'Check if pdiff was' 'not used'
@@ -389,21 +382,25 @@ testcase() {
testrun -o Acquire::PDiffs::Merge=1 -o APT::Get::List-Cleanup=0 "$@"
}
generatepartialleftovers() {
+ local PREFIX="$1"
+ shift
for f in "$@"; do
- cat "${PKGFILE}" "${PKGFILE}" > "rootdir/var/lib/apt/lists-bak/partial/localhost:${APTHTTPPORT}_${f}"
- printf '\n\nInvalid\nStanza: yes\n\n' >> "rootdir/var/lib/apt/lists-bak/partial/localhost:${APTHTTPPORT}_${f}"
+ cat "${PKGFILE}" "${PKGFILE}" > "rootdir/var/lib/apt/lists-bak/partial/localhost:${APTHTTPPORT}_${PREFIX}${f}"
+ printf '\n\nInvalid\nStanza: yes\n\n' >> "rootdir/var/lib/apt/lists-bak/partial/localhost:${APTHTTPPORT}_${PREFIX}${f}"
done
+ printf '\n\nInvalid\nStanza: yes\n\n' >> "rootdir/var/lib/apt/lists-bak/localhost:${APTHTTPPORT}_${PREFIX}Packages.diff_Index"
+ printf '\n\nInvalid\nStanza: yes\n\n' >> "rootdir/var/lib/apt/lists-bak/localhost:${APTHTTPPORT}_${PREFIX}Packages.diff_Index.xz"
}
-partialleftovers() { generatepartialleftovers 'Packages' 'Packages-patched'; }
+partialleftovers() { generatepartialleftovers '' 'Packages' 'Packages-patched'; }
aptautotest_apt_update() { aptautotest_aptget_update "$@"; testsuccess test -e "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_Packages"; }
testcase -o Acquire::IndexTargets::deb::Packages::KeepCompressed=false
-partialleftovers() { generatepartialleftovers "Packages.${LOWCOSTEXT}" "Packages-patched.${LOWCOSTEXT}"; }
+partialleftovers() { generatepartialleftovers '' "Packages.${LOWCOSTEXT}" "Packages-patched.${LOWCOSTEXT}"; }
aptautotest_apt_update() { aptautotest_aptget_update "$@"; testsuccess test -e "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_Packages.$LOWCOSTEXT"; }
testcase -o Acquire::IndexTargets::deb::Packages::KeepCompressed=true
-partialleftovers() { generatepartialleftovers "redirectme_Packages.${LOWCOSTEXT}" "redirectme_Packages-patched.${LOWCOSTEXT}"; }
+partialleftovers() { generatepartialleftovers 'redirectme_' "Packages.${LOWCOSTEXT}" "Packages-patched.${LOWCOSTEXT}"; }
# redirect the InRelease file only – the other files are auto-redirected by apt
webserverconfig 'aptwebserver::redirect::replace::/redirectme/I' "http://0.0.0.0:${APTHTTPPORT}/I"
rewritesourceslist "http://localhost:${APTHTTPPORT}/redirectme"