static int srunner_run_unchecked_setup (SRunner *sr, TCase *tc) { TestResult *tr; List *l; Fixture *f; int rval = 1; set_fork_status(CK_NOFORK); l = tc->unch_sflst; for (list_front(l); !list_at_end(l); list_advance(l)) { send_ctx_info(CK_CTX_SETUP); f = list_val(l); f->fun(); tr = receive_result_info_nofork (tc->name, "unchecked_setup", 0); if (tr->rtype != CK_PASS) { srunner_add_failure(sr, tr); rval = 0; break; } free(tr->file); free(tr->msg); free(tr); } set_fork_status(srunner_fork_status(sr)); return rval; }
static void srunner_iterate_tcase_tfuns (SRunner *sr, TCase *tc) { List *tfl; TF *tfun; TestResult *tr = NULL; tfl = tc->tflst; for (list_front(tfl); !list_at_end (tfl); list_advance (tfl)) { int i; tfun = list_val (tfl); for (i = tfun->loop_start; i < tfun->loop_end; i++) { log_test_start (sr, tc, tfun); switch (srunner_fork_status(sr)) { case CK_FORK: #ifdef _POSIX_VERSION tr = tcase_run_tfun_fork (sr, tc, tfun, i); #else /* _POSIX_VERSION */ eprintf("This version does not support fork", __FILE__, __LINE__); #endif /* _POSIX_VERSION */ break; case CK_NOFORK: tr = tcase_run_tfun_nofork (sr, tc, tfun, i); break; default: eprintf("Bad fork status in SRunner", __FILE__, __LINE__); } srunner_add_failure (sr, tr); log_test_end(sr, tr); } } }
static int srunner_run_unchecked_setup (SRunner * sr, TCase * tc) { TestResult *tr = NULL; int rval = 1; set_fork_status (CK_NOFORK); tr = srunner_run_setup (tc->unch_sflst, CK_NOFORK, tc->name, "unchecked_setup"); set_fork_status (srunner_fork_status (sr)); if (tr != NULL && tr->rtype != CK_PASS) { srunner_add_failure (sr, tr); rval = 0; } return rval; }
static void srunner_iterate_tcase_tfuns (SRunner * sr, TCase * tc) { List *tfl; TF *tfun; TestResult *tr = NULL; tfl = tc->tflst; for (check_list_front (tfl); !check_list_at_end (tfl); check_list_advance (tfl)) { int i; tfun = (TF *) check_list_val (tfl); for (i = tfun->loop_start; i < tfun->loop_end; i++) { log_test_start (sr, tc, tfun); switch (srunner_fork_status (sr)) { case CK_FORK: #if defined(HAVE_FORK) && HAVE_FORK==1 tr = tcase_run_tfun_fork (sr, tc, tfun, i); #else /* HAVE_FORK */ eprintf ("This version does not support fork", __FILE__, __LINE__); #endif /* HAVE_FORK */ break; case CK_NOFORK: tr = tcase_run_tfun_nofork (sr, tc, tfun, i); break; case CK_FORK_GETENV: default: eprintf ("Bad fork status in SRunner", __FILE__, __LINE__); } if (NULL != tr) { srunner_add_failure (sr, tr); log_test_end (sr, tr); } } } }