From 263431f3c07062bc10b2c76119568d71750b0618 Mon Sep 17 00:00:00 2001 From: brarcher Date: Thu, 26 Sep 2013 02:31:42 +0000 Subject: [PATCH] Disable checked fixtures if fork is unavailable checked fixtures allow setup and teardown functions to be run in the same process space as tests. If a fixture fails, the error is caught and reported as a failure for the associated test. If fork is not used, then the guarantee that checked fixtures try to provide is not possible. Further, using checked fixtures without fork can cause issues. For example, without fork if a checked teardown calls ck_assert() which fails, this results in longjmp being called, which results in the teardowns being called again. An infinate loop results. git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@795 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- src/check.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/check.c b/src/check.c index bdbd2b3..da7c035 100644 --- a/src/check.c +++ b/src/check.c @@ -190,7 +190,11 @@ void tcase_add_unchecked_fixture (TCase *tc, SFun setup, SFun teardown) void tcase_add_checked_fixture (TCase *tc, SFun setup, SFun teardown) { +#if defined(HAVE_FORK) tcase_add_fixture (tc,setup,teardown,1); +#else + eprintf("This version does not support checked fixtures, as fork is not supported", __FILE__, __LINE__); +#endif } static void tcase_add_fixture (TCase *tc, SFun setup, SFun teardown, -- 2.40.0