]> granicus.if.org Git - check/commitdiff
* protect files in tests/ per Friedrich Beckmann, using _POSIX_VERSION
authorcpickett <cpickett@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Thu, 1 Jan 2009 00:33:24 +0000 (00:33 +0000)
committercpickett <cpickett@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Thu, 1 Jan 2009 00:33:24 +0000 (00:33 +0000)
  instead of HAVE_FORK

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

AUTHORS
tests/check_check_main.c
tests/check_check_pack.c
tests/check_check_sub.c

diff --git a/AUTHORS b/AUTHORS
index f9ca3ca93107f57deca06eefab23ca1e13dba0eb..b80b215d5724c486cc509e83cd0074bdcbff360c 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -18,6 +18,7 @@ Patches:         Bernhard Reiter (configure issues)
                 Torok Edwin (strsignal and build fixes)
                 Roland Illig (varargs and strsignal portability fixes)
                 Daniel Gollub (pthreads support)
+                Friedrich Beckmann (mingw and msvc port)
 
 Anybody who has contributed code to Check or Check's build system is
 considered an author.  Send patches to this file to 
index d5a8a0c1b315e9f4f39d2ddf07ed683c41e8205f..04d2bb616a8c764cdab1e528fe37e6393340d8fd 100644 (file)
@@ -10,9 +10,12 @@ int main (void)
   int n;
   SRunner *sr;
 
+#ifdef _POSIX_VERSION
   fork_setup();
   setup_fixture();
   setup();
+#endif /* _POSIX_VERSION */
+
   sr = srunner_create (make_master_suite());
   srunner_add_suite(sr, make_list_suite());
   srunner_add_suite(sr, make_msg_suite());
index 898ec298a077096c1e6e6044fbd2db8bfa904a33..919783671f75b5e04261f7c3eb2e50e990af72bc 100644 (file)
@@ -189,6 +189,8 @@ START_TEST(test_pack_loc_limit)
 }
 END_TEST
 
+/* the ppack probably means 'pipe' pack */
+#ifdef _POSIX_VERSION
 START_TEST(test_ppack)
 {
   int filedes[2];
@@ -329,7 +331,6 @@ START_TEST(test_ppack_nofail)
 }
 END_TEST
 
-
 #define BIG_MSG_LEN 1037
 
 START_TEST(test_ppack_big)
@@ -371,6 +372,7 @@ START_TEST(test_ppack_big)
   free (fmsg.msg);
 }
 END_TEST
+#endif /* _POSIX_VERSION */
 
 Suite *make_pack_suite(void)
 {
@@ -388,16 +390,20 @@ Suite *make_pack_suite(void)
   tcase_add_test (tc_core, test_pack_loc);
   tcase_add_test (tc_core, test_pack_ctx);
   tcase_add_test (tc_core, test_pack_len);
+#ifdef _POSIX_VERSION
   tcase_add_test (tc_core, test_ppack);
   tcase_add_test (tc_core, test_ppack_noctx);
   tcase_add_test (tc_core, test_ppack_onlyctx);
   tcase_add_test (tc_core, test_ppack_multictx);
   tcase_add_test (tc_core, test_ppack_nofail);
+#endif /* _POSIX_VERSION */
   suite_add_tcase (s, tc_limit);
   tcase_add_test (tc_limit, test_pack_ctx_limit);
   tcase_add_test (tc_limit, test_pack_fail_limit);
   tcase_add_test (tc_limit, test_pack_loc_limit);
+#ifdef _POSIX_VERSION
   tcase_add_test (tc_limit, test_ppack_big);
+#endif /* _POSIX_VERSION */
 
   return s;
 }
index 474552bf6b71bcd96cd6bd454988fbd8cf036aff..f655b32930b0e9162890b7e49d7fe15f04e41403 100644 (file)
@@ -311,45 +311,38 @@ START_TEST(test_null_2)
 }
 END_TEST
 
+#ifdef _POSIX_VERSION
 START_TEST(test_fork1p_pass)
 {
-#ifdef _POSIX_VERSION
   pid_t pid;
 
   if((pid = fork()) < 0) {
     fail("Failed to fork new process");
   } else if (pid > 0) {
-#endif /* _POSIX_VERSION */
     fail_unless(1, NULL);
-#ifdef _POSIX_VERSION
     kill(pid, SIGKILL);
   } else {
     for (;;) {
       sleep(1);
     }
   }
-#endif /* _POSIX_VERSION */
 }
 END_TEST
 
 START_TEST(test_fork1p_fail)
 {
-#ifdef _POSIX_VERSION
   pid_t pid;
   
   if((pid = fork()) < 0) {
     fail("Failed to fork new process");
   } else if (pid > 0) {
-#endif /* _POSIX_VERSION */
     fail("Expected fail");
-#ifdef _POSIX_VERSION
     kill(pid, SIGKILL);
   } else {
     for (;;) {
       sleep(1);
     }
   }
-#endif /* _POSIX_VERSION */
 }
 END_TEST
 
@@ -422,6 +415,7 @@ START_TEST(test_fork2_fail)
   check_waitpid_and_exit(pid);
 }
 END_TEST
+#endif /* _POSIX_VERSION */
 
 START_TEST(test_srunner)
 {
@@ -574,12 +568,14 @@ Suite *make_sub_suite(void)
   tcase_add_test (tc_limit, test_null);
   tcase_add_test (tc_limit, test_null_2);
 
+#ifdef _POSIX_VERSION
   tcase_add_test (tc_messaging_and_fork, test_fork1p_pass);
   tcase_add_test (tc_messaging_and_fork, test_fork1p_fail);
   tcase_add_test (tc_messaging_and_fork, test_fork1c_pass);
   tcase_add_test (tc_messaging_and_fork, test_fork1c_fail);
   tcase_add_test (tc_messaging_and_fork, test_fork2_pass);
   tcase_add_test (tc_messaging_and_fork, test_fork2_fail);
+#endif /* _POSIX_VERSION */
 
   return s;
 }