source: rtems/c/src/tests/sptests/sp09/screen05.c @ 012bb56

4.104.114.84.95
Last change on this file since 012bb56 was 012bb56, checked in by Joel Sherrill <joel.sherrill@…>, on 12/03/98 at 21:57:50

Insure that the same output occurs when multiprocessing is disabled.

  • Property mode set to 100644
File size: 4.2 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-1998.
10 *  On-Line Applications Research Corporation (OAR).
11 *  Copyright assigned to U.S. Government, 1994.
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.OARcorp.com/rtems/license.html.
16 *
17 *  $Id$
18 */
19
20#include "system.h"
21
22void Screen5()
23{
24  rtems_status_code status;
25
26  status = rtems_semaphore_create(
27    0,
28    1,
29    RTEMS_DEFAULT_ATTRIBUTES,
30    RTEMS_NO_PRIORITY,
31    &Junk_id
32  );
33  fatal_directive_status(
34    status,
35    RTEMS_INVALID_NAME,
36    "rtems_semaphore_create with illegal name"
37  );
38  puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_NAME" );
39
40  status = rtems_semaphore_create(
41    Semaphore_name[ 1 ],
42    1,
43    RTEMS_DEFAULT_ATTRIBUTES,
44    RTEMS_NO_PRIORITY,
45    &Semaphore_id[ 1 ]
46  );
47  directive_failed( status, "rtems_semaphore_create" );
48  puts( "TA1 - rtems_semaphore_create - 1 - RTEMS_SUCCESSFUL" );
49
50  status = rtems_semaphore_create(
51    Semaphore_name[ 2 ],
52    1,
53    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
54    RTEMS_NO_PRIORITY,
55    &Semaphore_id[ 2 ]
56  );
57  directive_failed( status, "rtems_semaphore_create" );
58  puts( "TA1 - rtems_semaphore_create - 2 - RTEMS_SUCCESSFUL" );
59
60  do {
61      status = rtems_semaphore_create(
62          Semaphore_name[ 3 ],
63          1,
64          RTEMS_DEFAULT_ATTRIBUTES,
65          RTEMS_NO_PRIORITY,
66          &Junk_id
67      );
68  } while (status == RTEMS_SUCCESSFUL);
69
70  fatal_directive_status(
71    status,
72    RTEMS_TOO_MANY,
73    "rtems_semaphore_create of too many"
74  );
75  puts( "TA1 - rtems_semaphore_create - 3 - RTEMS_TOO_MANY" );
76
77  status = rtems_semaphore_create(
78    Semaphore_name[ 1 ],
79    1,
80    RTEMS_INHERIT_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_FIFO,
81    RTEMS_NO_PRIORITY,
82    &Junk_id
83  );
84  fatal_directive_status(
85    status,
86    RTEMS_NOT_DEFINED,
87    "rtems_semaphore_create of RTEMS_FIFO RTEMS_INHERIT_PRIORITY"
88  );
89  puts( "TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED" );
90
91  status = rtems_semaphore_create(
92    Semaphore_name[ 1 ],
93    1,
94    RTEMS_INHERIT_PRIORITY | RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY,
95    RTEMS_NO_PRIORITY,
96    &Junk_id
97  );
98  fatal_directive_status(
99    status,
100    RTEMS_NOT_DEFINED,
101    "rtems_semaphore_create of RTEMS_COUNTING_SEMAPHORE RTEMS_INHERIT_PRIORITY"
102  );
103  puts( "TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED" );
104
105  status = rtems_semaphore_create(
106    Semaphore_name[ 1 ],
107    2,
108    RTEMS_BINARY_SEMAPHORE,
109    RTEMS_NO_PRIORITY,
110    &Junk_id
111  );
112  fatal_directive_status(
113    status,
114    RTEMS_INVALID_NUMBER,
115    "rtems_semaphore_create of binary semaphore with count > 1"
116  );
117  puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_NUMBER" );
118
119  /*
120   *  The check for an object being global is only made if
121   *  multiprocessing is enabled.
122   */
123
124#if defined(RTEMS_MULTIPROCESSING)
125  status = rtems_semaphore_create(
126    Semaphore_name[ 3 ],
127    1,
128    RTEMS_GLOBAL,
129    RTEMS_NO_PRIORITY,
130    &Junk_id
131  );
132  fatal_directive_status(
133    status,
134    RTEMS_MP_NOT_CONFIGURED,
135    "rtems_semaphore_create of mp not configured"
136  );
137#endif
138  puts( "TA1 - rtems_semaphore_create - RTEMS_MP_NOT_CONFIGURED" );
139
140  status = rtems_semaphore_delete( 100 );
141  fatal_directive_status(
142    status,
143    RTEMS_INVALID_ID,
144    "rtems_semaphore_delete with illegal id"
145  );
146  puts( "TA1 - rtems_semaphore_delete - unknown RTEMS_INVALID_ID" );
147
148  status = rtems_semaphore_delete( 0x010100 );
149  fatal_directive_status(
150    status,
151    RTEMS_INVALID_ID,
152    "rtems_semaphore_delete with local illegal id"
153  );
154  puts( "TA1 - rtems_semaphore_delete - local RTEMS_INVALID_ID" );
155
156  status = rtems_semaphore_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id );
157  fatal_directive_status(
158    status,
159    RTEMS_INVALID_NAME,
160    "rtems_semaphore_ident will illegal name (local)"
161  );
162  puts( "TA1 - rtems_semaphore_ident - global RTEMS_INVALID_NAME" );
163
164  status = rtems_semaphore_ident( 100, 1, &Junk_id );
165  fatal_directive_status(
166    status,
167    RTEMS_INVALID_NAME,
168    "rtems_semaphore_ident will illegal name (global)"
169  );
170  puts( "TA1 - rtems_semaphore_ident - local RTEMS_INVALID_NAME" );
171}
Note: See TracBrowser for help on using the repository browser.