Changeset 7132d3d in rtems


Ignore:
Timestamp:
Jan 4, 2014, 5:04:51 PM (6 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
f17a9269
Parents:
524e785
Message:

sppartition_err01: Remove dead parts, reduce, and clean up.

Also fix naming issues.

Location:
testsuites/sptests/sppartition_err01
Files:
2 added
9 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/sppartition_err01/Makefile.am

    r524e785 r7132d3d  
    11
    2 rtems_tests_PROGRAMS = sp09
    3 sp09_SOURCES = init.c delay.c \
    4     screen11.c task1.c task2.c task3.c task4.c \
    5     system.h
     2rtems_tests_PROGRAMS = sppartition_err01
     3sppartition_err01_SOURCES = init.c system.h
    64
    7 dist_rtems_tests_DATA = sp09.scn
    8 dist_rtems_tests_DATA += sp09.doc
     5dist_rtems_tests_DATA = sppartition_err01.scn
     6dist_rtems_tests_DATA += sppartition_err01.doc
    97
    108include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
     
    1513AM_CPPFLAGS += -I$(top_srcdir)/../support/include
    1614
    17 LINK_OBJS = $(sp09_OBJECTS)
    18 LINK_LIBS = $(sp09_LDLIBS)
     15LINK_OBJS = $(sppartition_err01_OBJECTS)
     16LINK_LIBS = $(sppartition_err01_LDLIBS)
    1917
    20 sp09$(EXEEXT): $(sp09_OBJECTS) $(sp09_DEPENDENCIES)
    21         @rm -f sp09$(EXEEXT)
     18sppartition_err01$(EXEEXT): $(sppartition_err01_OBJECTS) $(sppartition_err01_DEPENDENCIES)
     19        @rm -f sppartition_err01$(EXEEXT)
    2220        $(make-exe)
    2321
  • testsuites/sptests/sppartition_err01/init.c

    r524e785 r7132d3d  
    11/*
    2  *  COPYRIGHT (c) 1989-2009.
     2 *  COPYRIGHT (c) 1989-2013.
    33 *  On-Line Applications Research Corporation (OAR).
    44 *
     
    1515#include "system.h"
    1616
     17uint32_t Other_Memory;
     18
     19TEST_EXTERN rtems_name Partition_name[ 2 ]; /* array of partition names */
     20TEST_EXTERN rtems_id   Partition_id[ 2 ];   /* array of partition ids */
     21
     22TEST_EXTERN uint8_t   Partition_good_area[256] CPU_STRUCTURE_ALIGNMENT;
     23#define Partition_bad_area (void *) 0x00000005
     24
     25void test_partition_errors(void);
     26
     27void test_partition_errors(void)
     28{
     29  void              *buffer_address_1;
     30  void              *buffer_address_2;
     31  void              *buffer_address_3;
     32  rtems_status_code  status;
     33  size_t             size;
     34  rtems_id           junk_id;
     35
     36  Partition_name[ 1 ]  =  rtems_build_name( 'P', 'T', '1', ' ' );
     37
     38  status = rtems_partition_create(
     39    0,
     40    Partition_good_area,
     41    128,
     42    40,
     43    RTEMS_DEFAULT_ATTRIBUTES,
     44    &junk_id
     45  );
     46  fatal_directive_status(
     47    status,
     48    RTEMS_INVALID_NAME,
     49    "rtems_partition_create with illegal name"
     50  );
     51  puts( "TA1 - rtems_partition_create - RTEMS_INVALID_NAME" );
     52
     53  status = rtems_partition_create(
     54    Partition_name[ 1 ],
     55    Partition_good_area,
     56    0,
     57    71,
     58    RTEMS_DEFAULT_ATTRIBUTES,
     59    &junk_id
     60  );
     61  fatal_directive_status(
     62    status,
     63    RTEMS_INVALID_SIZE,
     64    "rtems_partition_create with illegal length"
     65  );
     66  puts( "TA1 - rtems_partition_create - length - RTEMS_INVALID_SIZE" );
     67
     68  status = rtems_partition_create(
     69    Partition_name[ 1 ],
     70    Partition_good_area,
     71    128,
     72    0,
     73    RTEMS_DEFAULT_ATTRIBUTES,
     74    &junk_id
     75  );
     76  fatal_directive_status(
     77    status,
     78    RTEMS_INVALID_SIZE,
     79    "rtems_partition_create with illegal buffer size"
     80  );
     81  puts( "TA1 - rtems_partition_create - buffer size - RTEMS_INVALID_SIZE" );
     82
     83  status = rtems_partition_create(
     84    Partition_name[ 1 ],
     85    Partition_good_area,
     86    128,
     87    256,
     88    RTEMS_DEFAULT_ATTRIBUTES,
     89    &junk_id
     90  );
     91  fatal_directive_status(
     92    status,
     93    RTEMS_INVALID_SIZE,
     94    "rtems_partition_create with buffer_size > length"
     95  );
     96  puts(
     97    "TA1 - rtems_partition_create - length < buffer size - RTEMS_INVALID_SIZE"
     98  );
     99
     100  /*
     101   * Attempt to create a partition with a buffer size that is not large
     102   * enough to account for the overhead.
     103   */
     104  puts(
     105    "TA1 - rtems_partition_create - buffer size < overhead - RTEMS_INVALID_SIZE"
     106  );
     107#define SIZEOF_CHAIN_NODE 2 * sizeof(void *)
     108  for ( size=0 ; size < SIZEOF_CHAIN_NODE ; size++) {
     109    status = rtems_partition_create(
     110      Partition_name[ 1 ],
     111      Partition_good_area,
     112      size,
     113      256,
     114      RTEMS_DEFAULT_ATTRIBUTES,
     115      &junk_id
     116    );
     117    if ( status != RTEMS_INVALID_SIZE )
     118      printf( "ERROR when size == %zu\n", size );
     119
     120    fatal_directive_status(
     121      status,
     122      RTEMS_INVALID_SIZE,
     123      "rtems_partition_create with buffer_size > length"
     124    );
     125  }
     126
     127  /*
     128   *  The check for an object being global is only made if
     129   *  multiprocessing is enabled.
     130   */
     131
     132#if defined(RTEMS_MULTIPROCESSING)
     133  status = rtems_partition_create(
     134    Partition_name[ 1 ],
     135    Partition_good_area,
     136    128,
     137    64,
     138    RTEMS_GLOBAL,
     139    &junk_id
     140  );
     141  fatal_directive_status(
     142    status,
     143    RTEMS_MP_NOT_CONFIGURED,
     144    "rtems_partition_create of global"
     145  );
     146#endif
     147  puts( "TA1 - rtems_partition_create - RTEMS_MP_NOT_CONFIGURED" );
     148
     149#if defined(_C3x) || defined(_C4x)
     150  puts( "TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS - SKIPPED" );
     151#else
     152  status = rtems_partition_create(
     153    Partition_name[ 1 ],
     154    Partition_bad_area,
     155    128,
     156    64,
     157    RTEMS_GLOBAL,
     158    &junk_id
     159  );
     160  fatal_directive_status(
     161    status,
     162    RTEMS_INVALID_ADDRESS,
     163    "rtems_partition_create with bad address"
     164  );
     165  puts( "TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS" );
     166#endif
     167
     168#if defined(_C3x) || defined(_C4x)
     169  puts( "TA1 - rtems_partition_create - RTEMS_INVALID_SIZE - SKIPPED" );
     170#else
     171  status = rtems_partition_create(
     172    Partition_name[ 1 ],
     173    Partition_good_area,
     174    128,
     175    35,
     176    RTEMS_DEFAULT_ATTRIBUTES,
     177    &junk_id
     178  );
     179  fatal_directive_status(
     180    status,
     181    RTEMS_INVALID_SIZE,
     182    "rtems_partition_create with unaligned buffer_size"
     183  );
     184  puts( "TA1 - rtems_partition_create - RTEMS_INVALID_SIZE" );
     185#endif
     186
     187  status = rtems_partition_delete( 100 );
     188  fatal_directive_status(
     189    status,
     190    RTEMS_INVALID_ID,
     191    "rtems_partition_delete with illegal id"
     192  );
     193  puts( "TA1 - rtems_partition_delete - unknown RTEMS_INVALID_ID" );
     194
     195  status = rtems_partition_delete( rtems_build_id( 1, 1, 1, 256 ) );
     196  fatal_directive_status(
     197    status,
     198    RTEMS_INVALID_ID,
     199    "rtems_partition_delete with illegal id"
     200  );
     201  puts( "TA1 - rtems_partition_delete - local RTEMS_INVALID_ID" );
     202
     203  /* get bad address */
     204  status = rtems_partition_get_buffer( 100, NULL );
     205  fatal_directive_status(
     206    status,
     207    RTEMS_INVALID_ADDRESS,
     208    "rtems_partition_get_buffer with NULL param"
     209  );
     210  puts( "TA1 - rtems_partition_get_buffer - RTEMS_INVALID_ADDRESS" );
     211
     212  /* get bad Id */
     213  status = rtems_partition_get_buffer( 100, &buffer_address_1 );
     214  fatal_directive_status(
     215    status,
     216    RTEMS_INVALID_ID,
     217    "rtems_partition_get_buffer with illegal id"
     218  );
     219  puts( "TA1 - rtems_partition_get_buffer - RTEMS_INVALID_ID" );
     220
     221  status = rtems_partition_ident( 0, RTEMS_SEARCH_ALL_NODES, &junk_id );
     222  fatal_directive_status(
     223    status,
     224    RTEMS_INVALID_NAME,
     225    "rtems_partition_ident with illegal name"
     226  );
     227  puts( "TA1 - rtems_partition_ident - RTEMS_INVALID_NAME" );
     228
     229  status = rtems_partition_return_buffer( 100, buffer_address_1 );
     230  fatal_directive_status(
     231    status,
     232    RTEMS_INVALID_ID,
     233    "rtems_partition_return_buffer with illegal id"
     234  );
     235  puts( "TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ID" );
     236
     237  /* create bad area */
     238  status = rtems_partition_create(
     239    Partition_name[ 1 ],
     240    NULL,
     241    128,
     242    64,
     243    RTEMS_DEFAULT_ATTRIBUTES,
     244    &junk_id
     245  );
     246  fatal_directive_status(
     247    status,
     248    RTEMS_INVALID_ADDRESS,
     249    "rtems_partition_return_buffer with NULL area"
     250  );
     251  puts( "TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS" );
     252
     253  /* create OK */
     254  status = rtems_partition_create(
     255    Partition_name[ 1 ],
     256    Partition_good_area,
     257    128,
     258    64,
     259    RTEMS_DEFAULT_ATTRIBUTES,
     260    &Partition_id[ 1 ]
     261  );
     262  directive_failed( status, "rtems_partition_create" );
     263  puts( "TA1 - rtems_partition_create - RTEMS_SUCCESSFUL" );
     264
     265  status = rtems_partition_create(
     266    Partition_name[ 1 ],
     267    Partition_good_area,
     268    128,
     269    32,
     270    RTEMS_DEFAULT_ATTRIBUTES,
     271    &junk_id
     272  );
     273  fatal_directive_status(
     274    status,
     275    RTEMS_TOO_MANY,
     276    "rtems_partition_create of too many"
     277  );
     278  puts( "TA1 - rtems_partition_create - RTEMS_TOO_MANY" );
     279
     280  status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_1 );
     281  directive_failed( status, "rtems_partition_get_buffer");
     282  puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" );
     283
     284  status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_2 );
     285  directive_failed( status, "rtems_partition_get_buffer" );
     286  puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" );
     287
     288  status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_3 );
     289  fatal_directive_status(
     290    status,
     291    RTEMS_UNSATISFIED,
     292    "rtems_partition_get_buffer unsatisfied"
     293  );
     294  puts( "TA1 - rtems_partition_get_buffer - RTEMS_UNSATISFIED" );
     295
     296  status = rtems_partition_delete( Partition_id[ 1 ] );
     297  fatal_directive_status(
     298    status,
     299    RTEMS_RESOURCE_IN_USE,
     300    "rtems_partition_delete with buffers in use"
     301  );
     302  puts( "TA1 - rtems_partition_delete - RTEMS_RESOURCE_IN_USE" );
     303
     304  status = rtems_partition_return_buffer(
     305    Partition_id[ 1 ],
     306    &Other_Memory
     307  );
     308  fatal_directive_status(
     309    status,
     310    RTEMS_INVALID_ADDRESS,
     311    "rtems_partition_return_buffer with buffer address out of partition"
     312  );
     313  puts(
     314    "TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - out of range"
     315  );
     316
     317  status = rtems_partition_return_buffer(
     318    Partition_id[ 1 ],
     319    &Partition_good_area[ 7 ]
     320  );
     321  fatal_directive_status(
     322    status,
     323    RTEMS_INVALID_ADDRESS,
     324    "rtems_partition_return_buffer with buffer address not on boundary"
     325  );
     326  puts_nocr( "TA1 - rtems_partition_return_buffer - " );
     327  puts     ( "RTEMS_INVALID_ADDRESS - not on boundary");
     328}
     329
    17330rtems_task Init(
    18331  rtems_task_argument argument
    19332)
    20333{
    21   rtems_status_code status;
    22 
    23   puts( "\n\n*** TEST 9 ***" );
    24 
    25   Task_name[ 1 ]       =  rtems_build_name( 'T', 'A', '1', ' ' );
    26   Task_name[ 2 ]       =  rtems_build_name( 'T', 'A', '2', ' ' );
    27   Task_name[ 3 ]       =  rtems_build_name( 'T', 'A', '3', ' ' );
    28   Task_name[ 4 ]       =  rtems_build_name( 'T', 'A', '4', ' ' );
    29   Task_name[ 5 ]       =  rtems_build_name( 'T', 'A', '5', ' ' );
    30   Task_name[ 6 ]       =  rtems_build_name( 'T', 'A', '6', ' ' );
    31   Task_name[ 7 ]       =  rtems_build_name( 'T', 'A', '7', ' ' );
    32   Task_name[ 8 ]       =  rtems_build_name( 'T', 'A', '8', ' ' );
    33   Task_name[ 9 ]       =  rtems_build_name( 'T', 'A', '9', ' ' );
    34   Task_name[ 10 ]      =  rtems_build_name( 'T', 'A', 'A', ' ' );
    35 
    36   Semaphore_name[ 1 ]  =  rtems_build_name( 'S', 'M', '1', ' ' );
    37   Semaphore_name[ 2 ]  =  rtems_build_name( 'S', 'M', '2', ' ' );
    38   Semaphore_name[ 3 ]  =  rtems_build_name( 'S', 'M', '3', ' ' );
    39 
    40   Queue_name[ 1 ]      =  rtems_build_name( 'M', 'Q', '1', ' ' );
    41   Queue_name[ 2 ]      =  rtems_build_name( 'M', 'Q', '2', ' ' );
    42 
    43   Partition_name[ 1 ]  =  rtems_build_name( 'P', 'T', '1', ' ' );
    44 
    45   Port_name[ 1 ]       =  rtems_build_name( 'D', 'P', '1', ' ' );
    46 
    47   Period_name[ 1 ]     =  rtems_build_name( 'T', 'M', '1', ' ' );
    48 
    49   /* priority of 0 error */
    50   status = rtems_task_create(
    51      Task_name[1],
    52      0,
    53      RTEMS_MINIMUM_STACK_SIZE,
    54      RTEMS_DEFAULT_MODES,
    55      RTEMS_DEFAULT_ATTRIBUTES,
    56      &Task_id[ 1 ]
    57   );
    58   fatal_directive_status(
    59     status,
    60     RTEMS_INVALID_PRIORITY,
    61     "rtems_task_create with illegal priority"
    62   );
    63   puts( "INIT - rtems_task_create - priority of 0 - RTEMS_INVALID_PRIORITY" );
    64 
    65   /* priority > 255 error */
    66   status = rtems_task_create(
    67      Task_name[1],
    68      257,
    69      RTEMS_MINIMUM_STACK_SIZE,
    70      RTEMS_DEFAULT_MODES,
    71      RTEMS_DEFAULT_ATTRIBUTES,
    72      &Task_id[ 1 ]
    73   );
    74   fatal_directive_status(
    75     status,
    76     RTEMS_INVALID_PRIORITY,
    77     "rtems_task_create with illegal priority"
    78   );
    79   puts(
    80     "INIT - rtems_task_create - priority too high - RTEMS_INVALID_PRIORITY"
    81   );
    82 
    83   status = rtems_task_create(
    84     Task_name[ 1 ],
    85     4,
    86     RTEMS_MINIMUM_STACK_SIZE * 3,
    87     RTEMS_DEFAULT_MODES,
    88     RTEMS_DEFAULT_ATTRIBUTES,
    89     &Task_id[ 1 ]
    90   );
    91   directive_failed( status, "rtems_task_create of TA1" );
    92 
    93   status = rtems_task_restart( Task_id[ 1 ], 0 );
    94   fatal_directive_status(
    95     status,
    96     RTEMS_INCORRECT_STATE,
    97     "rtems_task_restart of DORMANT task"
    98   );
    99   puts( "INIT - rtems_task_restart - RTEMS_INCORRECT_STATE" );
    100 
    101   status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
    102   directive_failed( status, "rtems_task_start of TA1" );
    103 
    104   status = rtems_task_delete( RTEMS_SELF );
    105   directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
     334  puts( "\n\n*** TEST PARTITION ERROR 01 ***" );
     335
     336  test_partition_errors();
     337
     338  puts( "*** END OF TEST PARTITION ERROR 01 ***" );
     339  rtems_test_exit( 0 );
    106340}
  • testsuites/sptests/sppartition_err01/system.h

    r524e785 r7132d3d  
    1 /*  system.h
    2  *
    3  *  This include file contains information that is included in every
    4  *  function in the test set.
    5  *
    6  *  COPYRIGHT (c) 1989-1999.
     1/*
     2 *  COPYRIGHT (c) 1989-2013.
    73 *  On-Line Applications Research Corporation (OAR).
    84 *
     
    1410#include <tmacros.h>
    1511
    16 /* functions */
    17 
    18 rtems_task Init(
    19   rtems_task_argument argument
    20 );
    21 
    22 rtems_timer_service_routine Delayed_routine(
    23   rtems_id  ignored_id,
    24   void     *ignored_address
    25 );
    26 
    27 rtems_task Task_1(
    28   rtems_task_argument argument
    29 );
    30 
    31 rtems_task Task_2(
    32   rtems_task_argument argument
    33 );
    34 
    35 rtems_task Task_3(
    36   rtems_task_argument argument
    37 );
    38 
    39 rtems_task Task_4(
    40   rtems_task_argument argument
    41 );
    42 
    43 rtems_isr Service_routine(
    44   rtems_vector_number ignored
    45 );
    46 
    47 rtems_timer_service_routine Io_during_interrupt(
    48   rtems_id ignored
    49 );
    50 
    51 /*void Screen1( void );
    52 
    53 void Screen2( void );
    54 
    55 void Screen3( void );
    56 
    57 void Screen4( void );
    58 
    59 void Screen5( void );
    60 
    61 void Screen6( void );
    62 
    63 void Screen7( void );
    64 
    65 void Screen8( void );
    66 
    67 void Screen9( void );
    68 
    69 void Screen10( void );*/
    70 
    71 void Screen11( void );
    72 
    73 //void Screen12( void );
    74 
    7512/* configuration information */
    7613
     
    7815#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
    7916
    80 #define CONFIGURE_MAXIMUM_TASKS              10
    81 #define CONFIGURE_MAXIMUM_TIMERS              1
    82 #define CONFIGURE_MAXIMUM_SEMAPHORES          2
    83 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES      1
     17#define CONFIGURE_MAXIMUM_TASKS               1
    8418#define CONFIGURE_MAXIMUM_PARTITIONS          1
    85 #define CONFIGURE_MAXIMUM_PERIODS             1
    86 #define CONFIGURE_MAXIMUM_USER_EXTENSIONS     0
    87 #define CONFIGURE_TICKS_PER_TIMESLICE       100
    8819
    8920#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
    9021
    91 #define CONFIGURE_EXTRA_TASK_STACKS         (20 * RTEMS_MINIMUM_STACK_SIZE)
    92 
    9322#include <rtems/confdefs.h>
    94 
    95 /* global variables */
    96 
    97 TEST_EXTERN rtems_id   Task_id[ 11 ];       /* array of task ids */
    98 TEST_EXTERN rtems_name Task_name[ 11 ];     /* array of task names */
    99 
    100 TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */
    101 TEST_EXTERN rtems_id   Semaphore_id[ 4 ];   /* array of semaphore ids */
    102 
    103 TEST_EXTERN rtems_name Queue_name[ 3 ];     /* array of queue names */
    104 TEST_EXTERN rtems_id   Queue_id[ 3 ];       /* array of queue ids */
    105 
    106 TEST_EXTERN rtems_name Partition_name[ 2 ]; /* array of partition names */
    107 TEST_EXTERN rtems_id   Partition_id[ 2 ];   /* array of partition ids */
    108 
    109 TEST_EXTERN rtems_name Port_name[ 2 ];      /* array of port names */
    110 TEST_EXTERN rtems_id   Port_id[ 2 ];        /* array of port ids */
    111 
    112 TEST_EXTERN rtems_name Period_name[ 2 ];    /* array of period names */
    113 TEST_EXTERN rtems_id   Period_id[ 2 ];      /* array of period ids */
    114 
    115 TEST_EXTERN rtems_id   Junk_id;             /* id used to return errors */
    116 
    117 #define Internal_port_area (void *) 0x00001000
    118 #define External_port_area (void *) 0x00002000
    119 
    120 TEST_EXTERN uint8_t   Partition_good_area[256] CPU_STRUCTURE_ALIGNMENT;
    121 #define Partition_bad_area (void *) 0x00000005
    122 
    12323/* end of include file */
Note: See TracChangeset for help on using the changeset viewer.