From 2a2d6b68defac08a2dc44b687693afcd14f7a56d Mon Sep 17 00:00:00 2001 From: brarcher Date: Sun, 22 Sep 2013 17:22:55 +0000 Subject: [PATCH] Do not run signal tests without fork() Without fork(), the signal tests are invalid. They result in throwing different signals, no of which would let a no-fork unit test run finish. The tests are invalid without fork(). git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@767 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- tests/check_check_master.c | 2 ++ tests/check_check_sub.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/tests/check_check_master.c b/tests/check_check_master.c index a3c9918..b05d11d 100644 --- a/tests/check_check_master.c +++ b/tests/check_check_master.c @@ -71,6 +71,7 @@ static master_test_t master_tests[] = { { "Simple Tests", CK_FAILURE, "Assertion 'x==y' failed: x==0x1, y==0x2" }, { "Simple Tests", CK_FAILURE, "Assertion 'x!=z' failed: x==0x1, z==0x1" }, +#ifdef HAVE_FORK { "Signal Tests", CK_ERROR, signal_11_str }, { "Signal Tests", CK_PASS, "Passed" }, { "Signal Tests", CK_ERROR, signal_11_8_str }, @@ -78,6 +79,7 @@ static master_test_t master_tests[] = { { "Signal Tests", CK_FAILURE, "Early exit with return value 1" }, { "Signal Tests", CK_ERROR, signal_8_str }, { "Signal Tests", CK_ERROR, signal_8_str }, +#endif #if TIMEOUT_TESTS_ENABLED && defined(HAVE_FORK) #if HAVE_WORKING_SETENV diff --git a/tests/check_check_sub.c b/tests/check_check_sub.c index ba79792..5c05e9f 100644 --- a/tests/check_check_sub.c +++ b/tests/check_check_sub.c @@ -712,6 +712,7 @@ void init_master_tests_lineno(int num_master_tests) { LINENO_ck_assert_ptr_eq, LINENO_ck_assert_ptr_ne, +#ifdef HAVE_FORK /* Signal Tests */ "-1", "-1", @@ -720,6 +721,7 @@ void init_master_tests_lineno(int num_master_tests) { "-1", "-1", "-1", +#endif /* HAVE_FORK */ #if TIMEOUT_TESTS_ENABLED && defined(HAVE_FORK) #if HAVE_WORKING_SETENV @@ -872,7 +874,9 @@ Suite *make_sub_suite(void) Suite *s; TCase *tc_simple; +#ifdef HAVE_FORK TCase *tc_signal; +#endif #if TIMEOUT_TESTS_ENABLED && defined(HAVE_FORK) #if HAVE_WORKING_SETENV TCase *tc_timeout_env_int; @@ -896,7 +900,9 @@ Suite *make_sub_suite(void) s = suite_create("Check Servant"); tc_simple = tcase_create("Simple Tests"); +#ifdef HAVE_FORK tc_signal = tcase_create("Signal Tests"); +#endif /* HAVE_FORK */ #if TIMEOUT_TESTS_ENABLED && defined(HAVE_FORK) #if HAVE_WORKING_SETENV setenv("CK_DEFAULT_TIMEOUT", "6", 1); @@ -931,7 +937,9 @@ Suite *make_sub_suite(void) tc_messaging_and_fork = tcase_create("Msg and fork Tests"); suite_add_tcase (s, tc_simple); +#ifdef HAVE_FORK suite_add_tcase (s, tc_signal); +#endif /* HAVE_FORK */ #if TIMEOUT_TESTS_ENABLED && defined(HAVE_FORK) #if HAVE_WORKING_SETENV suite_add_tcase (s, tc_timeout_env_int); @@ -1007,6 +1015,7 @@ Suite *make_sub_suite(void) tcase_add_test (tc_simple, test_ck_assert_ptr_eq); tcase_add_test (tc_simple, test_ck_assert_ptr_ne); +#ifdef HAVE_FORK tcase_add_test (tc_signal, test_segv); tcase_add_test_raise_signal (tc_signal, test_segv, 11); /* pass */ tcase_add_test_raise_signal (tc_signal, test_segv, 8); /* error */ @@ -1014,6 +1023,7 @@ Suite *make_sub_suite(void) tcase_add_test_raise_signal (tc_signal, test_fail_unless, 8); /* fail */ tcase_add_test (tc_signal, test_fpe); tcase_add_test (tc_signal, test_mark_point); +#endif /* HAVE_FORK */ #if TIMEOUT_TESTS_ENABLED && defined(HAVE_FORK) #if HAVE_WORKING_SETENV -- 2.50.1