From a44691aa81139e8f0cfd301c60f372c26debcf73 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Tue, 20 May 2008 14:57:13 +0000 Subject: [PATCH] Oooops, forget add test file :) --- tests/zypp/Deltarpm_test.cc | 66 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tests/zypp/Deltarpm_test.cc diff --git a/tests/zypp/Deltarpm_test.cc b/tests/zypp/Deltarpm_test.cc new file mode 100644 index 0000000..76dfa27 --- /dev/null +++ b/tests/zypp/Deltarpm_test.cc @@ -0,0 +1,66 @@ +#include +#include +#include +#include +#include + +#include + +#include "zypp/base/Logger.h" +#include "zypp/base/Exception.h" +#include "zypp/PathInfo.h" +#include "zypp/RepoManager.h" +#include "zypp/sat/Pool.h" +#include "zypp/repo/DeltaCandidates.h" +#include "zypp/repo/PackageDelta.h" +#include "KeyRingTestReceiver.h" + +using boost::unit_test::test_case; + +using namespace std; +using namespace zypp; +using namespace zypp::repo; +using namespace zypp::filesystem; + +#define TEST_DIR TESTS_SRC_DIR "/zypp/data/Delta" + +BOOST_AUTO_TEST_CASE(delta) +{ + KeyRingTestReceiver rec; + rec.answerAcceptUnknownKey(true); +// rec.answerImportKey(true); + Pathname rootdir(TEST_DIR ); + RepoManagerOptions opts(rootdir); + opts.repoRawCachePath = rootdir; + opts.repoSolvCachePath = rootdir; + RepoManager rm(opts); + + RepoInfo updates; + updates.setAlias("updates"); + updates.addBaseUrl(Url(string("dir:") + rootdir.absolutename().asString() )); + + try + { + rm.buildCache(updates); + rm.loadFromCache(updates); + } + catch (const Exception & e) + { + BOOST_FAIL( string("Problem getting the data: ")+ e.msg()) ; + } + sat::Pool pool(sat::Pool::instance()); + + repo::DeltaCandidates dc(list(pool.reposBegin(),pool.reposEnd()), "libzypp"); + + std::list deltas = dc.deltaRpms(0); + for_ (it,deltas.begin(),deltas.end()) + { + BOOST_CHECK(it->name()=="libzypp"); +// BOOST_CHECK((it->edition()==Edition("0:4.21.3-2"))); +// BOOST_CHECK(it->arch()=="i386"); + BOOST_CHECK((it->baseversion().edition() == Edition("4.21.3-1")) + ||(it->baseversion().edition() == Edition("4.21.2-3"))); + cout << it->name() << " - " << it->edition() << " - " << it->arch() << " base: " << it->baseversion().edition() << endl; + } + rm.cleanCache(updates); +} -- 2.7.4