From db313f2c8776b7d753ba2932145fc8148eec2dcf Mon Sep 17 00:00:00 2001 From: brarcher Date: Sun, 22 Sep 2013 23:29:03 +0000 Subject: [PATCH] Do not run test_exit if fork is unavailable if fork is unavailable, the test is not valid, as it makes the unit test runner exit early. git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@779 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- tests/ex_output.c | 9 ++++++++- tests/test_output.sh | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/ex_output.c b/tests/ex_output.c index baf961b..cf8c617 100644 --- a/tests/ex_output.c +++ b/tests/ex_output.c @@ -18,11 +18,17 @@ START_TEST(test_fail) } END_TEST +/* + * This test will fail without fork, as it will result in the + * unit test runniner exiting early. + */ +#if defined(HAVE_FORK) START_TEST(test_exit) { exit(1); } END_TEST +#endif /* HAVE_FORK */ static Suite *make_suite (void) { @@ -34,8 +40,9 @@ static Suite *make_suite (void) suite_add_tcase(s, tc); tcase_add_test (tc, test_pass); tcase_add_test (tc, test_fail); +#if defined(HAVE_FORK) tcase_add_test (tc, test_exit); - +#endif /* HAVE_FORK */ return s; } diff --git a/tests/test_output.sh b/tests/test_output.sh index f7abc38..763db03 100755 --- a/tests/test_output.sh +++ b/tests/test_output.sh @@ -14,12 +14,12 @@ t1="xRunning suite(s): Master t2="xRunning suite(s): Master 33%: Checks: 3, Failures: 1, Errors: 1 ${lsrc}ex_output.c:17:F:Core:test_fail:0: Failure -${lsrc}ex_output.c:21:E:Core:test_exit:0: (after this point) Early exit with return value 1" +${lsrc}ex_output.c:26:E:Core:test_exit:0: (after this point) Early exit with return value 1" t3="xRunning suite(s): Master 33%: Checks: 3, Failures: 1, Errors: 1 ${lsrc}ex_output.c:11:P:Core:test_pass:0: Passed ${lsrc}ex_output.c:17:F:Core:test_fail:0: Failure -${lsrc}ex_output.c:21:E:Core:test_exit:0: (after this point) Early exit with return value 1" +${lsrc}ex_output.c:26:E:Core:test_exit:0: (after this point) Early exit with return value 1" t4="xtest: Core:test_pass success: Core:test_pass test: Core:test_fail @@ -28,7 +28,7 @@ ${lsrc}ex_output.c:17: Failure ] test: Core:test_exit error: Core:test_exit [ -${lsrc}ex_output.c:21: (after this point) Early exit with return value 1 +${lsrc}ex_output.c:26: (after this point) Early exit with return value 1 ]" op0=`./ex_output${EXEEXT} CK_SILENT` -- 2.40.0