Author: jkupec
Date: Sun Oct 12 01:44:06 2008
New Revision: 11304
URL: http://svn.opensuse.org/viewcvs/zypp?rev=11304&view=rev
Log:
- use TestSetup instead of direct use of .solv files
Added:
trunk/libzypp/tests/data/OBS:VirtualBox-11.1/
trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/
trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/primary.xml.gz (with props)
trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/repomd.xml
trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/repomd.xml.asc
trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/repomd.xml.key
trunk/libzypp/tests/data/OBS:zypp:svn-11.1/
trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/
trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/primary.xml.gz (with props)
trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/repomd.xml
trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/repomd.xml.asc
trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/repomd.xml.key
Removed:
trunk/libzypp/tests/zypp/data/PoolQuery/@System.solv
trunk/libzypp/tests/zypp/data/PoolQuery/factory-nonoss.solv
trunk/libzypp/tests/zypp/data/PoolQuery/factory.solv
trunk/libzypp/tests/zypp/data/PoolQuery/foo.solv
trunk/libzypp/tests/zypp/data/PoolQuery/python.solv
trunk/libzypp/tests/zypp/data/PoolQuery/zypp_svn.solv
Modified:
trunk/libzypp/tests/sat/Solvable_test.cc
trunk/libzypp/tests/zypp/Locks_test.cc
trunk/libzypp/tests/zypp/PoolQuery_test.cc
trunk/libzypp/tests/zypp/data/PoolQuery/savedqueries
Added: trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/primary.xml.gz
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/data/OBS%3AVirtualBox-11.1/repodata/primary.xml.gz?rev=11304&view=auto
==============================================================================
Binary file - no diff available.
Added: trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/repomd.xml
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/data/OBS%3AVirtualBox-11.1/repodata/repomd.xml?rev=11304&view=auto
==============================================================================
--- trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/repomd.xml (added)
+++ trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/repomd.xml Sun Oct 12 01:44:06 2008
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<repomd xmlns="http://linux.duke.edu/metadata/repo">
+ <data type="other">
+ <location href="repodata/other.xml.gz"/>
+ <checksum type="sha">580103a6b945e1830565121199acbdad45437c7f</checksum>
+ <timestamp>1223588080</timestamp>
+ <open-checksum type="sha">2d2604f11a697bc443b3c9999d630897138168ad</open-checksum>
+ </data>
+ <data type="filelists">
+ <location href="repodata/filelists.xml.gz"/>
+ <checksum type="sha">e8696a3badb8419500de7e1618585d6272912a99</checksum>
+ <timestamp>1223588080</timestamp>
+ <open-checksum type="sha">91d3e517317bcd686a5ec1e88abd63b6fb7619da</open-checksum>
+ </data>
+ <data type="primary">
+ <location href="repodata/primary.xml.gz"/>
+ <checksum type="sha">fc0f951db57c5b767887190bf99e479692b1c407</checksum>
+ <timestamp>1223588080</timestamp>
+ <open-checksum type="sha">a0015ff42e9822c16990b23a9cb08e026b4afdf9</open-checksum>
+ </data>
+</repomd>
Added: trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/repomd.xml.asc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/data/OBS%3AVirtualBox-11.1/repodata/repomd.xml.asc?rev=11304&view=auto
==============================================================================
--- trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/repomd.xml.asc (added)
+++ trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/repomd.xml.asc Sun Oct 12 01:44:06 2008
@@ -0,0 +1,7 @@
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.0.7 (GNU/Linux)
+
+iD8DBQBI7njy+FLjwVdyGmYRAh6pAJ4zinB1Qa04keOTZET1/KTWRQcdqACf
+WulP6OHLt3n1fuHPRQRYUmUgeaU=
+=GveQ
+-----END PGP SIGNATURE-----
Added: trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/repomd.xml.key
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/data/OBS%3AVirtualBox-11.1/repodata/repomd.xml.key?rev=11304&view=auto
==============================================================================
--- trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/repomd.xml.key (added)
+++ trunk/libzypp/tests/data/OBS:VirtualBox-11.1/repodata/repomd.xml.key Sun Oct 12 01:44:06 2008
@@ -0,0 +1,20 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.5 (GNU/Linux)
+
+mQGiBEeWVjIRBACUzcPOeJfTB0/AbBdlmZqfGca/YwPdg7PXB1zBkfuH/YSDDgTo
+4BesZigfcgIyO+3KCyPZ0P+5pO3RIdmIyMGndhKsSTb+sX0utPYvsJlMDmo2lHm3
+i26st2DZLESKOtfpeyeXrZHTL1loAyUy0IHpTD6pmtgnBLr7SNkcGb2oJwCgxMvG
+ArBVVG5+R6r8gXJ5NxAH+rUEAIOYuwl8RwmFHvVMg/swDl+YTXqhM7BOyieY4HzR
+hhm+OKOkMFqSMudReHvX+jwtpUduN8GiTZq0QaWTF1WUZLQhn+Q+4oRjOWnIKiwl
+RRQisrn4cVJtzLQojCh6JBcIobNCexAUCMMoC0dGB5LGxfx8eKKuytzPooMYpfzV
+78QmA/49WMDc5wLyobhchFzm4cQmk7SYGaTFbAnkF6IBgIEOfQGkQCSMcKlLNYfB
+kgJr8FMeakkeExrXKsvmL5U8stwtLgRqYhBYgEE/1ZS2MGDLB0nzaEVfovvTYn6B
+n4o34KE/l6RaXUsxcyL0sbZ6BOG1MgKWLjlKkn9xI77m9jR5HbRUVmlydHVhbGl6
+YXRpb246VmlydHVhbEJveCBPQlMgUHJvamVjdCA8VmlydHVhbGl6YXRpb246Vmly
+dHVhbEJveEBidWlsZC5vcGVuc3VzZS5vcmc+iGYEExECACYFAkeWVjICGwMFCQQe
+sAAGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRD4UuPBV3IaZrrMAJ0aJsQOUt+s
+efyWCGh3MefGjBEUFACdEixxBrtbVss3yILYjJbzlUwhp1GIRgQTEQIABgUCR5ZW
+MgAKCRA7MBG3a51lI3O8AJ9vv441rs2ZR8pHL2EEmvegbAMPTwCeJJUbs14J5Wlr
+zqyZAhXnXWJnldY=
+=elkz
+-----END PGP PUBLIC KEY BLOCK-----
Added: trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/primary.xml.gz
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/data/OBS%3Azypp%3Asvn-11.1/repodata/primary.xml.gz?rev=11304&view=auto
==============================================================================
Binary file - no diff available.
Added: trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/repomd.xml
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/data/OBS%3Azypp%3Asvn-11.1/repodata/repomd.xml?rev=11304&view=auto
==============================================================================
--- trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/repomd.xml (added)
+++ trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/repomd.xml Sun Oct 12 01:44:06 2008
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<repomd xmlns="http://linux.duke.edu/metadata/repo">
+ <data type="other">
+ <location href="repodata/other.xml.gz"/>
+ <checksum type="sha">734543b9cb748334925d6fac1a1f2f3f5b5dffd1</checksum>
+ <timestamp>1223586019</timestamp>
+ <open-checksum type="sha">97bd7432a1c6b1b44b9ca1f52b9a18979c72a9ba</open-checksum>
+ </data>
+ <data type="filelists">
+ <location href="repodata/filelists.xml.gz"/>
+ <checksum type="sha">722956718221845366d4572fe5649a268cb93920</checksum>
+ <timestamp>1223586019</timestamp>
+ <open-checksum type="sha">e9edadbe3063f4ae8c97667f67d31a192eadc427</open-checksum>
+ </data>
+ <data type="primary">
+ <location href="repodata/primary.xml.gz"/>
+ <checksum type="sha">f586852ceffd230cd6e7b15a880494a9e2f7a8a5</checksum>
+ <timestamp>1223586019</timestamp>
+ <open-checksum type="sha">c9e4113751d71ea413fe4564f1f0e94e2cda9bec</open-checksum>
+ </data>
+</repomd>
Added: trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/repomd.xml.asc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/data/OBS%3Azypp%3Asvn-11.1/repodata/repomd.xml.asc?rev=11304&view=auto
==============================================================================
--- trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/repomd.xml.asc (added)
+++ trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/repomd.xml.asc Sun Oct 12 01:44:06 2008
@@ -0,0 +1,7 @@
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.0.7 (GNU/Linux)
+
+iD8DBQBI7nDkyW8T9xlZ+8sRAolAAKCgHtH/tQVLIIM1k3SAo8EMMSe+7QCg
+ylO1hOqgWrRGrF+JovkE7akc4XI=
+=XnSD
+-----END PGP SIGNATURE-----
Added: trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/repomd.xml.key
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/data/OBS%3Azypp%3Asvn-11.1/repodata/repomd.xml.key?rev=11304&view=auto
==============================================================================
--- trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/repomd.xml.key (added)
+++ trunk/libzypp/tests/data/OBS:zypp:svn-11.1/repodata/repomd.xml.key Sun Oct 12 01:44:06 2008
@@ -0,0 +1,19 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.5 (GNU/Linux)
+
+mQGiBEeWW2sRBAC6p0M82A5kapMTPpn9MQ0w++cEHC4cKRGKe4ysJiGEOKcl8wmE
+buiiYOZKLvuFoyPDyyB/KPQ56nE/sEwJAsssXpMJ3EeSF5Px2qresY7Ralowozc5
+8WF2Btq90RNqIhfjAEpTmiDpn9g7fIn9YAzwh6md2i7BemKBEfNkVrVYNwCgy5bg
+9fSyOa4mr7HldiIAdNsPFLsD/0e8GhiSxD8xV3o7dchf8jMEgAv7gAbP1lGsbZQG
+dSsyODycr0PabGY3XVkNBb6NPdEcm63crsKeVltG455NL4WgkULaJDnDNtU1SGui
+AlAqEjXXR9dOCgVMs7lfpaF55cerUwGjGGMnZpGbzVClHZubwZrWV9h7O+9ln7Lu
+/W3mBACKfr68onKxCxmFEadAYEXtnJ/9Yk58rsD2V05rV+1SYCrybOTM/Hhjt5PZ
+WwXyfCwla43ljVGdIO2Rde8o6UIzbM49F04OC97HMzyGyUd2EiXfDtF4j5y+caoq
+9mZaXl2hiu4YSjNGEFGBelOS1YwBefnytgFV9nyWU+9E1iqDjLQyenlwcDpzdm4g
+T0JTIFByb2plY3QgPHp5cHA6c3ZuQGJ1aWxkLm9wZW5zdXNlLm9yZz6IZgQTEQIA
+JgUCR5ZbawIbAwUJBB6wAAYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEMlvE/cZ
+WfvLxR0AnRRinTmsd2B7Db6eruYX40smjwnrAJ4iIFZQXD/qMEGsSr0GfCgvhmGe
+94hGBBMRAgAGBQJHlltrAAoJEDswEbdrnWUjQqAAn1QYRSp5S0NrCknsvvWbGmhI
+jR0SAKCwuY8a+dKLOdrhV+520EhUsYU6+Q==
+=7eFk
+-----END PGP PUBLIC KEY BLOCK-----
Modified: trunk/libzypp/tests/sat/Solvable_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/sat/Solvable_test.cc?rev=11304&r1=11303&r2=11304&view=diff
==============================================================================
--- trunk/libzypp/tests/sat/Solvable_test.cc (original)
+++ trunk/libzypp/tests/sat/Solvable_test.cc Sun Oct 12 01:44:06 2008
@@ -5,9 +5,10 @@
#include
#include "zypp/base/Logger.h"
#include "zypp/base/Easy.h"
-#include "zypp/ZYppFactory.h"
#include "zypp/Pattern.h"
#include "zypp/sat/Solvable.h"
+#include "TestSetup.h"
+
#define BOOST_TEST_MODULE Solvable
@@ -18,23 +19,17 @@
using namespace boost::unit_test;
-static void init_pool()
+BOOST_AUTO_TEST_CASE(test_init)
{
- Pathname dir(TESTS_SRC_DIR);
- dir += "/zypp/data/PoolQuery";
-
- ZYpp::Ptr z = getZYpp();
- ZConfig::instance().setSystemArchitecture(Arch("i586"));
-
- RepoInfo i1; i1.setAlias("factory");
- sat::Pool::instance().addRepoSolv(dir / "factory.solv", i1);
+ TestSetup test( Arch_x86_64 );
+ test.loadRepo( TESTS_SRC_DIR "/data/openSUSE-11.1", "opensuse" );
}
+
BOOST_AUTO_TEST_CASE(attributes)
{
- init_pool();
MIL << sat::Pool::instance();
- Repository r = sat::Pool::instance().reposFind("factory");
+ Repository r = sat::Pool::instance().reposFind("opensuse");
int c = 0;
@@ -74,7 +69,7 @@
BOOST_CHECK_EQUAL(p->vendor(), "SUSE LINUX Products GmbH, Nuernberg, Germany");
BOOST_CHECK_EQUAL(p->category(), "Base Technologies");
BOOST_CHECK_EQUAL(p->summary(), "Novell AppArmor");
- BOOST_CHECK_EQUAL(p->icon(), "yast-software");
+ BOOST_CHECK_EQUAL(p->icon(), "pattern-apparmor");
BOOST_CHECK_EQUAL(p->userVisible(), true);
BOOST_CHECK_EQUAL(p->isDefault(), false);
}
Modified: trunk/libzypp/tests/zypp/Locks_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/Locks_test.cc?rev=11304&r1=11303&r2=11304&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/Locks_test.cc (original)
+++ trunk/libzypp/tests/zypp/Locks_test.cc Sun Oct 12 01:44:06 2008
@@ -4,11 +4,11 @@
#include
#include <list>
-#include "zypp/ZYppFactory.h"
#include "zypp/PoolQuery.h"
#include "zypp/PoolQueryUtil.tcc"
#include "zypp/TmpPath.h"
#include "zypp/Locks.h"
+#include "TestSetup.h"
#define BOOST_TEST_MODULE Locks
@@ -26,25 +26,15 @@
return false;
}
-static void init_pool()
-{
- Pathname dir(TESTS_SRC_DIR);
- dir += "/zypp/data/PoolQuery";
-
- ZYpp::Ptr z = getZYpp();
- ZConfig::instance().setSystemArchitecture(Arch("i586"));
-
- RepoInfo i1; i1.setAlias("factory");
- sat::Pool::instance().addRepoSolv(dir / "factory.solv", i1);
- RepoInfo i2; i2.setAlias("@System");
- sat::Pool::instance().addRepoSolv(dir / "@System.solv", i2);
-}
-
BOOST_AUTO_TEST_CASE(pool_query_init)
{
- init_pool();
+ TestSetup test( Arch_x86_64 );
+ //test.loadTarget(); // initialize and load target
+ test.loadRepo( TESTS_SRC_DIR "/data/openSUSE-11.1", "opensuse" );
+ test.loadRepo( TESTS_SRC_DIR "/data/OBS:zypp:svn-11.1", "@System" );
}
+
/////////////////////////////////////////////////////////////////////////////
// 0xx basic queries
/////////////////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/tests/zypp/PoolQuery_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/PoolQuery_test.cc?rev=11304&r1=11303&r2=11304&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/PoolQuery_test.cc (original)
+++ trunk/libzypp/tests/zypp/PoolQuery_test.cc Sun Oct 12 01:44:06 2008
@@ -4,10 +4,10 @@
#include
#include <list>
-#include "zypp/ZYppFactory.h"
+//#include "zypp/ZYppFactory.h"
#include "zypp/PoolQuery.h"
#include "zypp/PoolQueryUtil.tcc"
-#include "zypp/TmpPath.h"
+#include "TestSetup.h"
#define BOOST_TEST_MODULE PoolQuery
@@ -33,6 +33,7 @@
unsigned _count;
};
+/*
static void init_pool()
{
Pathname dir(TESTS_SRC_DIR);
@@ -50,16 +51,21 @@
RepoInfo i4; i4.setAlias("@System");
sat::Pool::instance().addRepoSolv(dir / "@System.solv", i4);
}
+*/
BOOST_AUTO_TEST_CASE(pool_query_init)
{
- init_pool();
+ TestSetup test( Arch_x86_64 );
+ //test.loadTarget(); // initialize and load target
+ test.loadRepo( TESTS_SRC_DIR "/data/openSUSE-11.1", "opensuse" );
+ test.loadRepo( TESTS_SRC_DIR "/data/OBS:zypp:svn-11.1", "zyppsvn" );
+ test.loadRepo( TESTS_SRC_DIR "/data/OBS:VirtualBox-11.1", "vbox" );
}
#if 0
-BOOST_AUTO_TEST_CASE(pool_query_exp)
+BOOST_AUTO_TEST_CASE(pool_query_experiment)
{
- cout << "****exp****" << endl;
+ cout << "****experiment****" << endl;
PoolQuery q;
q.addString("zypper");
@@ -90,12 +96,11 @@
{
cout << "****000****" << endl;
PoolQuery q;
- //cout << q.size() << endl;
- BOOST_CHECK(q.size() == 11451);
- /**!\todo should be 11453 probably according to:
- * dumpsolv factory.solv factory-nonoss.solv zypp_svn.solv \@System.solv | \
- * grep '^name:.*\(noarch\|i386\|i586\|i686\|src\)$' | wc -l
- */
+ cout << q.size() << endl;
+ BOOST_CHECK(q.size() == 3811);
+
+ /* dumpsolv repo1.solv repo2.solv repo3.solv | \
+ grep '^name:.*\(noarch\|x86_64\|i386\|i586\|i686\|src\)$' | wc -l */
}
// default query + one search string
@@ -107,7 +112,7 @@
PoolQuery q;
q.addString("zypper");
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 16);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 10);
}
// default query + one attribute + one string
@@ -122,14 +127,14 @@
q.addString("zypper");
q.addAttribute(sat::SolvAttr::name);
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 6);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 5);
cout << endl;
PoolQuery q1;
q1.addAttribute(sat::SolvAttr::name, "zypper");
- BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 6);
+ BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 5);
}
// kind filter
@@ -153,7 +158,7 @@
q.addAttribute(sat::SolvAttr::name);
q.setMatchExact();
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 3);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 1);
PoolQuery q1;
q1.addString("zypp");
@@ -173,7 +178,7 @@
q.addAttribute(sat::SolvAttr::name);
q.setMatchGlob();
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 11);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 6);
cout << "****005.2****" << endl;
@@ -182,7 +187,7 @@
q1.addAttribute(sat::SolvAttr::name);
q1.setMatchGlob();
- BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 28);
+ BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 26);
cout << "****005.3****" << endl;
@@ -191,7 +196,7 @@
q2.addString("zypp");
q2.addAttribute(sat::SolvAttr::name);
- BOOST_CHECK(q2.size() == 28);
+ BOOST_CHECK(q2.size() == 26);
}
// use regex
@@ -205,7 +210,7 @@
q.addAttribute(sat::SolvAttr::name);
q.setMatchRegex();
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 11);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 6);
cout << "****006.2***" << endl;
@@ -214,7 +219,7 @@
q1.addAttribute(sat::SolvAttr::name);
q1.setMatchRegex();
- BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 21);
+ BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 8);
cout << "****006.3***" << endl;
@@ -236,10 +241,10 @@
q.addAttribute(sat::SolvAttr::name);
q.setMatchWord();
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 2);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 6);
}
-
+/*
// match by installed status (basically by system vs. repo)
BOOST_AUTO_TEST_CASE(pool_query_050)
{
@@ -262,7 +267,7 @@
BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 5);
}
-
+*/
/////////////////////////////////////////////////////////////////////////////
// 1xx multiple attribute queries
@@ -273,25 +278,25 @@
{
cout << "****100****" << endl;
PoolQuery q;
- /* This string is found sometimes only in solvable names (e.g. novell-lum),
- sometimes only in summary (e.g. yast2-casa-ats) and sometimes only
- in descriptions (e.g. beagle-quickfinder). novell-lum doesn't exist
- in our test solv file, but let's ignore this. I didn't find a string
- with the same characteristics giving fewer matches :-/ */
- q.addString("novell");
+ /* This string is found sometimes only in only in summary (e.g. pgcalc)
+ and sometimes only in description (e.g. bc, lftp). We don't have
+ any package with 'revers' only in package name, but let's ignore this.
+ I didn't find a string with the same characteristics giving fewer matches
+ :-/ */
+ q.addString("revers");
q.addAttribute(sat::SolvAttr::name);
q.addAttribute(sat::SolvAttr::summary);
q.addAttribute(sat::SolvAttr::description);
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 74);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 5);
cout << endl;
PoolQuery q1;
- q1.addString("mp3");
+ q1.addString("sat");
q1.addAttribute(sat::SolvAttr::name);
- BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 7);
+ BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 15);
}
@@ -301,23 +306,23 @@
cout << "****101****" << endl;
PoolQuery q;
- q.addString("ZYpp");
+ q.addString("RELAX");
q.addAttribute(sat::SolvAttr::name);
q.addAttribute(sat::SolvAttr::summary);
q.addAttribute(sat::SolvAttr::description);
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 30);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 7);
cout << endl;
PoolQuery q2;
- q2.addString("ZYpp");
+ q2.addString("RELAX");
q2.addAttribute(sat::SolvAttr::name);
q2.addAttribute(sat::SolvAttr::summary);
q2.addAttribute(sat::SolvAttr::description);
q2.setCaseSensitive();
- BOOST_CHECK(std::for_each(q2.begin(), q2.end(), PrintAndCount())._count == 2);
+ BOOST_CHECK(std::for_each(q2.begin(), q2.end(), PrintAndCount())._count == 4);
}
@@ -331,7 +336,7 @@
q.addAttribute(sat::SolvAttr::summary);
q.setMatchGlob();
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 35);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 23);
}
@@ -340,21 +345,20 @@
{
cout << "****103.1****" << endl;
PoolQuery q;
- q.addAttribute(sat::SolvAttr::name, "novell");
- q.addAttribute(sat::SolvAttr::summary, "novell");
+ q.addAttribute(sat::SolvAttr::name, "rest");
+ q.addAttribute(sat::SolvAttr::summary, "rest");
- //std::for_each(q.begin(), q.end(), cb);
- BOOST_CHECK(q.size() == 42);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 14);
cout << "****103.2****" << endl;
PoolQuery q1;
- q1.addString("novell");
+ q1.addString("rest");
q1.addAttribute(sat::SolvAttr::name);
q1.addAttribute(sat::SolvAttr::summary);
-// std::for_each(q1.begin(), q1.end(), cb);
- BOOST_CHECK(q1.size() == 42);
+ BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 14);
+// BOOST_CHECK(q1.size() == 42);
cout << endl;
}
@@ -364,10 +368,10 @@
{
cout << "****104****" << endl;
PoolQuery q;
- q.addAttribute(sat::SolvAttr::name, "novell");
+ q.addAttribute(sat::SolvAttr::name, "zypper");
q.addAttribute(sat::SolvAttr::summary, "package management");
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 22);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 8);
}
// multiple attributes, different search strings (one string per attrbute), regex matching
@@ -375,11 +379,11 @@
{
cout << "****105****" << endl;
PoolQuery q;
- q.addAttribute(sat::SolvAttr::name, "no.ell");
+ q.addAttribute(sat::SolvAttr::name, "zy..er");
q.addAttribute(sat::SolvAttr::summary, "package management");
q.setMatchRegex();
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 22);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 8);
}
/////////////////////////////////////////////////////////////////////////////
@@ -392,9 +396,9 @@
cout << "****300****" << endl;
PoolQuery q;
q.addAttribute(sat::SolvAttr::name, "zypper");
- q.addRepo("zypp_svn");
+ q.addRepo("zyppsvn");
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 3);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 4);
}
// default query + one repo
@@ -402,9 +406,9 @@
{
cout << "****301****" << endl;
PoolQuery q;
- q.addRepo("zypp_svn");
+ q.addRepo("zyppsvn");
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 21);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 42);
}
// multiple repos + one attribute
@@ -412,12 +416,12 @@
{
cout << "****302****" << endl;
PoolQuery q;
- q.addString("ma");
+ q.addString("zypper");
q.addAttribute(sat::SolvAttr::name);
- q.addRepo("factory-nonoss");
- q.addRepo("zypp_svn");
+ q.addRepo("opensuse");
+ q.addRepo("zyppsvn");
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 8);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 5);
}
/////////////////////////////////////////////////////////////////////////////
@@ -445,7 +449,7 @@
q.addAttribute(sat::SolvAttr::name);
q.setMatchGlob();
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 8);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 4);
}
@@ -459,46 +463,46 @@
cout << "****500.1****" << endl;
PoolQuery q;
q.addString("zypper");
- q.addString("apt");
+ q.addString("yast2-packager");
q.addAttribute(sat::SolvAttr::name);
q.setMatchExact();
// creates: ^(apt|zypper)$
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 8);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 6);
cout << "****500.2****" << endl;
- q.addString("*zy?p");
+ q.addString("*bzypp");
q.setMatchGlob();
- // creates: ^(.*zy.p|apt|zypper)$
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 16);
+ // creates: ^(.*zy.p|yast.*package.*|.*bzypp)$
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 11);
cout << "****500.3****" << endl;
PoolQuery q1;
q1.addString("^libsm[a-z]*[0-9]$");
- q1.addAttribute(sat::SolvAttr::name, "os.libs$");
+ q1.addAttribute(sat::SolvAttr::name, "bzypp$");
q1.addKind(ResKind::package);
q1.setMatchRegex();
- // creates: (^libsm[a-z]*[0-9]$|os.libs$)
- BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 3);
+ // creates: (^libsm[a-z]*[0-9]$|bzypp$)
+ BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 5);
cout << "****500.4****" << endl;
PoolQuery q2;
- q2.addString("thunder");
+ q2.addString("Thunder");
q2.addAttribute(sat::SolvAttr::name, "sun");
q2.addKind(ResKind::package);
- q2.addRepo("factory");
+ q2.addRepo("opensuse");
q2.setCaseSensitive();
- // creates: (sun|thunder)
- BOOST_CHECK(std::for_each(q2.begin(), q2.end(), PrintAndCount())._count == 2);
+ // creates: (sun|Thunder)
+ BOOST_CHECK(std::for_each(q2.begin(), q2.end(), PrintAndCount())._count == 3);
cout << "****500.5****" << endl;
PoolQuery q3;
- q3.addString("zypp");
+ q3.addString("audio");
q3.addAttribute(sat::SolvAttr::name, "zip");
q3.addKind(ResKind::package);
- q3.addRepo("factory");
+ q3.addRepo("opensuse");
q3.setMatchWord();
- // creates: \b(zip|zypp)\b
- BOOST_CHECK(std::for_each(q3.begin(), q3.end(), PrintAndCount())._count == 4);
+ // creates: \b(zip|audio)\b
+ BOOST_CHECK(std::for_each(q3.begin(), q3.end(), PrintAndCount())._count == 3);
}
// multiple strings, multiple attributes, same strings
@@ -506,12 +510,12 @@
{
cout << "****501****" << endl;
PoolQuery q;
- q.addString("thunder");
+ q.addString("Thunder");
q.addString("storm");
q.addAttribute(sat::SolvAttr::name);
q.addAttribute(sat::SolvAttr::description);
q.addKind(ResKind::package);
- q.addRepo("factory");
+ q.addRepo("opensuse");
BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 14);
}
@@ -525,9 +529,9 @@
q.addAttribute(sat::SolvAttr::name, "thunder");
q.addAttribute(sat::SolvAttr::description, "storm");
q.addKind(ResKind::package);
- q.addRepo("factory");
+ q.addRepo("opensuse");
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 14);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 13);
}
/////////////////////////////////////////////////////////////////////////////
@@ -540,24 +544,24 @@
PoolQuery q;
q.addAttribute(sat::SolvAttr::name, "zypper");
q.setMatchExact();
- q.setEdition(Edition("0.10.5"), Rel::GT);
+ q.setEdition(Edition("0.12.5"), Rel::GT);
BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 4);
cout << "****600.2****" << endl;
- q.setEdition(Edition("0.10.5"), Rel::LT);
+ q.setEdition(Edition("0.12.5"), Rel::LT);
BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 0);
cout << "****600.3****" << endl;
- q.setEdition(Edition("0.10.5"), Rel::LE);
+ q.setEdition(Edition("0.12.5"), Rel::LE);
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 2);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 1);
cout << "****600.4****" << endl;
- q.setEdition(Edition("0.10.5-5"), Rel::LT);
+ q.setEdition(Edition("0.12.5-5"), Rel::LT);
- BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 2);
+ BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 1);
}
//! \todo FIXME this segfaults currently - one addString() + (version or kind or installed status condition)
@@ -592,21 +596,23 @@
Pathname testfile(TESTS_SRC_DIR);
testfile += "/zypp/data/PoolQuery/savedqueries";
cout << "****recovery****" << endl;
+
std::vector<PoolQuery> queries;
std::insert_iterator ii( queries,queries.begin());
readPoolQueriesFromFile(testfile,ii);
- BOOST_REQUIRE_MESSAGE(queries.size()==2,"Bad count of read queries.");
- BOOST_CHECK(queries[0].size() == 8);
+ BOOST_REQUIRE_MESSAGE(queries.size() == 2, "Bad count of read queries.");
+ BOOST_CHECK(queries[0].size() == 10);
+
PoolQuery q;
q.addString("ma*");
- q.addRepo("factory");
+ q.addRepo("opensuse");
q.addKind(ResKind::patch);
q.setMatchRegex();
q.setRequireAll();
q.setCaseSensitive();
q.setUninstalledOnly();
q.setEdition(Edition("0.8.3"),Rel::NE);
- BOOST_CHECK(q==queries[1]);
+ BOOST_CHECK(q == queries[1]);
}
#endif
@@ -618,13 +624,14 @@
q.addAttribute(sat::SolvAttr::name);
q.addRepo("factory-nonoss");
q.addRepo("zypp_svn");
+
PoolQuery q2;
q2.addAttribute(sat::SolvAttr::name,"ma");
q2.addRepo("factory-nonoss");
q2.addRepo("zypp_svn");
-// Pathname testfile(TESTS_SRC_DIR);
+ // Pathname testfile(TESTS_SRC_DIR);
// testfile += "/zypp/data/PoolQuery/testqueries";
filesystem::TmpFile testfile;
cout << "****serialize****" << endl;
@@ -636,12 +643,11 @@
std::insert_iterator ii( queries,queries.end());
readPoolQueriesFromFile(testfile,ii);
- BOOST_REQUIRE_MESSAGE(queries.size()==4,"Bad count of writed/readed queries.");
+ BOOST_REQUIRE_MESSAGE(queries.size()==4,"Bad count of written/readed queries.");
BOOST_CHECK(queries[2] == queries[0]);
BOOST_CHECK(queries[3] == queries[1]);
}
-
// test matching
BOOST_AUTO_TEST_CASE(pool_query_equal)
{
Modified: trunk/libzypp/tests/zypp/data/PoolQuery/savedqueries
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/data/PoolQuery/savedqueries?rev=11304&r1=11303&r2=11304&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/data/PoolQuery/savedqueries (original)
+++ trunk/libzypp/tests/zypp/data/PoolQuery/savedqueries Sun Oct 12 01:44:06 2008
@@ -1,9 +1,9 @@
-solvable_name: ma
-repo: factory-nonoss
-repo: zypp_svn
+solvable_name: tool
+repo: vbox
+repo: zyppsvn
query_string: ma*
-repo: factory
+repo: opensuse
type: patch
match_type: regex
require_all: on
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org