]> git.saurik.com Git - apt.git/commitdiff
rework some testcases to not spit out text
authorDavid Kalnischkies <david@kalnischkies.de>
Wed, 15 Jan 2014 17:44:47 +0000 (18:44 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Wed, 15 Jan 2014 21:58:50 +0000 (22:58 +0100)
Rework also uncovers two FIXMEs

Git-Dch: Ignore

test/integration/framework
test/integration/test-apt-progress-fd-conffile
test/integration/test-apt-sources-deb822
test/integration/test-bug-728500-tempdir

index 6ada1e9cc1ee679b9b764544aa1c4b35787b1dbf..2fe059280f3b0baf4ef7948364ddb5ae3bfad25d 100644 (file)
@@ -948,22 +948,22 @@ testempty() {
        test -z "$($* 2>&1)" && msgpass || msgfail
 }
 
        test -z "$($* 2>&1)" && msgpass || msgfail
 }
 
-testequalwithmsg() {
-        local MSG="$1"
-        shift
+testequal() {
+       local MSG='Test of equality of'
+       if [ "$1" = '--nomsg' ]; then
+               MSG=''
+               shift
+       fi
+
        local COMPAREFILE=$(mktemp)
        addtrap "rm $COMPAREFILE;"
        echo "$1" > $COMPAREFILE
        shift
        local COMPAREFILE=$(mktemp)
        addtrap "rm $COMPAREFILE;"
        echo "$1" > $COMPAREFILE
        shift
-       msgtest "$MSG"
-       $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
-}        
 
 
-testequal() { 
-       local EXPECTED="$1"
-       shift
-       local MSG="Test for equality of $*"
-       testequalwithmsg "$MSG" "$EXPECTED" $*
+       if [ -n "$MSG" ]; then
+               msgtest "$MSG" "$*"
+       fi
+       $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
 }
 
 testequalor2() {
 }
 
 testequalor2() {
index 0b42b1b2fc4016792735c0cfd2427556e9785199..085d5e87173b23837f66ce94bd062ba84b4e25ba 100755 (executable)
@@ -32,12 +32,19 @@ testsuccess aptget install compiz-core=1.0
 # fake conffile change
 echo "meep" >> rootdir/etc/compiz.conf/compiz.conf
 
 # fake conffile change
 echo "meep" >> rootdir/etc/compiz.conf/compiz.conf
 
-# install
+# FIXME: Is there really no way to see if dpkg actually prompts?
+msgtest 'Test for successful execution of' 'apt-get install compiz-core=2.0'
+OUTPUT=$(mktemp)
+addtrap "rm $OUTPUT;"
 exec 3> apt-progress.log
 exec 3> apt-progress.log
-echo n | aptget install compiz-core=2.0  -o APT::Status-Fd=3 -o Dpkg::Use-Pty=false
+if aptget install compiz-core=2.0 -o APT::Status-Fd=3 -o Dpkg::Use-Pty=false -o dpkg::options::='--force-confold' >${OUTPUT} 2>&1; then
+       msgpass
+else
+       echo
+       cat $OUTPUT
+       msgfail
+fi
 
 # and ensure there is a conffile message in the file
 
 # and ensure there is a conffile message in the file
-msgtest "Conffile prompt in apt-progress.log"
+msgtest 'Test status fd for an included' 'pmconffile msg'
 grep -q "pmconffile:/etc/compiz.conf/compiz.conf" apt-progress.log && msgpass || (cat apt-progress.log && msgfail)
 grep -q "pmconffile:/etc/compiz.conf/compiz.conf" apt-progress.log && msgpass || (cat apt-progress.log && msgfail)
-
-cat apt-progress.log
\ No newline at end of file
index bacad1ed479c155d05545d4a5221e0d9082f439d..8c022767fbd6ae0957d8d5c89843d4e3e29e0c12 100755 (executable)
@@ -5,17 +5,10 @@ TESTDIR=$(readlink -f $(dirname $0))
 . $TESTDIR/framework
 
 setupenvironment
 . $TESTDIR/framework
 
 setupenvironment
-configarchitecture "i386"
+configarchitecture 'i386'
 
 
-SOURCES="rootdir/etc/apt/sources.list"
-
-echo "deb http://ftp.debian.org/debian stable main" > $SOURCES
-testequalwithmsg "Old style sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
-'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
-'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 "  aptget update --print-uris 
-
-
-BASE="# some comment
+SOURCES='rootdir/etc/apt/sources.list'
+BASE='# some comment
 # that contains a : as well
 #Type: meep
 
 # that contains a : as well
 #Type: meep
 
@@ -24,57 +17,72 @@ URL: http://ftp.debian.org/debian
 Dist: stable
 Section: main
 Comment: Some random string
 Dist: stable
 Section: main
 Comment: Some random string
- that can be very long"
+ that can be very long'
 
 
-# simple case
-echo "$BASE"  > $SOURCES
 
 
-testequalwithmsg "Simple deb822 sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+msgtest 'Test old-style sources.list'
+echo "deb http://ftp.debian.org/debian stable main" > $SOURCES
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
-'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 "  aptget update --print-uris 
+'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 "  aptget update --print-uris
 
 
 
 
-# two sections (we support both "," and " " as seperator)
-echo "$BASE" | sed s/main/"main,contrib"/ > $SOURCES
+msgtest 'Test simple deb822 sources.list'
+echo "$BASE"  > $SOURCES
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 "  aptget update --print-uris
 
 
-testequalwithmsg "Two sections deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+
+msgtest 'Test deb822 with two sections' 'seperated by comma'
+echo "$BASE" | sed 's/main/main,contrib/' > $SOURCES
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
 'http://ftp.debian.org/debian/dists/stable/contrib/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_contrib_binary-i386_Packages 0 :
 'http://ftp.debian.org/debian/dists/stable/contrib/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_contrib_i18n_Translation-en 0 :
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
 'http://ftp.debian.org/debian/dists/stable/contrib/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_contrib_binary-i386_Packages 0 :
 'http://ftp.debian.org/debian/dists/stable/contrib/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_contrib_i18n_Translation-en 0 :
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
-'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 "  aptget update --print-uris 
+'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 "  aptget update --print-uris
+
 
 
+# FIXME: Advertised, but not supported at the moment
+#msgtest 'Test deb822 with two sections' 'seperated by space'
+#echo "$BASE" | sed 's/main/main contrib/' > $SOURCES
+#testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+#'http://ftp.debian.org/debian/dists/stable/contrib/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_contrib_binary-i386_Packages 0 :
+#'http://ftp.debian.org/debian/dists/stable/contrib/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_contrib_i18n_Translation-en 0 :
+#'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
+#'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 "  aptget update --print-uris
 
 
-# Two entries
+
+msgtest 'Test deb822 with' 'two entries'
 echo "$BASE" > $SOURCES
 echo "" >> $SOURCES
 echo "$BASE" | sed  s/stable/unstable/  >> $SOURCES
 echo "$BASE" > $SOURCES
 echo "" >> $SOURCES
 echo "$BASE" | sed  s/stable/unstable/  >> $SOURCES
-
-testequalwithmsg "Multiple entries in deb822 sources.list work" "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
 'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 :
 'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 :
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
 'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 :
 'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 :
-'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 "  aptget update --print-uris 
+'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 "  aptget update --print-uris
 
 
 
 
-# ARCH option
+msgtest 'Test deb822' 'architecture option'
 echo "$BASE" > $SOURCES
 echo "Arch: amd64,armel" >> $SOURCES
 echo "$BASE" > $SOURCES
 echo "Arch: amd64,armel" >> $SOURCES
-
-testequalwithmsg "Arch: option in deb822 sources.list works" "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 :
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 :
 'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 :
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 "  aptget update --print-uris
 
 'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 :
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 "  aptget update --print-uris
 
-# invalid sources.list file
-echo "deb http://ftp.debian.org" > $SOURCES
 
 
-testequalwithmsg "Invalid sources.list file gives proper error" "E: Malformed line 1 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (dist)
+msgtest 'Test old-style sources.list file which has' 'malformed dist'
+echo "deb http://ftp.debian.org" > $SOURCES
+testequal --nomsg "E: Malformed line 1 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (dist)
 E: The list of sources could not be read."  aptget update --print-uris
 
 E: The list of sources could not be read."  aptget update --print-uris
 
+
+msgtest 'Test deb822 sources.list file which has' 'malformed URI'
 echo "Type: deb
 Dist: stable
 " > $SOURCES
 echo "Type: deb
 Dist: stable
 " > $SOURCES
-
-testequalwithmsg "Invalid deb822 sources.list file gives proper error" "E: Malformed stanza 0 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (URI parse)
+testequal --nomsg  "E: Malformed stanza 0 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (URI parse)
 E: The list of sources could not be read."  aptget update --print-uris
 E: The list of sources could not be read."  aptget update --print-uris
index 0606538a1d011512bdbb2c26c7b16889a5398a09..0451fc1ed97ca3e0d11fbef4800b38caa85e1c6a 100755 (executable)
@@ -7,12 +7,23 @@ TESTDIR=$(readlink -f $(dirname $0))
 setupenvironment
 configarchitecture 'i386'
 
 setupenvironment
 configarchitecture 'i386'
 
-buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable'
+insertpackage 'unstable' 'coolstuff' 'all' '1.0'
 
 setupaptarchive
 changetowebserver
 
 
 setupaptarchive
 changetowebserver
 
-msgtest 'Test with incorect TMPDIR'
+msgtest 'Test apt-get update with incorrect' 'TMPDIR'
+
+OUTPUT=$(mktemp)
+addtrap "rm $OUTPUT;"
 export TMPDIR=/does-not-exists
 export TMPDIR=/does-not-exists
-aptget update && msgpass || msgfail
-unset TMPDIR
\ No newline at end of file
+if aptget update >${OUTPUT} 2>&1; then
+       msgpass
+else
+       echo
+       cat $OUTPUT
+       msgfail
+fi
+unset TMPDIR
+
+testequal 'coolstuff' aptcache pkgnames