xapian-core  1.4.27
testrunner.h
Go to the documentation of this file.
1 
4 /* Copyright 2008 Lemur Consulting Ltd
5  * Copyright 2008,2009,2014,2015,2017,2018 Olly Betts
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
20  * USA
21  */
22 
23 #ifndef XAPIAN_INCLUDED_TESTRUNNER_H
24 #define XAPIAN_INCLUDED_TESTRUNNER_H
25 
26 #include <string>
27 
28 class BackendManager;
29 
32 
36 class TestRunner {
39  std::string user_backend;
40 
46 
49  std::string srcdir;
50 
53  bool use_backend(const std::string & backend_name);
54 
57  void set_properties_for_backend(const std::string & backend_name);
58 
60 
64  do_tests_for_backend_(&manager);
65  }
66 
68  do_tests_for_backend_(&manager);
69  }
70 
71  protected:
72  enum {
73  BACKEND = 0x00000001,
74  REMOTE = 0x00000002,
75  TRANSACTIONS = 0x00000004,
76  POSITIONAL = 0x00000008,
77  WRITABLE = 0x00000010,
78  SPELLING = 0x00000020,
79  METADATA = 0x00000040,
80  SYNONYMS = 0x00000080,
81  REPLICAS = 0x00000100,
82  VALUESTATS = 0x00000200,
83  MULTI = 0x00000400,
84  SINGLEFILE = 0x00000800,
85  INMEMORY = 0x00001000,
86  GLASS = 0x00002000,
87  COMPACT = 0x00004000,
88  CHERT = 0x00008000,
90  PATH = 0x00010000,
92  REMOTETCP = 0x00020000,
94  CHECK = 0x00040000,
95  };
96 
97  public:
99  unsigned properties;
100 
102  virtual ~TestRunner();
103 
109  int run_tests(int argc, char ** argv);
110 
116  virtual int run() const = 0;
117 };
118 
119 #endif // XAPIAN_INCLUDED_TESTRUNNER_H
virtual int run() const =0
Run the tests with a particular backend.
const char * backend_name(int code)
Definition: backends.h:33
TCP variant of remote.
Definition: testrunner.h:92
BackendManager * backendmanager
backendmanager is global so that it can be accessed by individual tests.
Definition: testrunner.cc:42
std::string srcdir
The source directory, read from the test driver.
Definition: testrunner.h:49
void set_properties_for_backend(const std::string &backend_name)
Set the property flags to those for the named backend.
Definition: testrunner.cc:59
virtual ~TestRunner()
Virtual destructor - needed for abstract class.
Definition: testrunner.cc:44
int run_tests(int argc, char **argv)
Run all the tests.
Definition: testrunner.cc:136
bool use_backend(const std::string &backend_name)
Return true iff we should use the named backend.
Definition: testrunner.cc:47
void do_tests_for_backend(BackendManager &manager)
Definition: testrunner.h:67
int result_so_far
Result of running tests so far.
Definition: testrunner.h:45
void do_tests_for_backend_(BackendManager *manager)
Definition: testrunner.cc:123
A test runner, which runs the tests (implemented by subclassing it) with a variety of backends...
Definition: testrunner.h:36
Requires get_database_path() or similar.
Definition: testrunner.h:90
void do_tests_for_backend(BackendManager &&manager)
Run the tests with the specified backend.
Definition: testrunner.h:63
Supports Xapian::Database::check().
Definition: testrunner.h:94
std::string user_backend
Backend specified by the user (or empty if none was specified).
Definition: testrunner.h:39
unsigned properties
Property bitmask.
Definition: testrunner.h:99