From 636c7dc17286d93d788c741d15fd756aeda066d5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 5 May 2024 20:07:13 +0200 Subject: Adding upstream version 1.8.2.3. Signed-off-by: Daniel Baumann --- test/integration/test-apt-cdrom | 158 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100755 test/integration/test-apt-cdrom (limited to 'test/integration/test-apt-cdrom') diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom new file mode 100755 index 0000000..01680c4 --- /dev/null +++ b/test/integration/test-apt-cdrom @@ -0,0 +1,158 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'amd64' 'i386' + +buildsimplenativepackage 'testing' 'amd64,i386' '0.8.15' 'stable' +setupaptarchive --no-update + +changetocdrom 'Debian APT Testdisk 0.8.15' + +# -de is not in the Release file, but picked up anyway for compatibility +cd rootdir/media/cdrom-unmounted/dists/stable/main/i18n +chmod +w . +sed -e '/^Description-en:/ d' -e '/^ / d' -e '/^$/ d' Translation-en > Translation-de +echo 'Description-de: automatisch generiertes Testpaket testing=0.8.15/stable + Diese Pakete sind nur für das testen von APT gedacht, + sie erfüllen keinen Zweck auf einem normalen System… +' >> Translation-de +compressfile Translation-de +rm -f Translation-en Translation-de +chmod -R 555 . +cd - > /dev/null + +aptcdromlog() { + rm -f rootdir/tmp/apt-cdrom.log + test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!" + test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!" + aptcdrom "$@" -o quiet=1 >rootdir/tmp/apt-cdrom.log 2>&1 /dev/null +} +testcdromusage + +# check Idempotence of apt-cdrom (and disabling of Translation dropping) +testsuccessequal "$CDROM_PRE +Found 3 package indexes, 1 source indexes, 2 translation indexes and 1 signatures +$CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0 + +# take Translations from previous runs as needed +testsuccessequal "$CDROM_PRE +Found 3 package indexes, 1 source indexes, 2 translation indexes and 1 signatures +$CDROM_POST" aptcdromlog add +msgtest 'Test for the german description translation of' 'testing' +aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail +rm -rf rootdir/var/lib/apt/lists +testsuccessequal "$CDROM_PRE +Found 3 package indexes, 1 source indexes, 1 translation indexes and 1 signatures +$CDROM_POST" aptcdromlog add +msgtest 'Test for the english description translation of' 'testing' +aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail + +# ensure cdrom method isn't trying to mount the cdrom +mv rootdir/media/cdrom-unmounted rootdir/media/cdrom-ejected +msgmsg "ensure an update doesn't mess with cdrom sources" +testsuccess aptget update +testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease +Reading package lists...' +mv rootdir/media/cdrom-ejected rootdir/media/cdrom-unmounted +testcdromusage + +msgmsg 'and again to check that it withstands the temptation even if it could mount' +testsuccess aptget update +testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease +Reading package lists...' +testcdromusage + +msgmsg 'Check that nothing touched our' 'CD-ROM' +for file in $(find rootdir/media/cdrom-unmounted/dists); do + testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:555" +done -- cgit v1.2.3