当前位置: 首页>>代码示例>>C++>>正文


C++ TEST_END函数代码示例

本文整理汇总了C++中TEST_END函数的典型用法代码示例。如果您正苦于以下问题:C++ TEST_END函数的具体用法?C++ TEST_END怎么用?C++ TEST_END使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TEST_END函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TEST_BEGIN

void *POSIX_Init(
  void *argument
)
{
  struct mq_attr         attr;
  mqd_t                  mq;

  TEST_BEGIN();


  /* set the time of day, and print our buffer in multiple ways */

  set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );

  /* get id of this thread */

  Init_id = pthread_self();
  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );

  rtems_workspace_greedy_allocate( NULL, 0 );

  attr.mq_maxmsg  = MAXMSG;
  attr.mq_msgsize = MSGSIZE;
  puts("Init: mq_open - Workspace not available - ENOMEM");
  mq = mq_open( Get_Longest_Name(), O_CREAT, 0x777, &attr );
  fatal_posix_service_status_errno(mq, ENOMEM, "no workspace available");

  TEST_END();
  rtems_test_exit( 0 );

  return NULL; /* just so the compiler thinks we returned something */
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:32,代码来源:init.c

示例2: Init

rtems_task Init(
  rtems_task_argument ignored
)
{
  rtems_status_code    status;
  rtems_id             extension;
  rtems_id             task_id;

  TEST_BEGIN();

  puts( "Init - rtems_extension_create - OK" );
  status = rtems_extension_create(
    rtems_build_name( 'E', 'X', 'T', ' ' ),
    &Extensions,
    &extension
  );
  directive_failed( status, "rtems_extension_create" );

  puts( "Init - rtems_task_create - create extension fails - UNSATISFIED" );
  status = rtems_task_create(
     rtems_build_name( 'T', 'A', '1', ' ' ),
     1,
     RTEMS_MINIMUM_STACK_SIZE,
     RTEMS_TIMESLICE,
     RTEMS_FLOATING_POINT,
     &task_id
  );
  fatal_directive_status( status, RTEMS_UNSATISFIED, "rtems_task_create" );

  puts( "Init - rtems_extension_delete - OK" );
  status = rtems_extension_delete( extension );
  directive_failed( status, "rtems_extension_delete" );
  TEST_END();
  rtems_test_exit(0);
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:35,代码来源:init.c

示例3: TaskAB_entry

/* TASK A/B */
rtems_task TaskAB_entry(rtems_task_argument me)
{
  static rtems_mode previous_mode_set;
  rtems_status_code status;
  uint32_t iterations = 0;

  status = rtems_task_mode(
    RTEMS_PREEMPT | RTEMS_TIMESLICE,
    RTEMS_PREEMPT_MASK | RTEMS_TIMESLICE_MASK,
    &previous_mode_set
  );
  directive_failed(status, "Unable to change task mode.");

  while(1) {
    if (turn == me) {
      printf(
        "Task #%" PRIdrtems_task_argument "'s turn. Now setting turn to %"
          PRIdrtems_task_argument "\n",
          me,
          1 - me
      );

      if ( ++iterations == 10 ) {
        TEST_END();
        exit( 0 );
      }

      turn = 1 - me;
    }
  }
}
开发者ID:gedare,项目名称:rtems,代码行数:32,代码来源:init.c

示例4: Task01

/* Task01 starts with priority 36 */
rtems_task Task01(rtems_task_argument ignored)
{
  rtems_status_code status;
  printf("TA01: started with priority %d\n", getprio());

  status = rtems_semaphore_obtain( sem_id[0], RTEMS_WAIT, 0 );
  directive_failed( status, "rtems_semaphore_obtain of S0\n");
  printf("TA01: priority %d, holding S0\n", getprio());

  status = rtems_semaphore_obtain( sem_id[1], RTEMS_WAIT, 0 );
  directive_failed( status, "rtems_semaphore_obtain of S1");
  printf("TA01: priority %d, holding S0, S1\n", getprio());

  /* Start Task 2 (TA02) with priority 34. It will run immediately. */
  status = rtems_task_start( Task_id[1], Task02, 0);
  directive_failed( status, "rtems_task_start of TA02\n");

  /* Start Task 3 (TA03) with priority 32. It will run immediately. */
  status = rtems_task_start( Task_id[2], Task03, 0);
  directive_failed( status, "rtems_task_start of TA03\n");
  printf("TA01: priority %d, holding S0, S1\n", getprio());

  status = rtems_semaphore_release(sem_id[1]);
  directive_failed( status, "rtems_semaphore_release of S1\n");
  printf("TA01: priority %d, holding S0\n", getprio());

  status = rtems_semaphore_release(sem_id[0]);
  directive_failed( status, "rtems_semaphore_release of S0\n");
  printf("TA01: priority %d\n", getprio());

  printf("TA01: exiting\n");
  TEST_END();

  rtems_test_exit(0);
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:36,代码来源:init.c

示例5: High_task

rtems_task High_task(
  rtems_task_argument argument
)
{
  size_t  size;

  (void) rtems_message_queue_receive(
           Queue_id,
           (long (*)[4]) Buffer,
           &size,
           RTEMS_DEFAULT_OPTIONS,
           RTEMS_NO_TIMEOUT
         );

  end_time = benchmark_timer_read();

  put_time(
    "rtems_message_queue_send: task readied preempts caller",
    end_time,
    operation_count,
    0,
    0
  );

  TEST_END();
  rtems_test_exit( 0 );
}
开发者ID:gedare,项目名称:rtems,代码行数:27,代码来源:task1.c

示例6: Init

static rtems_task Init(rtems_task_argument ignored)
{
    Freechain_Control fc;
    test_node *node;

    TEST_BEGIN();

    _Freechain_Initialize(&fc, NULL, 0, sizeof(test_node));
    rtems_test_assert(_Chain_Is_empty(&fc.Free));

    _Freechain_Initialize(&fc, malloc, 1, SIZE_MAX);
    rtems_test_assert(_Chain_Is_empty(&fc.Free));

    rtems_test_assert(_Freechain_Get(&fc, NULL, 0, sizeof(test_node)) == NULL);

    rtems_test_assert(_Freechain_Get(&fc, malloc, 1, SIZE_MAX) == NULL);

    /* check whether freechain put and get works correctly*/

    _Freechain_Put(&fc, NULL);

    puts( "INIT - Get node from freechain - OK" );
    node = _Freechain_Get(&fc, malloc, 1, sizeof(test_node));
    node->x = 1;

    puts( "INIT - Put node back to freechain - OK" );
    _Freechain_Put(&fc, node);

    puts( "INIT - Verify freechain node put and get - OK" );
    node = _Freechain_Get(&fc, NULL, 0, sizeof(test_node));
    rtems_test_assert(node->x == 1);

    TEST_END();
    rtems_test_exit(0);
}
开发者ID:Avanznow,项目名称:rtems,代码行数:35,代码来源:init.c

示例7: Init

rtems_task Init(
  rtems_task_argument argument
)
{
  FILE *fd;
  int   sc;

  TEST_BEGIN();

  puts( "Open /testfile" );
  fd = fopen( "/testfile", "w+" );
  rtems_test_assert( fd );

  puts( "flockfile /testfile" );
  flockfile( fd );
  
  puts( "ftrylockfile /testfile" );
  sc = ftrylockfile( fd );
  rtems_test_assert( sc == -1 );
  rtems_test_assert( errno == ENOTSUP );
  
  puts( "flockfile /testfile" );
  flockfile( fd );
  
  puts( "funlockfile /testfile" );
  funlockfile( fd );
  
  TEST_END();

  rtems_test_exit(0);
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:31,代码来源:init.c

示例8: pthread_rwlock_wrlock

void *Low(
  void *argument
)
{
  int      status;
  benchmark_timer_t end_time;

  /* write locking */
    status = pthread_rwlock_wrlock(&rwlock);
  end_time = benchmark_timer_read();

  rtems_test_assert( status == 0 );

  put_time(
    "pthread_rwlock_unlock: thread waiting preempt",
    end_time,
    OPERATION_COUNT,
    0,
    0
  );

  TEST_END();
  rtems_test_exit( 0 );
  return NULL;
}
开发者ID:Fyleo,项目名称:rtems,代码行数:25,代码来源:init.c

示例9: Init

rtems_task Init(
  rtems_task_argument ignored
)
{
  rtems_status_code     status;

  TEST_BEGIN();

  puts( "Init - Trying to generate semaphore release from ISR while blocking" );
  puts( "Init - Variation is: " TEST_STRING );
  status = rtems_semaphore_create(
    rtems_build_name( 'S', 'M', '1', ' ' ),
    0,
    SEMAPHORE_ATTRIBUTES,
    RTEMS_NO_PRIORITY,
    &Semaphore
  );
  directive_failed( status, "rtems_semaphore_create of SM1" );

  interrupt_critical_section_test( test_body, NULL, test_release_from_isr );

  if ( case_hit ) {
    puts( "Init - Case hit" );
    TEST_END();
  } else
    puts( "Init - Case not hit - ran too long" );

  rtems_test_exit(0);
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:29,代码来源:init.c

示例10: Init

static rtems_task Init(
  rtems_task_argument ignored
)
{
  rtems_status_code     sc;

  TEST_BEGIN();

  thread = _Thread_Get_executing();

  puts( "Init - Test may not be able to detect case is hit reliably" );
  puts( "Init - Trying to generate timeout from ISR while blocking" );
  sc = rtems_semaphore_create(
    rtems_build_name( 'S', 'M', '1', ' ' ),
    0,
    RTEMS_DEFAULT_ATTRIBUTES,
    RTEMS_NO_PRIORITY,
    &Semaphore
  );
  directive_failed( sc, "rtems_semaphore_create of SM1" );

  interrupt_critical_section_test( test_body, NULL, test_release_from_isr );

  if ( case_hit ) {
    puts( "Init - It appears the case has been hit" );
    TEST_END();
  } else
    puts( "Init - Case not hit - ran too long" );

  rtems_test_exit(0);
}
开发者ID:Avanznow,项目名称:rtems,代码行数:31,代码来源:init.c

示例11: Task_1_through_3

rtems_task Task_1_through_3(
  rtems_task_argument argument
)
{
  rtems_id          tid;
  rtems_time_of_day time;
  rtems_status_code status;

  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
  directive_failed( status, "rtems_task_ident of self" );

  while ( FOREVER )  {
    status = rtems_timer_server_fire_after(
      Timer_id[ argument ],
      (task_number( tid ) - 1) * 5 * rtems_clock_get_ticks_per_second(),
      Resume_task,
      (void *) &tid
    );
    directive_failed( status, "rtems_timer_server_fire_after failed" );

    status = rtems_clock_get_tod( &time );
    directive_failed( status, "rtems_clock_get_tod failed" );

    if ( time.second >= 35 ) {
      TEST_END();
      rtems_test_exit( 0 );
    }

    put_name( Task_name[ task_number( tid ) - 1 ], FALSE );
    print_time( " - rtems_clock_get_tod - ", &time, "\n" );

    status = rtems_task_suspend( RTEMS_SELF );
    directive_failed( status, "rtems_task_suspend" );
  }
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:35,代码来源:task1.c

示例12: Init

static void Init(rtems_task_argument arg)
{
  test_context *ctx = &test_instance;

  TEST_BEGIN();

  ctx->low = rtems_task_self();

  create_task(&ctx->mid, 3);
  create_task(&ctx->high, 1);
  create_task(&ctx->inversion, 2);
  create_sema(&ctx->sem_a);
  create_sema(&ctx->sem_b);

  obtain_sema(ctx->sem_a);
  start_task(ctx->mid, mid_task);
  start_task(ctx->high, high_task);

  /*
   * Here we see that the priority of the high priority task blocked on
   * semaphore B propagated to the low priority task owning semaphore A
   * on which the owner of semaphore B depends.
   */
  assert_prio(ctx->low, 1);
  assert_prio(ctx->mid, 1);
  assert_prio(ctx->high, 1);
  assert_prio(ctx->inversion, 2);

  TEST_END();
  rtems_test_exit(0);
}
开发者ID:gedare,项目名称:rtems,代码行数:31,代码来源:init.c

示例13: main

int main(int argc, char *argv[])
{
	TEST_START();
	TEST(test_cat());
	TEST_END();
	return 0;
}
开发者ID:freedreno,项目名称:freedreno,代码行数:7,代码来源:test-cat.c

示例14: pthread_mutex_lock

void *Blocker(
  void *argument
)
{

  uint32_t end_time;
  struct   sched_param param;
  int      policy;
  int      status;

  status = pthread_mutex_lock(&MutexID);
  rtems_test_assert( status == 0 );
  status = pthread_getschedparam(pthread_self(), &policy, &param);
  rtems_test_assert( status == 0 );
  param.sched_priority = sched_get_priority_max(policy) - 1;
  status = pthread_setschedparam(pthread_self(), policy, &param);
  /* Thread blocks, unlocks mutex, waits for CondID to be signaled */
  pthread_cond_wait(&CondID,&MutexID);

  /* Once signaled, this thread preempts POSIX_Init thread */
  end_time = benchmark_timer_read();
  put_time(
    "pthread_cond_signal: thread waiting preempt",
    end_time,
    1,
    0,
    0
  );
  TEST_END();
  rtems_test_exit( 0 );
  return NULL;
}
开发者ID:mcspic,项目名称:rtems,代码行数:32,代码来源:init.c

示例15: sched_yield

void *Low(
  void *argument
)
{
  benchmark_timer_t end_time;

  /*
   * Now we have finished the thread startup overhead,
   * so let other threads run.  When we return, we can
   * finish the benchmark.
   */
  sched_yield();
    /* let other threads run */

  end_time = benchmark_timer_read();

  put_time(
    "pthread_rwlock_timedwrlock: not available blocks",
    end_time,
    OPERATION_COUNT,
    0,
    0
  );

  TEST_END();

  rtems_test_exit( 0 );
  return NULL;
}
开发者ID:gedare,项目名称:rtems,代码行数:29,代码来源:init.c


注:本文中的TEST_END函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。