source: rtems/testsuites/sptests/sp09/screen05.c @ b1b4fd5a

4.104.114.84.95
Last change on this file since b1b4fd5a was b1b4fd5a, checked in by Joel Sherrill <joel.sherrill@…>, on 02/20/98 at 19:59:41

Modified to reflect new restrictions on mutex being released.

  • Property mode set to 100644
File size: 4.1 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  status = rtems_semaphore_create(
120    Semaphore_name[ 3 ],
121    1,
122    RTEMS_GLOBAL,
123    RTEMS_NO_PRIORITY,
124    &Junk_id
125  );
126  fatal_directive_status(
127    status,
128    RTEMS_MP_NOT_CONFIGURED,
129    "rtems_semaphore_create of mp not configured"
130  );
131  puts( "TA1 - rtems_semaphore_create - RTEMS_MP_NOT_CONFIGURED" );
132
133  status = rtems_semaphore_delete( 100 );
134  fatal_directive_status(
135    status,
136    RTEMS_INVALID_ID,
137    "rtems_semaphore_delete with illegal id"
138  );
139  puts( "TA1 - rtems_semaphore_delete - unknown RTEMS_INVALID_ID" );
140
141  status = rtems_semaphore_delete( 0x010100 );
142  fatal_directive_status(
143    status,
144    RTEMS_INVALID_ID,
145    "rtems_semaphore_delete with local illegal id"
146  );
147  puts( "TA1 - rtems_semaphore_delete - local RTEMS_INVALID_ID" );
148
149  status = rtems_semaphore_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id );
150  fatal_directive_status(
151    status,
152    RTEMS_INVALID_NAME,
153    "rtems_semaphore_ident will illegal name (local)"
154  );
155  puts( "TA1 - rtems_semaphore_ident - global RTEMS_INVALID_NAME" );
156
157  status = rtems_semaphore_ident( 100, 1, &Junk_id );
158  fatal_directive_status(
159    status,
160    RTEMS_INVALID_NAME,
161    "rtems_semaphore_ident will illegal name (global)"
162  );
163  puts( "TA1 - rtems_semaphore_ident - local RTEMS_INVALID_NAME" );
164}
Note: See TracBrowser for help on using the repository browser.