* Do library cleanup and optionally check for memory leaks
*/
static bool post_test(test_runner_init_t init, bool check_leaks,
- array_t *failures, char *name, int i)
+ array_t *failures, char *name, int i, int *leaks)
{
report_data_t data = {
.failures = failures,
if (init)
{
- init(FALSE);
+ if (test_restore_point())
+ {
+ init(FALSE);
+ }
+ else
+ {
+ library_deinit();
+ return FALSE;
+ }
}
if (check_leaks && lib->leak_detective)
{
}
library_deinit();
- return data.leaks != 0;
+ *leaks = data.leaks;
+ return TRUE;
}
/**
{
if (pre_test(init))
{
- bool ok = FALSE, leaks = FALSE;
+ bool ok = FALSE;
+ int leaks = 0;
test_setup_timeout(tcase->timeout);
{
call_fixture(tcase, FALSE);
}
-
}
- leaks = post_test(init, ok, failures, tfun->name, i);
+ if (!post_test(init, ok, failures, tfun->name, i, &leaks))
+ {
+ ok = FALSE;
+ }
test_setup_timeout(0);