xapian-core  1.4.27
Public Member Functions | Public Attributes | Protected Types | Private Member Functions | Private Attributes | List of all members
TestRunner Class Referenceabstract

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

#include <testrunner.h>

+ Inheritance diagram for TestRunner:
+ Collaboration diagram for TestRunner:

Public Member Functions

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

Public Attributes

unsigned properties
 Property bitmask. More...
 

Protected Types

enum  {
  BACKEND = 0x00000001, REMOTE = 0x00000002, TRANSACTIONS = 0x00000004, POSITIONAL = 0x00000008,
  WRITABLE = 0x00000010, SPELLING = 0x00000020, METADATA = 0x00000040, SYNONYMS = 0x00000080,
  REPLICAS = 0x00000100, VALUESTATS = 0x00000200, MULTI = 0x00000400, SINGLEFILE = 0x00000800,
  INMEMORY = 0x00001000, GLASS = 0x00002000, COMPACT = 0x00004000, CHERT = 0x00008000,
  PATH = 0x00010000, REMOTETCP = 0x00020000, CHECK = 0x00040000
}
 

Private Member Functions

bool use_backend (const std::string &backend_name)
 Return true iff we should use the named backend. More...
 
void set_properties_for_backend (const std::string &backend_name)
 Set the property flags to those for the named backend. More...
 
void do_tests_for_backend_ (BackendManager *manager)
 
void do_tests_for_backend (BackendManager &&manager)
 Run the tests with the specified backend. More...
 
void do_tests_for_backend (BackendManager &manager)
 

Private Attributes

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

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.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
BACKEND 
REMOTE 
TRANSACTIONS 
POSITIONAL 
WRITABLE 
SPELLING 
METADATA 
SYNONYMS 
REPLICAS 
VALUESTATS 
MULTI 
SINGLEFILE 
INMEMORY 
GLASS 
COMPACT 
CHERT 
PATH 

Requires get_database_path() or similar.

REMOTETCP 

TCP variant of remote.

CHECK 

Supports Xapian::Database::check().

Definition at line 72 of file testrunner.h.

Constructor & Destructor Documentation

◆ ~TestRunner()

TestRunner::~TestRunner ( )
virtual

Virtual destructor - needed for abstract class.

Definition at line 44 of file testrunner.cc.

Member Function Documentation

◆ do_tests_for_backend() [1/2]

void TestRunner::do_tests_for_backend ( BackendManager &&  manager)
inlineprivate

Run the tests with the specified backend.

Definition at line 63 of file testrunner.h.

References do_tests_for_backend_().

◆ do_tests_for_backend() [2/2]

void TestRunner::do_tests_for_backend ( BackendManager manager)
inlineprivate

Definition at line 67 of file testrunner.h.

References do_tests_for_backend_().

◆ do_tests_for_backend_()

void TestRunner::do_tests_for_backend_ ( BackendManager manager)
private

Definition at line 123 of file testrunner.cc.

References backend_name(), and BackendManager::get_dbtype().

Referenced by do_tests_for_backend().

◆ run()

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 PerfTestRunner, ApiTestRunner, and SoakTestRunner.

◆ run_tests()

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 136 of file testrunner.cc.

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

Referenced by main().

◆ 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.

A description of the properties which a particular backend supports.

A list of the properties of each backend.

Definition at line 59 of file testrunner.cc.

References name, and Glass::SPELLING.

◆ use_backend()

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

Return true iff we should use the named backend.

Definition at line 47 of file testrunner.cc.

References startswith().

Member Data Documentation

◆ properties

unsigned TestRunner::properties

Property bitmask.

Definition at line 99 of file testrunner.h.

◆ result_so_far

int TestRunner::result_so_far
private

Result of running tests so far.

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

Definition at line 45 of file testrunner.h.

◆ srcdir

std::string TestRunner::srcdir
private

The source directory, read from the test driver.

Definition at line 49 of file testrunner.h.

◆ user_backend

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.


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