static void tcase_run_checked_teardown (TCase *tc);
static void srunner_iterate_tcase_tfuns (SRunner *sr, TCase *tc);
static void srunner_add_failure (SRunner *sr, TestResult *tf);
+#ifdef _POSIX_VERSION
static TestResult *tcase_run_tfun_fork (SRunner *sr, TCase *tc, TF *tf, int i);
+#endif /* _POSIX_VERSION */
static TestResult *tcase_run_tfun_nofork (SRunner *sr, TCase *tc, TF *tf, int i);
+#ifdef _POSIX_VERSION
static TestResult *receive_result_info_fork (const char *tcname,
const char *tname,
int iter,
int status, int expected_signal);
+#endif /* _POSIX_VERSION */
static TestResult *receive_result_info_nofork (const char *tcname,
const char *tname,
int iter);
+#ifdef _POSIX_VERSION
static void set_fork_info (TestResult *tr, int status, int expected_signal);
+#endif /* _POSIX_VERSION */
static void set_nofork_info (TestResult *tr);
+#ifdef _POSIX_VERSION
static char *signal_msg (int sig);
static char *signal_error_msg (int signal_received, int signal_expected);
-static char *pass_msg (void);
static char *exit_msg (int exitstatus);
+#endif /* _POSIX_VERSION */
+static char *pass_msg (void);
+#ifdef _POSIX_VERSION
static int waserror (int status, int expected_signal);
+#endif /* _POSIX_VERSION */
#define MSG_LEN 100
+#ifdef _POSIX_VERSION
static int alarm_received;
static pid_t group_pid;
+#endif /* _POSIX_VERSION */
#ifdef _POSIX_VERSION
static void CK_ATTRIBUTE_UNUSED sig_handler(int sig_nr)
}
}
+#ifdef _POSIX_VERSION
static TestResult *receive_result_info_fork (const char *tcname,
const char *tname,
int iter,
return tr;
}
+#endif /* _POSIX_VERSION */
static TestResult *receive_result_info_nofork (const char *tcname,
const char *tname,
return tr;
}
+#ifdef _POSIX_VERSION
static void set_fork_info (TestResult *tr, int CK_ATTRIBUTE_UNUSED status, int signal_expected)
{
-#ifdef _POSIX_VERSION
int was_sig = WIFSIGNALED(status);
int was_exit = WIFEXITED(status);
int exit_status = WEXITSTATUS(status);
tr->rtype = CK_FAILURE; /* early exit */
}
}
-#else /* _POSIX_VERSION */
- eprintf("This version does not support fork", __FILE__, __LINE__);
-#endif /* _POSIX_VERSION */
}
+#endif /* _POSIX_VERSION */
static void set_nofork_info (TestResult *tr)
{
return tr;
}
-
+#ifdef _POSIX_VERSION
static TestResult *tcase_run_tfun_fork (SRunner *sr, TCase *tc, TF *tfun, int i)
{
-#ifdef _POSIX_VERSION
pid_t pid_w;
pid_t pid;
int status = 0;
killpg(pid, SIGKILL); /* Kill remaining processes. */
return receive_result_info_fork(tc->name, tfun->name, i, status, tfun->signal);
-#else /* _POSIX_VERSION */
- eprintf("This version does not support fork", __FILE__, __LINE__);
- return NULL;
-#endif /* _POSIX_VERSION */
}
static char *signal_error_msg (int signal_received, int signal_expected)
"Early exit with return value %d", exitval);
return msg;
}
+#endif /* _POSIX_VERSION */
static char *pass_msg (void)
{
#endif /* _POSIX_VERSION */
}
-void check_waitpid_and_exit (pid_t pid)
+void check_waitpid_and_exit (pid_t pid CK_ATTRIBUTE_UNUSED)
{
#ifdef _POSIX_VERSION
pid_t pid_w;
#endif /* _POSIX_VERSION */
}
+#ifdef _POSIX_VERSION
static int waserror (int CK_ATTRIBUTE_UNUSED status, int signal_expected)
{
-#ifdef _POSIX_VERSION
int was_sig = WIFSIGNALED (status);
int was_exit = WIFEXITED (status);
int exit_status = WEXITSTATUS (status);
return ((was_sig && (signal_received != signal_expected)) ||
(was_exit && exit_status != 0));
-#else /* _POSIX_VERSION */
- eprintf("This version does not support fork", __FILE__, __LINE__);
- return 0;
-#endif /* _POSIX_VERSION */
}
+#endif /* _POSIX_VERSION */