From: David Kalnischkies Date: Sat, 12 Sep 2015 08:35:49 +0000 (+0200) Subject: various changes to increase test-coverage X-Git-Tag: 1.1.exp13~15 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/7414af7fa88164209eec9c585b8d175c1618ecbc?ds=sidebyside various changes to increase test-coverage 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 --- diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 1493b63dc..2db251350 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -312,13 +312,14 @@ static void ShowHashTableStats(std::string Type, /* */ 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; } + + pkgCacheFile CacheFile; + pkgCache *Cache = CacheFile.GetPkgCache(); + if (unlikely(Cache == NULL)) return false; diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc index 2e352931f..47b515be5 100644 --- a/cmdline/apt-dump-solver.cc +++ b/cmdline/apt-dump-solver.cc @@ -53,7 +53,8 @@ int main(int argc,const char *argv[]) /*{{{*/ 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 || diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc index 2d24a8aee..dc4efb32b 100644 --- a/cmdline/apt-helper.cc +++ b/cmdline/apt-helper.cc @@ -81,7 +81,7 @@ static bool DoDownloadFile(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) @@ -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) - _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) - _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; diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc index 12ef8dda0..cde3069bd 100644 --- a/cmdline/apt-sortpkgs.cc +++ b/cmdline/apt-sortpkgs.cc @@ -30,6 +30,7 @@ #include #include #include +#include #include /*}}}*/ @@ -112,32 +113,21 @@ static bool DoIt(string InFile) // Emit FileFd stdoutfd; stdoutfd.OpenDescriptor(STDOUT_FILENO, FileFd::WriteOnly, false); - unsigned char *Buffer = new unsigned char[Largest+1]; + auto const Buffer = std::unique_ptr(new unsigned char[Largest+1]); for (vector::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; - } 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"); - } // 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"); - } } - - delete [] Buffer; return true; } /*}}}*/ diff --git a/test/integration/framework b/test/integration/framework index 3bf6012ba..322c74a21 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1592,29 +1592,30 @@ testfailure() { 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 } +testsuccessequal() { + testreturnstateequal 'testsuccess' "$@" +} testwarningequal() { - msggroup 'testwarningequal' - local CMP="$1" - shift - testwarning "$@" - testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" "$CMP" - msggroup + testreturnstateequal 'testwarning' "$@" } testfailureequal() { - msggroup 'testfailureequal' - local CMP="$1" - shift - testfailure "$@" - testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" "$CMP" - msggroup + testreturnstateequal 'testfailure' "$@" } testfailuremsg() { diff --git a/test/integration/test-apt-cache b/test/integration/test-apt-cache index 7927686fc..c254aa602 100755 --- a/test/integration/test-apt-cache +++ b/test/integration/test-apt-cache @@ -34,6 +34,7 @@ testempty aptcache unmet dpkg 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 diff --git a/test/integration/test-apt-get-build-dep b/test/integration/test-apt-get-build-dep index f7af5b782..6df49d782 100755 --- a/test/integration/test-apt-get-build-dep +++ b/test/integration/test-apt-get-build-dep @@ -5,12 +5,15 @@ TESTDIR=$(readlink -f $(dirname $0)) . $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 + +msgmsg 'Test with' 'unsigned dsc' cat > 2vcard_0.5-3.dsc < Uploaders: Marcela Tiznado 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 @@ -32,17 +36,24 @@ Files: 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 +The following packages will be REMOVED: + build-conflict 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 +} +test2vcardbuilddep +msgmsg 'Test with' 'signed dsc' cat > 2vcard_0.5-3.dsc < Uploaders: Marcela Tiznado 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 @@ -74,20 +86,10 @@ z2UAn1oXgTai6opwhVfkxrlmJ+iRxzuc =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 @@ -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 + + +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 diff --git a/test/integration/test-apt-get-clean b/test/integration/test-apt-get-clean index 457bff9d3..31e9900c9 100755 --- a/test/integration/test-apt-get-clean +++ b/test/integration/test-apt-get-clean @@ -15,6 +15,7 @@ setupaptarchive # 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 diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper index d6c8385af..944406580 100755 --- a/test/integration/test-apt-helper +++ b/test/integration/test-apt-helper @@ -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 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 diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index 09ff9304e..662a866aa 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -8,6 +8,7 @@ setupenvironment 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 @@ -27,19 +28,39 @@ msgcleantest() { 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 -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 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 -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 @@ -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 -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 -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 -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 @@ -68,7 +89,7 @@ msgcleantest 'Test deb822 with' 'two entries' 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 @@ -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 -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 @@ -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 -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 -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 @@ -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 -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 -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 -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 @@ -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 -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 @@ -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 -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 @@ -149,6 +170,6 @@ Types: deb 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 diff --git a/test/integration/test-external-dependency-solver-protocol b/test/integration/test-external-dependency-solver-protocol index 3654e705c..a9746d4a2 100755 --- a/test/integration/test-external-dependency-solver-protocol +++ b/test/integration/test-external-dependency-solver-protocol @@ -27,6 +27,9 @@ setupaptarchive 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... @@ -111,6 +114,14 @@ testfailure aptget install awesome badstuff -s --solver apt 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 @@ -121,8 +132,6 @@ else fi rm -f "$APT_EDSP_DUMP_FILENAME" -testfailure aptget install --solver apt awesomecoolstuff:i386 -s - testsuccess aptinternalsolver scenario testsuccessequal 'Package: stuff Source: stuff diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index 4dc94db76..f6a94ba67 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -95,14 +95,6 @@ SHA256-Download: 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 '