Changeset cd4884a in rtems


Ignore:
Timestamp:
Sep 13, 2009, 8:37:54 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
33046a5
Parents:
88271c33
Message:

2009-09-13 Joel Sherrill <joel.sherrill@…>

  • sp43/Makefile.am, sp43/init.c, sp43/sp43.scn, sp43/system.h: Add test for Id which is in range for the object class but not allocated yet.
Location:
testsuites/sptests
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/ChangeLog

    r88271c33 rcd4884a  
     12009-09-13      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * sp43/Makefile.am, sp43/init.c, sp43/sp43.scn, sp43/system.h: Add test
     4        for Id which is in range for the object class but not allocated yet.
     5
    162009-09-09      Joel Sherrill <joel.sherrill@OARcorp.com>
    27
  • testsuites/sptests/sp43/Makefile.am

    r88271c33 rcd4884a  
    66
    77rtems_tests_PROGRAMS = sp43
    8 sp43_SOURCES = init.c system.h
     8sp43_SOURCES = init.c
    99
    1010dist_rtems_tests_DATA = sp43.scn
  • testsuites/sptests/sp43/init.c

    r88271c33 rcd4884a  
    6666)
    6767{
    68   rtems_status_code    status;
     68  rtems_status_code    sc;
    6969  char                 name[ 5 ];
    7070  char                *ptr;
     
    8686  }
    8787
    88   status = rtems_object_set_name( id, newName );
    89   directive_failed( status, "rtems_object_set_name" );
    90 
    91   status = rtems_object_get_classic_name( id, &main_name );
    92   directive_failed( status, "rtems_object_get_classic_name" );
     88  sc = rtems_object_set_name( id, newName );
     89  directive_failed( sc, "rtems_object_set_name" );
     90
     91  sc = rtems_object_get_classic_name( id, &main_name );
     92  directive_failed( sc, "rtems_object_get_classic_name" );
    9393  put_name( main_name, FALSE );
    9494  puts( " - name returned by rtems_object_get_classic_name" );
     
    103103)
    104104{
    105   rtems_status_code                   status;
     105  rtems_status_code                   sc;
    106106  rtems_id                            tmpId;
    107107  rtems_name                          tmpName;
     
    120120
    121121  puts( "rtems_object_get_classic_name - INVALID_ADDRESS" );
    122   status = rtems_object_get_classic_name( main_task, NULL );
    123   fatal_directive_status(
    124     status,
     122  sc = rtems_object_get_classic_name( main_task, NULL );
     123  fatal_directive_status(
     124    sc,
    125125    RTEMS_INVALID_ADDRESS,
    126126    "rtems_object_get_classic_name #1"
     
    128128
    129129  puts( "rtems_object_get_classic_name - INVALID_ID (bad index)" );
    130   status = rtems_object_get_classic_name( main_task + 5, &main_name );
    131   fatal_directive_status(
    132     status,
     130  sc = rtems_object_get_classic_name( main_task + 5, &main_name );
     131  fatal_directive_status(
     132    sc,
    133133    RTEMS_INVALID_ID,
    134134    "rtems_object_get_classic_name #2"
     
    136136
    137137  puts( "rtems_object_get_classic_name - INVALID_ID (unallocated index)" );
    138   status = rtems_object_get_classic_name( main_task + 1, &main_name );
    139   fatal_directive_status(
    140     status,
     138  sc = rtems_object_get_classic_name( main_task + 1, &main_name );
     139  fatal_directive_status(
     140    sc,
    141141    RTEMS_INVALID_ID,
    142142    "rtems_object_get_classic_name #4"
     
    145145  puts( "rtems_object_get_classic_name - INVALID_ID (bad API)" );
    146146  tmpId = rtems_build_id( 0xff, OBJECTS_RTEMS_TASKS, 1, 1 ),
    147   status = rtems_object_get_classic_name( tmpId, &main_name );
    148   fatal_directive_status(
    149     status,
     147  sc = rtems_object_get_classic_name( tmpId, &main_name );
     148  fatal_directive_status(
     149    sc,
    150150    RTEMS_INVALID_ID,
    151151    "rtems_object_get_classic_name #5"
    152152  );
    153153
    154   status = rtems_object_get_classic_name( main_task, &main_name );
    155   directive_failed( status, "rtems_object_get_classic_name" );
     154  sc = rtems_object_get_classic_name( main_task, &main_name );
     155  directive_failed( sc, "rtems_object_get_classic_name" );
    156156  put_name( main_name, FALSE );
    157157  puts( " - name returned by rtems_object_get_classic_name for Init task id" );
    158158
    159   status = rtems_object_get_classic_name( RTEMS_SELF, &main_name );
    160   directive_failed( status, "rtems_object_get_classic_name" );
     159  sc = rtems_object_get_classic_name( RTEMS_SELF, &main_name );
     160  directive_failed( sc, "rtems_object_get_classic_name" );
    161161  put_name( main_name, FALSE );
    162162  puts( " - name returned by rtems_object_get_classic_name for RTEMS_SELF" );
     
    204204  puts( "rtems_object_set_name - INVALID_ID (bad API)" );
    205205  tmpId = rtems_build_id( 0xff, OBJECTS_RTEMS_TASKS, 1, 1 ),
    206   status = rtems_object_set_name( tmpId, newName );
    207   fatal_directive_status(
    208     status,
     206  sc = rtems_object_set_name( tmpId, newName );
     207  fatal_directive_status(
     208    sc,
    209209    RTEMS_INVALID_ID,
    210210    "rtems_object_set_name #1"
     
    212212
    213213  puts( "rtems_object_set_name - INVALID_ID (bad index)" );
    214   status = rtems_object_set_name( main_task + 10, newName );
    215   fatal_directive_status(
    216     status,
     214  sc = rtems_object_set_name( main_task + 10, newName );
     215  fatal_directive_status(
     216    sc,
    217217    RTEMS_INVALID_ID,
    218218    "rtems_object_set_name #2"
     
    345345 
    346346  puts( "rtems_object_get_class_information - INVALID_ADDRESS" );
    347   status = rtems_object_get_class_information(
     347  sc = rtems_object_get_class_information(
    348348             OBJECTS_INTERNAL_API, OBJECTS_INTERNAL_THREADS, NULL );
    349349  fatal_directive_status(
    350     status,
     350    sc,
    351351    RTEMS_INVALID_ADDRESS,
    352352    "rtems_object_get_class_information"
     
    354354
    355355  puts( "rtems_object_get_class_information - INVALID_NUMBER (bad API)" );
    356   status =
     356  sc =
    357357    rtems_object_get_class_information(0, OBJECTS_INTERNAL_THREADS, &info);
    358358  fatal_directive_status(
    359     status,
     359    sc,
    360360    RTEMS_INVALID_NUMBER,
    361361    "rtems_object_get_class_information (API)"
     
    363363
    364364  puts( "rtems_object_get_class_information - INVALID_NUMBER (api=0xff)" );
    365   status = rtems_object_get_class_information( 0xff, 1, &info );
    366   fatal_directive_status(
    367     status,
     365  sc = rtems_object_get_class_information( 0xff, 1, &info );
     366  fatal_directive_status(
     367    sc,
    368368    RTEMS_INVALID_NUMBER,
    369369    "rtems_object_get_class_information (api=0xff)"
     
    371371
    372372  puts( "rtems_object_get_class_information - INVALID_NUMBER (class=0)" );
    373   status = rtems_object_get_class_information(
     373  sc = rtems_object_get_class_information(
    374374    OBJECTS_INTERNAL_API, 0, &info );
    375375  fatal_directive_status(
    376     status,
     376    sc,
    377377    RTEMS_INVALID_NUMBER,
    378378    "rtems_object_get_class_information (class=0)"
     
    381381  puts(
    382382    "rtems_object_get_class_information - INVALID_NUMBER (class too high)" );
    383   status = rtems_object_get_class_information(
     383  sc = rtems_object_get_class_information(
    384384    OBJECTS_INTERNAL_API, 0xff, &info);
    385385  fatal_directive_status(
    386     status,
     386    sc,
    387387    RTEMS_INVALID_NUMBER,
    388388    "rtems_object_get_class_information (class #2)"
     
    390390
    391391  puts( "rtems_object_get_class_information - Classic Tasks - OK" );
    392   status = rtems_object_get_class_information(
     392  sc = rtems_object_get_class_information(
    393393             OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, &info );
    394   directive_failed( status, "rtems_object_get_class_information" );
     394  directive_failed( sc, "rtems_object_get_class_information" );
    395395  print_class_info( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, &info );
    396396
    397397  puts( "rtems_object_get_class_information - Classic Timers - OK" );
    398   status = rtems_object_get_class_information(
     398  sc = rtems_object_get_class_information(
    399399             OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TIMERS, &info );
    400   directive_failed( status, "rtems_object_get_class_information" );
     400  directive_failed( sc, "rtems_object_get_class_information" );
    401401  print_class_info( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TIMERS, &info );
    402402
    403403  /*
    404    *  Ugly hack to force a weird error
     404   *  Ugly hack to force a weird error.
     405   *
     406   *  The weird case is that we need to look up a thread Id where the
     407   *  thread classes' object information table pointer is NULL.  Probably
     408   *  impossible to really hit until registration is completely dynamically
     409   *  configurable.
    405410   */
    406411  {
    407     rtems_status_code                sc;
    408412    rtems_task_priority              old_priority;
    409413    void                            *tmp;
     
    439443    _Objects_Information_table[ class ][ api ] = tmp;
    440444  }
    441  
     445
     446  /*
     447   *  Bad Id on an object which disables interrupts as part of translating
     448   *  the Id into an object pointer.  Semaphore is the only object that
     449   *  needs this. This is a "good" Id in that is it in range, but bad in
     450   *  that it has not been allocated so the local_table pointer is NULL.
     451   */
     452  puts( "rtems_semaphore_release - good but uncreated ID - INVALID_ID - OK" );
     453  sc = rtems_semaphore_release(
     454    rtems_build_id(
     455      OBJECTS_CLASSIC_API,
     456      OBJECTS_RTEMS_SEMAPHORES,
     457      1,
     458      rtems_configuration_get_maximum_semaphores()
     459    )
     460  );
     461  fatal_directive_status( sc, RTEMS_INVALID_ID, "rtems_semaphore_obtain" );
     462
    442463  puts( "*** END OF TEST 43 ***" );
    443464  rtems_test_exit( 0 );
  • testsuites/sptests/sp43/sp43.scn

    r88271c33 rcd4884a  
    8888rtems_task_set_priority - use valid Idle thread id again
    8989rtems_task_set_priority - restore internal thread class info
     90rtems_semaphore_release - good but uncreated ID - INVALID_ID - OK
    9091*** END OF TEST 43 ***
  • testsuites/sptests/sp43/system.h

    r88271c33 rcd4884a  
    3131#define CONFIGURE_MAXIMUM_TASKS             2
    3232#define CONFIGURE_MAXIMUM_TIMERS            1
    33 #define CONFIGURE_MAXIMUM_SEMAPHORES        1
     33#define CONFIGURE_MAXIMUM_SEMAPHORES        2
    3434
    3535#include <rtems/confdefs.h>
    36 
    3736/* end of include file */
Note: See TracChangeset for help on using the changeset viewer.