1 /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
5 * Copyright (C) 2011 Data Differential, http://datadifferential.com/
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 3 of the License, or (at your option) any later version.
12 * This library 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 GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 Framework is the structure which is passed to the test implementation to be filled.
28 This must be implemented in order for the test framework to load the tests. We call
29 get_world() in order to fill this structure.
34 collection_st
*collections
;
36 /* These methods are called outside of any collection call. */
37 test_callback_create_fn
*_create
;
38 test_callback_destroy_fn
*_destroy
;
40 /* This is called a the beginning of any collection run. */
41 test_callback_fn
*collection_startup
;
43 /* This is called a the end of any collection run. */
44 test_callback_fn
*collection_shutdown
;
46 void set_collection_shutdown(test_callback_error_fn
*arg
)
52 void* create(test_return_t
& arg
);
54 test_return_t
startup(void*);
56 test_return_t
shutdown(void* arg
)
58 if (collection_shutdown
)
60 return collection_shutdown(arg
);
67 These are run before/after the test. If implemented. Their execution is not controlled
72 /* This is called a the beginning of any run. */
73 test_callback_fn
*_startup
;
75 test_return_t
startup(void*);
78 This called on a test if the test requires a flush call (the bool is
81 test_callback_fn
*_flush
;
90 void set_startup(test_callback_fn
*arg
)
95 void set_collection(test_callback_fn
*arg
)
100 void set_flush(test_callback_fn
*arg
)
105 test_return_t
flush(void* arg
, test_st
* run
);
110 If an error occurs during the test, this is called.
112 test_callback_error_fn
*_on_error
;
114 void set_on_error(test_callback_error_fn
*arg
)
119 test_return_t
on_error(const enum test_return_t
, void *);
123 _servers
.set_socket();
126 void set_sasl(const std::string
& username_arg
, const std::string
& password_arg
)
128 _servers
.set_sasl(username_arg
, password_arg
);
131 libtest::server_startup_st
& servers()
137 Runner represents the callers for the tests. If not implemented we will use
138 a set of default implementations.
140 libtest::Runner
*_runner
;
142 void set_runner(libtest::Runner
*arg
)
147 libtest::Runner
*runner();
152 virtual ~Framework();
154 Framework(const Framework
&);
157 Framework
& operator=(const Framework
&);
158 libtest::server_startup_st _servers
;
161 unsigned long int _servers_to_run
;