Mailinglist Archive: zypp-commit (500 mails)

< Previous Next >
[zypp-commit] r5961 - in /branches/REFACTORING-10_3/libzypp/tests/cache: CMakeLists.txt CacheStore_test.cc
  • From: dmacvicar@xxxxxxxxxxxxxxxx
  • Date: Tue, 10 Jul 2007 18:27:30 -0000
  • Message-id: <20070710182730.AFAD326990@xxxxxxxxxxxxxxxx>
Author: dmacvicar
Date: Tue Jul 10 20:27:30 2007
New Revision: 5961

URL: http://svn.opensuse.org/viewcvs/zypp?rev=5961&view=rev
Log:
fix test data path

Modified:
    branches/REFACTORING-10_3/libzypp/tests/cache/CMakeLists.txt
    branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc

Modified: branches/REFACTORING-10_3/libzypp/tests/cache/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/tests/cache/CMakeLists.txt?rev=5961&r1=5960&r2=5961&view=diff
==============================================================================
--- branches/REFACTORING-10_3/libzypp/tests/cache/CMakeLists.txt (original)
+++ branches/REFACTORING-10_3/libzypp/tests/cache/CMakeLists.txt Tue Jul 10 20:27:30 2007
@@ -11,7 +11,7 @@
 TARGET_LINK_LIBRARIES(CacheQuery zypp )
 
 ADD_TEST(CacheInitializer ${CMAKE_CURRENT_BINARY_DIR}/CacheInitializer ${CMAKE_CURRENT_SOURCE_DIR}/data )
-ADD_TEST(CacheStore ${CMAKE_CURRENT_BINARY_DIR}/CacheStore ${CMAKE_CURRENT_SOURCE_DIR}/data )
+ADD_TEST(CacheStore ${CMAKE_CURRENT_BINARY_DIR}/CacheStore ${CMAKE_SOURCE_DIR}/tests )
 
 # run this test against a YUM repo
 ADD_TEST(CacheQuery ${CMAKE_CURRENT_BINARY_DIR}/CacheQuery ${CMAKE_SOURCE_DIR}/tests/repo/yum/data/10.2-updates-subset )

Modified: branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc?rev=5961&r1=5960&r2=5961&view=diff
==============================================================================
--- branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc (original)
+++ branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc Tue Jul 10 20:27:30 2007
@@ -16,6 +16,7 @@
 #include "zypp/cache/CacheStore.h"
 #include "zypp/RepoInfo.h"
 #include "zypp/repo/cached/RepoImpl.h"
+#include "zypp/parser/yum/RepoParser.h"
 #include "zypp/Url.h"
 #include "zypp/NVRA.h"
 #include "zypp/PathInfo.h"
@@ -25,16 +26,18 @@
 
 using namespace std;
 using namespace zypp;
+using namespace zypp::parser;
 using namespace zypp::repo;
 using namespace zypp::repo::cached;
 using namespace boost::unit_test;
 
 void cache_write_test(const string &dir)
 {
+  Pathname repodir = Pathname(dir) + "/cache/data";
   data::RecordId repository_id;
   filesystem::TmpDir tmpdir;
   {
-    Pathname nvra_list = Pathname(dir) + "package-set.txt.gz";
+    Pathname nvra_list = Pathname(repodir) + "package-set.txt.gz";
     list<MiniResolvable> res_list;
     
     parse_mini_file( nvra_list, res_list );
@@ -56,7 +59,36 @@
   {
     MIL << "now read resolvables" << endl;
     
-    cached::RepoImpl *repositoryImpl = new cached::RepoImpl( RepoInfo(), tmpdir.path(), repository_id);
+    cached::RepoImpl *repositoryImpl = new cached::RepoImpl( cached::RepoOptions( RepoInfo(), tmpdir.path(), repository_id ));
+    //RepositoryFactory factory;
+    //Repository_Ref repository = factory.createFrom(repositoryImpl);
+    repositoryImpl->createResolvables();
+    ResStore dbres = repositoryImpl->resolvables();
+        
+    MIL << dbres.size() << " resolvables" << endl;
+  }
+}
+
+void cache_write_test2(const string &dir)
+{
+  data::RecordId repository_id;
+  Pathname repodir = Pathname(dir) + "/repo/yum/data/10.2-updates-subset";
+  filesystem::TmpDir tmpdir;
+  {
+    cache::CacheStore store(tmpdir.path());
+    repository_id = store.lookupOrAppendRepository("novell.com");
+    
+    zypp::debug::Measure repo_write_timer("store resolvables");
+
+    yum::RepoParser parser( repository_id, store);
+    parser.parse(repodir);
+    store.commit();
+  }
+  {
+    MIL << "now read resolvables" << endl;
+    
+    zypp::debug::Measure repo_read_timer("read resolvables");
+    cached::RepoImpl *repositoryImpl = new cached::RepoImpl( cached::RepoOptions( RepoInfo(), tmpdir.path(), repository_id ));
     //RepositoryFactory factory;
     //Repository_Ref repository = factory.createFrom(repositoryImpl);
     repositoryImpl->createResolvables();
@@ -73,7 +105,6 @@
   if (argc < 2)
   {
     datadir = TESTS_SRC_DIR;
-    datadir = (Pathname(datadir) + "/cache/data").asString();
     cout << "CacheStore_test:"
       " path to directory with test data required as parameter. Using " << datadir  << endl;
     //return (test_suite *)0;
@@ -89,6 +120,8 @@
   std::string const params[] = { datadir };
   test->add(BOOST_PARAM_TEST_CASE(&cache_write_test,
                                  (std::string const*)params, params+1));
+  //test->add(BOOST_PARAM_TEST_CASE(&cache_write_test2,
+  //                               (std::string const*)params, params+1));
   return test;
 }
 

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages