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
24 #include <libtest/common.h>
27 using namespace libtest
;
29 static test_return_t
_default_callback(void *p
)
36 Framework::Framework() :
40 collection_startup(_default_callback
),
41 collection_shutdown(_default_callback
),
49 Framework::~Framework()
51 if (_destroy
and _destroy(_creators_ptr
))
53 Error
<< "Failure in _destroy(), some resources may not have been cleaned up.";
61 test_return_t
Framework::Item::flush(void* arg
, test_st
* run
)
63 if (run
->requires_flush
and _flush
)
71 test_return_t
Framework::on_error(const test_return_t rc
, void* arg
)
73 if (_on_error
and test_failed(_on_error(rc
, arg
)))
81 test_return_t
Framework::startup(void* arg
)
83 if (collection_startup
)
85 return collection_startup(arg
);
91 test_return_t
Framework::Item::startup(void* arg
)
101 libtest::Runner
*Framework::runner()
107 _runner
->set_servers(_servers
);
112 void* Framework::create(test_return_t
& arg
)
117 return _creators_ptr
= _create(_servers
, arg
);