diff options
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/framework | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/test/integration/framework b/test/integration/framework index 8efe47330..8a5973d4b 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -72,11 +72,15 @@ aptconfig() { runapt apt-config $*; } aptcache() { runapt apt-cache $*; } aptget() { runapt apt-get $*; } aptftparchive() { runapt apt-ftparchive $*; } +aptkey() { runapt apt-key $*; } +dpkg() { + $(which dpkg) --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log $* +} setupenvironment() { TMPWORKINGDIRECTORY=$(mktemp -d) local TESTDIR=$(readlink -f $(dirname $0)) - msgninfo "Preparing environment for ${CCMD}$0${CINFO} in ${TMPWORKINGDIRECTORY}… " + msgninfo "Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… " BUILDDIRECTORY="${TESTDIR}/../../build/bin" test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first" local OLDWORKINGDIRECTORY=$(pwd) @@ -85,10 +89,10 @@ setupenvironment() { cd $TMPWORKINGDIRECTORY mkdir rootdir aptarchive keys cd rootdir - mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d var/cache - mkdir -p var/log/apt var/lib/apt + mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d + mkdir -p var/cache var/lib var/log mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers - local STATUSFILE=$(echo "$(basename $0)" | sed 's/^test-/status-/') + local STATUSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/') if [ -f "${TESTDIR}/${STATUSFILE}" ]; then cp "${TESTDIR}/${STATUSFILE}" var/lib/dpkg/status else @@ -98,7 +102,7 @@ setupenvironment() { mkdir -p usr/lib/apt ln -s ${BUILDDIRECTORY}/methods usr/lib/apt/methods cd .. - local PACKAGESFILE=$(echo "$(basename $0)" | sed 's/^test-/Packages-/') + local PACKAGESFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/') if [ -f "${TESTDIR}/${PACKAGESFILE}" ]; then cp "${TESTDIR}/${PACKAGESFILE}" aptarchive/Packages else @@ -228,6 +232,10 @@ buildaptarchive() { createaptftparchiveconfig() { local ARCHS="$(find pool/ -name '*.deb' | grep -oE '_[a-z0-9-]+\.deb$' | sort | uniq | sed -e '/^_all.deb$/ d' -e 's#^_\([a-z0-9-]*\)\.deb$#\1#' | tr '\n' ' ')" + if [ -z "$ARCHS" ]; then + # the pool is empty, so we will operate on faked packages - let us use the configured archs + ARCHS="$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')" + fi echo -n 'Dir { ArchiveDir "' >> ftparchive.conf echo -n $(readlink -f .) >> ftparchive.conf @@ -297,7 +305,7 @@ buildaptftparchivedirectorystructure() { } buildaptarchivefromincoming() { - msginfo "Build APT archive for ${CCMD}$0${CINFO} based on incoming packages…" + msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…" cd aptarchive [ -e pool ] || ln -s ../incoming pool [ -e ftparchive.conf ] || createaptftparchiveconfig @@ -314,7 +322,7 @@ buildaptarchivefromincoming() { } buildaptarchivefromfiles() { - msginfo "Build APT archive for ${CCMD}$0${CINFO} based on prebuild files…" + msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…" cd aptarchive if [ -f Packages ]; then msgninfo "\tPackages file… " @@ -476,7 +484,7 @@ N: No packages found" local ARCH=$(dpkg-architecture -qDEB_HOST_ARCH_CPU) eval `apt-config shell ARCH APT::Architecture` echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE - aptcache show $PACKAGE 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail + aptcache show -q=0 $PACKAGE 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail rm $COMPAREFILE } |