void srunner_run (SRunner *sr, const char *sname, const char *tcname, enum print_output print_mode) { #ifdef _POSIX_VERSION struct sigaction old_action; struct sigaction new_action; #endif /* _POSIX_VERSION */ /* Get the selected test suite and test case from the environment. */ if (!tcname) tcname = getenv ("CK_RUN_CASE"); if (!sname) sname = getenv ("CK_RUN_SUITE"); if (sr == NULL) return; if (print_mode >= CK_LAST) { eprintf ("Bad print_mode argument to srunner_run_all: %d", __FILE__, __LINE__, print_mode); } #ifdef _POSIX_VERSION memset(&new_action, 0, sizeof new_action); new_action.sa_handler = sig_handler; sigaction(SIGALRM, &new_action, &old_action); #endif /* _POSIX_VERSION */ srunner_run_init (sr, print_mode); srunner_iterate_suites (sr, sname, tcname, print_mode); srunner_run_end (sr, print_mode); #ifdef _POSIX_VERSION sigaction(SIGALRM, &old_action, NULL); #endif /* _POSIX_VERSION */ }
void srunner_run_all (SRunner *sr, enum print_output print_mode) { #ifdef _POSIX_VERSION struct sigaction old_action; struct sigaction new_action; #endif /* _POSIX_VERSION */ if (sr == NULL) return; if (print_mode >= CK_LAST) { eprintf ("Bad print_mode argument to srunner_run_all: %d", __FILE__, __LINE__, print_mode); } #ifdef _POSIX_VERSION memset(&new_action, 0, sizeof new_action); new_action.sa_handler = sig_handler; sigaction(SIGALRM, &new_action, &old_action); #endif /* _POSIX_VERSION */ srunner_run_init (sr, print_mode); srunner_iterate_suites (sr, print_mode); srunner_run_end (sr, print_mode); #ifdef _POSIX_VERSION sigaction(SIGALRM, &old_action, NULL); #endif /* _POSIX_VERSION */ }
void srunner_run (SRunner * sr, const char *sname, const char *tcname, enum print_output print_mode) { /* Get the selected test suite and test case from the environment. */ if (!tcname) tcname = getenv ("CK_RUN_CASE"); if (!sname) sname = getenv ("CK_RUN_SUITE"); if (sr == NULL) return; if (print_mode >= CK_LAST) { eprintf ("Bad print_mode argument to srunner_run_all: %d", __FILE__, __LINE__, print_mode); } #if defined(HAVE_SIGACTION) && defined(HAVE_FORK) memset (&new_action, 0, sizeof new_action); new_action[0].sa_handler = sig_handler; sigaction (SIGALRM, &new_action[0], &old_action[0]); new_action[1].sa_handler = sig_handler; sigaction (SIGINT, &new_action[1], &old_action[1]); new_action[2].sa_handler = sig_handler; sigaction (SIGTERM, &new_action[2], &old_action[2]); #endif /* HAVE_SIGACTION && HAVE_FORK */ srunner_run_init (sr, print_mode); srunner_iterate_suites (sr, sname, tcname, print_mode); srunner_run_end (sr, print_mode); #if defined(HAVE_SIGACTION) && defined(HAVE_FORK) sigaction (SIGALRM, &old_action[0], NULL); sigaction (SIGINT, &old_action[1], NULL); sigaction (SIGTERM, &old_action[2], NULL); #endif /* HAVE_SIGACTION && HAVE_FORK */ }