Changeset 83e6cefa in rtems


Ignore:
Timestamp:
Dec 20, 2017, 6:24:00 PM (18 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.10
Children:
776caaed
Parents:
95d5a0a9
git-author:
Sebastian Huber <sebastian.huber@…> (12/20/17 18:24:00)
git-committer:
Gedare Bloom <gedare@…> (03/23/18 15:33:59)
Message:

sptests/spmutex01: test flush with inherit prio

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/spmutex01/init.c

    r95d5a0a9 r83e6cefa  
    3232  REQ_WAKE_UP_HELPER = RTEMS_EVENT_1,
    3333  REQ_MTX_0_OBTAIN = RTEMS_EVENT_2,
    34   REQ_MTX_0_RELEASE = RTEMS_EVENT_3,
    35   REQ_MTX_1_OBTAIN = RTEMS_EVENT_4,
    36   REQ_MTX_1_OBTAIN_TIMEOUT = RTEMS_EVENT_5,
    37   REQ_MTX_1_RELEASE = RTEMS_EVENT_6,
    38   REQ_MTX_2_OBTAIN = RTEMS_EVENT_7,
    39   REQ_MTX_2_RELEASE = RTEMS_EVENT_8,
     34  REQ_MTX_0_OBTAIN_UNSATISFIED = RTEMS_EVENT_3,
     35  REQ_MTX_0_RELEASE = RTEMS_EVENT_4,
     36  REQ_MTX_1_OBTAIN = RTEMS_EVENT_5,
     37  REQ_MTX_1_OBTAIN_TIMEOUT = RTEMS_EVENT_6,
     38  REQ_MTX_1_RELEASE = RTEMS_EVENT_7,
     39  REQ_MTX_2_OBTAIN = RTEMS_EVENT_8,
     40  REQ_MTX_2_RELEASE = RTEMS_EVENT_9,
    4041} request_id;
    4142
     
    142143}
    143144
     145static void obtain_unsatisfied(test_context *ctx, mutex_id id)
     146{
     147  rtems_status_code sc;
     148
     149  sc = rtems_semaphore_obtain(ctx->mtx[id], RTEMS_WAIT, RTEMS_NO_TIMEOUT);
     150  rtems_test_assert(sc == RTEMS_UNSATISFIED);
     151}
     152
    144153static void obtain(test_context *ctx, mutex_id id)
    145154{
     
    155164
    156165  sc = rtems_semaphore_release(ctx->mtx[id]);
     166  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     167}
     168
     169static void flush(test_context *ctx, mutex_id id)
     170{
     171  rtems_status_code sc;
     172
     173  sc = rtems_semaphore_flush(ctx->mtx[id]);
    157174  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    158175}
     
    230247    if ((events & REQ_MTX_0_OBTAIN) != 0) {
    231248      obtain(ctx, MTX_0);
     249      ++ctx->generation[id];
     250    }
     251
     252    if ((events & REQ_MTX_0_OBTAIN_UNSATISFIED) != 0) {
     253      obtain_unsatisfied(ctx, MTX_0);
    232254      ++ctx->generation[id];
    233255    }
     
    408430}
    409431
     432static void test_inherit_flush(test_context *ctx)
     433{
     434  assert_prio(ctx, M, 3);
     435  obtain(ctx, MTX_0);
     436  request(ctx, A_1, REQ_MTX_0_OBTAIN_UNSATISFIED);
     437  check_generations(ctx, NONE, NONE);
     438  assert_prio(ctx, M, 1);
     439  flush(ctx, MTX_0);
     440  check_generations(ctx, A_1, NONE);
     441  assert_prio(ctx, M, 3);
     442  release(ctx, MTX_0);
     443}
     444
    410445static void tear_down(test_context *ctx)
    411446{
     
    438473  test_inherit_nested_vertical_timeout(ctx);
    439474  test_inherit_nested_horizontal(ctx);
     475  test_inherit_flush(ctx);
    440476  tear_down(ctx);
    441477
Note: See TracChangeset for help on using the changeset viewer.