]> granicus.if.org Git - check/commitdiff
Do not run test_mark_lno without fork()
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Sun, 22 Sep 2013 17:22:53 +0000 (17:22 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Sun, 22 Sep 2013 17:22:53 +0000 (17:22 +0000)
Previously the test_mark_lno test would run without fork, it just
would not early exit. This let the unit tests run, but did not
let them pass. Without fork(), the test is invalid.

git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@766 64e312b2-a51f-0410-8e61-82d0ca0eb02a

tests/check_check_master.c
tests/check_check_sub.c

index 938354140e95de6eb1e78397a323784903b6a20e..a3c9918d5706202271989233cd5162f6c99e2ee5 100644 (file)
@@ -27,7 +27,9 @@ static char signal_8_str[SIG_STR_LEN];
 /* FIXME: all these line numbers are kind of hard to maintain */
 static master_test_t master_tests[] = {
   { "Simple Tests", CK_FAILURE, "Failure expected" },
+#ifdef HAVE_FORK
   { "Simple Tests", CK_ERROR,   "Early exit with return value 1" },
+#endif
   { "Simple Tests", CK_PASS,    "Passed" },
   { "Simple Tests", CK_FAILURE, "This test should fail" },
   { "Simple Tests", CK_PASS,    "Passed" },
index d74d7336851a8d8666e1ee605215c29f013bd355..ba797927a30f2b46f9dbda66b3d33469cb8c4619 100644 (file)
@@ -16,16 +16,16 @@ START_TEST(test_lno)
 }
 END_TEST
 
+#ifdef HAVE_FORK
 START_TEST(test_mark_lno)
 {
   mark_point();
   #define LINENO_mark_lno _STR(__LINE__)
-#ifdef HAVE_FORK
   exit(EXIT_FAILURE); /* should fail with mark_point above as line */
-#endif /* HAVE_FORK */
 }
-
 END_TEST
+#endif /* HAVE_FORK */
+
 START_TEST(test_pass)
 {
   ck_assert_msg(1 == 1, "This test should pass");
@@ -668,7 +668,9 @@ void init_master_tests_lineno(int num_master_tests) {
   const char * lineno[] = {
 /* Simple Tests */
     LINENO_lno,
+#ifdef HAVE_FORK
     LINENO_mark_lno,
+#endif
     "-1",
     "-1",
     "-1",
@@ -954,7 +956,9 @@ Suite *make_sub_suite(void)
   suite_add_tcase (s, tc_messaging_and_fork);
 
   tcase_add_test (tc_simple, test_lno);
+#ifdef HAVE_FORK
   tcase_add_test (tc_simple, test_mark_lno);
+#endif
   tcase_add_test (tc_simple, test_pass);
   tcase_add_test (tc_simple, test_fail_unless);
   tcase_add_test (tc_simple, test_fail_if_pass);