Changeset 3a27248 in rtems for testsuites/smptests


Ignore:
Timestamp:
Oct 21, 2016, 7:23:58 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
73a193f
Parents:
913864c
git-author:
Sebastian Huber <sebastian.huber@…> (10/21/16 07:23:58)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/02/16 09:05:43)
Message:

score: First part of new MrsP implementation

Update #2556.

Location:
testsuites/smptests
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • testsuites/smptests/Makefile.am

    r913864c r3a27248  
    1818SUBDIRS += smpfatal01
    1919SUBDIRS += smpfatal02
     20SUBDIRS += smpfatal03
    2021SUBDIRS += smpfatal04
    2122SUBDIRS += smpfatal05
  • testsuites/smptests/configure.ac

    r913864c r3a27248  
    7676smpfatal01/Makefile
    7777smpfatal02/Makefile
     78smpfatal03/Makefile
    7879smpfatal04/Makefile
    7980smpfatal05/Makefile
  • testsuites/smptests/smpmrsp01/init.c

    r913864c r3a27248  
    215215}
    216216
     217static void create_timer(test_context *ctx)
     218{
     219  rtems_status_code sc;
     220
     221  sc = rtems_timer_create(
     222    rtems_build_name('T', 'I', 'M', 'R'),
     223    &ctx->timer_id
     224  );
     225  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     226}
     227
     228static void delete_timer(test_context *ctx)
     229{
     230  rtems_status_code sc;
     231
     232  sc = rtems_timer_delete(ctx->timer_id);
     233  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     234}
     235
     236static void fire_timer(
     237  test_context *ctx,
     238  rtems_interval interval,
     239  rtems_timer_service_routine_entry routine
     240)
     241{
     242  rtems_status_code sc;
     243
     244  sc = rtems_timer_fire_after(ctx->timer_id, interval, routine, ctx);
     245  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     246}
     247
    217248static void create_mrsp_sema(
    218249  test_context *ctx,
     
    745776}
    746777
    747 static void test_mrsp_unlock_order_error(test_context *ctx)
    748 {
    749   rtems_status_code sc;
    750   rtems_id id_a;
    751   rtems_id id_b;
    752 
    753   puts("test MrsP unlock order error");
    754 
    755   create_mrsp_sema(ctx, &id_a, 1);
    756   create_mrsp_sema(ctx, &id_b, 1);
    757 
    758   sc = rtems_semaphore_obtain(id_a, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    759   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    760 
    761   sc = rtems_semaphore_obtain(id_b, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    762   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    763 
    764   sc = rtems_semaphore_release(id_a);
    765   rtems_test_assert(sc == RTEMS_INCORRECT_STATE);
    766 
    767   sc = rtems_semaphore_release(id_b);
    768   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    769 
    770   sc = rtems_semaphore_release(id_a);
    771   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    772 
    773   sc = rtems_semaphore_delete(id_a);
    774   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    775 
    776   sc = rtems_semaphore_delete(id_b);
    777   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     778static void deadlock_timer(rtems_id timer_id, void *arg)
     779{
     780  test_context *ctx = arg;
     781
     782  change_prio(ctx->main_task_id, 1);
    778783}
    779784
     
    785790  sc = rtems_semaphore_obtain(ctx->mrsp_ids[1], RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    786791  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     792
     793  fire_timer(ctx, 2, deadlock_timer);
    787794
    788795  sc = rtems_semaphore_obtain(ctx->mrsp_ids[0], RTEMS_WAIT, RTEMS_NO_TIMEOUT);
     
    811818  change_prio(RTEMS_SELF, prio);
    812819
     820  create_timer(ctx);
    813821  create_mrsp_sema(ctx, &ctx->mrsp_ids[0], prio);
    814822  create_mrsp_sema(ctx, &ctx->mrsp_ids[1], prio);
     
    833841  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    834842
     843  prio = 1;
     844  sc = rtems_semaphore_set_priority(
     845    ctx->mrsp_ids[1],
     846    ctx->scheduler_ids[0],
     847    prio,
     848    &prio
     849  );
     850  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     851  rtems_test_assert(prio == 2);
     852
    835853  sc = rtems_semaphore_obtain(ctx->mrsp_ids[1], RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    836   rtems_test_assert(sc == RTEMS_UNSATISFIED);
     854  rtems_test_assert(sc == RTEMS_INCORRECT_STATE);
     855
     856  sc = rtems_semaphore_set_priority(
     857    ctx->mrsp_ids[1],
     858    ctx->scheduler_ids[0],
     859    prio,
     860    &prio
     861  );
     862  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    837863
    838864  sc = rtems_semaphore_release(ctx->mrsp_ids[0]);
     
    850876  sc = rtems_semaphore_delete(ctx->mrsp_ids[1]);
    851877  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     878
     879  delete_timer(ctx);
    852880}
    853881
     
    10071035  assert_prio(RTEMS_SELF, 3);
    10081036
    1009   sc = rtems_timer_fire_after(ctx->timer_id, 2, unblock_ready_timer, ctx);
    1010   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     1037  fire_timer(ctx, 2, unblock_ready_timer);
    10111038
    10121039  sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT);
     
    11041131   */
    11051132
    1106   sc = rtems_timer_fire_after(
    1107     ctx->timer_id,
    1108     2,
    1109     unblock_owner_before_rival_timer,
    1110     ctx
    1111   );
    1112   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     1133  fire_timer(ctx, 2, unblock_owner_before_rival_timer);
    11131134
    11141135  /* This will take the processor away from us, the timer will help later */
     
    11241145  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    11251146
    1126   sc = rtems_timer_fire_after(
    1127     ctx->timer_id,
    1128     2,
    1129     unblock_owner_after_rival_timer,
    1130     ctx
    1131   );
    1132   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     1147  fire_timer(ctx, 2, unblock_owner_after_rival_timer);
    11331148
    11341149  /* This will take the processor away from us, the timer will help later */
     
    12301245  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    12311246
    1232   sc = rtems_timer_create(
    1233     rtems_build_name('T', 'I', 'M', 'R'),
    1234     &ctx->timer_id
    1235   );
    1236   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     1247  create_timer(ctx);
    12371248
    12381249  /* In case these tasks run, then we have a MrsP protocol violation */
     
    12471258
    12481259  print_switch_events(ctx);
    1249 
    1250   sc = rtems_timer_delete(ctx->timer_id);
    1251   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     1260  delete_timer(ctx);
    12521261
    12531262  sc = rtems_task_delete(ctx->high_task_id[0]);
     
    17501759  test_mrsp_initially_locked_error();
    17511760  test_mrsp_nested_obtain_error(ctx);
    1752   test_mrsp_unlock_order_error(ctx);
    17531761  test_mrsp_deadlock_error(ctx);
    17541762  test_mrsp_multiple_obtain(ctx);
Note: See TracChangeset for help on using the changeset viewer.