source: rtems/testsuites/sptests/sp09/screen05.c @ 4650a44c

4.104.114.95
Last change on this file since 4650a44c was 4650a44c, checked in by Glenn Humphrey <glenn.humphrey@…>, on 11/27/07 at 20:44:55

2007-11-27 Glenn Humphrey <glenn.humphrey@…>

  • sp07/sp07.scn, sp07/task1.c, sp09/screen01.c, sp09/screen05.c, sp09/screen07.c, sp09/screen10.c, sp09/screen12.c, sp09/screen14.c, sp09/sp09.scn, sp25/sp25.scn, sp25/task1.c: Added several test cases to improve test coverage.
  • Property mode set to 100644
File size: 4.6 KB
Line 
1/*  Screen5
2 *
3 *  This routine generates error screen 5 for test 9.
4 *
5 *  Input parameters:  NONE
6 *
7 *  Output parameters:  NONE
8 *
9 *  COPYRIGHT (c) 1989-1999.
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 Screen5()
22{
23  rtems_status_code status;
24
25  status = rtems_semaphore_create(
26    0,
27    1,
28    RTEMS_DEFAULT_ATTRIBUTES,
29    RTEMS_NO_PRIORITY,
30    &Junk_id
31  );
32  fatal_directive_status(
33    status,
34    RTEMS_INVALID_NAME,
35    "rtems_semaphore_create with illegal name"
36  );
37  puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_NAME" );
38
39  status = rtems_semaphore_create(
40    Semaphore_name[ 1 ],
41    1,
42    RTEMS_DEFAULT_ATTRIBUTES,
43    RTEMS_NO_PRIORITY,
44    &Semaphore_id[ 1 ]
45  );
46  directive_failed( status, "rtems_semaphore_create" );
47  puts( "TA1 - rtems_semaphore_create - 1 - RTEMS_SUCCESSFUL" );
48
49  status = rtems_semaphore_create(
50    Semaphore_name[ 2 ],
51    1,
52    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
53    RTEMS_NO_PRIORITY,
54    &Semaphore_id[ 2 ]
55  );
56  directive_failed( status, "rtems_semaphore_create" );
57  puts( "TA1 - rtems_semaphore_create - 2 - RTEMS_SUCCESSFUL" );
58
59  do {
60      status = rtems_semaphore_create(
61          Semaphore_name[ 3 ],
62          1,
63          RTEMS_DEFAULT_ATTRIBUTES,
64          RTEMS_NO_PRIORITY,
65          &Junk_id
66      );
67  } while (status == RTEMS_SUCCESSFUL);
68
69  fatal_directive_status(
70    status,
71    RTEMS_TOO_MANY,
72    "rtems_semaphore_create of too many"
73  );
74  puts( "TA1 - rtems_semaphore_create - 3 - RTEMS_TOO_MANY" );
75
76  status = rtems_semaphore_create(
77    Semaphore_name[ 1 ],
78    1,
79    RTEMS_INHERIT_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_FIFO,
80    RTEMS_NO_PRIORITY,
81    &Junk_id
82  );
83  fatal_directive_status(
84    status,
85    RTEMS_NOT_DEFINED,
86    "rtems_semaphore_create of RTEMS_FIFO RTEMS_INHERIT_PRIORITY"
87  );
88  puts( "TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED" );
89
90  status = rtems_semaphore_create(
91    Semaphore_name[ 1 ],
92    1,
93    RTEMS_INHERIT_PRIORITY | RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY,
94    RTEMS_NO_PRIORITY,
95    &Junk_id
96  );
97  fatal_directive_status(
98    status,
99    RTEMS_NOT_DEFINED,
100    "rtems_semaphore_create of RTEMS_COUNTING_SEMAPHORE RTEMS_INHERIT_PRIORITY"
101  );
102  puts( "TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED" );
103
104  status = rtems_semaphore_create(
105    Semaphore_name[ 1 ],
106    2,
107    RTEMS_BINARY_SEMAPHORE,
108    RTEMS_NO_PRIORITY,
109    &Junk_id
110  );
111  fatal_directive_status(
112    status,
113    RTEMS_INVALID_NUMBER,
114    "rtems_semaphore_create of binary semaphore with count > 1"
115  );
116  puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_NUMBER" );
117
118  /*
119   *  The check for an object being global is only made if
120   *  multiprocessing is enabled.
121   */
122
123#if defined(RTEMS_MULTIPROCESSING)
124  status = rtems_semaphore_create(
125    Semaphore_name[ 3 ],
126    1,
127    RTEMS_GLOBAL,
128    RTEMS_NO_PRIORITY,
129    &Junk_id
130  );
131  fatal_directive_status(
132    status,
133    RTEMS_MP_NOT_CONFIGURED,
134    "rtems_semaphore_create of mp not configured"
135  );
136#endif
137  puts( "TA1 - rtems_semaphore_create - RTEMS_MP_NOT_CONFIGURED" );
138
139  status = rtems_semaphore_delete( 100 );
140  fatal_directive_status(
141    status,
142    RTEMS_INVALID_ID,
143    "rtems_semaphore_delete with illegal id"
144  );
145  puts( "TA1 - rtems_semaphore_delete - RTEMS_INVALID_ID" );
146
147  status = rtems_semaphore_delete( 0x010100 );
148  fatal_directive_status(
149    status,
150    RTEMS_INVALID_ID,
151    "rtems_semaphore_delete with local illegal id"
152  );
153  puts( "TA1 - rtems_semaphore_delete - local RTEMS_INVALID_ID" );
154
155  status = rtems_semaphore_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id );
156  fatal_directive_status(
157    status,
158    RTEMS_INVALID_NAME,
159    "rtems_semaphore_ident will illegal name (local)"
160  );
161  puts( "TA1 - rtems_semaphore_ident - global RTEMS_INVALID_NAME" );
162
163  status = rtems_semaphore_ident( 100, 1, &Junk_id );
164  fatal_directive_status(
165    status,
166    RTEMS_INVALID_NAME,
167    "rtems_semaphore_ident will illegal name (global)"
168  );
169  puts( "TA1 - rtems_semaphore_ident - local RTEMS_INVALID_NAME" );
170
171  status = rtems_semaphore_release( 100 );
172  fatal_directive_status(
173    status,
174    RTEMS_INVALID_ID,
175    "rtems_semaphore_release with illegal id"
176  );
177  puts( "TA1 - rtems_semaphore_release - RTEMS_INVALID_ID" );
178
179  status = rtems_semaphore_flush( 100 );
180  fatal_directive_status(
181    status,
182    RTEMS_INVALID_ID,
183    "rtems_semaphore_flush with illegal id"
184  );
185  puts( "TA1 - rtems_semaphore_flush - RTEMS_INVALID_ID" );
186}
Note: See TracBrowser for help on using the repository browser.