source: rtems/testsuites/sptests/sp09/screen10.c @ 8d8c1f1

4.104.115
Last change on this file since 8d8c1f1 was 8d8c1f1, checked in by Joel Sherrill <joel.sherrill@…>, on 09/28/09 at 19:39:06

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

  • sp09/screen02.c, sp09/screen04.c, sp09/screen07.c, sp09/screen09.c, sp09/screen10.c, sp09/screen11.c, sp09/screen12.c, sp09/sp09.scn: Add some error cases uncovered by uC5282 coverage runs.
  • Property mode set to 100644
File size: 6.4 KB
Line 
1/*  Screen10
2 *
3 *  This routine generates error screen 10 for test 9.
4 *
5 *  Input parameters:  NONE
6 *
7 *  Output parameters:  NONE
8 *
9 *  COPYRIGHT (c) 1989-2009.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#include "system.h"
20
21void Screen10()
22{
23  rtems_rate_monotonic_period_status period_status;
24  rtems_status_code                  status;
25
26  /*
27   * Check create error cases.
28   */
29  status = rtems_rate_monotonic_create( Period_name[ 1 ], NULL );
30  fatal_directive_status(
31    status,
32    RTEMS_INVALID_ADDRESS,
33    "rtems_rate_monotonic_create with NULL param"
34  );
35
36  puts( "TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_ADDRESS" );
37
38  status = rtems_rate_monotonic_create( 0, &Junk_id );
39  fatal_directive_status(
40    status,
41    RTEMS_INVALID_NAME,
42    "rtems_rate_monotonic_create with illegal name"
43  );
44  puts( "TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_NAME" );
45
46  status = rtems_rate_monotonic_create( Period_name[ 1 ], &Period_id[ 1 ] );
47  directive_failed( status, "rtems_rate_monotonic_create successful" );
48  puts( "TA1 - rtems_rate_monotonic_create - RTEMS_SUCCESSFUL" );
49
50  status = rtems_rate_monotonic_create( Period_name[ 1 ], &Junk_id );
51  fatal_directive_status(
52    status,
53    RTEMS_TOO_MANY,
54    "rtems_rate_monotonic_create of too many"
55  );
56  puts( "TA1 - rtems_rate_monotonic_create - RTEMS_TOO_MANY" );
57
58  /*
59   * Check ident error cases.
60   */
61  status = rtems_rate_monotonic_ident( 0, &Junk_id );
62  fatal_directive_status(
63    status,
64    RTEMS_INVALID_NAME,
65    "rtems_rate_monotonic_ident with illegal name"
66  );
67  puts( "TA1 - rtems_rate_monotonic_ident - RTEMS_INVALID_NAME" );
68
69  /*
70   * Check period error cases.
71   */
72  status = rtems_rate_monotonic_period( 100, 5 );
73  fatal_directive_status(
74    status,
75    RTEMS_INVALID_ID,
76    "rtems_rate_monotonic_period with illegal id"
77  );
78  puts( "TA1 - rtems_rate_monotonic_period - RTEMS_INVALID_ID" );
79
80  status = rtems_rate_monotonic_period( rtems_build_id( 1, 1, 1, 256 ), 5 );
81  fatal_directive_status(
82    status,
83    RTEMS_INVALID_ID,
84    "rtems_rate_monotonic_period with illegal id"
85  );
86  puts( "TA1 - rtems_rate_monotonic_period - local RTEMS_INVALID_ID" );
87
88  status = rtems_rate_monotonic_period( Period_id[ 1 ], RTEMS_PERIOD_STATUS );
89  fatal_directive_status(
90    status,
91    RTEMS_NOT_DEFINED,
92    "rtems_rate_monotonic_period status not defined"
93  );
94  puts(
95    "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_NOT_DEFINED"
96  );
97
98  status = rtems_rate_monotonic_period( Period_id[ 1 ], 100 );
99  directive_failed( status, "rtems_rate_monotonic_period successful" );
100  puts( "TA1 - rtems_rate_monotonic_period - 100 ticks - RTEMS_SUCCESSFUL" );
101
102  status = rtems_rate_monotonic_period( Period_id[ 1 ], RTEMS_PERIOD_STATUS );
103  directive_failed( status, "rtems_rate_monotonic_period status" );
104  puts(
105    "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_SUCCESSFUL"
106  );
107
108  while ( FOREVER ) {
109
110     status = rtems_rate_monotonic_period(Period_id[ 1 ], RTEMS_PERIOD_STATUS);
111
112     if ( status == RTEMS_TIMEOUT ) break;
113
114     directive_failed(
115       status,
116       "rtems_rate_monotonic_period waiting for timeout"
117     );
118
119     rtems_task_wake_after( 1 );
120  }
121  puts(
122    "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_TIMEOUT"
123  );
124
125  /*
126   * Check get_statistics error cases.
127   */
128  status = rtems_rate_monotonic_get_statistics( Period_id[ 1 ], NULL );
129  fatal_directive_status(
130    status,
131    RTEMS_INVALID_ADDRESS,
132    "rtems_rate_monotonic_get_statistics with NULL param"
133  );
134  puts( "TA1 - rtems_rate_monotonic_get_statistics - RTEMS_INVALID_ADDRESS" );
135
136  /*
137   * Check get_status error cases.
138   */
139  status = rtems_rate_monotonic_get_status( Period_id[ 1 ], NULL );
140  fatal_directive_status(
141    status,
142    RTEMS_INVALID_ADDRESS,
143    "rtems_rate_monotonic_get_status with NULL param"
144  );
145  puts( "TA1 - rtems_rate_monotonic_get_status - RTEMS_INVALID_ADDRESS" );
146
147  status = rtems_rate_monotonic_get_status( 100, &period_status );
148  fatal_directive_status(
149    status,
150    RTEMS_INVALID_ID,
151    "rtems_rate_monotonic_get_status with illegal id"
152  );
153  puts( "TA1 - rtems_rate_monotonic_get_status - RTEMS_INVALID_ID" );
154
155  /*
156   * Check cancel error cases.
157   */
158  status = rtems_rate_monotonic_cancel( 100 );
159  fatal_directive_status(
160    status,
161    RTEMS_INVALID_ID,
162    "rtems_rate_monotonic_cancel with illegal id"
163  );
164  puts( "TA1 - rtems_rate_monotonic_cancel - RTEMS_INVALID_ID" );
165
166  status = rtems_rate_monotonic_cancel( rtems_build_id( 1, 1, 1, 256 ) );
167  fatal_directive_status(
168    status,
169    RTEMS_INVALID_ID,
170    "rtems_rate_monotonic_cancel will illegal id"
171  );
172  puts( "TA1 - rtems_rate_monotonic_cancel - local RTEMS_INVALID_ID" );
173
174  status = rtems_rate_monotonic_cancel( Period_id[ 1 ] );
175  directive_failed( status, "rtems_rate_monotonic_cancel" );
176  puts( "TA1 - rtems_rate_monotonic_cancel - RTEMS_SUCCESSFUL" );
177
178  status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 );
179  directive_failed( status, "rtems_rate_monotonic_period restart" );
180
181  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
182  directive_failed( status, "rtems_task_wake_after" );
183
184  status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 );
185  fatal_directive_status(
186    status,
187    RTEMS_TIMEOUT,
188    "rtems_rate_monotonic_period"
189  );
190  puts( "TA1 - rtems_rate_monotonic_period - 5 ticks - RTEMS_TIMEOUT" );
191
192  status = rtems_task_start( Task_id[ 4 ], Task_4, 0 );
193  directive_failed( status, "rtems_task_start of TA4" );
194
195  puts( "TA1 - yielding to TA4" );
196  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
197
198  /*
199   * Check delete error cases.
200   */
201  status = rtems_rate_monotonic_delete( 100 );
202  fatal_directive_status(
203    status,
204    RTEMS_INVALID_ID,
205    "rtems_rate_monotonic_delete with illegal id"
206  );
207  puts( "TA1 - rtems_rate_monotonic_delete - RTEMS_INVALID_ID" );
208
209  status = rtems_rate_monotonic_delete( rtems_build_id( 1, 1, 1, 256 ) );
210  fatal_directive_status(
211    status,
212    RTEMS_INVALID_ID,
213    "rtems_rate_monotonic_delete with illegal id"
214  );
215  puts( "TA1 - rtems_rate_monotonic_delete - local RTEMS_INVALID_ID" );
216
217  status = rtems_rate_monotonic_delete( Period_id[ 1 ] );
218  directive_failed( status, "rtems_rate_monotonic_delete" );
219  puts( "TA1 - rtems_rate_monotonic_delete - RTEMS_SUCCESSFUL" );
220}
Note: See TracBrowser for help on using the repository browser.