Ejemplo n.º 1
0
int run_tests(int benchmark_output) {
  int total;
  int passed;
  int failed;
  int todos;
  int skipped;
  int current;
  int test_result;
  task_entry_t* task;

  /* Count the number of tests. */
  total = 0;
  for (task = TASKS; task->main; task++) {
    if (!task->is_helper) {
      total++;
    }
  }

  if (tap_output) {
    fprintf(stderr, "1..%d\n", total);
    fflush(stderr);
  }

  /* Run all tests. */
  passed = 0;
  failed = 0;
  todos = 0;
  skipped = 0;
  current = 1;
  for (task = TASKS; task->main; task++) {
    if (task->is_helper) {
      continue;
    }

    if (!tap_output)
      rewind_cursor();

    if (!benchmark_output && !tap_output) {
      log_progress(total, passed, failed, todos, skipped, task->task_name);
    }

    test_result = run_test(task->task_name, benchmark_output, current);
    switch (test_result) {
    case TEST_OK: passed++; break;
    case TEST_TODO: todos++; break;
    case TEST_SKIP: skipped++; break;
    default: failed++;
    }
    current++;
  }

  if (!tap_output)
    rewind_cursor();

  if (!benchmark_output && !tap_output) {
    log_progress(total, passed, failed, todos, skipped, "Done.\n");
  }

  return failed;
}
Ejemplo n.º 2
0
Archivo: runner.c Proyecto: Isszul/node
int run_tests(int timeout, int benchmark_output) {
  int total, passed, failed, current;
  task_entry_t* task;

  /* Count the number of tests. */
  total = 0;
  for (task = TASKS; task->main; task++) {
    if (!task->is_helper) {
      total++;
    }
  }

  if (tap_output) {
    LOGF("1..%d\n", total);
  }

  /* Run all tests. */
  passed = 0;
  failed = 0;
  current = 1;
  for (task = TASKS; task->main; task++) {
    if (task->is_helper) {
      continue;
    }

    rewind_cursor();
    if (!benchmark_output && !tap_output) {
      log_progress(total, passed, failed, task->task_name);
    }

    if (run_test(task->task_name, timeout, benchmark_output, current) == 0) {
      passed++;
    } else {
      failed++;
    }
    current++;
  }

  rewind_cursor();

  if (!benchmark_output && !tap_output) {
    log_progress(total, passed, failed, "Done.\n");
  }

  return failed;
}