示例#1
0
文件: run.c 项目: maleadt/genetic
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 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);
      }
    }
  }
}