Преглед изворни кода

merged lp:~donkult/apt/sid

Michael Vogt пре 15 година
родитељ
комит
178dd062ee
58 измењених фајлова са 116 додато и 2067 уклоњено
  1. 3 2
      Makefile
  2. 2 2
      buildlib/defaults.mak
  3. 6 1
      debian/apt.symbols
  4. 7 1
      debian/changelog
  5. 5 0
      debian/rules
  6. 16 0
      test/Makefile
  7. 0 25
      test/authReliability/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-broken_Packages
  8. 0 13
      test/authReliability/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-broken_Release
  9. 0 7
      test/authReliability/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-broken_Release.gpg
  10. 0 25
      test/authReliability/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-ok_Packages
  11. 0 13
      test/authReliability/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-ok_Release
  12. 0 7
      test/authReliability/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-ok_Release.gpg
  13. 0 2
      test/authReliability/sources.list.failure
  14. 0 2
      test/authReliability/sources.list.good
  15. 0 16
      test/fake-status
  16. 0 70
      test/hash.cc
  17. 18 11
      test/integration/framework
  18. 10 0
      test/integration/makefile
  19. 17 4
      test/integration/run-tests
  20. 0 0
      test/interactive-helper/extract-control.cc
  21. 3 16
      test/makefile
  22. 0 0
      test/interactive-helper/mthdcat.cc
  23. 0 0
      test/interactive-helper/networkless-install-fixes/README
  24. 0 0
      test/interactive-helper/networkless-install-fixes/sources.test.list
  25. 0 0
      test/interactive-helper/networkless-install-fixes/test.sh
  26. 0 0
      test/interactive-helper/rpmver.cc
  27. 1 2
      test/test_udevcdrom.cc
  28. 0 0
      test/interactive-helper/testdeb.cc
  29. 0 0
      test/interactive-helper/testextract.cc
  30. 5 2
      test/libapt/compareversion_test.cc
  31. 4 0
      test/libapt/makefile
  32. 19 6
      test/libapt/run-tests
  33. 0 0
      test/libapt/versions.lst
  34. 0 11
      test/local-repo/Packages
  35. BIN
      test/local-repo/Packages.gz
  36. BIN
      test/local-repo/Packages.gz.save
  37. 0 13
      test/local-repo/Release
  38. 0 7
      test/local-repo/Release.gpg
  39. BIN
      test/local-repo/gdebi-test4.deb
  40. 0 266
      test/pre-upload-check.py
  41. 0 105
      test/scratch.cc
  42. 0 235
      test/test-indexes.sh
  43. 0 1182
      test/testkeys/mvo.key
  44. 0 2
      test/testsources.list/sources.list.all-gpg-broken
  45. 0 2
      test/testsources.list/sources.list.all-gpg-ok
  46. 0 1
      test/testsources.list/sources.list.all-release-broken
  47. 0 1
      test/testsources.list/sources.list.all-release-ok
  48. 0 1
      test/testsources.list/sources.list.all-validuntil-broken
  49. 0 2
      test/testsources.list/sources.list.md5-package-broken
  50. 0 2
      test/testsources.list/sources.list.md5-package-ok
  51. 0 1
      test/testsources.list/sources.list.md5-release-broken
  52. 0 1
      test/testsources.list/sources.list.md5-release-ok
  53. 0 1
      test/testsources.list/sources.list.sha1-release-broken
  54. 0 1
      test/testsources.list/sources.list.sha1-release-ok
  55. 0 2
      test/testsources.list/sources.list.sha256-package-broken
  56. 0 2
      test/testsources.list/sources.list.sha256-package-ok
  57. 0 1
      test/testsources.list/sources.list.sha256-release-broken
  58. 0 1
      test/testsources.list/sources.list.sha256-release-ok

+ 3 - 2
Makefile

@@ -9,8 +9,8 @@ endif
 .PHONY: default
 default: startup all
 
-.PHONY: headers library clean veryclean all binary program doc
-all headers library clean veryclean binary program doc dirs:
+.PHONY: headers library clean veryclean all binary program doc test
+all headers library clean veryclean binary program doc dirs test:
 	$(MAKE) -C apt-pkg $@
 	$(MAKE) -C apt-inst $@
 	$(MAKE) -C methods $@
@@ -19,6 +19,7 @@ all headers library clean veryclean binary program doc dirs:
 	$(MAKE) -C dselect $@
 	$(MAKE) -C doc $@
 	$(MAKE) -C po $@
+	$(MAKE) -C test $@
 
 # Some very common aliases
 .PHONY: maintainer-clean dist-clean distclean pristine sanity 

+ 2 - 2
buildlib/defaults.mak

@@ -118,10 +118,10 @@ MKDIRS := $(BIN)
 # list
 .PHONY: headers library clean veryclean all binary program doc dirs
 .PHONY: maintainer-clean dist-clean distclean pristine sanity
-all: binary doc
+all: dirs binary doc
 binary: library program
 maintainer-clean dist-clean distclean pristine sanity: veryclean
-headers library clean veryclean program:
+headers library clean veryclean program test:
 
 veryclean:
 	echo Very Clean done for $(SUBDIR)

+ 6 - 1
debian/apt.symbols

@@ -563,7 +563,6 @@ libapt-pkg.so.4.10 libapt-pkg4.10
  (c++)"pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.8.0
  (c++)"pkgCacheGenerator::ListParser::CollectFileProvides(pkgCache&, pkgCache::VerIterator&)@Base" 0.8.0
  (c++)"pkgCacheGenerator::ListParser::~ListParser()@Base" 0.8.0
- (c++)"pkgCacheGenerator::NewDepends(pkgCache::PkgIterator&, pkgCache::VerIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int const&, unsigned int const&, unsigned int*)@Base" 0.8.0
  (c++)"pkgCacheGenerator::NewFileVer(pkgCache::VerIterator&, pkgCacheGenerator::ListParser&)@Base" 0.8.0
  (c++)"pkgCacheGenerator::NewPackage(pkgCache::PkgIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.8.0
  (c++)"pkgCacheGenerator::NewVersion(pkgCache::VerIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)@Base" 0.8.0
@@ -1327,3 +1326,9 @@ libapt-pkg.so.4.10 libapt-pkg4.10
  (c++)"pkgDepCache::IsModeChangeOk(pkgDepCache::ModeList, pkgCache::PkgIterator const&, unsigned long, bool)@Base" 0.8.13.2 1
  (c++)"pkgPackageManager::SmartUnPack(pkgCache::PkgIterator, bool)@Base" 0.8.15~exp1 1
  (c++)"pkgCache::DepIterator::IsNegative() const@Base" 0.8.15~exp1 1
+ (c++)"Configuration::CndSet(char const*, int)@Base" 0.8.15.3 1
+ (c++)"pkgProblemResolver::InstOrNewPolicyBroken(pkgCache::PkgIterator)@Base" 0.8.15.3 1
+ (c++)"DeEscapeString(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.8.15.4 1
+ (c++)"GetModificationTime(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.8.15.6 1
+ (c++)"pkgSourceList::GetLastModifiedTime()@Base" 0.8.15.6 1
+ (c++)"pkgCacheGenerator::NewDepends(pkgCache::PkgIterator&, pkgCache::VerIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int const&, unsigned int const&, unsigned int*&)@Base" 0.8.15.6 1

+ 7 - 1
debian/changelog

@@ -5,8 +5,14 @@ apt (0.8.15.7) UNRELEASED; urgency=low
     - ignore "self"-conflicts for all architectures of a package
       instead of just for the architecture of the package locked at
       in the ordering of installations too (Closes: #802901)
+  * test/*
+    - reorganize the various testcases and helper we have and
+      integrate them better into the buildsystem
+    - run the test/libapt testcases at package build-time
+  * debian/apt.symbols:
+    - add the newly added symbols since 0.8.15.3
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Wed, 17 Aug 2011 11:08:02 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Wed, 17 Aug 2011 15:09:16 +0200
 
 apt (0.8.15.6) unstable; urgency=low
 

+ 5 - 0
debian/rules

@@ -97,6 +97,11 @@ build/configure-stamp: configure
 build/build-stamp: build/configure-stamp
 	# Add here commands to compile the package.
 	$(MAKE) binary
+ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
+	$(MAKE) test
+else
+	@echo "Tests DISABLED"
+endif
 	touch $@
 
 build/build-doc-stamp: build/configure-stamp

+ 16 - 0
test/Makefile

@@ -0,0 +1,16 @@
+# -*- make -*-
+
+# This is the top level test makefile for APT, it recurses to each lower
+# level make file and runs it with the proper target
+ifndef NOISY
+.SILENT:
+endif
+
+.PHONY: headers library clean veryclean all binary program doc test
+all clean veryclean binary program dirs test:
+	$(MAKE) -C libapt $@
+	$(MAKE) -C interactive-helper $@
+
+# Some very common aliases
+.PHONY: maintainer-clean dist-clean distclean pristine sanity
+maintainer-clean dist-clean distclean pristine sanity: veryclean

+ 0 - 25
test/authReliability/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-broken_Packages

@@ -1,25 +0,0 @@
-Package: libglib2.0-data
-Priority: optional
-Section: misc
-Installed-Size: 2288
-Maintainer: Ubuntu Desktop Team <ubuntu-desktop@lists.ubuntu.com>
-Original-Maintainer: Loic Minier <lool@dooz.org>
-Architecture: all
-Source: glib2.0
-Version: 2.13.6-1ubuntu1
-Replaces: libglib1.3, libglib1.3-data
-Depends: libglib2.0-0 (>= 2.13.6-1ubuntu1)
-Conflicts: libglib1.3-data
-Filename: ./libglib2.0-data_2.13.6-1ubuntu1_all.deb
-Size: 958
-MD5sum: 803fc5e2e31a4345b3e9c771e1eae49f
-SHA1: 75b2c62b21bae60c58e694dd40ed6d4df946e304
-SHA256: 142d8466eac252f06bc957d76fe1bb87f86f2d3512b99c8d4b08c1ad79fbe59e
-Description: Common files for GLib library
- GLib is a library containing many useful C routines for things such
- as trees, hashes, lists, and strings.  It is a useful general-purpose
- C library used by projects such as GTK+, GIMP, and GNOME.
- .
- This package is needed for the runtime libraries to display messages in
- languages other than English.
-

+ 0 - 13
test/authReliability/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-broken_Release

@@ -1,13 +0,0 @@
-Date: Fri, 27 Jul 2007 14:39:41 UTC
-MD5Sum:
- 4672dadea6a144839f823c9f3d5fd44b              934 Packages
- 82ebcf09a8d78a2b9cf7759349da4936              603 Packages.gz
- d41d8cd98f00b204e9800998ecf8427e                0 Release
-SHA1:
- fa0f294aa30789529371066b10e9497be1284d26              934 Packages
- f4032808663b2810d87b4a4dab6f5ae4a1e8fa8e              603 Packages.gz
- da39a3ee5e6b4b0d3255bfef95601890afd80709                0 Release
-SHA256:
- 92c9b605480dc74e6be79c0ddc24738bfcbd6dd3148af531acd68717de528049              934 Packages
- 659ccc0d07ff21f0247f9fa5abe149221c90d5e17da52c7afddb035b93c23d39              603 Packages.gz
- e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855                0 Release

+ 0 - 7
test/authReliability/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-broken_Release.gpg

@@ -1,7 +0,0 @@
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQBGqgOwliSD4VZixzQRAs6jAJ9p7Aiob9gzkUNCtoW8UPrBo0E/YwCdEaz0
-CQJszU6fRYX5jGWXSWzfc5c=
-=ugH0
------END PGP SIGNATURE-----

+ 0 - 25
test/authReliability/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-ok_Packages

@@ -1,25 +0,0 @@
-Package: libglib2.0-data
-Priority: optional
-Section: misc
-Installed-Size: 2288
-Maintainer: Ubuntu Desktop Team <ubuntu-desktop@lists.ubuntu.com>
-Original-Maintainer: Loic Minier <lool@dooz.org>
-Architecture: all
-Source: glib2.0
-Version: 2.13.6-1ubuntu1
-Replaces: libglib1.3, libglib1.3-data
-Depends: libglib2.0-0 (>= 2.13.6-1ubuntu1)
-Conflicts: libglib1.3-data
-Filename: ./libglib2.0-data_2.13.6-1ubuntu1_all.deb
-Size: 958
-MD5sum: 803fc5e2e31a4345b3e9c771e1eae49f
-SHA1: 75b2c62b21bae60c58e694dd40ed6d4df946e304
-SHA256: 142d8466eac252f06bc957d76fe1bb87f86f2d3512b99c8d4b08c1ad79fbe59e
-Description: Common files for GLib library
- GLib is a library containing many useful C routines for things such
- as trees, hashes, lists, and strings.  It is a useful general-purpose
- C library used by projects such as GTK+, GIMP, and GNOME.
- .
- This package is needed for the runtime libraries to display messages in
- languages other than English.
-

+ 0 - 13
test/authReliability/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-ok_Release

@@ -1,13 +0,0 @@
-Date: Fri, 27 Jul 2007 14:39:41 UTC
-MD5Sum:
- 4672dadea6a144839f823c9f3d5fd44b              934 Packages
- 82ebcf09a8d78a2b9cf7759349da4936              603 Packages.gz
- d41d8cd98f00b204e9800998ecf8427e                0 Release
-SHA1:
- fa0f294aa30789529371066b10e9497be1284d26              934 Packages
- f4032808663b2810d87b4a4dab6f5ae4a1e8fa8e              603 Packages.gz
- da39a3ee5e6b4b0d3255bfef95601890afd80709                0 Release
-SHA256:
- 92c9b605480dc74e6be79c0ddc24738bfcbd6dd3148af531acd68717de528049              934 Packages
- 659ccc0d07ff21f0247f9fa5abe149221c90d5e17da52c7afddb035b93c23d39              603 Packages.gz
- e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855                0 Release

+ 0 - 7
test/authReliability/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-ok_Release.gpg

@@ -1,7 +0,0 @@
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQBGqgOwliSD4VZixzQRAs6jAJ9p7Aiob9gzkUNCtoW8UPrBo0E/YwCdEaz0
-CQJszU6fRYX5jGWXSWzfc5c=
-=ugH0
------END PGP SIGNATURE-----

+ 0 - 2
test/authReliability/sources.list.failure

@@ -1,2 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/gpg-package-broken/ /
-

+ 0 - 2
test/authReliability/sources.list.good

@@ -1,2 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/gpg-package-ok/ /
-

+ 0 - 16
test/fake-status

@@ -1,16 +0,0 @@
-Package: libglib2.0-0
-Status: install ok installed
-Priority: optional
-Section: libs
-Installed-Size: 1376
-Maintainer: Ubuntu Desktop Team <ubuntu-desktop@lists.ubuntu.com>
-Architecture: all
-Source: glib2.0
-Version: 2.13.7-1ubuntu1
-Description: The GLib library of C routines
- GLib is a library containing many useful C routines for things such
- as trees, hashes, lists, and strings.  It is a useful general-purpose
- C library used by projects such as GTK+, GIMP, and GNOME.
- .
- This package contains the shared libraries.
-Original-Maintainer: Loic Minier <lool@dooz.org>

+ 0 - 70
test/hash.cc

@@ -1,70 +0,0 @@
-#include <apt-pkg/md5.h>
-#include <apt-pkg/sha1.h>
-#include <apt-pkg/sha256.h>
-#include <apt-pkg/strutl.h>
-#include <iostream>
-
-using namespace std;
-
-template <class T> void Test(const char *In,const char *Out)
-{
-   T Sum;
-   Sum.Add(In);
-   cout << Sum.Result().Value() << endl;
-   if (stringcasecmp(Sum.Result().Value(),Out) != 0)
-      abort();
-}
-
-template <class T> void TestMill(const char *Out)
-{
-   T Sum;
-   
-   const unsigned char As[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
-   unsigned Count = 1000000;
-   for (; Count != 0;)
-   {
-      if (Count >= 64)
-      {
-	 Sum.Add(As,64);
-	 Count -= 64;
-      }
-      else
-      {
-	 Sum.Add(As,Count);
-	 Count = 0;
-      }
-   }
-   
-   cout << Sum.Result().Value() << endl;
-   if (stringcasecmp(Sum.Result().Value(),Out) != 0)
-      abort();
-}
-
-int main()
-{
-   // From  FIPS PUB 180-1
-   Test<SHA1Summation>("abc","A9993E364706816ABA3E25717850C26C9CD0D89D");
-   Test<SHA1Summation>("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
-		       "84983E441C3BD26EBAAE4AA1F95129E5E54670F1");
-   TestMill<SHA1Summation>("34AA973CD4C4DAA4F61EEB2BDBAD27316534016F");
-   
-   // MD5 tests from RFC 1321
-   Test<MD5Summation>("","d41d8cd98f00b204e9800998ecf8427e");
-   Test<MD5Summation>("a","0cc175b9c0f1b6a831c399e269772661");
-   Test<MD5Summation>("abc","900150983cd24fb0d6963f7d28e17f72");
-   Test<MD5Summation>("message digest","f96b697d7cb7938d525a2f31aaf161d0");
-   Test<MD5Summation>("abcdefghijklmnopqrstuvwxyz","c3fcd3d76192e4007dfb496cca67e13b");
-   Test<MD5Summation>("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
-		      "d174ab98d277d9f5a5611c2c9f419d9f");
-   Test<MD5Summation>("12345678901234567890123456789012345678901234567890123456789012345678901234567890",
-		      "57edf4a22be3c955ac49da2e2107b67a");
-
-   // SHA-256, From FIPS 180-2
-   Test<SHA256Summation>("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 
-			 "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1");
-   
-
-   return 0; 
-}
-
-	 

+ 18 - 11
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; }

+ 10 - 0
test/integration/makefile

@@ -0,0 +1,10 @@
+# -*- make -*-
+BASE=../..
+SUBDIR=test/integration
+
+# Bring in the default rules
+include ../../buildlib/defaults.mak
+
+.PHONY: test
+test:
+	./run-tests

+ 17 - 4
test/integration/run-tests

@@ -8,17 +8,30 @@ if [ "$1" = "-q" ]; then
 elif [ "$1" = "-v" ]; then
 	export MSGLEVEL=4
 fi
+
+if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then
+	CTEST='\033[1;32m'
+	CHIGH='\033[1;35m'
+	CRESET='\033[0m'
+elif [ -z "${MSGLEVEL}" ]; then
+	export MSGLEVEL=2
+fi
+
+if [ -z "$MSGLEVEL" ]; then
+	MSGLEVEL=5
+fi
+
 for testcase in $(run-parts --list $DIR | grep '/test-'); do
-	if [ "$1" = "-q" ]; then
-		echo -n "\033[1;32mRun Testcase \033[1;35m$(basename ${testcase})\033[0m"
+	if [ "$MSGLEVEL" -le 2 ]; then
+		echo -n "${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: "
 	else
-		echo "\033[1;32mRun Testcase \033[1;35m$(basename ${testcase})\033[0m"
+		echo "${CTEST}Run Testcase ${CHIGH}$(basename ${testcase})${CRESET}"
 	fi
 	if ! ${testcase}; then
                  FAIL=$((FAIL+1))
                  echo "$(basename $testcase) ... FAIL"
         fi
-	if [ "$1" = "-q" ]; then
+	if [ "$MSGLEVEL" -le 2 ]; then
 		echo
 	fi
 done

test/extract-control.cc → test/interactive-helper/extract-control.cc


+ 3 - 16
test/makefile

@@ -1,9 +1,9 @@
 # -*- make -*-
-BASE=..
-SUBDIR=test
+BASE=../..
+SUBDIR=test/interactive-helper
 
 # Bring in the default rules
-include ../buildlib/defaults.mak
+include ../../buildlib/defaults.mak
 
 # Program for testing methods
 PROGRAM=mthdcat
@@ -11,13 +11,6 @@ SLIBS =
 SOURCE = mthdcat.cc
 include $(PROGRAM_H)
 
-# Scratch program to test incomplete code fragments in
-PROGRAM=scratch-test
-SLIBS = -lapt-inst -lapt-pkg
-LIB_MAKES = apt-pkg/makefile apt-inst/makefile
-SOURCE = scratch.cc
-include $(PROGRAM_H)
-
 # Version compare tester
 PROGRAM=testextract
 SLIBS = -lapt-pkg -lapt-inst
@@ -37,12 +30,6 @@ SLIBS = -lapt-pkg -lapt-inst
 SOURCE = extract-control.cc
 include $(PROGRAM_H)
 
-# Program for testing hashes
-PROGRAM=hash
-SLIBS = -lapt-pkg 
-SOURCE = hash.cc
-include $(PROGRAM_H)
-
 # Program for testing udevcdrom
 PROGRAM=test_udevcdrom
 SLIBS = -lapt-pkg 

test/mthdcat.cc → test/interactive-helper/mthdcat.cc


test/networkless-install-fixes/README → test/interactive-helper/networkless-install-fixes/README


test/networkless-install-fixes/sources.test.list → test/interactive-helper/networkless-install-fixes/sources.test.list


test/networkless-install-fixes/test.sh → test/interactive-helper/networkless-install-fixes/test.sh


test/rpmver.cc → test/interactive-helper/rpmver.cc


+ 1 - 2
test/test_udevcdrom.cc

@@ -4,14 +4,13 @@
 
 int main()
 {
-   int i;
    pkgUdevCdromDevices c;
    assert(c.Dlopen());
 
    vector<CdromDevice> l;
    l = c.Scan();
    assert(l.empty() == false);
-   for (i=0;i<l.size();i++)
+   for (size_t i = 0; i < l.size(); ++i)
       std::cerr << l[i].DeviceName << " " 
 		<< l[i].Mounted << " " 
 		<< l[i].MountPath << std::endl;

test/testdeb.cc → test/interactive-helper/testdeb.cc


test/testextract.cc → test/interactive-helper/testextract.cc


+ 5 - 2
test/libapt/compareversion_test.cc

@@ -63,6 +63,9 @@ void assertVersion(int const &CurLine, string const &A, string const &B, int con
 
 bool RunTest(const char *File)
 {
+   if (FileExists(File) == false)
+      return _error->Error("Versiontestfile %s doesn't exist!", File);
+
    ifstream F(File,ios::in);
    if (!F != 0)
       return false;
@@ -112,8 +115,8 @@ bool RunTest(const char *File)
 
 int main(int argc, char *argv[])
 {
-   if (argc <= 1)
-      RunTest("../versions.lst");
+   if (argc != 2)
+      return 1;
    else
       RunTest(argv[1]);
 

+ 4 - 0
test/libapt/makefile

@@ -6,6 +6,10 @@ BASENAME=_libapt_test
 # Bring in the default rules
 include ../../buildlib/defaults.mak
 
+.PHONY: test
+test:
+	./run-tests
+
 # Program for testing getLanguageCode
 PROGRAM = getLanguages${BASENAME}
 SLIBS = -lapt-pkg

+ 19 - 6
test/libapt/run-tests

@@ -3,19 +3,32 @@ set -e
 
 DIR=$(readlink -f $(dirname $0))
 echo "Compiling the tests …"
-test -d "$DIR/../../build/obj/test/libapt/" || mkdir -p "$DIR/../../build/obj/test/libapt/"
 (cd $DIR && make)
 echo "Running all testcases …"
 LDPATH="$DIR/../../build/bin"
 EXT="_libapt_test"
+
+# detect if output is on a terminal (colorful) or better not
+if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then
+	COLHIGH='\033[1;35m'
+	COLRESET='\033[0m'
+	TESTOKAY='\033[1;32mOKAY\033[0m'
+	TESTFAIL='\033[1;31mFAILED\033[0m'
+else
+	COLHIGH=''
+	COLRESET=''
+	TESTOKAY='OK'
+	TESTFAIL='###FAILED###'
+fi
+
 for testapp in $(ls ${LDPATH}/*$EXT)
 do
 	name=$(basename ${testapp})
+	NAME="${COLHIGH}${name}${COLRESET}"
 	tmppath=""
 
 	if [ $name = "GetListOfFilesInDir${EXT}" ]; then
 		# TODO: very-low: move env creation to the actual test-app
-		echo "Prepare Testarea for \033[1;35m$name\033[0m ..."
 		tmppath=$(mktemp -d)
 		touch "${tmppath}/anormalfile" \
 			"${tmppath}/01yet-anothernormalfile" \
@@ -47,19 +60,19 @@ do
 		ln -s "${tmppath}/anormalfile" "${tmppath}/linkedfile.list"
 		ln -s "${tmppath}/non-existing-file" "${tmppath}/brokenlink.list"
 	elif [ $name = "getLanguages${EXT}" ]; then
-		echo "Prepare Testarea for \033[1;35m$name\033[0m ..."
 		tmppath=$(mktemp -d)
 		touch "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-tr" \
 			"${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-pt" \
 			"${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-se~" \
 			"${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-st.bak"
+	elif [ $name = "CompareVersion${EXT}" ]; then
+		tmppath="${DIR}/versions.lst"
 	fi
 
-	echo -n "Testing with \033[1;35m${name}\033[0m ... "
-	LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} && echo "\033[1;32mOKAY\033[0m" || echo "\033[1;31mFAILED\033[0m"
+	echo -n "Testing with ${NAME} "
+	LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} && echo "$TESTOKAY" || echo "$TESTFAIL"
 
 	if [ -n "$tmppath" -a -d "$tmppath" ]; then
-		echo "Cleanup Testarea after \033[1;35m$name\033[0m ..."
 		rm -rf "$tmppath"
 	fi
 

test/versions.lst → test/libapt/versions.lst


+ 0 - 11
test/local-repo/Packages

@@ -1,11 +0,0 @@
-Package: gdebi-test4
-Architecture: all
-Version: 1.0
-Conflicts: apt (<= 0.1)
-Filename: ./gdebi-test4.deb
-Size: 2306
-MD5sum: 0952a2b4a566215e0794c7603f3fcfcc
-SHA1: 318688ea2d53352a1bdb669ebd2cd4847f6c4e7c
-SHA256: 35f600b57253cef807a1da7c5deb06e7821de9223842a310a77b4da87cf51e2c
-Description: testpackage for gdebi - Conflicts: apt (<= 0.1)
-

BIN
test/local-repo/Packages.gz


BIN
test/local-repo/Packages.gz.save


+ 0 - 13
test/local-repo/Release

@@ -1,13 +0,0 @@
-Date: Thu, 09 Aug 2007 10:13:06 UTC
-MD5Sum:
- 29f79161fafe1f0c393e7fc6ddcb99b5              338 Packages
- 2f885b2ebdb77d3354ba63d8b5aad614              269 Packages.gz
- d41d8cd98f00b204e9800998ecf8427e                0 Release
-SHA1:
- d8860d409a8b0db443fbf254e2d6afbfc9bc04a8              338 Packages
- 8b668a7b730ceb4d702737a13a723959c20b67df              269 Packages.gz
- da39a3ee5e6b4b0d3255bfef95601890afd80709                0 Release
-SHA256:
- 39aa9fc59d868a71030d24aeaa4b574d7a11a10ea79491a0881f8d755b36a06d              338 Packages
- 62898623498ebf8304647db1ba2d33e4d8ec0e3e45250c2b66907c812b099297              269 Packages.gz
- e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855                0 Release

+ 0 - 7
test/local-repo/Release.gpg

@@ -1,7 +0,0 @@
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQBGuui6liSD4VZixzQRApSlAJ9D6G1QXvtXH1jH1I4SStsb1VsImQCbBPfp
-+1p0bDANcBVY+GckjJvFRkY=
-=a0AR
------END PGP SIGNATURE-----

BIN
test/local-repo/gdebi-test4.deb


+ 0 - 266
test/pre-upload-check.py

@@ -1,266 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import os
-import glob
-import os.path
-import shutil
-import time
-from subprocess import call, PIPE
-
-import unittest
-
-stdout = os.open("/dev/null",0) #sys.stdout
-stderr = os.open("/dev/null",0) # sys.stderr
-
-apt_args = [] 
-#apt_args = ["-o","Debug::pkgAcquire::Auth=true"]
-
-class testAptAuthenticationReliability(unittest.TestCase):
-    """
-    test if the spec https://wiki.ubuntu.com/AptAuthenticationReliability 
-    is properly implemented
-    """
-    #apt = "../bin/apt-get"
-    apt = "apt-get"
-
-    def setUp(self):
-        if os.path.exists("/tmp/autFailure"):
-            os.unlink("/tmp/authFailure");
-        if os.path.exists("/tmp/autFailure2"):
-            os.unlink("/tmp/authFailure2");
-    def testRepositorySigFailure(self):
-        """
-        test if a repository that used to be authenticated and fails on
-        apt-get update refuses to update and uses the old state
-        """
-        # copy valid signatures into lists (those are ok, even
-        # if the name is "-broken-" ...
-        for f in glob.glob("./authReliability/lists/*"):
-            shutil.copy(f,"/var/lib/apt/lists")
-            # ensure we do *not* get a I-M-S hit
-            os.utime("/var/lib/apt/lists/%s" % os.path.basename(f), (0,0))
-        res = call([self.apt,
-                    "update",
-                    "-o","Dir::Etc::sourcelist=./authReliability/sources.list.failure", 
-                    "-o",'APT::Update::Auth-Failure::=touch /tmp/authFailure',
-                   ] + apt_args,
-                   stdout=stdout, stderr=stderr)
-        self.assert_(os.path.exists("/var/lib/apt/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-broken_Release.gpg"),
-                     "The gpg file disappeared, this should not happen")
-        self.assert_(os.path.exists("/var/lib/apt/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-broken_Packages"),
-                     "The Packages file disappeared, this should not happen")
-        self.assert_(os.path.exists("/tmp/authFailure"),
-                     "The APT::Update::Auth-Failure script did not run (1)")
-        # the same with i-m-s hit this time
-        for f in glob.glob("./authReliability/lists/*"):
-            shutil.copy(f,"/var/lib/apt/lists")
-            os.utime("/var/lib/apt/lists/%s" % os.path.basename(f), (time.time(),time.time()))
-        res = call([self.apt,
-                    "update",
-                    "-o","Dir::Etc::sourcelist=./authReliability/sources.list.failure",
-                    "-o",'APT::Update::Auth-Failure::=touch /tmp/authFailure2',
-                   ] + apt_args,
-                   stdout=stdout, stderr=stderr)
-        self.assert_(os.path.exists("/var/lib/apt/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-broken_Release.gpg"),
-                     "The gpg file disappeared, this should not happen")
-        self.assert_(os.path.exists("/var/lib/apt/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-broken_Packages"),
-                     "The Packages file disappeared, this should not happen")
-        self.assert_(os.path.exists("/tmp/authFailure2"),
-                     "The APT::Update::Auth-Failure script did not run (2)")
-    def testRepositorySigGood(self):
-        """
-        test that a regular repository with good data stays good
-        """
-        res = call([self.apt,
-                    "update",
-                    "-o","Dir::Etc::sourcelist=./authReliability/sources.list.good"
-                   ] + apt_args,
-                   stdout=stdout, stderr=stderr)
-        self.assert_(os.path.exists("/var/lib/apt/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-ok_Release.gpg"),
-                     "The gpg file disappeared after a regular download, this should not happen")
-        self.assert_(os.path.exists("/var/lib/apt/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-ok_Packages"),
-                     "The Packages file disappeared, this should not happen")
-        # test good is still good after non I-M-S hit and a previous files in lists/
-        for f in glob.glob("./authReliability/lists/*"):
-            shutil.copy(f,"/var/lib/apt/lists")
-            # ensure we do *not* get a I-M-S hit
-            os.utime("/var/lib/apt/lists/%s" % os.path.basename(f), (0,0))
-        res = call([self.apt,
-                    "update",
-                    "-o","Dir::Etc::sourcelist=./authReliability/sources.list.good"
-                   ] + apt_args,
-                   stdout=stdout, stderr=stderr)
-        self.assert_(os.path.exists("/var/lib/apt/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-ok_Release.gpg"),
-                     "The gpg file disappeared after a I-M-S hit, this should not happen")
-        self.assert_(os.path.exists("/var/lib/apt/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-ok_Packages"),
-                     "The Packages file disappeared, this should not happen")
-        # test good is still good after I-M-S hit
-        for f in glob.glob("./authReliability/lists/*"):
-            shutil.copy(f,"/var/lib/apt/lists")
-            # ensure we do get a I-M-S hit
-            os.utime("/var/lib/apt/lists/%s" % os.path.basename(f), (time.time(),time.time()))
-        res = call([self.apt,
-                    "update",
-                    "-o","Dir::Etc::sourcelist=./authReliability/sources.list.good"
-                   ] + apt_args,
-                   stdout=stdout, stderr=stderr)
-        self.assert_(os.path.exists("/var/lib/apt/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-ok_Release.gpg"),
-                     "The gpg file disappeared, this should not happen")
-        self.assert_(os.path.exists("/var/lib/apt/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-ok_Packages"),
-                     "The Packages file disappeared, this should not happen")
-
-
-class testAuthentication(unittest.TestCase):
-    """
-    test if the authentication is working, the repository
-    of the test-data can be found here:
-    bzr get http://people.ubuntu.com/~mvo/bzr/apt/apt-auth-test-suit/
-    """
-    
-    # some class wide data
-    apt = "apt-get"
-    pkg = "libglib2.0-data"
-    pkgver = "2.13.6-1ubuntu1"
-    pkgpath = "/var/cache/apt/archives/libglib2.0-data_2.13.6-1ubuntu1_all.deb"
-
-    def setUp(self):
-        for f in glob.glob("testkeys/*,key"):
-            call(["apt-key", "add", f], stdout=stdout, stderr=stderr)
-
-    def _cleanup(self):
-        " make sure we get new lists and no i-m-s "
-        call(["rm","-f", "/var/lib/apt/lists/*"])
-        if os.path.exists(self.pkgpath):
-            os.unlink(self.pkgpath)
-
-    def _expectedRes(self, resultstr):
-        if resultstr == 'ok':
-            return 0
-        elif resultstr == 'broken':
-            return 100
-        
-
-    def testPackages(self):
-        for f in glob.glob("testsources.list/sources.list*package*"):
-            self._cleanup()
-            (prefix, testtype, result) = f.split("-")
-            expected_res = self._expectedRes(result)
-            # update first
-            call([self.apt,"update",
-                  "-o","Dir::Etc::sourcelist=./%s" % f]+apt_args,
-                 stdout=stdout, stderr=stderr)
-            # then get the pkg
-            cmd = ["install", "-y", "-d", "--reinstall",
-                   "%s=%s" % (self.pkg, self.pkgver),
-                   "-o","Dir::state::Status=./fake-status"]
-            res = call([self.apt, "-o","Dir::Etc::sourcelist=./%s" % f]+cmd+apt_args,
-                       stdout=stdout, stderr=stderr)
-            self.assert_(res == expected_res,
-                         "test '%s' failed (got %s expected %s" % (f,res,expected_res))
-            
-
-    def testGPG(self):
-        for f in glob.glob("testsources.list/sources.list*gpg*"):
-            self._cleanup()
-            (prefix, testtype, result) = f.split("-")
-            expected_res = self._expectedRes(result)
-            # update first
-            call([self.apt,"update",
-                  "-o","Dir::Etc::sourcelist=./%s" % f]+apt_args,
-                 stdout=stdout, stderr=stderr)
-            cmd = ["install", "-y", "-d", "--reinstall",
-                   "%s=%s" % (self.pkg, self.pkgver),
-                   "-o","Dir::state::Status=./fake-status"]
-            res = call([self.apt, "-o","Dir::Etc::sourcelist=./%s" % f]+
-                       cmd+apt_args,
-                       stdout=stdout, stderr=stderr)
-            self.assert_(res == expected_res,
-                         "test '%s' failed (got %s expected %s" % (f,res,expected_res))
-
-    def testRelease(self):
-        for f in glob.glob("testsources.list/sources.list*release*"):
-            self._cleanup()
-            (prefix, testtype, result) = f.split("-")
-            expected_res = self._expectedRes(result)
-            cmd = ["update"]
-            res = call([self.apt,"-o","Dir::Etc::sourcelist=./%s" % f]+cmd+apt_args,
-                       stdout=stdout, stderr=stderr)
-            self.assert_(res == expected_res,
-                         "test '%s' failed (got %s expected %s" % (f,res,expected_res))
-            if expected_res == 0:
-                self.assert_(len(glob.glob("/var/lib/apt/lists/partial/*")) == 0,
-                             "partial/ dir has leftover files: %s" % glob.glob("/var/lib/apt/lists/partial/*"))
-
-    def testValid(self):
-        for f in glob.glob("testsources.list/sources.list*validuntil*"):
-            self._cleanup()
-            (prefix, testtype, result) = f.split("-")
-            expected_res = self._expectedRes(result)
-            cmd = ["update"]
-            res = call([self.apt,"-o","Dir::Etc::sourcelist=./%s" % f]+cmd+apt_args,
-                       stdout=stdout, stderr=stderr)
-            self.assert_(res == expected_res,
-                         "test '%s' failed (got %s expected %s" % (f,res,expected_res))
-            if expected_res == 0:
-                self.assert_(len(glob.glob("/var/lib/apt/lists/partial/*")) == 0,
-                             "partial/ dir has leftover files: %s" % glob.glob("/var/lib/apt/lists/partial/*"))
-
-
-class testLocalRepositories(unittest.TestCase):
-    " test local repository regressions "
-
-    repo_dir = "local-repo"
-    apt = "apt-get"
-    pkg = "gdebi-test4"
-
-    def setUp(self):
-        self.repo = os.path.abspath(os.path.join(os.getcwd(), self.repo_dir))
-        self.sources = os.path.join(self.repo, "sources.list")
-        s = open(self.sources,"w")
-        s.write("deb file://%s/ /\n" % self.repo)
-        s.close()
-
-    def testLocalRepoAuth(self):
-        # two times to get at least one i-m-s hit
-        for i in range(2):
-            self.assert_(os.path.exists(self.sources))
-            cmd = [self.apt,"update","-o", "Dir::Etc::sourcelist=%s" % self.sources]+apt_args
-            res = call(cmd, stdout=stdout, stderr=stderr)
-            self.assertEqual(res, 0, "local repo test failed")
-            self.assert_(os.path.exists(os.path.join(self.repo,"Packages.gz")),
-                         "Packages.gz vanished from local repo")
-
-    def testInstallFromLocalRepo(self):
-        apt = [self.apt,"-o", "Dir::Etc::sourcelist=%s"% self.sources]+apt_args
-        cmd = apt+["update"]
-        res = call(cmd, stdout=stdout, stderr=stderr)
-        self.assertEqual(res, 0)
-        res = call(apt+["-y","install","--reinstall",self.pkg],
-                   stdout=stdout, stderr=stderr)
-        self.assert_(res == 0,
-                     "installing %s failed (got %s)" % (self.pkg, res))
-        res = call(apt+["-y","remove",self.pkg],
-                   stdout=stdout, stderr=stderr)
-        self.assert_(res == 0,
-                     "removing %s failed (got %s)" % (self.pkg, res))
-
-    def testPythonAptInLocalRepo(self):
-        import apt, apt_pkg
-        apt_pkg.Config.Set("Dir::Etc::sourcelist",self.sources)
-        cache = apt.Cache()
-        cache.update()
-        pkg = cache["apt"]
-        self.assert_(pkg.name == 'apt')
-        
-
-
-if __name__ == "__main__":
-    print "Runing simple testsuit on current apt-get and libapt"
-    if len(sys.argv) > 1 and sys.argv[1] == "-v":
-        stdout = sys.stdout
-        stderr = sys.stderr
-    
-    # run only one for now
-    #unittest.main(defaultTest="testAptAuthenticationReliability")
-    unittest.main()

+ 0 - 105
test/scratch.cc

@@ -1,105 +0,0 @@
-#include <apt-pkg/dpkgdb.h>
-#include <apt-pkg/debfile.h>
-#include <apt-pkg/error.h>
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/extract.h>
-#include <apt-pkg/init.h>
-#include <apt-pkg/fileutl.h>
-
-using namespace std;
-
-int main(int argc,char *argv[])
-{
-   pkgInitConfig(*_config);
-   pkgInitSystem(*_config,_system);
-
-//   cout << flNoLink(argv[1]) << endl;
-   
-//   #if 0
-/*   DynamicMMap *FileMap = new DynamicMMap(MMap::Public);
-   pkgFLCache *FList = new pkgFLCache(*FileMap);
-   
-   char *Name = "/tmp/test";
-   pkgFLCache::PkgIterator Pkg(*FList,0);
-   pkgFLCache::NodeIterator Node = FList->GetNode(Name,Name+strlen(Name),Pkg.Offset(),true,false);
-   cout << (pkgFLCache::Node *)Node << endl;
-   Node = FList->GetNode(Name,Name+strlen(Name),Pkg.Offset(),true,false);
-   cout << (pkgFLCache::Node *)Node << endl;
-*/
-//   #if 0
-   _config->Set("Dir::State::status","/tmp/testing/status");
-
-   debDpkgDB Db;
-   
-   {
-      OpTextProgress Prog;
-      
-      if (Db.ReadyPkgCache(Prog) == false)
-	 cerr << "Error!" << endl;
-      Prog.Done();
-      
-      if (Db.ReadyFileList(Prog) == false)
-	 cerr << "Error!" << endl;
-   }
-   
-   if (_error->PendingError() == true)
-   {
-      _error->DumpErrors();
-      return 0;
-   }
-   
-/*   Db.GetFLCache().BeginDiverLoad();
-   pkgFLCache::PkgIterator Pkg(Db.GetFLCache(),0);
-   if (Db.GetFLCache().AddDiversion(Pkg,"/usr/include/linux/kerneld.h","/usr/bin/nslookup") == false)
-      cerr << "Error!" << endl;
-
-   const char *Tmp = "/usr/include/linux/kerneld.h";
-   pkgFLCache::NodeIterator Nde = Db.GetFLCache().GetNode(Tmp,Tmp+strlen(Tmp),0,false,false);
-   map_ptrloc Loc = Nde->File;
-      
-   for (; Nde.end() == false && Nde->File == Loc; Nde++)
-      cout << Nde->Flags << ',' << Nde->Pointer << ',' << Nde.File() << endl;
-   Db.GetFLCache().FinishDiverLoad();*/
-
-/*   unsigned int I = 0;
-   pkgFLCache &Fl = Db.GetFLCache();
-   while (I < Fl.HeaderP->HashSize)
-   {
-      cout << I << endl;
-      pkgFLCache::NodeIterator Node(Fl,Fl.NodeP + Fl.HeaderP->FileHash + I++);
-      if (Node->Pointer == 0)
-	 continue;
-      for (; Node.end() == false; Node++)
-      {
-	 cout << Node.DirN() << '/' << Node.File();
-	 if (Node->Flags == pkgFLCache::Node::Diversion)
-	    cout << " (div)";
-	 if (Node->Flags == pkgFLCache::Node::ConfFile)
-	    cout << " (conf)";
-	 cout << endl;
-      }
-   }*/
-
-   for (int I = 1; I < argc; I++)
-   {
-      FileFd F(argv[I],FileFd::ReadOnly);
-      debDebFile Deb(F);
-      
-      if (Deb.ExtractControl(Db) == false)
-	 cerr << "Error!" << endl;
-      cout << argv[I] << endl;
-      
-      pkgCache::VerIterator Ver = Deb.MergeControl(Db);
-      if (Ver.end() == true)
-	 cerr << "Failed" << endl;
-      else
-	 cout << Ver.ParentPkg().Name() << ' ' << Ver.VerStr() << endl;
-      
-      pkgExtract Extract(Db.GetFLCache(),Ver);
-      Deb.ExtractArchive(Extract);
-   }
-//   #endif
-//#endif      
-   _error->DumpErrors();
-}

+ 0 - 235
test/test-indexes.sh

@@ -1,235 +0,0 @@
-#!/bin/sh -e
-
-# Test behaviour of index retrieval and usage, in particular with uncompressed
-# and gzip compressed indexes.
-# Author: Martin Pitt <martin.pitt@ubuntu.com>
-# (C) 2010 Canonical Ltd.
-
-BUILDDIR=$(readlink -f $(dirname $0)/../build)
-
-TEST_SOURCE="http://ftp.debian.org/debian unstable contrib"
-GPG_KEYSERVER=gpg-keyserver.de
-# should be a small package with dependencies satisfiable in TEST_SOURCE, i. e.
-# ideally no depends at all
-TEST_PKG="python-psyco-doc"
-
-export LD_LIBRARY_PATH=$BUILDDIR/bin
-
-OPTS="-qq -o Dir::Bin::Methods=$BUILDDIR/bin/methods -o Debug::NoLocking=true"
-DEBUG=""
-#DEBUG="-o Debug::pkgCacheGen=true"
-#DEBUG="-o Debug::pkgAcquire=true"
-APT_GET="$BUILDDIR/bin/apt-get $OPTS $DEBUG"
-APT_CACHE="$BUILDDIR/bin/apt-cache $OPTS $DEBUG"
-APT_FTPARCHIVE="$BUILDDIR/bin/apt-ftparchive"
-
-[ -x "$BUILDDIR/bin/apt-get" ] || {
-    echo "please build the tree first" >&2
-    exit 1
-}
-
-check_update() {
-    echo "--- apt-get update $@ (no trusted keys)"
-
-    rm -f etc/apt/trusted.gpg etc/apt/secring.gpg
-    touch etc/apt/trusted.gpg etc/apt/secring.gpg
-    find var/lib/apt/lists/ -type f | xargs -r rm
-
-    # first attempt should fail, no trusted GPG key
-    out=$($APT_GET "$@" update 2>&1)
-    echo "$out" | grep -q NO_PUBKEY
-    key=$(echo "$out" | sed -n '/NO_PUBKEY/ { s/^.*NO_PUBKEY \([[:alnum:]]\+\)$/\1/; p}')
-
-    # get keyring
-    gpg -q --no-options --no-default-keyring --secret-keyring etc/apt/secring.gpg --trustdb-name etc/apt/trustdb.gpg --keyring etc/apt/trusted.gpg --primary-keyring etc/apt/trusted.gpg --keyserver $GPG_KEYSERVER --recv-keys $key
-
-    # now it should work
-    echo "--- apt-get update $@ (with trusted keys)"
-    find var/lib/apt/lists/ -type f | xargs -r rm
-    $APT_GET "$@" update
-}
-
-# if $1 == "compressed", check that we have compressed indexes, otherwise
-# uncompressed ones
-check_indexes() {
-    echo "--- only ${1:-uncompressed} index files present"
-    local F
-    if [ "$1" = "compressed" ]; then
-	! test -e var/lib/apt/lists/*_Packages || F=1
-	! test -e var/lib/apt/lists/*_Sources || F=1
-	test -e var/lib/apt/lists/*_Packages.gz || F=1
-	test -e var/lib/apt/lists/*_Sources.gz || F=1
-    else
-	test -e var/lib/apt/lists/*_Packages || F=1
-	test -e var/lib/apt/lists/*_Sources || F=1
-	! test -e var/lib/apt/lists/*_Packages.gz || F=1
-	! test -e var/lib/apt/lists/*_Sources.gz || F=1
-    fi
-
-    if [ -n "$F" ]; then
-	ls -laR var/lib/apt/lists/
-	exit 1
-    fi
-}
-
-# test apt-cache commands
-check_cache() {
-    echo "--- apt-cache commands"
-
-    $APT_CACHE show $TEST_PKG | grep -q ^Version:
-    # again (with cache)
-    $APT_CACHE show $TEST_PKG | grep -q ^Version:
-    rm var/cache/apt/*.bin
-    $APT_CACHE policy $TEST_PKG | egrep -q '500 (http://|file:/)'
-    # again (with cache)
-    $APT_CACHE policy $TEST_PKG | egrep -q '500 (http://|file:/)'
-
-    TEST_SRC=`$APT_CACHE show $TEST_PKG | grep ^Source: | awk '{print $2}'`
-    rm var/cache/apt/*.bin
-    $APT_CACHE showsrc $TEST_SRC | grep -q ^Binary:
-    # again (with cache)
-    $APT_CACHE showsrc $TEST_SRC | grep -q ^Binary:
-}
-
-# test apt-get install
-check_install() {
-    echo "--- apt-get install"
-
-    $APT_GET install -d $TEST_PKG 
-    test -e var/cache/apt/archives/$TEST_PKG*.deb
-    $APT_GET clean
-    ! test -e var/cache/apt/archives/$TEST_PKG*.deb
-}
-
-# test apt-get source
-check_get_source() {
-    echo "--- apt-get source"
-    # quiesce: it'll complain about not being able to verify the signature
-    $APT_GET source $TEST_PKG >/dev/null 2>&1
-    test -f $TEST_SRC_*.dsc
-    test -d $TEST_SRC-*
-    rm -r $TEST_SRC*
-}
-
-############################################################################
-# main
-############################################################################
-
-echo "===== building sandbox ====="
-WORKDIR=$(mktemp -d)
-trap "cd /; rm -rf $WORKDIR" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
-cd $WORKDIR
-
-rm -fr etc var
-rm -f home
-ln -s /home home
-mkdir -p etc/apt/preferences.d etc/apt/trusted.gpg.d etc/apt/apt.conf.d var/cache/apt/archives/partial var/lib/apt/lists/partial var/lib/dpkg
-cp /etc/apt/trusted.gpg etc/apt
-touch var/lib/dpkg/status
-echo "deb $TEST_SOURCE" > etc/apt/sources.list
-echo "deb-src $TEST_SOURCE" >> etc/apt/sources.list
-
-# specifying -o RootDir at the command line does not work for
-# etc/apt/apt.conf.d/ since it is parsed after pkgInitConfig(); $APT_CONFIG is
-# checked first, so this works
-echo "RootDir \"$WORKDIR\";" > apt_config
-export APT_CONFIG=`pwd`/apt_config
-
-echo "==== no indexes ===="
-echo '--- apt-get check works without indexes'
-[ -z `$APT_GET check` ]
-echo '--- apt-cache policy works without indexes'
-$APT_CACHE policy bash >/dev/null
-echo '--- apt-cache show works without indexes'
-! LC_MESSAGES=C $APT_CACHE show bash 2>&1| grep -q 'E: No packages found'
-
-echo "===== uncompressed indexes ====="
-echo 'Acquire::GzipIndexes "false";' > etc/apt/apt.conf.d/02compress-indexes
-check_update
-check_indexes
-check_cache
-check_install
-check_get_source
-
-echo "--- apt-get update with preexisting indexes"
-$APT_GET update
-check_indexes
-check_cache
-
-echo "--- apt-get update with preexisting indexes and pdiff mode"
-$APT_GET -o Acquire::PDiffs=true update
-check_indexes
-check_cache
-
-echo "===== compressed indexes (CLI option) ====="
-check_update -o Acquire::GzipIndexes=true
-check_indexes compressed
-check_cache
-check_install
-check_get_source
-
-echo "--- apt-get update with preexisting indexes"
-$APT_GET -o Acquire::GzipIndexes=true update
-check_indexes compressed
-check_cache
-
-echo "--- apt-get update with preexisting indexes and pdiff mode"
-$APT_GET -o Acquire::GzipIndexes=true -o Acquire::PDiffs=true update
-check_indexes compressed
-check_cache
-
-echo "===== compressed indexes (apt.conf.d option) ====="
-cat <<EOF > etc/apt/apt.conf.d/02compress-indexes
-Acquire::GzipIndexes "true";
-Acquire::CompressionTypes::Order:: "gz";
-EOF
-
-check_update
-check_indexes compressed
-check_cache
-check_install
-check_get_source
-
-echo "--- apt-get update with preexisting indexes"
-$APT_GET update
-check_indexes compressed
-check_cache
-
-echo "--- apt-get update with preexisting indexes and pdiff mode"
-$APT_GET -o Acquire::PDiffs=true update
-check_indexes compressed
-check_cache
-
-rm etc/apt/apt.conf.d/02compress-indexes
-
-echo "==== apt-ftparchive ===="
-mkdir arch
-$APT_GET install -d $TEST_PKG 
-cp var/cache/apt/archives/$TEST_PKG*.deb arch/
-cd arch
-$APT_GET source -d $TEST_PKG >/dev/null 2>&1
-$APT_FTPARCHIVE packages . | gzip -9 > Packages.gz
-$APT_FTPARCHIVE sources . | gzip -9 > Sources.gz
-cd ..
-
-echo "deb file://$WORKDIR/arch /
-deb-src file://$WORKDIR/arch /" > etc/apt/sources.list
-$APT_GET clean
-
-echo "==== uncompressed indexes from local file:// archive ===="
-echo "--- apt-get update"
-$APT_GET update
-check_indexes
-check_cache
-check_get_source
-
-echo "==== compressed indexes from local file:// archive ===="
-echo "--- apt-get update"
-$APT_GET -o Acquire::GzipIndexes=true update
-# EXFAIL: file:/ URIs currently decompress even with above option
-#check_indexes compressed
-check_indexes
-check_cache
-check_get_source
-
-echo "===== ALL TESTS PASSED ====="

Разлика између датотеке није приказан због своје велике величине
+ 0 - 1182
test/testkeys/mvo.key


+ 0 - 2
test/testsources.list/sources.list.all-gpg-broken

@@ -1,2 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/gpg-package-broken/ /
-

+ 0 - 2
test/testsources.list/sources.list.all-gpg-ok

@@ -1,2 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/gpg-package-ok/ /
-

+ 0 - 1
test/testsources.list/sources.list.all-release-broken

@@ -1 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/all-release-broken/ /

+ 0 - 1
test/testsources.list/sources.list.all-release-ok

@@ -1 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/all-release-ok/ /

+ 0 - 1
test/testsources.list/sources.list.all-validuntil-broken

@@ -1 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/all-validuntil-broken/ /

+ 0 - 2
test/testsources.list/sources.list.md5-package-broken

@@ -1,2 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/md5-package-broken/ /
-

+ 0 - 2
test/testsources.list/sources.list.md5-package-ok

@@ -1,2 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/md5-package-ok/ /
-

+ 0 - 1
test/testsources.list/sources.list.md5-release-broken

@@ -1 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/md5-release-broken/ /

+ 0 - 1
test/testsources.list/sources.list.md5-release-ok

@@ -1 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/md5-release-ok/ /

+ 0 - 1
test/testsources.list/sources.list.sha1-release-broken

@@ -1 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/sha1-release-broken/ /

+ 0 - 1
test/testsources.list/sources.list.sha1-release-ok

@@ -1 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/sha1-release-ok/ /

+ 0 - 2
test/testsources.list/sources.list.sha256-package-broken

@@ -1,2 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/sha256-package-broken/ /
-

+ 0 - 2
test/testsources.list/sources.list.sha256-package-ok

@@ -1,2 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/sha256-package-ok/ /
-

+ 0 - 1
test/testsources.list/sources.list.sha256-release-broken

@@ -1 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/sha256-release-broken/ /

+ 0 - 1
test/testsources.list/sources.list.sha256-release-ok

@@ -1 +0,0 @@
-deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/sha256-release-ok/ /