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 static Runner defualt_runners
;
38 Framework::Framework() :
42 collection_startup(_default_callback
),
43 collection_shutdown(_default_callback
),
51 Framework::~Framework()
53 if (_destroy
and _destroy(_creators_ptr
))
55 Error
<< "Failure in _destroy(), some resources may not have been cleaned up.";
61 test_return_t
Framework::Item::pre(void *arg
)
71 test_return_t
Framework::Item::post(void *arg
)
81 test_return_t
Framework::Item::flush(void* arg
, test_st
* run
)
83 if (run
->requires_flush
and _flush
)
91 test_return_t
Framework::on_error(const test_return_t rc
, void* arg
)
93 if (_on_error
and test_failed(_on_error(rc
, arg
)))
101 test_return_t
Framework::startup(void* arg
)
103 if (collection_startup
)
105 return collection_startup(arg
);
111 test_return_t
Framework::Item::startup(void* arg
)
115 return _startup(arg
);
121 libtest::Runner
*Framework::runner()
125 _runner
= &defualt_runners
;
127 _runner
->set_servers(_servers
);
132 void* Framework::create(test_return_t
& arg
)
137 return _creators_ptr
= _create(_servers
, arg
);