Esempio n. 1
0
rtems_task Init(
  rtems_task_argument ignored
)
{
  rtems_status_code     sc;

  TEST_BEGIN();

  puts( "Init - Trying to generate period ending while blocking" );

  puts( "Init - rtems_rate_monotonic_create - OK" );
  sc = rtems_rate_monotonic_create(
    rtems_build_name( 'P', 'E', 'R', '1' ),
    &Period
  );
  directive_failed( sc, "rtems_rate_monotonic_create" );

  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);
}
Esempio n. 2
0
rtems_task Init(
  rtems_task_argument ignored
)
{
  int sc;

  TEST_BEGIN();

  puts( "Init - Trying to generate timer fire from ISR while firing" );
  puts( "Init - Variation is: " TEST_STRING );

  puts( "Init - There is no way for the test to know if it hits the case" );

  /* create POSIX Timer */
  sc = timer_create (CLOCK_REALTIME, NULL, &Timer);
  if ( sc == -1 ) {
    perror ("Error in timer creation\n");
    rtems_test_exit(0);
  }

  /* we don't care if it ever fires */
  TimerParams.it_interval.tv_sec  = 10;
  TimerParams.it_interval.tv_nsec = 0;
  TimerParams.it_value.tv_sec     = 10;
  TimerParams.it_value.tv_nsec    = 0;

  interrupt_critical_section_test( test_body, NULL, test_release_from_isr );

  TEST_END();
  rtems_test_exit(0);
}
Esempio n. 3
0
static rtems_task Init(
  rtems_task_argument ignored
)
{
  rtems_status_code     status;

  TEST_BEGIN();

  thread = _Thread_Get_executing();

  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);
}
Esempio n. 4
0
static rtems_task Init(
    rtems_task_argument ignored
)
{
    rtems_status_code     sc;

    TEST_BEGIN();

    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);
}
Esempio n. 5
0
static void Init(rtems_task_argument ignored)
{
  test_context *ctx = &ctx_instance;
  rtems_status_code sc;

  TEST_BEGIN();

  ctx->main_task_control = _Thread_Get_executing();

  sc = rtems_semaphore_create(
    rtems_build_name('S', 'E', 'M', 'A'),
    1,
    RTEMS_SIMPLE_BINARY_SEMAPHORE,
    0,
    &ctx->semaphore_id
  );
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);

  ctx->semaphore_control = get_semaphore_control(ctx->semaphore_id);

  interrupt_critical_section_test(test_body, ctx, release_semaphore);
  rtems_test_assert(ctx->done);

  TEST_END();

  rtems_test_exit(0);
}
Esempio n. 6
0
File: init.c Progetto: Dipupo/rtems
static void test_timeout_before_all_satisfy(test_context *ctx)
{
  rtems_status_code sc;

  puts(
    "Init - Trying to generate timeout before all satisfied "
    "while blocking on event"
  );

  ctx->hit = false;

  sc = rtems_timer_fire_after(ctx->timer, 1, timeout_before_satisfied, ctx);
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);

  interrupt_critical_section_test(
    test_body_timeout_before_all_satisfy,
    ctx,
    NULL
  );

  sc = rtems_timer_cancel(ctx->timer);
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);

  rtems_test_assert(ctx->hit);
}
Esempio n. 7
0
static void test_any_satisfy_before_timeout(test_context *ctx)
{
  rtems_status_code sc;

  puts(
    "Init - Trying to generate any satisfied before timeout "
    "while blocking on event"
  );

  ctx->hit = false;
  ctx->thread->Wait.count = 0;

  sc = rtems_timer_fire_after(ctx->timer, 1, any_satisfy_before_timeout, ctx);
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);

  interrupt_critical_section_test(
    test_body_any_satisfy_before_timeout,
    ctx,
    NULL
  );

  sc = rtems_timer_cancel(ctx->timer);
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);

  rtems_test_assert(ctx->hit);
}
Esempio n. 8
0
static void Init(rtems_task_argument ignored)
{
  test_context *ctx = &ctx_instance;
  rtems_status_code sc;

  TEST_BEGIN();

  ctx->master_task = rtems_task_self();

  sc = rtems_semaphore_create(
    rtems_build_name('S', 'E', 'M', 'A'),
    1,
    RTEMS_COUNTING_SEMAPHORE,
    0,
    &ctx->semaphore_id
  );
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);

  sc = rtems_task_create(
    rtems_build_name('S', 'E', 'M', 'A'),
    PRIORITY_SEMAPHORE,
    RTEMS_MINIMUM_STACK_SIZE,
    RTEMS_DEFAULT_MODES,
    RTEMS_DEFAULT_ATTRIBUTES,
    &ctx->semaphore_task
  );
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);

  sc = rtems_task_start(
    ctx->semaphore_task,
    semaphore_task,
    (rtems_task_argument) ctx
  );
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);

  interrupt_critical_section_test(test_body, ctx, release_semaphore);

  rtems_test_assert(ctx->thread_queue_was_null);
  rtems_test_assert(ctx->status_was_successful);
  rtems_test_assert(ctx->status_was_timeout);

  TEST_END();

  rtems_test_exit(0);
}
Esempio n. 9
0
File: init.c Progetto: gedare/rtems
static void test(test_context *ctx)
{
  const char *path = "generic";
  int rv;

  rv = IMFS_make_generic_node(
    path,
    S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
    &node_control,
    ctx
  );
  rtems_test_assert(rv == 0);

  interrupt_critical_section_test(test_body, ctx, do_fcntl);

  /* There is no reliable indicator if the test case has been hit */
  rtems_test_assert(ctx->append_count > 0);
  rtems_test_assert(ctx->no_append_count > 0);

  rv = unlink(path);
  rtems_test_assert(rv == 0);
}
Esempio n. 10
0
rtems_task Init(
  rtems_task_argument argument
)
{
  rtems_status_code     status;

  TEST_BEGIN();

  main_task = rtems_task_self();
  main_thread = _Thread_Get_executing();

  status = rtems_task_create(
    0xa5a5a5a5,
    1,
    RTEMS_MINIMUM_STACK_SIZE,
    RTEMS_DEFAULT_MODES,
    RTEMS_DEFAULT_ATTRIBUTES,
    &other_task
  );
  directive_failed( status, "rtems_task_create" );

  /*
   * Test Event send successful from ISR -- receive is forever
   */

  case_hit = false;
  interrupt_critical_section_test(
    test_body_event_from_isr,
    NULL,
    test_event_from_isr
  );

  printf(
    "Event sent from ISR hitting synchronization point has %soccurred\n",
    case_hit ? "" : "NOT "
  );

  rtems_test_assert( case_hit );

  /*
   * Test Event send successful from ISR -- receive has timeout
   */

  case_hit = false;
  interrupt_critical_section_test(
    test_body_event_with_timeout_from_isr,
    NULL,
    test_event_with_timeout_from_isr
  );

  printf(
    "Event sent from ISR (with timeout) hitting synchronization "
      "point has %soccurred\n",
    case_hit ? "" : "NOT "
  );

  rtems_test_assert( case_hit );

  TEST_END();
  rtems_test_exit( 0 );
}