test case and reproduced bug # 307163 : empty package descriptions
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Thu, 6 Sep 2007 00:23:51 +0000 (00:23 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Thu, 6 Sep 2007 00:23:51 +0000 (00:23 +0000)
tests/cache/CacheStore_test.cc
tests/repo/susetags/data/shared_attributes/content [new file with mode: 0644]
tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages [new file with mode: 0644]
tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.DU [new file with mode: 0644]
tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.en [new file with mode: 0644]

index d91046e..54feff1 100644 (file)
@@ -387,6 +387,41 @@ void cache_write_susetags(const Pathname &repodir)
   check_tables_clean(tmpdir);
 }
 
+/**
+ * \short Test that a susetags repo reads shared attributes
+ */
+void cache_write_shared_attributes(const Pathname &repodir)
+{
+  ZConfig::instance().overrideSystemArchitecture( Arch( "x86_64" ) );
+  data::RecordId repository_id;
+  filesystem::TmpDir tmpdir;
+  string alias = "novell.com";
+  write_susetags_repo( alias, repodir, tmpdir );
+
+  ResStore dbres = get_resolvables( alias, tmpdir);;
+  //read_resolvables( alias, tmpdir, std::inserter(dbres, dbres.end()));
+  MIL << dbres.size() << " resolvables" << endl;
+
+  // 2 packages and a product
+  BOOST_CHECK_EQUAL( dbres.size(), (unsigned)3);
+  
+  for ( ResStore::const_iterator it = dbres.begin();
+        it != dbres.end();
+        ++it )
+  {
+    MIL << *it << endl;
+    if ( isKind<Package>(*it) )
+    {
+      Package::Ptr p = asKind<Package>(*it);
+      if ( (p->name() == "foo") && p->arch() == Arch("x86_64") )
+      {
+        BOOST_CHECK_EQUAL( p->description(), "foo bar");
+      }
+    }
+  }
+  check_tables_clean(tmpdir);
+}
+
 void cache_write_susetags_normal_test(const std::string &dir)
 {
   Pathname repodir = Pathname(dir) + "/repo/susetags/data/stable-x86-subset";
@@ -399,6 +434,12 @@ void cache_write_susetags_gz_test(const std::string &dir)
   cache_write_susetags(repodir);
 }
 
+void cache_write_shared_attributes_test(const std::string &dir)
+{
+  Pathname repodir = Pathname(dir) + "/repo/susetags/data/shared_attributes";
+  cache_write_shared_attributes(repodir);
+}
+
 test_suite*
 init_unit_test_suite( int argc, char *argv[] )
 {
@@ -437,8 +478,8 @@ init_unit_test_suite( int argc, char *argv[] )
                                  (std::string const*)params, params+1));
   test->add(BOOST_PARAM_TEST_CASE(&cache_write_susetags_gz_test,
                                  (std::string const*)params, params+1));
-  //test->add(BOOST_PARAM_TEST_CASE(&cache_write_test2,
-  //                               (std::string const*)params, params+1));
+  test->add(BOOST_PARAM_TEST_CASE(&cache_write_shared_attributes_test,
+                                 (std::string const*)params, params+1));
   return test;
 }
 
diff --git a/tests/repo/susetags/data/shared_attributes/content b/tests/repo/susetags/data/shared_attributes/content
new file mode 100644 (file)
index 0000000..75955ab
--- /dev/null
@@ -0,0 +1,30 @@
+PRODUCT openSUSE-factory
+VERSION 10.3
+DISTPRODUCT SuSE-Linux-STABLE-X86
+DISTVERSION 10.2.42-factory
+VENDOR SUSE LINUX Products GmbH, Nuernberg, Germany
+RELNOTESURL http://www.suse.com/relnotes/i386/openSUSE/FACTORY/release-notes.rpm
+ARCH.x86_64 x86_64 i686 i586 i486 i386 noarch
+ARCH.i686 i686 i586 i486 i386 noarch
+ARCH.i586 i586 i486 i386 noarch
+ARCH.i486 i486 i386 noarch
+ARCH.i386 i386 noarch
+DEFAULTBASE i586
+REQUIRES openSUSE-release = 10.3 pattern:basesystem
+PROVIDES product:openSUSE = 10.2.42
+OBSOLETES product:SUSE_LINUX product:openSUSE <= 10.2
+LINGUAS cs da de en en_GB es fi fr hu it ja km nl nb pl pt_BR zh_CN zh_TW
+SHORTLABEL FACTORY
+LABEL openSUSE FACTORY 10.3
+LABEL.de openSUSE FACTORY 10.3
+EXTRAURLS http://download.opensuse.org/distribution/10.2/repo/oss/
+OPTIONALURLS http://download.opensuse.org/distribution/10.2/repo/non-oss/ http://download.opensuse.org/distribution/10.2/repo/debug/
+DESCRDIR suse/setup/descr
+DATADIR suse
+FLAGS update
+LANGUAGE en_US
+META SHA1 cec02abacb62fce2964a787d516879822691be6e  packages
+META SHA1 2664997a3bae2679cf1395a81d54a7dd4532c276  packages.DU
+META SHA1 1c539c3fe4a8ec5fbe96ce3b559fc952124f9acd  packages.en
+
+
diff --git a/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages b/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages
new file mode 100644 (file)
index 0000000..231681b
--- /dev/null
@@ -0,0 +1,32 @@
+##----------------------------------------
+=Pkg: foo 1.0 1 i586
+=Cks: SHA1 05f0647241433d01636785fd282cc824a6527269
++Req:
+bar > 1.0
+-Req:
+=Grp: Bar
+=Lic: BSD License and BSD-like, GNU General Public License (GPL)
+=Src: foo 1.0 1 src
+=Tim: 1183399094
+=Loc: 1 foo-1.0-1.i586.rpm
+=Siz: 16356019 38850584
++Aut:
+Foo Bar <foo@bar.org>
+-Aut:
+##----------------------------------------
+=Pkg: foo 1.0 1 x86_64
+=Cks: SHA1 05f0647241433d01636785fd282cc824a6527269
++Req:
+bar > 1.0
+-Req:
+=Grp: Bar
+=Lic: BSD License and BSD-like, GNU General Public License (GPL)
+=Src: foo 1.0 1 src
+=Tim: 1183399094
+=Loc: 1 foo-1.0-1.x86_64.rpm
+=Siz: 16356019 38850584
++Aut:
+Foo Bar <foo@bar.org>
+-Aut:
+=Shr: foo 1.0 1 i586
+
diff --git a/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.DU b/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.DU
new file mode 100644 (file)
index 0000000..f8a911b
--- /dev/null
@@ -0,0 +1,7 @@
+##----------------------------------------
+=Pkg: foo 1.0 1 i586
++Dir:
+/ 0 39444 0 3068
+usr/share/ 11 0 1 0
+-Dir:
+##----------------------------------------
diff --git a/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.en b/tests/repo/susetags/data/shared_attributes/suse/setup/descr/packages.en
new file mode 100644 (file)
index 0000000..166fdf5
--- /dev/null
@@ -0,0 +1,8 @@
+##----------------------------------------
+=Pkg: foo 1.0 1 i586
+=Sum: Foo program
++Des:
+<!-- DT:Rich -->
+<p>This package contains foo</p>
+-Des:
+##----------------------------------------