]> git.saurik.com Git - apt.git/commitdiff
improve tests
authorMichael Vogt <mvo@debian.org>
Sat, 4 Jan 2014 14:39:04 +0000 (15:39 +0100)
committerMichael Vogt <mvo@debian.org>
Sat, 4 Jan 2014 14:39:04 +0000 (15:39 +0100)
apt-pkg/sourcelist.cc
test/integration/framework
test/integration/test-apt-sources-deb822

index 99cdbe03080b6bdd95bf2a284e8ac78e98add3f0..35e13b6f5ec9c05b385e6863ccd5bd12fd62a61b 100644 (file)
@@ -342,7 +342,8 @@ bool pkgSourceList::ParseFileDeb822(string File)
 
       // check if there are any options we support
       const char* option_str[] = { 
 
       // check if there are any options we support
       const char* option_str[] = { 
-         "arch", "arch+", "arch-", "trusted" };
+         "arch", "arch+", "arch-", "trusted",
+      };
       for (unsigned int j=0; j < sizeof(option_str)/sizeof(char*); j++)
          if (Tags.Exists(option_str[j]))
             Options[option_str[j]] = Tags.FindS(option_str[j]);
       for (unsigned int j=0; j < sizeof(option_str)/sizeof(char*); j++)
          if (Tags.Exists(option_str[j]))
             Options[option_str[j]] = Tags.FindS(option_str[j]);
index a2836376876b6925fd7ea56ec734b4112ba6c7cc..6ada1e9cc1ee679b9b764544aa1c4b35787b1dbf 100644 (file)
@@ -948,13 +948,22 @@ testempty() {
        test -z "$($* 2>&1)" && msgpass || msgfail
 }
 
        test -z "$($* 2>&1)" && msgpass || msgfail
 }
 
-testequal() {
+testequalwithmsg() {
+        local MSG="$1"
+        shift
        local COMPAREFILE=$(mktemp)
        addtrap "rm $COMPAREFILE;"
        echo "$1" > $COMPAREFILE
        shift
        local COMPAREFILE=$(mktemp)
        addtrap "rm $COMPAREFILE;"
        echo "$1" > $COMPAREFILE
        shift
-       msgtest "Test for equality of" "$*"
+       msgtest "$MSG"
        $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
        $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
+}        
+
+testequal() { 
+       local EXPECTED="$1"
+       shift
+       local MSG="Test for equality of $*"
+       testequalwithmsg "$MSG" "$EXPECTED" $*
 }
 
 testequalor2() {
 }
 
 testequalor2() {
index 6e9700bb0358814993f00c7b89bc9f899f80f68c..24fb1bdb06726f473afbb38d3de87091f070c7ae 100755 (executable)
@@ -7,7 +7,17 @@ TESTDIR=$(readlink -f $(dirname $0))
 setupenvironment
 configarchitecture "i386"
 
 setupenvironment
 configarchitecture "i386"
 
-BASE="Type: deb
+echo "deb http://ftp.debian.org/debian stable main" > rootdir/etc/apt/sources.list
+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
+# that contains a : as well
+#Type: meep
+
+Type: deb
 URL: http://ftp.debian.org/debian
 Dist: stable
 Section: main
 URL: http://ftp.debian.org/debian
 Dist: stable
 Section: main
@@ -17,7 +27,7 @@ Comment: Some random string
 # simple case
 echo "$BASE" > rootdir/etc/apt/sources.list
 
 # simple case
 echo "$BASE" > rootdir/etc/apt/sources.list
 
-testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+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 :
 '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/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 
 
@@ -25,7 +35,7 @@ testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.
 # two sections (we support both "," and " " as seperator)
 echo "$BASE" | sed s/main/"main,contrib"/ > rootdir/etc/apt/sources.list
 
 # two sections (we support both "," and " " as seperator)
 echo "$BASE" | sed s/main/"main,contrib"/ > rootdir/etc/apt/sources.list
 
-testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+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 :
 '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 :
@@ -37,7 +47,7 @@ echo "$BASE" > rootdir/etc/apt/sources.list
 echo "" >> rootdir/etc/apt/sources.list
 echo "$BASE" | sed  s/stable/unstable/ >> rootdir/etc/apt/sources.list
 
 echo "" >> rootdir/etc/apt/sources.list
 echo "$BASE" | sed  s/stable/unstable/ >> rootdir/etc/apt/sources.list
 
-testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+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 :
 '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/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 :
@@ -49,7 +59,8 @@ testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.
 echo "$BASE" > rootdir/etc/apt/sources.list
 echo "Arch: amd64,armel" >> rootdir/etc/apt/sources.list
 
 echo "$BASE" > rootdir/etc/apt/sources.list
 echo "Arch: amd64,armel" >> rootdir/etc/apt/sources.list
 
-testequal "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 :
+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 :
 '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
+