From 6e7d39d0f52c02c1da991554bc8f44301369fced Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 15 Aug 2011 18:23:54 +0200 Subject: support yet another webserver in the integration tests: gatling --- test/integration/framework | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/integration/framework') diff --git a/test/integration/framework b/test/integration/framework index fa451cf4f..ccab010e6 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -612,6 +612,11 @@ changetowebserver() { if which weborf > /dev/null; then weborf -xb aptarchive/ 2>&1 > /dev/null & addtrap "kill $!;" + elif which gatling > /dev/null; then + cd aptarchive + gatling -p 8080 -F -S 2>&1 > /dev/null & + addtrap "kill $!;" + cd - > /dev/null elif which lighttpd > /dev/null; then echo "server.document-root = \"$(readlink -f ./aptarchive)\" server.port = 8080 -- cgit v1.2.3 From 682a3bf727cd79a66eeb335c4c6593472ce11907 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 17 Aug 2011 14:37:25 +0200 Subject: do not output color in the testcases if stdout/stderr are not a /dev/pts --- test/integration/framework | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'test/integration/framework') diff --git a/test/integration/framework b/test/integration/framework index ccab010e6..45c1f156a 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1,16 +1,19 @@ #!/bin/sh -- # no runable script, just for vi # we all like colorful messages -CERROR="" # red -CWARNING="" # yellow -CMSG="" # green -CINFO="" # light blue -CDEBUG="" # blue -CNORMAL="" # default system console color -CDONE="" # green -CPASS="" # green -CFAIL="" # red -CCMD="" # pink +if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null && \ + expr match "$(readlink -f /proc/$$/fd/2)" '/dev/pts/[0-9]\+' > /dev/null; then + CERROR="" # red + CWARNING="" # yellow + CMSG="" # green + CINFO="" # light blue + CDEBUG="" # blue + CNORMAL="" # default system console color + CDONE="" # green + CPASS="" # green + CFAIL="" # red + CCMD="" # pink +fi msgdie() { echo "${CERROR}E: $1${CNORMAL}" >&2; exit 1; } msgwarn() { echo "${CWARNING}W: $1${CNORMAL}" >&2; } @@ -42,7 +45,11 @@ if [ $MSGLEVEL -le 2 ]; then msgtest() { true; } msgpass() { echo -n " ${CPASS}P${CNORMAL}" >&2; } msgskip() { echo -n " ${CWARNING}S${CNORMAL}" >&2; } - msgfail() { echo -n " ${CFAIL}FAIL${CNORMAL}" >&2; } + if [ -n "$CFAIL" ]; then + msgfail() { echo -n " ${CFAIL}FAIL${CNORMAL}" >&2; } + else + msgfail() { echo -n " ###FAILED###" >&2; } + fi fi if [ $MSGLEVEL -le 3 ]; then msginfo() { true; } -- cgit v1.2.3 From 884a4c0a3a6cba654e77478a086f26539bc5bd32 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 5 Sep 2011 14:50:30 +0200 Subject: * apt-pkg/indexrecords.cc: - fix Acquire::Max-ValidTime option by interpreting it really as seconds as specified in the manpage and not as days --- test/integration/framework | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'test/integration/framework') diff --git a/test/integration/framework b/test/integration/framework index 45c1f156a..322cf2875 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -515,8 +515,9 @@ getcodenamefromsuite() { echo -n "$1"; } getreleaseversionfromsuite() { true; } generatereleasefiles() { + # $1 is the Date header and $2 is the ValidUntil header to be set + # both should be given in notation date/touch can understand msgninfo "\tGenerate Release files… " - local DATE="${1:-now}" if [ -e aptarchive/dists ]; then for dir in $(find ./aptarchive/dists -mindepth 3 -maxdepth 3 -type d -name 'i18n'); do aptftparchive -qq release $dir -o APT::FTPArchive::Release::Patterns::='Translation-*' > $dir/Index @@ -525,27 +526,31 @@ generatereleasefiles() { local SUITE="$(echo "$dir" | cut -d'/' -f 4)" local CODENAME="$(getcodenamefromsuite $SUITE)" local VERSION="$(getreleaseversionfromsuite $SUITE)" - if [ -z "$VERSION" ]; then - aptftparchive -qq release $dir \ - -o APT::FTPArchive::Release::Suite="${SUITE}" \ - -o APT::FTPArchive::Release::Codename="${CODENAME}" \ - | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference - else - aptftparchive -qq release $dir \ - -o APT::FTPArchive::Release::Suite="${SUITE}" \ - -o APT::FTPArchive::Release::Codename="${CODENAME}" \ - -o APT::FTPArchive::Release::Version="${VERSION}" \ - | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference + if [ -n "$VERSION" ]; then + VERSION="-o APT::FTPArchive::Release::Version='${VERSION}'" fi + aptftparchive -qq release $dir \ + -o APT::FTPArchive::Release::Suite="${SUITE}" \ + -o APT::FTPArchive::Release::Codename="${CODENAME}" \ + -o APT::FTPArchive::Release::Label="Testcases" \ + ${VERSION} \ + | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then sed -i '/^Date: / a\ NotAutomatic: yes' $dir/Release fi + if [ -n "$1" -a "$1" != "now" ]; then + sed -i "s/^Date: .*$/Date: $(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')/" $dir/Release + fi + if [ -n "$2" ]; then + sed -i "/^Date: / a\ +Valid-Until: $(date -d "$2" '+%a, %d %b %Y %H:%M:%S %Z')" $dir/Release + fi done else aptftparchive -qq release ./aptarchive | sed -e '/0 Release$/ d' > aptarchive/Release # remove the self reference fi - if [ "$DATE" != "now" ]; then + if [ -n "$1" -a "$1" != "now" ]; then for release in $(find ./aptarchive -name 'Release'); do touch -d "$1" $release done -- cgit v1.2.3 From 718f797cef0fb766b6f7cfa1d34b617ad047dbc5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 9 Sep 2011 10:56:42 +0200 Subject: fix bashism (local outside function) and releasefile creation in testcases --- test/integration/framework | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test/integration/framework') diff --git a/test/integration/framework b/test/integration/framework index 322cf2875..a2e71760e 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -513,6 +513,7 @@ buildaptarchivefromfiles() { # can be overridden by testcases for their pleasure getcodenamefromsuite() { echo -n "$1"; } getreleaseversionfromsuite() { true; } +getlabelfromsuite() { true; } generatereleasefiles() { # $1 is the Date header and $2 is the ValidUntil header to be set @@ -526,13 +527,17 @@ generatereleasefiles() { local SUITE="$(echo "$dir" | cut -d'/' -f 4)" local CODENAME="$(getcodenamefromsuite $SUITE)" local VERSION="$(getreleaseversionfromsuite $SUITE)" + local LABEL="$(getlabelfromsuite $SUITE)" if [ -n "$VERSION" ]; then - VERSION="-o APT::FTPArchive::Release::Version='${VERSION}'" + VERSION="-o APT::FTPArchive::Release::Version=${VERSION}" + fi + if [ -n "$LABEL" ]; then + LABEL="-o APT::FTPArchive::Release::Label=${LABEL}" fi aptftparchive -qq release $dir \ -o APT::FTPArchive::Release::Suite="${SUITE}" \ -o APT::FTPArchive::Release::Codename="${CODENAME}" \ - -o APT::FTPArchive::Release::Label="Testcases" \ + ${LABEL} \ ${VERSION} \ | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then -- cgit v1.2.3 From ea65d079e19231eee2b9a167384fac33c1534290 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 11 Oct 2011 14:37:03 +0200 Subject: run integration tests on my new amd64 box without failures --- test/integration/framework | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'test/integration/framework') diff --git a/test/integration/framework b/test/integration/framework index a2e71760e..b55f793a4 100644 --- a/test/integration/framework +++ b/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 } -- cgit v1.2.3