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
23 #include <libtest/common.h>
26 using namespace libtest
;
28 static test_return_t
_default_callback(void *p
)
35 static Runner defualt_runners
;
37 Framework::Framework() :
41 collection_startup(_default_callback
),
42 collection_shutdown(_default_callback
),
50 Framework::~Framework()
52 if (_destroy
and _destroy(_creators_ptr
))
54 Error
<< "Failure in _destroy(), some resources may not have been cleaned up.";
60 test_return_t
Framework::Item::pre(void *arg
)
70 test_return_t
Framework::Item::post(void *arg
)
80 test_return_t
Framework::Item::flush(void* arg
, test_st
* run
)
82 if (run
->requires_flush
and _flush
)
90 test_return_t
Framework::on_error(const test_return_t rc
, void* arg
)
92 if (_on_error
and test_failed(_on_error(rc
, arg
)))
100 test_return_t
Framework::startup(void* arg
)
102 if (collection_startup
)
104 return collection_startup(arg
);
110 test_return_t
Framework::Item::startup(void* arg
)
114 return _startup(arg
);
120 libtest::Runner
*Framework::runner()
122 return _runner
? _runner
: &defualt_runners
;
125 void* Framework::create(test_return_t
& arg
)
130 return _creators_ptr
= _create(_servers
, arg
);