summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartin@piware.de <>2010-06-10 15:19:10 +0200
committermartin@piware.de <>2010-06-10 15:19:10 +0200
commit31e1187be48846395cb3b57f0e9a731261a1484c (patch)
tree50fcd6deb4bb0a52ce4b643aaeee5c68aa7cfd49
parent6617de4d12e2bae1a463af2a6631dd2f109da7be (diff)
* Add test/test-indexes.sh:
- Test behaviour of index retrieval and usage, in particular with uncompressed and gzip compressed indexes.
-rw-r--r--debian/changelog3
-rwxr-xr-xtest/test-indexes.sh106
2 files changed, 109 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 7facf6f80..bd328fd08 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,9 @@ apt (0.7.26~exp5) UNRELEASED; urgency=low
- If the Acquire::GzipIndexes option is true and we download a gzipped
index file, keep it as it is (and rename to .gz) instead of
uncompressing it.
+ * Add test/test-indexes.sh:
+ - Test behaviour of index retrieval and usage, in particular with
+ uncompressed and gzip compressed indexes.
-- Christian Perrier <bubulle@debian.org> Tue, 11 May 2010 19:52:00 +0200
diff --git a/test/test-indexes.sh b/test/test-indexes.sh
new file mode 100755
index 000000000..d3f5e7cd3
--- /dev/null
+++ b/test/test-indexes.sh
@@ -0,0 +1,106 @@
+#!/bin/sh -e
+
+# Test behaviour of index retrieval and usage, in particular with uncompressed
+# and gzip compressed indexes.
+# Author: Martin Pitt <martin.pitt@ubuntu.com>
+# (C) 2010 Canonical Ltd.
+
+BUILDDIR=$(readlink -f $(dirname $0)/../build)
+
+TEST_SOURCE="deb http://ftp.debian.org/debian unstable contrib"
+TEST_SOURCE_KEYID=55BE302B
+GPG_KEYSERVER=gpg-keyserver.de
+# should be a small package with dependencies satisfiable in TEST_SOURCE, i. e.
+# ideally no depends at all
+TEST_PKG="python-psyco-doc"
+
+export LD_LIBRARY_PATH=$BUILDDIR/bin
+
+OPTS="-o RootDir=. -o Dir::Bin::Methods=$BUILDDIR/bin/methods -o Debug::NoLocking=true"
+DEBUG=""
+#DEBUG="-o Debug::pkgCacheGen=true"
+#DEBUG="-o Debug::pkgAcquire=true"
+APT_GET="$BUILDDIR/bin/apt-get $OPTS $DEBUG"
+APT_CACHE="$BUILDDIR/bin/apt-cache $OPTS $DEBUG"
+
+[ -x "$BUILDDIR/bin/apt-get" ] || {
+ echo "please build the tree first" >&2
+ exit 1
+}
+
+echo "---- building sandbox----"
+WORKDIR=$(mktemp -d)
+trap "cd /; rm -rf $WORKDIR" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+cd $WORKDIR
+
+rm -fr etc var
+rm -f home
+ln -s /home home
+mkdir -p etc/apt/preferences.d etc/apt/trusted.gpg.d var/cache/apt/archives/partial var/lib/apt/lists/partial var/lib/dpkg
+cp /etc/apt/trusted.gpg etc/apt
+touch var/lib/dpkg/status
+echo "$TEST_SOURCE" > etc/apt/sources.list
+
+# get keyring
+gpg --no-options --no-default-keyring --secret-keyring etc/apt/secring.gpg --trustdb-name etc/apt/trustdb.gpg --keyring etc/apt/trusted.gpg --primary-keyring etc/apt/trusted.gpg --keyserver $GPG_KEYSERVER --recv-keys $TEST_SOURCE_KEYID
+
+echo "---- uncompressed update ----"
+$APT_GET update
+test -e var/lib/apt/lists/*_Packages
+! test -e var/lib/apt/lists/*_Packages.gz
+
+echo "---- uncompressed cache ----"
+$APT_CACHE show $TEST_PKG | grep -q ^Version:
+# again (with cache)
+$APT_CACHE show $TEST_PKG | grep -q ^Version:
+rm var/cache/apt/*.bin
+$APT_CACHE policy $TEST_PKG | grep -q '500 http://'
+# again (with cache)
+$APT_CACHE policy $TEST_PKG | grep -q '500 http://'
+
+echo "---- uncompressed install ----"
+$APT_GET install -d $TEST_PKG
+test -e var/cache/apt/archives/$TEST_PKG*.deb
+$APT_GET clean
+! test -e var/cache/apt/archives/$TEST_PKG*.deb
+
+echo "----- uncompressed update with preexisting indexes, no pdiff ----"
+$APT_GET -o Acquire::PDiffs=false update
+test -e var/lib/apt/lists/*_Packages
+! test -e var/lib/apt/lists/*_Packages.gz
+
+echo "----- uncompressed update with preexisting indexes, with pdiff ----"
+$APT_GET -o Acquire::PDiffs=true update
+test -e var/lib/apt/lists/*_Packages
+! test -e var/lib/apt/lists/*_Packages.gz
+
+echo "----- compressed update ----"
+find var/lib/apt/lists/ -type f | xargs -r rm
+$APT_GET -o Acquire::GzipIndexes=true update
+! test -e var/lib/apt/lists/*_Packages
+test -e var/lib/apt/lists/*_Packages.gz
+
+echo "---- compressed cache ----"
+$APT_CACHE show $TEST_PKG | grep -q ^Version:
+# again (with cache)
+$APT_CACHE show $TEST_PKG | grep -q ^Version:
+rm var/cache/apt/*.bin
+$APT_CACHE policy $TEST_PKG | grep -q '500 http://'
+# again (with cache)
+$APT_CACHE policy $TEST_PKG | grep -q '500 http://'
+
+echo "---- compressed install ----"
+$APT_GET install -d $TEST_PKG
+! test -e var/cache/apt/archives/$TEST_PKG*.deb
+
+echo "----- compressed update with preexisting indexes, no pdiff ----"
+$APT_GET -o Acquire::PDiffs=false -o Acquire::GzipIndexes=true update
+! test -e var/lib/apt/lists/*_Packages
+test -e var/lib/apt/lists/*_Packages.gz
+
+echo "----- compressed update with preexisting indexes, with pdiff ----"
+$APT_GET -o Acquire::PDiffs=true -o Acquire::GzipIndexes=true update
+! test -e var/lib/apt/lists/*_Packages
+test -e var/lib/apt/lists/*_Packages.gz
+
+echo "---- ALL TESTS PASSED ----"