Просмотр исходного кода

run integration tests on my new amd64 box without failures

David Kalnischkies лет назад: 14
Родитель
Сommit
ea65d079e1

+ 21 - 7
test/integration/framework

@@ -149,6 +149,7 @@ setupenvironment() {
 	echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
 	echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
 	echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
+	echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it…
 	echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
 	echo 'quiet::NoUpdate "true";' >> aptconfig.conf
 	export LC_ALL=C
@@ -156,13 +157,26 @@ setupenvironment() {
 	msgdone "info"
 }
 
+getarchitecture() {
+	if [ "$1" = "native" -o -z "$1" ]; then
+		eval `aptconfig shell ARCH APT::Architecture`
+		if [ -n "$ARCH" ]; then
+			echo $ARCH
+		else
+			dpkg-architecture -qDEB_BUILD_ARCH
+		fi
+	else
+		echo $1
+	fi
+}
+
 configarchitecture() {
 	local CONFFILE=rootdir/etc/apt/apt.conf.d/01multiarch.conf
 	rm -f $CONFFILE
-	echo "APT::Architecture \"$1\";" > $CONFFILE
+	echo "APT::Architecture \"$(getarchitecture $1)\";" > $CONFFILE
 	shift
 	while [ -n "$1" ]; do
-		echo "APT::Architectures:: \"$1\";" >> $CONFFILE
+		echo "APT::Architectures:: \"$(getarchitecture $1)\";" >> $CONFFILE
 		shift
 	done
 }
@@ -275,7 +289,7 @@ Package: $NAME" > ${BUILDDIR}/debian/control
 		echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
 	done
 
-	for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do
+	for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
 		rm -rf ${BUILDDIR}/debian/tmp
 		mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
 		cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}
@@ -298,6 +312,7 @@ buildpackage() {
 	local BUILDDIR=$1
 	local RELEASE=$2
 	local SECTION=$3
+	local ARCH=$(getarchitecture $4)
 	msgninfo "Build package $(echo "$BUILDDIR" | grep -o '[^/]*$') for ${RELEASE} in ${SECTION}… "
 	cd $BUILDDIR
 	if [ "$ARCH" = "all" ]; then
@@ -408,7 +423,7 @@ insertpackage() {
 	local DEPENDENCIES="$5"
 	local PRIORITY="${6:-optional}"
 	local ARCHS=""
-	for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do
+	for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
 		if [ "$arch" = "all" ]; then
 			ARCHS="$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
 		else
@@ -465,7 +480,7 @@ insertinstalledpackage() {
 	local DEPENDENCIES="$4"
 	local PRIORITY="${5:-optional}"
 	local FILE="rootdir/var/lib/dpkg/status"
-	for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do
+	for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
 		echo "Package: $NAME
 Status: install ok installed
 Priority: $PRIORITY
@@ -715,8 +730,7 @@ N: Can't select versions from package '$1' as it is purely virtual"
 N: No packages found"
 	local COMPAREFILE=$(mktemp)
 	addtrap "rm $COMPAREFILE;"
-	local ARCH=$(dpkg-architecture -qDEB_HOST_ARCH_CPU)
-	eval `apt-config shell ARCH APT::Architecture`
+	local ARCH="$(getarchitecture 'native')"
 	echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE
 	aptcache show -q=0 $PACKAGE 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
 }

+ 1 - 1
test/integration/test-bug-590041-prefer-non-virtual-packages

@@ -3,7 +3,7 @@ set -e
 
 . $(readlink -f $(dirname $0))/framework
 setupenvironment
-configarchitecture "i386" "armel"
+configarchitecture 'i386' 'armel'
 
 pkglibc6="Package: libc6
 Architecture: armel

+ 1 - 7
test/integration/test-bug-595691-empty-and-broken-archive-files

@@ -13,7 +13,7 @@ setupflataptarchive
 testaptgetupdate() {
 	rm -rf rootdir/var/lib/apt
 	aptget update 2>> testaptgetupdate.diff >> testaptgetupdate.diff || true
-	sed -i -e '/^Fetched / d' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff
+	sed -i -e '/^Fetched / d' -e '/Ign / d' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff
 	GIVEN="$1"
 	shift
 	msgtest "Test for correctness of" "apt-get update with $*"
@@ -78,7 +78,6 @@ testoverfile() {
 
 	createemptyfile 'en'
 	testaptgetupdate "Get:1 file:  InRelease []
-Ign file:  Translation-en
 Reading package lists..." "empty file en.$COMPRESS over file"
 
 	createemptyarchive 'en'
@@ -89,12 +88,10 @@ Reading package lists..." "empty archive en.$COMPRESS over file"
 	# FIXME: Why omits the file transport the Packages Get line?
 	#Get:3 file:  Packages []
 	testaptgetupdate "Get:1 file:  InRelease []
-Ign file:  Translation-en
 Reading package lists..." "empty archive Packages.$COMPRESS over file"
 
 	createemptyfile 'Packages'
 	testaptgetupdate "Get:1 file:  InRelease []
-Ign file:  Translation-en
 Err file:  Packages
   Empty files can't be valid archives
 W: Failed to fetch ${COMPRESSOR}:$(readlink -f aptarchive/Packages.$COMPRESS)  Empty files can't be valid archives
@@ -109,7 +106,6 @@ testoverhttp() {
 	testaptgetupdate "Get:1 http://localhost  InRelease []
 Get:2 http://localhost  Packages []
 Get:3 http://localhost  Translation-en
-Ign http://localhost  Translation-en
 Reading package lists..." "empty file en.$COMPRESS over http"
 
 	createemptyarchive 'en'
@@ -121,14 +117,12 @@ Reading package lists..." "empty archive en.$COMPRESS over http"
 	createemptyarchive 'Packages'
 	testaptgetupdate "Get:1 http://localhost  InRelease []
 Get:2 http://localhost  Packages []
-Ign http://localhost  Translation-en
 Reading package lists..." "empty archive Packages.$COMPRESS over http"
 
 	createemptyfile 'Packages'
 	#FIXME: we should response with a good error message instead
 	testaptgetupdate "Get:1 http://localhost  InRelease []
 Get:2 http://localhost  Packages
-Ign http://localhost  Translation-en
 Err http://localhost  Packages
   Empty files can't be valid archives
 W: Failed to fetch ${COMPRESSOR}:$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:8080_Packages)  Empty files can't be valid archives

+ 1 - 6
test/integration/test-bug-612099-multiarch-conflicts

@@ -4,9 +4,7 @@ set -e
 TESTDIR=$(readlink -f $(dirname $0))
 . $TESTDIR/framework
 setupenvironment
-configarchitecture "i386" "amd64"
-
-buildsimplenativepackage 'peace-dpkg' 'all' '1.0' 'stable'
+configarchitecture 'i386' 'amd64'
 
 buildsimplenativepackage 'libc6' 'i386' '1.0' 'stable'
 buildsimplenativepackage 'libc6' 'amd64' '1.0' 'stable'
@@ -17,9 +15,6 @@ buildsimplenativepackage 'foobar' 'amd64' '1.0' 'stable' 'Depends: libc6'
 
 setupaptarchive
 
-aptget install peace-dpkg:i386 -y -qq 2>&1 > /dev/null
-testdpkginstalled peace-dpkg
-
 aptget install libc6:i386 -t stable -y -qq 2>&1 > /dev/null
 testdpkginstalled libc6
 testequal 'Reading package lists...

+ 7 - 7
test/integration/test-disappearing-packages

@@ -4,12 +4,12 @@ set -e
 TESTDIR=$(readlink -f $(dirname $0))
 . $TESTDIR/framework
 setupenvironment
-configarchitecture "i386"
+configarchitecture 'native'
 
-buildsimplenativepackage "old-pkg" "i386" "1.0" "stable"
+buildsimplenativepackage "old-pkg" "native" "1.0" "stable"
 buildsimplenativepackage "unrelated" "all" "0.5" "unstable"
 
-setupsimplenativepackage "new-pkg" "i386" "2.0" "unstable" "Provides: old-pkg
+setupsimplenativepackage "new-pkg" "native" "2.0" "unstable" "Provides: old-pkg
 Replaces: old-pkg
 Conflicts: old-pkg (<< 2.0)"
 BUILDDIR="incoming/new-pkg-2.0"
@@ -43,12 +43,12 @@ Note: This is done automatic and on purpose by dpkg." > $COMPAREFILE
 $CMD 2>&1 | tail -n 4 | diff $COMPAREFILE - && msgpass || msgfail
 rm $COMPAREFILE
 
-sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d'
+sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -e "s#:$(getarchitecture 'native') #:native #"
 testfileequal "rootdir/var/log/apt/history.log" "
-Install: old-pkg:i386 (1.0)
+Install: old-pkg:native (1.0)
 
-Install: new-pkg:i386 (2.0, automatic)
-Upgrade: old-pkg:i386 (1.0, 2.0)
+Install: new-pkg:native (2.0, automatic)
+Upgrade: old-pkg:native (1.0, 2.0)
 Disappeared: old-pkg (1.0)"
 
 testmarkedauto  # new-pkg should have get the manual flag from old-pkg

+ 4 - 4
test/integration/test-ubuntu-bug-761175-remove-purge

@@ -4,14 +4,14 @@ set -e
 TESTDIR=$(readlink -f $(dirname $0))
 . $TESTDIR/framework
 setupenvironment
-configarchitecture 'i386'
+configarchitecture 'native'
 
-setupsimplenativepackage 'compiz-core' 'i386' '1.0' 'unstable'
+setupsimplenativepackage 'compiz-core' 'native' '1.0' 'unstable'
 BUILDDIR='incoming/compiz-core-1.0'
 mkdir -p ${BUILDDIR}/debian/compiz-core/etc
 echo 'foo=bar;' > ${BUILDDIR}/compiz.conf
 echo 'compiz.conf	/etc/compiz.conf' >> ${BUILDDIR}/debian/install
-buildpackage "$BUILDDIR" 'unstable' 'main'
+buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
 rm -rf "$BUILDDIR"
 
 setupaptarchive
@@ -27,7 +27,7 @@ aptget remove compiz-core -y -qq 2>&1 >/dev/null && msgpass || msgfail
 testdpkgnotinstalled compiz-core
 
 msgtest 'Check that conffiles are still around for' 'compiz-core'
-dpkg -l compiz-core | grep '^rc' 2>&1 >/dev/null && msgpass || msgfail
+dpkg -l compiz-core | grep -q '^rc' && msgpass || msgfail
 
 testequal 'Reading package lists...
 Building dependency tree...