]> git.saurik.com Git - apt.git/commitdiff
various changes to increase test-coverage
authorDavid Kalnischkies <david@kalnischkies.de>
Sat, 12 Sep 2015 08:35:49 +0000 (10:35 +0200)
committerDavid Kalnischkies <david@kalnischkies.de>
Mon, 14 Sep 2015 13:22:19 +0000 (15:22 +0200)
And of course, testing obscure things ends up showing obscure 'bugs' or
better shortcomings/inconsitencies, so lets fix them with the tests.

Git-Dch: Ignore

12 files changed:
cmdline/apt-cache.cc
cmdline/apt-dump-solver.cc
cmdline/apt-helper.cc
cmdline/apt-sortpkgs.cc
test/integration/framework
test/integration/test-apt-cache
test/integration/test-apt-get-build-dep
test/integration/test-apt-get-clean
test/integration/test-apt-helper
test/integration/test-apt-sources-deb822
test/integration/test-external-dependency-solver-protocol
test/integration/test-pdiff-usage

index 1493b63dca318e55dbf8707c87d8d13e557463c4..2db25135070f6a36d393c2fde92f850aaec05d27 100644 (file)
@@ -312,13 +312,14 @@ static void ShowHashTableStats(std::string Type,
 /* */
 static bool Stats(CommandLine &CmdL)
 {
 /* */
 static bool Stats(CommandLine &CmdL)
 {
-   pkgCacheFile CacheFile;
-   pkgCache *Cache = CacheFile.GetPkgCache();
-
    if (CmdL.FileSize() > 1) {
       _error->Error(_("apt-cache stats does not take any arguments"));
       return false;
    }
    if (CmdL.FileSize() > 1) {
       _error->Error(_("apt-cache stats does not take any arguments"));
       return false;
    }
+
+   pkgCacheFile CacheFile;
+   pkgCache *Cache = CacheFile.GetPkgCache();
+
    if (unlikely(Cache == NULL))
       return false;
 
    if (unlikely(Cache == NULL))
       return false;
 
index 2e352931fd0c47eef8b46a89caa23904da04f7e6..47b515be5cb70abbd6c8ad63e7495bb8c1e94211 100644 (file)
@@ -53,7 +53,8 @@ int main(int argc,const char *argv[])                                 /*{{{*/
           return 0;
        }
 
           return 0;
        }
 
-       unlink(filename);
+       if (strcmp(filename, "/dev/null") != 0)
+          unlink(filename);
        FileFd input, output;
        if (input.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly) == false ||
              output.Open(filename, FileFd::WriteOnly | FileFd::Create | FileFd::Exclusive, 0600) == false ||
        FileFd input, output;
        if (input.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly) == false ||
              output.Open(filename, FileFd::WriteOnly | FileFd::Create | FileFd::Exclusive, 0600) == false ||
index 2d24a8aee8b351cad0cf6317e76b556b05268a13..dc4efb32b1ea7d5f1157de695e8cbc058487287c 100644 (file)
@@ -81,7 +81,7 @@ static bool DoDownloadFile(CommandLine &CmdL)
 
 static bool DoSrvLookup(CommandLine &CmdL)
 {
 
 static bool DoSrvLookup(CommandLine &CmdL)
 {
-   if (CmdL.FileSize() < 1)
+   if (CmdL.FileSize() <= 1)
       return _error->Error("Must specify at least one SRV record");
 
    for(size_t i = 1; CmdL.FileList[i] != NULL; ++i)
       return _error->Error("Must specify at least one SRV record");
 
    for(size_t i = 1; CmdL.FileList[i] != NULL; ++i)
@@ -95,10 +95,10 @@ static bool DoSrvLookup(CommandLine &CmdL)
         std::string const host = name.substr(0, found);
         size_t const port = atoi(name.c_str() + found + 1);
         if(GetSrvRecords(host, port, srv_records) == false)
         std::string const host = name.substr(0, found);
         size_t const port = atoi(name.c_str() + found + 1);
         if(GetSrvRecords(host, port, srv_records) == false)
-           _error->Warning(_("GetSrvRec failed for %s"), name.c_str());
+           _error->Error(_("GetSrvRec failed for %s"), name.c_str());
       }
       else if(GetSrvRecords(name, srv_records) == false)
       }
       else if(GetSrvRecords(name, srv_records) == false)
-        _error->Warning(_("GetSrvRec failed for %s"), name.c_str());
+        _error->Error(_("GetSrvRec failed for %s"), name.c_str());
 
       for (SrvRec const &I : srv_records)
         c1out << I.target << "\t" << I.priority << "\t" << I.weight << "\t" << I.port << std::endl;
 
       for (SrvRec const &I : srv_records)
         c1out << I.target << "\t" << I.priority << "\t" << I.weight << "\t" << I.port << std::endl;
index 12ef8dda091c38a710537137242455fe5402b668..cde3069bd20550574c0ea667b7230a63f0b388fb 100644 (file)
@@ -30,6 +30,7 @@
 #include <stdio.h>
 #include <iostream>
 #include <string>
 #include <stdio.h>
 #include <iostream>
 #include <string>
+#include <memory>
 
 #include <apti18n.h>
                                                                        /*}}}*/
 
 #include <apti18n.h>
                                                                        /*}}}*/
@@ -112,32 +113,21 @@ static bool DoIt(string InFile)
    // Emit
    FileFd stdoutfd;
    stdoutfd.OpenDescriptor(STDOUT_FILENO, FileFd::WriteOnly, false);
    // Emit
    FileFd stdoutfd;
    stdoutfd.OpenDescriptor(STDOUT_FILENO, FileFd::WriteOnly, false);
-   unsigned char *Buffer = new unsigned char[Largest+1];
+   auto const Buffer = std::unique_ptr<unsigned char[]>(new unsigned char[Largest+1]);
    for (vector<PkgName>::iterator I = List.begin(); I != List.end(); ++I)
    {
       // Read in the Record.
    for (vector<PkgName>::iterator I = List.begin(); I != List.end(); ++I)
    {
       // Read in the Record.
-      if (Fd.Seek(I->Offset) == false || Fd.Read(Buffer,I->Length) == false)
-      {
-        delete [] Buffer;
+      if (Fd.Seek(I->Offset) == false || Fd.Read(Buffer.get(),I->Length) == false)
         return false;
         return false;
-      }
 
       Buffer[I->Length] = '\n';
 
       Buffer[I->Length] = '\n';
-      if (Section.Scan((char *)Buffer,I->Length+1) == false)
-      {
-        delete [] Buffer;
+      if (Section.Scan((char *)Buffer.get(),I->Length+1) == false)
         return _error->Error("Internal error, failed to scan buffer");
         return _error->Error("Internal error, failed to scan buffer");
-      }
 
       // Sort the section
       if (Section.Write(stdoutfd, Order) == false || stdoutfd.Write("\n", 1) == false)
 
       // Sort the section
       if (Section.Write(stdoutfd, Order) == false || stdoutfd.Write("\n", 1) == false)
-      {
-        delete [] Buffer;
         return _error->Error("Internal error, failed to sort fields");
         return _error->Error("Internal error, failed to sort fields");
-      }
    }
    }
-
-   delete [] Buffer;
    return true;
 }
                                                                        /*}}}*/
    return true;
 }
                                                                        /*}}}*/
index 3bf6012bad70f211548b642d2e1e798eb0e963ce..322c74a211923c374a4d9a52dc0b56e91994bb41 100644 (file)
@@ -1592,29 +1592,30 @@ testfailure() {
        msggroup
 }
 
        msggroup
 }
 
-testsuccessequal() {
-       msggroup 'testsuccessequal'
-       local CMP="$1"
-       shift
-       testsuccess "$@"
-       testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$CMP"
+testreturnstateequal() {
+       local STATE="$1"
+       msggroup "${STATE}equal"
+       if [ "$2" != '--nomsg' ]; then
+               local CMP="$2"
+               shift 2
+               "$STATE" "$@"
+               testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP"
+       else
+               local CMP="$3"
+               shift 3
+               "$STATE" --nomsg "$@"
+               testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP"
+       fi
        msggroup
 }
        msggroup
 }
+testsuccessequal() {
+       testreturnstateequal 'testsuccess' "$@"
+}
 testwarningequal() {
 testwarningequal() {
-       msggroup 'testwarningequal'
-       local CMP="$1"
-       shift
-       testwarning "$@"
-       testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" "$CMP"
-       msggroup
+       testreturnstateequal 'testwarning' "$@"
 }
 testfailureequal() {
 }
 testfailureequal() {
-       msggroup 'testfailureequal'
-       local CMP="$1"
-       shift
-       testfailure "$@"
-       testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" "$CMP"
-       msggroup
+       testreturnstateequal 'testfailure' "$@"
 }
 
 testfailuremsg() {
 }
 
 testfailuremsg() {
index 7927686fcdd3bf78fa1d3277be9ad92aedab3697..c254aa602dc6c20e2a01aac1cd18763af067129d 100755 (executable)
@@ -34,6 +34,7 @@ testempty aptcache unmet dpkg
 testsuccess aptcache stats
 cp rootdir/tmp/testsuccess.output stats.output
 testsuccess test -s stats.output
 testsuccess aptcache stats
 cp rootdir/tmp/testsuccess.output stats.output
 testsuccess test -s stats.output
+testfailureequal 'E: apt-cache stats does not take any arguments' aptcache stats foo
 testsuccess aptcache xvcg foo
 cp rootdir/tmp/testsuccess.output xvcg.output
 testsuccess test -s xvcg.output
 testsuccess aptcache xvcg foo
 cp rootdir/tmp/testsuccess.output xvcg.output
 testsuccess test -s xvcg.output
index f7af5b782c78fda6dd775f72a1dbf1ed6871d203..6df49d7825fb46f3ea1bfeb4ec43f7bc8923f394 100755 (executable)
@@ -5,12 +5,15 @@ TESTDIR=$(readlink -f $(dirname $0))
 . $TESTDIR/framework
 
 setupenvironment
 . $TESTDIR/framework
 
 setupenvironment
-configarchitecture "i386"
+configarchitecture 'i386'
 
 
-buildsimplenativepackage 'debhelper' 'i386' '7' 'stable'
-buildsimplenativepackage 'build-essential' 'i386' '1' 'stable'
+insertpackage 'stable' 'debhelper' 'i386' '7'
+insertpackage 'stable' 'build-essential' 'i386' '1'
+insertinstalledpackage 'build-conflict' 'i386' '1'
 
 setupaptarchive
 
 setupaptarchive
+
+msgmsg 'Test with' 'unsigned dsc'
 cat > 2vcard_0.5-3.dsc <<EOF
 Format: 1.0
 Source: 2vcard
 cat > 2vcard_0.5-3.dsc <<EOF
 Format: 1.0
 Source: 2vcard
@@ -21,6 +24,7 @@ Maintainer: Martin Albisetti <argentina@gmail.com>
 Uploaders: Marcela Tiznado <mlt@debian.org>
 Standards-Version: 3.8.0
 Build-Depends: debhelper (>= 5.0.37)
 Uploaders: Marcela Tiznado <mlt@debian.org>
 Standards-Version: 3.8.0
 Build-Depends: debhelper (>= 5.0.37)
+Build-Conflicts: build-conflict (<< 2)
 Checksums-Sha1: 
  b7f1ce31ec856414a3f0f1090689f91aa7456d56 9398 2vcard_0.5.orig.tar.gz
  5f9acd07ebda6ab00fa6b4fe3198c13e94090862 2036 2vcard_0.5-3.diff.gz
 Checksums-Sha1: 
  b7f1ce31ec856414a3f0f1090689f91aa7456d56 9398 2vcard_0.5.orig.tar.gz
  5f9acd07ebda6ab00fa6b4fe3198c13e94090862 2036 2vcard_0.5-3.diff.gz
@@ -32,17 +36,24 @@ Files:
  1e806d32233af87437258d86b1561f57 2036 2vcard_0.5-3.diff.gz
 EOF
 
  1e806d32233af87437258d86b1561f57 2036 2vcard_0.5-3.diff.gz
 EOF
 
-testsuccessequal "Reading package lists...
+test2vcardbuilddep() {
+       testsuccessequal "Reading package lists...
 Building dependency tree...
 Note, using file '2vcard_0.5-3.dsc' to get the build dependencies
 Building dependency tree...
 Note, using file '2vcard_0.5-3.dsc' to get the build dependencies
+The following packages will be REMOVED:
+  build-conflict
 The following NEW packages will be installed:
   build-essential debhelper
 The following NEW packages will be installed:
   build-essential debhelper
-0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded.
+Remv build-conflict [1]
 Inst build-essential (1 stable [i386])
 Inst debhelper (7 stable [i386])
 Conf build-essential (1 stable [i386])
 Conf debhelper (7 stable [i386])" aptget build-dep -s 2vcard_0.5-3.dsc
 Inst build-essential (1 stable [i386])
 Inst debhelper (7 stable [i386])
 Conf build-essential (1 stable [i386])
 Conf debhelper (7 stable [i386])" aptget build-dep -s 2vcard_0.5-3.dsc
+}
+test2vcardbuilddep
 
 
+msgmsg 'Test with' 'signed dsc'
 cat > 2vcard_0.5-3.dsc <<EOF
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 cat > 2vcard_0.5-3.dsc <<EOF
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
@@ -56,6 +67,7 @@ Maintainer: Martin Albisetti <argentina@gmail.com>
 Uploaders: Marcela Tiznado <mlt@debian.org>
 Standards-Version: 3.8.0
 Build-Depends: debhelper (>= 5.0.37)
 Uploaders: Marcela Tiznado <mlt@debian.org>
 Standards-Version: 3.8.0
 Build-Depends: debhelper (>= 5.0.37)
+Build-Conflicts: build-conflict (<< 2)
 Checksums-Sha1: 
  b7f1ce31ec856414a3f0f1090689f91aa7456d56 9398 2vcard_0.5.orig.tar.gz
  5f9acd07ebda6ab00fa6b4fe3198c13e94090862 2036 2vcard_0.5-3.diff.gz
 Checksums-Sha1: 
  b7f1ce31ec856414a3f0f1090689f91aa7456d56 9398 2vcard_0.5.orig.tar.gz
  5f9acd07ebda6ab00fa6b4fe3198c13e94090862 2036 2vcard_0.5-3.diff.gz
@@ -74,20 +86,10 @@ z2UAn1oXgTai6opwhVfkxrlmJ+iRxzuc
 =4eRd
 -----END PGP SIGNATURE-----
 EOF
 =4eRd
 -----END PGP SIGNATURE-----
 EOF
-
-testsuccessequal "Reading package lists...
-Building dependency tree...
-Note, using file '2vcard_0.5-3.dsc' to get the build dependencies
-The following NEW packages will be installed:
-  build-essential debhelper
-0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
-Inst build-essential (1 stable [i386])
-Inst debhelper (7 stable [i386])
-Conf build-essential (1 stable [i386])
-Conf debhelper (7 stable [i386])" aptget build-dep --simulate 2vcard_0.5-3.dsc
+test2vcardbuilddep
 
 
 
 
-# unpacked source dir
+msgmsg 'Test with' 'unpacked source dir'
 mkdir -p foo-1.0/debian
 cat > foo-1.0/debian/control <<'EOF'
 Source: apturl
 mkdir -p foo-1.0/debian
 cat > foo-1.0/debian/control <<'EOF'
 Source: apturl
@@ -127,3 +129,14 @@ Inst build-essential (1 stable [i386])
 Inst debhelper (7 stable [i386])
 Conf build-essential (1 stable [i386])
 Conf debhelper (7 stable [i386])" aptget build-dep --simulate ./foo-1.0
 Inst debhelper (7 stable [i386])
 Conf build-essential (1 stable [i386])
 Conf debhelper (7 stable [i386])" aptget build-dep --simulate ./foo-1.0
+
+
+testfailureequal 'Reading package lists...
+Building dependency tree...
+E: Must specify at least one package to check builddeps for' aptget build-dep
+testfailureequal 'Reading package lists...
+Building dependency tree...
+E: No architecture information available for armel. See apt.conf(5) APT::Architectures for setup' aptget build-dep --simulate ./foo-1.0 -a armel
+testfailureequal 'Reading package lists...
+Building dependency tree...
+E: Unable to find a source package for foo' aptget build-dep --simulate foo
index 457bff9d3e68739a8556fa460346599a181e5967..31e9900c9286358c00b4250a08c958859c60cdf8 100755 (executable)
@@ -15,6 +15,7 @@ setupaptarchive
 
 # nothing to do always works
 testsuccess aptget clean
 
 # nothing to do always works
 testsuccess aptget clean
+testsuccess aptget clean -s
 
 # generate some dirt and clean it up
 touch rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
 
 # generate some dirt and clean it up
 touch rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
index d6c8385af3af758f1bc577b5d7b48f5544dd65c1..9444065801f78b6d41604f3c04d9e9ab29995091 100755 (executable)
@@ -89,3 +89,6 @@ testfailureequal 'E: Invalid operation download' apthelper download
 testfailureequal 'E: Must specify at least one pair url/filename' apthelper download-file
 testfailureequal 'E: Must specify at least one pair url/filename' apthelper download-file http://example.org/
 testfailureequal 'E: Need one URL as argument' apthelper auto-detect-proxy
 testfailureequal 'E: Must specify at least one pair url/filename' apthelper download-file
 testfailureequal 'E: Must specify at least one pair url/filename' apthelper download-file http://example.org/
 testfailureequal 'E: Need one URL as argument' apthelper auto-detect-proxy
+testfailureequal 'E: Must specify at least one SRV record' apthelper srv-lookup
+testfailureequal 'E: GetSrvRec failed for localhost' apthelper srv-lookup localhost
+testfailureequal 'E: GetSrvRec failed for localhost:8080' apthelper srv-lookup localhost:8080
index 09ff9304e1399fdf153da43ad61282299a2736d9..662a866aa70dbc0d807bd87adde5ce83f952bc66 100755 (executable)
@@ -8,6 +8,7 @@ setupenvironment
 configarchitecture 'i386'
 
 LISTS='rootdir/etc/apt/sources.list.d/test.list'
 configarchitecture 'i386'
 
 LISTS='rootdir/etc/apt/sources.list.d/test.list'
+ABSLISTS="$(readlink -f $LISTS)"
 SOURCES='rootdir/etc/apt/sources.list.d/test.sources'
 BASE='# some comment
 # that contains a : as well
 SOURCES='rootdir/etc/apt/sources.list.d/test.sources'
 BASE='# some comment
 # that contains a : as well
@@ -27,19 +28,39 @@ msgcleantest() {
 
 msgcleantest 'Test sources.list' 'old style'
 echo "deb http://ftp.debian.org/debian stable main" > $LISTS
 
 msgcleantest 'Test sources.list' 'old style'
 echo "deb http://ftp.debian.org/debian stable main" > $LISTS
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
+testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 
 msgcleantest 'Test sources.list' 'old style with tabs'
 echo "deb      http://ftp.debian.org/debian    stable main" > $LISTS
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 
 msgcleantest 'Test sources.list' 'old style with tabs'
 echo "deb      http://ftp.debian.org/debian    stable main" > $LISTS
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
+testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 
+msgcleantest 'Test sources.list' 'old style with forgotten end for options'
+echo "deb [trusted=yes arch+=armel,powerpc http://ftp.debian.org/debian stable main" > $LISTS
+testfailureequal "E: Malformed entry 1 in list file $ABSLISTS ([option] not assignment)
+E: The list of sources could not be read." aptget update --print-uris
+
+msgcleantest 'Test sources.list' 'old style with stray ] instead of options'
+echo "deb ] http://ftp.debian.org/debian stable main" > $LISTS
+testfailureequal "E: Malformed entry 1 in list file $ABSLISTS (URI parse)
+E: The list of sources could not be read." aptget update --print-uris
+
+msgcleantest 'Test sources.list' 'old style options no key'
+echo "deb [=test] http://ftp.debian.org/debian stable main" > $LISTS
+testfailureequal "E: Malformed entry 1 in list file $ABSLISTS ([option] no key)
+E: The list of sources could not be read." aptget update --print-uris
+
+msgcleantest 'Test sources.list' 'old style options no value'
+echo "deb [test=] http://ftp.debian.org/debian stable main" > $LISTS
+testfailureequal "E: Malformed entry 1 in list file $ABSLISTS ([option] no value)
+E: The list of sources could not be read." aptget update --print-uris
+
 msgcleantest 'Test sources.list' 'old style with options'
 echo "deb [trusted=yes arch+=armel,powerpc] http://ftp.debian.org/debian stable main" > $LISTS
 msgcleantest 'Test sources.list' 'old style with options'
 echo "deb [trusted=yes arch+=armel,powerpc] http://ftp.debian.org/debian stable main" > $LISTS
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
+testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-powerpc/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-powerpc_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-powerpc/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-powerpc_Packages 0 
@@ -47,19 +68,19 @@ testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.deb
 
 msgcleantest 'Test sources.list' 'old style with comments'
 echo "deb http://ftp.debian.org/debian stable main # non-free" > $LISTS
 
 msgcleantest 'Test sources.list' 'old style with comments'
 echo "deb http://ftp.debian.org/debian stable main # non-free" > $LISTS
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
+testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 
 msgcleantest 'Test sources.list' 'old style with option comments'
 echo "deb [trusted=yes#yeahreally] http://ftp.debian.org/debian stable main # non-free" > $LISTS
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 
 msgcleantest 'Test sources.list' 'old style with option comments'
 echo "deb [trusted=yes#yeahreally] http://ftp.debian.org/debian stable main # non-free" > $LISTS
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
+testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 
 msgcleantest 'Test sources.list' 'simple deb822'
 echo "$BASE"  > $SOURCES
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 
 msgcleantest 'Test sources.list' 'simple deb822'
 echo "$BASE"  > $SOURCES
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
+testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 
@@ -68,7 +89,7 @@ msgcleantest '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
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
+testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 
 'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 
 'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 
@@ -78,7 +99,7 @@ testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.deb
 # two suite entries
 msgcleantest 'Test deb822 with' 'two Suite entries'
 echo "$BASE"  | sed -e "s/stable/stable unstable/" > $SOURCES
 # two suite entries
 msgcleantest 'Test deb822 with' 'two Suite entries'
 echo "$BASE"  | sed -e "s/stable/stable unstable/" > $SOURCES
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
+testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 
 'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 
 'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 
@@ -88,14 +109,14 @@ testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.deb
 msgcleantest 'Test deb822' 'architecture option'
 echo "$BASE" > $SOURCES
 echo "Architectures: amd64 armel" >> $SOURCES
 msgcleantest 'Test deb822' 'architecture option'
 echo "$BASE" > $SOURCES
 echo "Architectures: amd64 armel" >> $SOURCES
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
+testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 
 msgcleantest 'Test old-style' 'suite arch variable'
 echo 'deb http://ftp.tlh.debian.org/universe unstable/binary-$(ARCH)/' > $LISTS
 'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 
 msgcleantest 'Test old-style' 'suite arch variable'
 echo 'deb http://ftp.tlh.debian.org/universe unstable/binary-$(ARCH)/' > $LISTS
-testequal --nomsg "'http://ftp.tlh.debian.org/universe/unstable/binary-i386/InRelease' ftp.tlh.debian.org_universe_unstable_binary-i386_InRelease 0 
+testsuccessequal --nomsg "'http://ftp.tlh.debian.org/universe/unstable/binary-i386/InRelease' ftp.tlh.debian.org_universe_unstable_binary-i386_InRelease 0 
 'http://ftp.tlh.debian.org/universe/unstable/binary-i386/Packages.xz' ftp.tlh.debian.org_universe_unstable_binary-i386_Packages 0 
 'http://ftp.tlh.debian.org/universe/unstable/binary-i386/en.xz' ftp.tlh.debian.org_universe_unstable_binary-i386_en 0 " aptget update --print-uris
 
 'http://ftp.tlh.debian.org/universe/unstable/binary-i386/Packages.xz' ftp.tlh.debian.org_universe_unstable_binary-i386_Packages 0 
 'http://ftp.tlh.debian.org/universe/unstable/binary-i386/en.xz' ftp.tlh.debian.org_universe_unstable_binary-i386_en 0 " aptget update --print-uris
 
@@ -103,20 +124,20 @@ msgcleantest 'Test deb822' 'suite arch variable'
 echo 'Types: deb
 URIs: http://ftp.tlh.debian.org/universe
 Suites: stable/binary-$(ARCH)/' > $SOURCES
 echo 'Types: deb
 URIs: http://ftp.tlh.debian.org/universe
 Suites: stable/binary-$(ARCH)/' > $SOURCES
-testequal --nomsg "'http://ftp.tlh.debian.org/universe/stable/binary-i386/InRelease' ftp.tlh.debian.org_universe_stable_binary-i386_InRelease 0 
+testsuccessequal --nomsg "'http://ftp.tlh.debian.org/universe/stable/binary-i386/InRelease' ftp.tlh.debian.org_universe_stable_binary-i386_InRelease 0 
 'http://ftp.tlh.debian.org/universe/stable/binary-i386/Packages.xz' ftp.tlh.debian.org_universe_stable_binary-i386_Packages 0 
 'http://ftp.tlh.debian.org/universe/stable/binary-i386/en.xz' ftp.tlh.debian.org_universe_stable_binary-i386_en 0 " aptget update --print-uris
 
 msgcleantest 'Test old-style sources.list file which has' 'malformed dist'
 echo "deb http://ftp.debian.org" > $LISTS
 'http://ftp.tlh.debian.org/universe/stable/binary-i386/Packages.xz' ftp.tlh.debian.org_universe_stable_binary-i386_Packages 0 
 'http://ftp.tlh.debian.org/universe/stable/binary-i386/en.xz' ftp.tlh.debian.org_universe_stable_binary-i386_en 0 " aptget update --print-uris
 
 msgcleantest 'Test old-style sources.list file which has' 'malformed dist'
 echo "deb http://ftp.debian.org" > $LISTS
-testequal --nomsg "E: Malformed entry 1 in list file $TMPWORKINGDIRECTORY/$LISTS (Suite)
+testfailureequal --nomsg "E: Malformed entry 1 in list file $TMPWORKINGDIRECTORY/$LISTS (Suite)
 E: The list of sources could not be read."  aptget update --print-uris
 
 msgcleantest 'Test deb822 sources.list file which has' 'malformed URI'
 echo "Types: deb
 Suites: stable
 " > $SOURCES
 E: The list of sources could not be read."  aptget update --print-uris
 
 msgcleantest 'Test deb822 sources.list file which has' 'malformed URI'
 echo "Types: deb
 Suites: stable
 " > $SOURCES
-testequal --nomsg  "E: Malformed entry 1 in sources file $TMPWORKINGDIRECTORY/$SOURCES (URI)
+testfailureequal --nomsg  "E: Malformed entry 1 in sources file $TMPWORKINGDIRECTORY/$SOURCES (URI)
 E: The list of sources could not be read."  aptget update --print-uris
 
 # with Enabled: false
 E: The list of sources could not be read."  aptget update --print-uris
 
 # with Enabled: false
@@ -127,7 +148,7 @@ testempty aptget update --print-uris
 # multiple URIs
 msgcleantest 'Test deb822 sources.list file which has' 'Multiple URIs work'
 echo "$BASE"  | sed -e 's#http://ftp.debian.org/debian#http://ftp.debian.org/debian http://ftp.de.debian.org/debian#' > $SOURCES
 # multiple URIs
 msgcleantest 'Test deb822 sources.list file which has' 'Multiple URIs work'
 echo "$BASE"  | sed -e 's#http://ftp.debian.org/debian#http://ftp.debian.org/debian http://ftp.de.debian.org/debian#' > $SOURCES
-testequal --nomsg  "'http://ftp.de.debian.org/debian/dists/stable/InRelease' ftp.de.debian.org_debian_dists_stable_InRelease 0 
+testsuccessequal --nomsg  "'http://ftp.de.debian.org/debian/dists/stable/InRelease' ftp.de.debian.org_debian_dists_stable_InRelease 0 
 'http://ftp.de.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.de.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.de.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.de.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.de.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.de.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.de.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.de.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 
@@ -137,7 +158,7 @@ testequal --nomsg  "'http://ftp.de.debian.org/debian/dists/stable/InRelease' ftp
 # multiple Type in one field
 msgcleantest 'Test deb822 sources.list file which has' 'Multiple Types work'
 echo "$BASE"  | sed -e 's#Types: deb#Types: deb deb-src#' > $SOURCES
 # multiple Type in one field
 msgcleantest 'Test deb822 sources.list file which has' 'Multiple Types work'
 echo "$BASE"  | sed -e 's#Types: deb#Types: deb deb-src#' > $SOURCES
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
+testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
 'http://ftp.debian.org/debian/dists/stable/main/source/Sources.xz' ftp.debian.org_debian_dists_stable_main_source_Sources 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 'http://ftp.debian.org/debian/dists/stable/main/source/Sources.xz' ftp.debian.org_debian_dists_stable_main_source_Sources 0 
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
@@ -149,6 +170,6 @@ Types: deb
 URIs: http://emacs.naquadah.org
 Suites: stable/
 EOF
 URIs: http://emacs.naquadah.org
 Suites: stable/
 EOF
-testequal --nomsg "'http://emacs.naquadah.org/stable/InRelease' emacs.naquadah.org_stable_InRelease 0 
+testsuccessequal --nomsg "'http://emacs.naquadah.org/stable/InRelease' emacs.naquadah.org_stable_InRelease 0 
 'http://emacs.naquadah.org/stable/Packages.xz' emacs.naquadah.org_stable_Packages 0 
 'http://emacs.naquadah.org/stable/en.xz' emacs.naquadah.org_stable_en 0 " aptget update --print-uris
 'http://emacs.naquadah.org/stable/Packages.xz' emacs.naquadah.org_stable_Packages 0 
 'http://emacs.naquadah.org/stable/en.xz' emacs.naquadah.org_stable_en 0 " aptget update --print-uris
index 3654e705ca51a5e3d1e71cdf3e19e782660eb99e..a9746d4a2f98467c35e79e6f86e9bb601562e963 100755 (executable)
@@ -27,6 +27,9 @@ setupaptarchive
 
 testfailure aptget install --solver dump coolstuff -s
 testsuccess grep ERR_NO_FILENAME rootdir/tmp/testfailure.output
 
 testfailure aptget install --solver dump coolstuff -s
 testsuccess grep ERR_NO_FILENAME rootdir/tmp/testfailure.output
+export APT_EDSP_DUMP_FILENAME="/nonexistent/apt/edsp.dump"
+testfailure aptget install --solver dump coolstuff -s
+testsuccess grep ERR_WRITE_ERROR rootdir/tmp/testfailure.output
 export APT_EDSP_DUMP_FILENAME="${TMPWORKINGDIRECTORY}/downloaded/dump.edsp"
 
 testfailureequal 'Reading package lists...
 export APT_EDSP_DUMP_FILENAME="${TMPWORKINGDIRECTORY}/downloaded/dump.edsp"
 
 testfailureequal 'Reading package lists...
@@ -111,6 +114,14 @@ testfailure aptget install awesome badstuff -s --solver apt
 testsuccess grep 'ERR_UNSOLVABLE' rootdir/tmp/testfailure.output
 
 configarchitecture 'armel'
 testsuccess grep 'ERR_UNSOLVABLE' rootdir/tmp/testfailure.output
 
 configarchitecture 'armel'
+testfailure aptget install --solver apt awesomecoolstuff:i386 -s
+msgtest 'An invalid EDSP file generates a' 'hard error'
+if echo "Request: This is a test\nFoo: bar\n\n" | aptinternalsolver -q=0 > solver.result 2>&1; then
+       cat solver.result
+       msgfail
+else
+       msgpass
+fi
 msgtest 'Test direct calling is okay for' 'apt-internal-solver'
 cat "$APT_EDSP_DUMP_FILENAME" | aptinternalsolver -q=0 > solver.result 2>&1 || true
 if [ "$(tail -n2 solver.result | head -n1 )" = "Message: Done" ]; then
 msgtest 'Test direct calling is okay for' 'apt-internal-solver'
 cat "$APT_EDSP_DUMP_FILENAME" | aptinternalsolver -q=0 > solver.result 2>&1 || true
 if [ "$(tail -n2 solver.result | head -n1 )" = "Message: Done" ]; then
@@ -121,8 +132,6 @@ else
 fi
 rm -f "$APT_EDSP_DUMP_FILENAME"
 
 fi
 rm -f "$APT_EDSP_DUMP_FILENAME"
 
-testfailure aptget install --solver apt awesomecoolstuff:i386 -s
-
 testsuccess aptinternalsolver scenario
 testsuccessequal 'Package: stuff
 Source: stuff
 testsuccess aptinternalsolver scenario
 testsuccessequal 'Package: stuff
 Source: stuff
index 4dc94db7639cb4f634b834d08cb7eda510927887..f6a94ba67747f99b222d470d8a2bfcc7bfcb6aba 100755 (executable)
@@ -95,14 +95,6 @@ SHA256-Download:
        testsuccessequal "$(cat ${PKGFILE}-new)
 " aptcache show apt newstuff
 
        testsuccessequal "$(cat ${PKGFILE}-new)
 " aptcache show apt newstuff
 
-       msgmsg "Testcase: index is already up-to-date: $*"
-       find rootdir/var/lib/apt/lists -name '*diff_Index' -type f -delete
-       testsuccess aptget update "$@"
-       testequal 'Hit:1 http://localhost:8080  InRelease
-Reading package lists...' aptget update "$@" -o Debug::Acquire::Transaction=0 -o Debug::pkgAcquire::Diffs=0
-       testsuccessequal "$(cat ${PKGFILE}-new)
-" aptcache show apt newstuff
-
        msgmsg "Testcase: apply with two patches: $*"
        cp ${PKGFILE}-new aptarchive/Packages
        echo '
        msgmsg "Testcase: apply with two patches: $*"
        cp ${PKGFILE}-new aptarchive/Packages
        echo '