Libzypp/Testsuite solver

From openSUSE

Contents

Solver Testsuite

In order to ensure valid regressions tests the libzypp solver has his own testsuite.

Currently there are about 250 testcases available which reflects the behaviour of the solver while evaluating results and error messages.

Environment

The testsuite programs are handled in the package libzypp-testsuite-tools. The check program for the solver testcase can be found under:

 /usr/lib/zypp/testsuite/bin/deptestomatic.multi

The individual testcases can be found in the package libzypp-testsuite-tools-data:

 /usr/share/zypp/testsuite/data/solver/data.deptestomatic>

Structure of a Testcase

Each testcase consists of different XML files which should be available in the same directory:

Testcase description ( filename: <name>-test.xml )

This file described a testcase. Which repos are used, which e.g. packages are already installed and which actions should be transacted. An example is here:

 <?xml version="1.0"?>
 <test>
 <setup arch="x86_64">
       <system file="bug310618-system.xml.gz"/>
       <channel file="bug310618-1-package.xml.gz" name="1" />
       <locale name="en" />
       <locale name="en_US" />
 </setup>
 <trial>
   <install kind="product" name="openSUSE" />
   <distupgrade delete_unmaintained="true"/>
   <reportproblems/>
 </trial>
 </test>
setup section
XML Description
<setup arch="..."> Setting architecture
<system file="..."/> xml-file in helix-format which includes the pre-installed packages, patterns, patches...
<channel name="..." file="..." type="..."/> Activates a repo. type: url or leave it out.
<locale name="..." /> Required language support.
<forceResolve/> Delete resolvables which have broken dependencies without asking the user.
<ignorealreadyrecommended/> Ignore recommended packages that have already been recommended by the installed packages.
<onlyRequires/> Ignore recommended packages.
<maxSolverPasses value=".."/> Sets the max solver passes.
<setlicencebit/> Set licence-bit on all Items in Pool and on all Items which will be definded later.
trial section
XML Description
<verifiy/> The system will be verified by the resolver.
<install channel="..." name="..." package="..." kind="..." soft="..."/> Installs a package ?? SOFT. kind: package, pattern, patch or product. Default is package
<uninstall name="..." package="..." kind="..." soft="..."/> Uninstalls a package ?? SOFT
<distupgrade delete_unmaintained="..."/> Distribution-Upgrade. delete_unmaintained: false: Unmaintained packages will not be deleted.
<establish/> Establish state of 'higher level' Resolvables in Pool. This call shows the state of e.g. patches.
<instorder/> Calculates the installation order.
<mediaorder/> Calculates the media order.
<whatprovides kind="..." provides="..."/> Lists the packages which provides the choosen
<whatdependson channel="..." package="..." kind="..." provides="..."/> Lists the packages which depends on the choosen.
<addProvide kind="..." name="..."/> Sets an additional Provide.
<addConflict kind="..." name="..."/> Sets an additional Conflict
<addRequire kind="..." name="..."/> Sets an additional Require
<lock channel="..." name="..." kind="..."/> Locks a resolvable from channel.
<keep channel="..." name="..." kind="..."/> Keep a resolvable from channel.
<reportproblems/> Reports solver problems
<takesolution problem="..." solution="..."/> Takes the given solution number to solve the logged problem number.
<showpool prefix="..." all="..." getlicence="..."/> Collect all objects in pool. With no given all only changing obejcts will be shown otherwise all. If getlicence is true, the licencebit will be shown.
<availablelocales/> Lists the available locales
<graphic/> Shows the solver result in gaphic mode.
<YOU/> Starts the YOU package selector.
<PkgUI/> Starts the YaST package selector.

.

Version:
Only since Code 11
openSUSE 11.1 and SLE11 or later

.

XML Description
<showselectable name="..." kind="..."/> Dump a selectable with that name, so you can see candidates, availables and installed items.

.

Version:
Only since Code 12
openSUSE 11.2 or later

.

XML Description
<upgradeRepo name="..."/> Distupgrade restricted to repository with alias 'name'

System environment ( filename: <name>-system.xml )

This XML-file describes the installed packages, products, patterns, patches,.....

Available repos ( filename: <name>-package.xml )

This XML-file describes packages, products, patterns, patches,... of an available repo.

Solution description ( filename: <name>-test.solution )

Each testcase run produces an output to stdout. This output will be compared with this solution file.

The testcases has run successfully if it returns with 0 and the output is the same as described in this solution file.

Running a Testcase

If you want to run one test separatly just execute /usr/lib/zypp/testsuite/bin/deptestomatic.multi with the test-file as option.

Generate a Testcase

It is most helpful to have a dump of the RPM database of a system in question. Look here on how to do that.

Since OpenSUSE 10.2 beta2 we have included a new API call which generates a dump of the complete pool in terms of a testcase and add the logfiles of a solver run:

/** File : Resolver.h
 *
 * Generates a solver Testcase of the current state
 *
 * return true if it was successful     
 */
 bool createSolverTestcase (const std::string & dumpPath = "/var/log/YaST2/solverTestcase");      

This call will be already used in the single package selection frame: Menue Extras/Generate_Dependency_Resolver_Test_Case