[zypp-devel] Some changes related to writing zypp test cases.
Hi!. Some changes related to writing zypp test cases. zypp-trunk rev. 11223: - added tests/data/openSUSE-11.1 containing raw susetags metadata. Keeping .solv files in svn is somewhat inconvenient, as you must rebuild them if something in satsolver changes. - added tests/include as location for includes that might be used in multiple testcases. - added tests/include/TestSetup.h to ease building a test environment below some tempdir. Currently supports easy setup of Target, RepoManager and loading data (raw metadata and .solv files) into the pool. That's how it currently looks like: #include "TestSetup.h" BOOST_AUTO_TEST_CASE(WhatProvides) { TestSetup test( Arch_x86_64 ); // use x86_64 as system arch test.loadTarget(); // initialize and load target test.loadRepo( TESTS_SRC_DIR"/data/openSUSE-11.1" ); This is all you need to setup Target, RepoManager below some temp directory and load the raw metadata into the pool. In case you want to setup the system below some fix directory, use: TestSetup test( "/tmp/mydir", Arch_x86_64 ); You directory is used as it is and not removed at the end. Feel free to add whatever helps you writing testcases. -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres YaST Development ma@novell.com SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+ -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
On Wednesday 01 October 2008 18:24:56 Michael Andres wrote:
- added tests/include/TestSetup.h to ease building a test environment below some tempdir. Currently supports easy setup of Target, RepoManager and loading data (raw metadata and .solv files) into the pool.
That's how it currently looks like:
#include "TestSetup.h"
BOOST_AUTO_TEST_CASE(WhatProvides) { TestSetup test( Arch_x86_64 ); // use x86_64 as system arch test.loadTarget(); // initialize and load target test.loadRepo( TESTS_SRC_DIR"/data/openSUSE-11.1" );
This is all you need to setup Target, RepoManager below some temp directory and load the raw metadata into the pool.
In case you want to setup the system below some fix directory, use:
TestSetup test( "/tmp/mydir", Arch_x86_64 );
I just want to point out that the lifetime of the TestSetup instance is also the lifetime of the temp. directory! So if you want to setup a common environment for many test cases, you CAN'T DO IT LIKE THIS: BOOST_AUTO_TEST_CASE(init) { 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" ); dumpRange( USR, test.pool().knownRepositoriesBegin(), test.pool().knownRepositoriesEnd() ); USR << "pool: " << test.pool() << endl; } Leaving the init function the directory gets deleted, which may result in strange effects. Best might be to have a global static instance, so you can also access all components and convenience methods we may add. static TestSetup test( Arch_x86_64 ); BOOST_AUTO_TEST_CASE(init) { //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" ); dumpRange( USR, test.pool().knownRepositoriesBegin(), test.pool().knownRepositoriesEnd() ); USR << "pool: " << test.pool() << endl; } -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres YaST Development ma@novell.com SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+
Hi, In the progress of making packages of the ZYpp stack on Fedora (yes, the package review is progressing slowly) I encountered several problems compiling the ZYpp stack against RPM 4.5.90 and RPM 4.6 rc1 (the ones from rpm.org). I have zero-knowledge of sat-solver, libzypp and zypper codebase but I was able to create a patch to make sat-solver compile against that particular version of RPM, however libzypp codebase is very complex and I wasn't able to make a patch for it. Are there any plans to port the stable codebase to RPM 4.6? This is slowing the possible adoption of ZYpp stack in Fedora even further (next Fedora release - on November 25th - will come with RPM 4.6 by default). PS: I attached my sat-solver-0.9.5-rpm4.5.90 patch and sat-solver-db-corruption-fix.patch made with the help of Michael Schroeder Regards -- Lorenzo Villani Blog: http//blog.binaryhelix.net LinkedIn profile: http://www.linkedin.com/in/lorenzovillani
participants (2)
-
Lorenzo Villani
-
Michael Andres