Exemplo n.º 1
0
END_TEST


START_TEST(test_send_test_error)
{
  TestResult *tr;
  setup_messaging();
  send_ctx_info(CK_CTX_SETUP);
  send_loc_info("abc123.c", 10);
  send_ctx_info(CK_CTX_TEST);
  send_loc_info("abc124.c", 22);
  send_loc_info("abc125.c", 25);
  tr = receive_test_result(1);
  teardown_messaging();

  ck_assert_msg (tr != NULL,
	       "No test result received");
  ck_assert_msg (tr_ctx(tr) == CK_CTX_TEST,
	       "Bad CTX received");
  ck_assert_msg (strcmp(tr_lfile(tr), "abc125.c") == 0,
	       "Bad loc file received");
  ck_assert_msg (tr_lno(tr) == 25,
	       "Bad loc line received");
  if (tr != NULL)
    tr_free(tr);
}
Exemplo n.º 2
0
END_TEST

START_TEST(test_send_big)
{
  TestResult *tr;
  int i;
  
  setup_messaging();
  send_ctx_info(CK_CTX_SETUP);
  send_loc_info("abc123.c", 10);
  for (i = 0; i < 10000; i++) {
    send_ctx_info(CK_CTX_TEST);
    send_loc_info("abc124.c", i);
  }

  tr = receive_test_result(0);
  teardown_messaging();

  ck_assert_msg (tr != NULL,
	       "No test result received");
  ck_assert_msg (tr_ctx(tr) == CK_CTX_TEST,
	       "Bad CTX received");
  ck_assert_msg (strcmp(tr_lfile(tr), "abc124.c") == 0,
	       "Bad loc file received");
  ck_assert_msg (tr_lno(tr) == i -1,
	       "Bad loc line received");
  if (tr != NULL)
    tr_free(tr);
}
Exemplo n.º 3
0
Arquivo: check.c Projeto: BruceYi/okl4
void _fail_unless (int result, const char *file,
                   int line, const char * msg, ...)
{
  va_list ap;
  char buf[BUFSIZ];

  /* Ensure a sane message was passed in. */
  if (msg == NULL) {
    eprintf ("_fail_unless() called with NULL msg",__FILE__,__LINE__);
    msg = "(null)";
  }

  /* If we passed the test, we need do nothing more. */
  if (result) {
      return;
  }

  /* Unlike normal libcheck, we don't want to mark all the time, as it can
   * waste a lot of memory, so we only mark on failure */
  send_loc_info (get_send_key(), file, line);

  va_start(ap,msg);
  vsnprintf(buf, BUFSIZ, msg, ap);
  va_end(ap);

  /* Display a failure message now, just in case we don't make it
   * until the end of the tests. */
  printf("*** Failure: ");
  puts(buf);

  /* Send failure information to the test controller. */
  send_failure_info(get_send_key(), buf);

#if defined(OKL4_KERNEL_MICRO)
  /* Send failure message to our pager. */
  if (cur_fork_status() == CK_WITHPAGER) {
    L4_MsgTag_t tag = L4_Niltag;

    /* Send a failure message to the test runner. A label of '1' indicates
     * failure. */
    tag = L4_MsgTagAddLabel(tag, 1);
    L4_Set_MsgTag(tag);

    /* Inform the library, and wait for them to kill us. */
    L4_Call(libcheck);
    L4_WaitForever();
  }
#endif
}
Exemplo n.º 4
0
Arquivo: check.c Projeto: BruceYi/okl4
void _mark_point (const char *file, int line)
{
  send_loc_info (get_send_key(), file, line);
}
Exemplo n.º 5
0
Arquivo: check.c Projeto: BruceYi/okl4
void tcase_fn_start (const char *fname, const char *file, int line)
{
    printf("%s\n", fname);
  send_ctx_info (get_send_key(),CK_CTX_TEST);
  send_loc_info (get_send_key(),file, line);
}