Changeset ec5d95e1 in rtems


Ignore:
Timestamp:
Jun 23, 2016, 8:31:04 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
93f158f
Parents:
0c1413c
git-author:
Sebastian Huber <sebastian.huber@…> (06/23/16 08:31:04)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/23/16 08:36:22)
Message:

smptests/smpmrsp01: Fix due to API changes

Commit 77ff5599e0d8e6d91190a379be21a332f83252b0 introduced a change in
the rtems_semaphore_create() behaviour for MrsP semaphores. The ceiling
priorities for all schedulers except the scheduler of the executing
thread are initialized to zero.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/smptests/smpmrsp01/init.c

    r0c1413c rec5d95e1  
    215215}
    216216
     217static void create_mrsp_sema(
     218  test_context *ctx,
     219  rtems_id *id,
     220  rtems_task_priority prio
     221)
     222{
     223  uint32_t cpu_count = rtems_get_processor_count();
     224  uint32_t index;
     225  rtems_status_code sc;
     226
     227  sc = rtems_semaphore_create(
     228    rtems_build_name('M', 'R', 'S', 'P'),
     229    1,
     230    RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
     231      | RTEMS_BINARY_SEMAPHORE,
     232    prio,
     233    id
     234  );
     235  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     236
     237  for (index = 1; index < cpu_count; index = ((index + 2) & ~UINT32_C(1))) {
     238    rtems_task_priority old_prio;
     239
     240    old_prio = 1;
     241    sc = rtems_semaphore_set_priority(
     242      *id,
     243      ctx->scheduler_ids[index],
     244      prio,
     245      &old_prio
     246    );
     247    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     248    rtems_test_assert(old_prio == 0);
     249  }
     250}
     251
    217252static void run_task(rtems_task_argument arg)
    218253{
     
    322357  /* Create a MrsP semaphore object and lock it */
    323358
    324   sc = rtems_semaphore_create(
    325     rtems_build_name('M', 'R', 'S', 'P'),
    326     1,
    327     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    328       | RTEMS_BINARY_SEMAPHORE,
    329     2,
    330     &ctx->mrsp_ids[0]
    331   );
    332   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     359  create_mrsp_sema(ctx, &ctx->mrsp_ids[0], 2);
    333360
    334361  assert_prio(RTEMS_SELF, 3);
     
    562589  /* Create a MrsP semaphore objects */
    563590
    564   sc = rtems_semaphore_create(
    565     rtems_build_name('M', 'R', 'S', 'P'),
    566     1,
    567     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    568       | RTEMS_BINARY_SEMAPHORE,
    569     3,
    570     &ctx->mrsp_ids[0]
    571   );
    572   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    573 
    574   sc = rtems_semaphore_create(
    575     rtems_build_name('M', 'R', 'S', 'P'),
    576     1,
    577     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    578       | RTEMS_BINARY_SEMAPHORE,
    579     2,
    580     &ctx->mrsp_ids[1]
    581   );
    582   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    583 
    584   sc = rtems_semaphore_create(
    585     rtems_build_name('M', 'R', 'S', 'P'),
    586     1,
    587     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    588       | RTEMS_BINARY_SEMAPHORE,
    589     1,
    590     &ctx->mrsp_ids[2]
    591   );
    592   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     591  create_mrsp_sema(ctx, &ctx->mrsp_ids[0], 3);
     592  create_mrsp_sema(ctx, &ctx->mrsp_ids[1], 2);
     593  create_mrsp_sema(ctx, &ctx->mrsp_ids[2], 1);
    593594
    594595  prio = 4;
     
    688689}
    689690
    690 static void test_mrsp_flush_error(void)
     691static void test_mrsp_flush_error(test_context *ctx)
    691692{
    692693  rtems_status_code sc;
     
    695696  puts("test MrsP flush error");
    696697
    697   sc = rtems_semaphore_create(
    698     rtems_build_name('M', 'R', 'S', 'P'),
    699     1,
    700     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    701       | RTEMS_BINARY_SEMAPHORE,
    702     1,
    703     &id
    704   );
    705   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     698  create_mrsp_sema(ctx, &id, 1);
    706699
    707700  sc = rtems_semaphore_flush(id);
     
    730723}
    731724
    732 static void test_mrsp_nested_obtain_error(void)
     725static void test_mrsp_nested_obtain_error(test_context *ctx)
    733726{
    734727  rtems_status_code sc;
     
    737730  puts("test MrsP nested obtain error");
    738731
    739   sc = rtems_semaphore_create(
    740     rtems_build_name('M', 'R', 'S', 'P'),
    741     1,
    742     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    743       | RTEMS_BINARY_SEMAPHORE,
    744     1,
    745     &id
    746   );
    747   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     732  create_mrsp_sema(ctx, &id, 1);
    748733
    749734  sc = rtems_semaphore_obtain(id, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
     
    760745}
    761746
    762 static void test_mrsp_unlock_order_error(void)
     747static void test_mrsp_unlock_order_error(test_context *ctx)
    763748{
    764749  rtems_status_code sc;
     
    768753  puts("test MrsP unlock order error");
    769754
    770   sc = rtems_semaphore_create(
    771     rtems_build_name(' ', ' ', ' ', 'A'),
    772     1,
    773     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    774       | RTEMS_BINARY_SEMAPHORE,
    775     1,
    776     &id_a
    777   );
    778   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    779 
    780   sc = rtems_semaphore_create(
    781     rtems_build_name(' ', ' ', ' ', 'B'),
    782     1,
    783     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    784       | RTEMS_BINARY_SEMAPHORE,
    785     1,
    786     &id_b
    787   );
    788   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     755  create_mrsp_sema(ctx, &id_a, 1);
     756  create_mrsp_sema(ctx, &id_b, 1);
    789757
    790758  sc = rtems_semaphore_obtain(id_a, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
     
    843811  change_prio(RTEMS_SELF, prio);
    844812
    845   sc = rtems_semaphore_create(
    846     rtems_build_name(' ', ' ', ' ', 'A'),
    847     1,
    848     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    849       | RTEMS_BINARY_SEMAPHORE,
    850     prio,
    851     &ctx->mrsp_ids[0]
    852   );
    853   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    854 
    855   sc = rtems_semaphore_create(
    856     rtems_build_name(' ', ' ', ' ', 'B'),
    857     1,
    858     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    859       | RTEMS_BINARY_SEMAPHORE,
    860     prio,
    861     &ctx->mrsp_ids[1]
    862   );
    863   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     813  create_mrsp_sema(ctx, &ctx->mrsp_ids[0], prio);
     814  create_mrsp_sema(ctx, &ctx->mrsp_ids[1], prio);
    864815
    865816  sc = rtems_task_create(
     
    901852}
    902853
    903 static void test_mrsp_multiple_obtain(void)
     854static void test_mrsp_multiple_obtain(test_context *ctx)
    904855{
    905856  rtems_status_code sc;
     
    912863  change_prio(RTEMS_SELF, 4);
    913864
    914   sc = rtems_semaphore_create(
    915     rtems_build_name(' ', ' ', ' ', 'A'),
    916     1,
    917     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    918       | RTEMS_BINARY_SEMAPHORE,
    919     3,
    920     &sem_a_id
    921   );
    922   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    923 
    924   sc = rtems_semaphore_create(
    925     rtems_build_name(' ', ' ', ' ', 'B'),
    926     1,
    927     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    928       | RTEMS_BINARY_SEMAPHORE,
    929     2,
    930     &sem_b_id
    931   );
    932   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    933 
    934   sc = rtems_semaphore_create(
    935     rtems_build_name(' ', ' ', ' ', 'C'),
    936     1,
    937     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    938       | RTEMS_BINARY_SEMAPHORE,
    939     1,
    940     &sem_c_id
    941   );
    942   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     865  create_mrsp_sema(ctx, &sem_a_id, 3);
     866  create_mrsp_sema(ctx, &sem_b_id, 2);
     867  create_mrsp_sema(ctx, &sem_c_id, 1);
    943868
    944869  assert_prio(RTEMS_SELF, 4);
     
    12631188  ctx->high_run[1] = false;
    12641189
    1265   sc = rtems_semaphore_create(
    1266     rtems_build_name(' ', ' ', ' ', 'A'),
    1267     1,
    1268     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    1269       | RTEMS_BINARY_SEMAPHORE,
    1270     3,
    1271     &ctx->mrsp_ids[0]
    1272   );
    1273   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    1274 
     1190  create_mrsp_sema(ctx, &ctx->mrsp_ids[0], 3);
    12751191  assert_prio(RTEMS_SELF, 4);
    12761192
     
    13801296  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    13811297
    1382   sc = rtems_semaphore_create(
    1383     rtems_build_name('S', 'E', 'M', 'A'),
    1384     1,
    1385     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    1386       | RTEMS_BINARY_SEMAPHORE,
    1387     1,
    1388     &sem_id
    1389   );
    1390   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     1298  create_mrsp_sema(ctx, &sem_id, 1);
    13911299
    13921300  rtems_test_assert(!run);
     
    14491357  reset_switch_events(ctx);
    14501358
    1451   sc = rtems_semaphore_create(
    1452     rtems_build_name('S', 'E', 'M', 'A'),
    1453     1,
    1454     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    1455       | RTEMS_BINARY_SEMAPHORE,
    1456     2,
    1457     &ctx->mrsp_ids[0]
    1458   );
    1459   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     1359  create_mrsp_sema(ctx, &ctx->mrsp_ids[0], 2);
    14601360
    14611361  sc = rtems_semaphore_obtain(ctx->mrsp_ids[0], RTEMS_WAIT, RTEMS_NO_TIMEOUT);
     
    16921592
    16931593  for (index = 0; index < MRSP_COUNT; ++index) {
    1694     sc = rtems_semaphore_create(
    1695       'A' + index,
    1696       1,
    1697       RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
    1698         | RTEMS_BINARY_SEMAPHORE,
    1699       3 + index,
    1700       &ctx->mrsp_ids[index]
    1701     );
    1702     rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     1594    create_mrsp_sema(ctx, &ctx->mrsp_ids[index], 3 + index);
    17031595  }
    17041596
     
    18521744  }
    18531745
    1854   test_mrsp_flush_error();
     1746  test_mrsp_flush_error(ctx);
    18551747  test_mrsp_initially_locked_error();
    1856   test_mrsp_nested_obtain_error();
    1857   test_mrsp_unlock_order_error();
     1748  test_mrsp_nested_obtain_error(ctx);
     1749  test_mrsp_unlock_order_error(ctx);
    18581750  test_mrsp_deadlock_error(ctx);
    1859   test_mrsp_multiple_obtain();
     1751  test_mrsp_multiple_obtain(ctx);
    18601752
    18611753  if (cpu_count > 1) {
Note: See TracChangeset for help on using the changeset viewer.