summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-cdrom
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-05-07 17:55:10 +0200
committerMichael Vogt <mvo@debian.org>2014-05-07 17:55:10 +0200
commit38d2959ffb8c6f5f291b2910014a67b1b352ab4c (patch)
treec5977b8f34aaf973ed3956952ec3ff43ac59f143 /test/integration/test-apt-cdrom
parentfce69e7a0f38299c57ef96ae1c1dd9a5379bfd5a (diff)
parent3fa4e98f62e469f4292d2811b4e15f4afb678fbd (diff)
Merge branch 'debian/sid' into debian/experimental
Conflicts: apt-pkg/cachefilter.h apt-pkg/contrib/fileutl.cc apt-pkg/contrib/netrc.h apt-pkg/deb/debsrcrecords.cc apt-pkg/init.h apt-pkg/pkgcache.cc debian/apt.install.in debian/changelog
Diffstat (limited to 'test/integration/test-apt-cdrom')
-rwxr-xr-xtest/integration/test-apt-cdrom86
1 files changed, 45 insertions, 41 deletions
diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom
index cc3483f9b..8d8fdf167 100755
--- a/test/integration/test-apt-cdrom
+++ b/test/integration/test-apt-cdrom
@@ -12,31 +12,60 @@ 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/dists/stable/main/i18n
+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 Translation-en Translation-de
+rm -f Translation-en Translation-de
+chmod -R -w .
cd - > /dev/null
-addtrap 'prefix' "chmod -R +w $PWD/rootdir/media/cdrom/dists/;"
-chmod -R -w rootdir/media/cdrom/dists
-aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1
-sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log
-testfileequal apt-cdrom.log "Scanning disc for index files..
-Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
-Found label 'Debian APT Testdisk 0.8.15'
-This disc is called:
+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
+ sed -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' 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!"
+}
+
+CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
+Unmounting CD-ROM...
+Waiting for disc...
+Please insert a Disc in the drive and press enter
+Mounting CD-ROM...
+Scanning disc for index files..."
+CDROM_POST="This disc is called:
'Debian APT Testdisk 0.8.15'
Writing new source list
Source list entries for this disc are:
deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
+Unmounting CD-ROM...
Repeat this process for the rest of the CDs in your set."
+testequal "$CDROM_PRE
+Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
+Found label 'Debian APT Testdisk 0.8.15'
+$CDROM_POST" aptcdromlog add
+
+testequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
+Mounting CD-ROM...
+Stored label: Debian APT Testdisk 0.8.15
+Unmounting CD-ROM..." aptcdromlog ident
+
+# apt-setup uses these commands (expect the tr in the id) to find id and label
+ident="$(LC_ALL=C aptcdrom ident 2>&1 )"
+CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')"
+CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")"
+testequal "CD::${CD_ID} \"${CD_LABEL}\";
+CD::${CD_ID}::Label \"${CD_LABEL}\";" cat rootdir/var/lib/apt/cdroms.list
+
testequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
@@ -54,49 +83,24 @@ Inst testing:i386 (0.8.15 stable [i386])
Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s
# check Idempotence of apt-cdrom (and disabling of Translation dropping)
-aptcdrom add -m -o quiet=1 -o APT::CDROM::DropTranslation=0 > apt-cdrom.log 2>&1
-sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log
-testfileequal apt-cdrom.log "Scanning disc for index files..
+testequal "$CDROM_PRE
Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
-This disc is called:
-'Debian APT Testdisk 0.8.15'
-Writing new source list
-Source list entries for this disc are:
-deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
-deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
-Repeat this process for the rest of the CDs in your set."
+$CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0
# take Translations from previous runs as needed
-aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1
-sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log
-testfileequal apt-cdrom.log "Scanning disc for index files..
+testequal "$CDROM_PRE
Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
-This disc is called:
-'Debian APT Testdisk 0.8.15'
-Writing new source list
-Source list entries for this disc are:
-deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
-deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
-Repeat this process for the rest of the CDs in your set."
+$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
mkdir -p rootdir/var/lib/apt/lists/partial
-aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1
-sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log
-testfileequal apt-cdrom.log "Scanning disc for index files..
+testequal "$CDROM_PRE
Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
-This disc is called:
-'Debian APT Testdisk 0.8.15'
-Writing new source list
-Source list entries for this disc are:
-deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
-deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
-Repeat this process for the rest of the CDs in your set."
+$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
-
# check that we really can install from a 'cdrom'
testdpkgnotinstalled testing
testsuccess aptget install testing -y