TestRunner Class Reference

A test runner, which runs the tests (implemented by subclassing it) with a variety of backends. More...

#include <testrunner.h>

Inheritance diagram for TestRunner:

Inheritance graph
[legend]
Collaboration diagram for TestRunner:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~TestRunner ()
 Virtual destructor - needed for abstract class.
int run_tests (int argc, char **argv)
 Run all the tests.
virtual int run () const =0
 Run the tests with a particular backend.

Public Attributes

bool backend
 True if a backend is in use.
bool remote
 True if a remote backend is in use.
bool transactions
 True if transactions are supported by the backend in use.
bool positional
 True is positional information is stored by the backend in use.
bool writable
 True if the backend is writable.
bool spelling
 True if the backend supports spelling corrections.
bool synonyms
 True if the backend supports synonyms.
bool metadata
 True if the backend supports metadata.
bool replicas
 True if the backend supports replication.
bool valuestats
 True if the backend supports getting value statistics.
bool generated
 True if the backend supports generated databases.
bool multi
 True if the backend is the multi backend.
bool inmemory
 True if the backend is the inmemory backend.
bool brass
 True if the backend is the brass backend.
bool chert
 True if the backend is the chert backend.
bool flint
 True if the backend is the flint backend.

Private Member Functions

void set_properties (const std::string &properties)
 Set the properties in use from a comma separated list.
bool use_backend (const std::string &backend_name)
 Return true iff we should use the named backend.
void set_properties_for_backend (const std::string &backend_name)
 Set the property flags to those for the named backend.
void do_tests_for_backend (BackendManager *manager)
 Run the tests with the specified backend.

Private Attributes

std::string user_backend
 Backend specified by the user (or empty if none was specified).
int result_so_far
 Result of running tests so far.
std::string srcdir
 The source directory, read from the test driver.


Detailed Description

A test runner, which runs the tests (implemented by subclassing it) with a variety of backends.

Definition at line 36 of file testrunner.h.


Constructor & Destructor Documentation

TestRunner::~TestRunner (  )  [virtual]

Virtual destructor - needed for abstract class.

Definition at line 74 of file testrunner.cc.


Member Function Documentation

void TestRunner::do_tests_for_backend ( BackendManager manager  )  [private]

Run the tests with the specified backend.

Definition at line 175 of file testrunner.cc.

References BackendManager::get_dbtype(), result_so_far, run(), BackendManager::set_datadir(), set_properties_for_backend(), srcdir, and use_backend().

Referenced by run_tests().

virtual int TestRunner::run (  )  const [pure virtual]

Run the tests with a particular backend.

Properties of the backend can be determined by checking the settings of the flags.

Implemented in ApiTestRunner, PerfTestRunner, and SoakTestRunner.

Referenced by do_tests_for_backend().

int TestRunner::run_tests ( int  argc,
char **  argv 
)

Run all the tests.

This should be passed the command line arguments supplied to main, and will parse them for options.

Definition at line 188 of file testrunner.cc.

References test_driver::add_command_line_option(), do_tests_for_backend(), Xapian::Error::get_description(), test_driver::get_srcdir(), test_driver::parse_command_line(), result_so_far, srcdir, and user_backend.

Referenced by main().

void TestRunner::set_properties ( const std::string &  properties  )  [private]

Set the properties in use from a comma separated list.

Definition at line 77 of file testrunner.cc.

References backend, brass, chert, flint, generated, inmemory, metadata, multi, positional, remote, replicas, spelling, synonyms, transactions, valuestats, and writable.

Referenced by set_properties_for_backend().

void TestRunner::set_properties_for_backend ( const std::string &  backend_name  )  [private]

Set the property flags to those for the named backend.

Definition at line 160 of file testrunner.cc.

References BackendProperties::name, and set_properties().

Referenced by do_tests_for_backend().

bool TestRunner::use_backend ( const std::string &  backend_name  )  [private]

Return true iff we should use the named backend.

Definition at line 148 of file testrunner.cc.

References startswith(), and user_backend.

Referenced by do_tests_for_backend().


Member Data Documentation

True if a backend is in use.

Definition at line 70 of file testrunner.h.

Referenced by set_properties().

True if the backend is the brass backend.

Definition at line 109 of file testrunner.h.

Referenced by set_properties().

True if the backend is the chert backend.

Definition at line 112 of file testrunner.h.

Referenced by set_properties().

True if the backend is the flint backend.

Definition at line 115 of file testrunner.h.

Referenced by set_properties().

True if the backend supports generated databases.

Definition at line 100 of file testrunner.h.

Referenced by set_properties().

True if the backend is the inmemory backend.

Definition at line 106 of file testrunner.h.

Referenced by set_properties().

True if the backend supports metadata.

Definition at line 91 of file testrunner.h.

Referenced by set_properties().

True if the backend is the multi backend.

Definition at line 103 of file testrunner.h.

Referenced by set_properties().

True is positional information is stored by the backend in use.

Definition at line 79 of file testrunner.h.

Referenced by set_properties().

True if a remote backend is in use.

Definition at line 73 of file testrunner.h.

Referenced by set_properties().

True if the backend supports replication.

Definition at line 94 of file testrunner.h.

Referenced by set_properties().

Result of running tests so far.

Actually, the maximum value returned by run() so far.

Definition at line 45 of file testrunner.h.

Referenced by do_tests_for_backend(), and run_tests().

True if the backend supports spelling corrections.

Definition at line 85 of file testrunner.h.

Referenced by set_properties().

std::string TestRunner::srcdir [private]

The source directory, read from the test driver.

Definition at line 49 of file testrunner.h.

Referenced by do_tests_for_backend(), and run_tests().

True if the backend supports synonyms.

Definition at line 88 of file testrunner.h.

Referenced by set_properties().

True if transactions are supported by the backend in use.

Definition at line 76 of file testrunner.h.

Referenced by set_properties().

std::string TestRunner::user_backend [private]

Backend specified by the user (or empty if none was specified).

Definition at line 39 of file testrunner.h.

Referenced by run_tests(), and use_backend().

True if the backend supports getting value statistics.

Definition at line 97 of file testrunner.h.

Referenced by set_properties().

True if the backend is writable.

Definition at line 82 of file testrunner.h.

Referenced by set_properties().


The documentation for this class was generated from the following files:

Documentation for Xapian (version 1.2.9).
Generated on 10 May 2012 by Doxygen 1.5.9.