1 | /* Task_1 |
---|
2 | * |
---|
3 | * This task generates all possible errors for the RTEMS executive. |
---|
4 | * |
---|
5 | * Input parameters: |
---|
6 | * argument - task argument |
---|
7 | * |
---|
8 | * Output parameters: NONE |
---|
9 | * |
---|
10 | * COPYRIGHT (c) 1989-1999. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
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.rtems.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #ifdef HAVE_CONFIG_H |
---|
19 | #include "config.h" |
---|
20 | #endif |
---|
21 | |
---|
22 | #include "system.h" |
---|
23 | #include <rtems/rtems/tasksimpl.h> |
---|
24 | |
---|
25 | |
---|
26 | rtems_task Task_1( |
---|
27 | rtems_task_argument argument |
---|
28 | ) |
---|
29 | { |
---|
30 | rtems_id self_id; |
---|
31 | rtems_task_priority previous_priority; |
---|
32 | rtems_status_code status; |
---|
33 | |
---|
34 | /* bad Id */ |
---|
35 | status = rtems_task_is_suspended( 100 ); |
---|
36 | fatal_directive_status( |
---|
37 | status, |
---|
38 | RTEMS_INVALID_ID, |
---|
39 | "rtems_task_set_priority with illegal id" |
---|
40 | ); |
---|
41 | puts( "TA1 - rtems_task_is_suspended - RTEMS_INVALID_ID" ); |
---|
42 | |
---|
43 | /* bad Id */ |
---|
44 | status = rtems_task_delete( 100 ); |
---|
45 | fatal_directive_status( |
---|
46 | status, |
---|
47 | RTEMS_INVALID_ID, |
---|
48 | "rtems_task_delete with illegal id" |
---|
49 | ); |
---|
50 | puts( "TA1 - rtems_task_delete - RTEMS_INVALID_ID" ); |
---|
51 | |
---|
52 | /* NULL param */ |
---|
53 | status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, NULL ); |
---|
54 | fatal_directive_status( |
---|
55 | status, |
---|
56 | RTEMS_INVALID_ADDRESS, |
---|
57 | "rtems_task_ident NULL param" |
---|
58 | ); |
---|
59 | puts( "TA1 - rtems_task_ident - RTEMS_INVALID_ADDRESS" ); |
---|
60 | |
---|
61 | /* OK */ |
---|
62 | status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &self_id ); |
---|
63 | directive_failed( status, "rtems_task_ident of self" ); |
---|
64 | if ( self_id != Task_id[ 1 ] ) { |
---|
65 | puts( "ERROR - rtems_task_ident - incorrect ID returned!" ); |
---|
66 | } |
---|
67 | puts( "TA1 - rtems_task_ident - current task RTEMS_SUCCESSFUL" ); |
---|
68 | |
---|
69 | status = rtems_task_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id ); |
---|
70 | fatal_directive_status( |
---|
71 | status, |
---|
72 | RTEMS_INVALID_NAME, |
---|
73 | "rtems_task_ident with illegal name (local)" |
---|
74 | ); |
---|
75 | puts( "TA1 - rtems_task_ident - global RTEMS_INVALID_NAME" ); |
---|
76 | |
---|
77 | status = rtems_task_ident( 100, 1, &Junk_id ); |
---|
78 | fatal_directive_status( |
---|
79 | status, |
---|
80 | RTEMS_INVALID_NAME, |
---|
81 | "rtems_task_ident with illegal name (global)" |
---|
82 | ); |
---|
83 | puts( "TA1 - rtems_task_ident - local RTEMS_INVALID_NAME" ); |
---|
84 | |
---|
85 | /* |
---|
86 | * This one case is different if MP is enabled/disabled. |
---|
87 | */ |
---|
88 | |
---|
89 | status = rtems_task_ident( 100, 2, &Junk_id ); |
---|
90 | #if defined(RTEMS_MULTIPROCESSING) |
---|
91 | fatal_directive_status( |
---|
92 | status, |
---|
93 | RTEMS_INVALID_NODE, |
---|
94 | "rtems_task_ident with illegal node" |
---|
95 | ); |
---|
96 | #else |
---|
97 | fatal_directive_status( |
---|
98 | status, |
---|
99 | RTEMS_INVALID_NAME, |
---|
100 | "rtems_task_ident with illegal node" |
---|
101 | ); |
---|
102 | #endif |
---|
103 | puts( "TA1 - rtems_task_ident - RTEMS_INVALID_NODE" ); |
---|
104 | |
---|
105 | status = rtems_task_restart( 100, 0 ); |
---|
106 | fatal_directive_status( |
---|
107 | status, |
---|
108 | RTEMS_INVALID_ID, |
---|
109 | "rtems_task_restart with illegal id" |
---|
110 | ); |
---|
111 | puts( "TA1 - rtems_task_restart - RTEMS_INVALID_ID" ); |
---|
112 | |
---|
113 | status = rtems_task_resume( 100 ); |
---|
114 | fatal_directive_status( |
---|
115 | status, |
---|
116 | RTEMS_INVALID_ID, |
---|
117 | "rtems_task_resume with illegal id" |
---|
118 | ); |
---|
119 | puts( "TA1 - rtems_task_resume - RTEMS_INVALID_ID" ); |
---|
120 | |
---|
121 | status = rtems_task_resume( RTEMS_SELF ); |
---|
122 | fatal_directive_status( |
---|
123 | status, |
---|
124 | RTEMS_INCORRECT_STATE, |
---|
125 | "rtems_task_resume of ready task" |
---|
126 | ); |
---|
127 | puts( "TA1 - rtems_task_resume - RTEMS_INCORRECT_STATE" ); |
---|
128 | |
---|
129 | /* NULL param */ |
---|
130 | status = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, NULL ); |
---|
131 | fatal_directive_status( |
---|
132 | status, |
---|
133 | RTEMS_INVALID_ADDRESS, |
---|
134 | "rtems_task_set_priority with NULL param" |
---|
135 | ); |
---|
136 | puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_ADDRESS" ); |
---|
137 | |
---|
138 | /* bad priority */ |
---|
139 | status = rtems_task_set_priority( RTEMS_SELF, 512, &previous_priority ); |
---|
140 | fatal_directive_status( |
---|
141 | status, |
---|
142 | RTEMS_INVALID_PRIORITY, |
---|
143 | "rtems_task_set_priority with illegal priority" |
---|
144 | ); |
---|
145 | puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_PRIORITY" ); |
---|
146 | |
---|
147 | /* bad Id */ |
---|
148 | status = rtems_task_set_priority( 100, 8, &previous_priority ); |
---|
149 | fatal_directive_status( |
---|
150 | status, |
---|
151 | RTEMS_INVALID_ID, |
---|
152 | "rtems_task_set_priority with illegal id" |
---|
153 | ); |
---|
154 | puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_ID" ); |
---|
155 | |
---|
156 | status = rtems_task_start( 100, Task_1, 0 ); |
---|
157 | fatal_directive_status( |
---|
158 | status, |
---|
159 | RTEMS_INVALID_ID, |
---|
160 | "rtems_task_start with illegal id" |
---|
161 | ); |
---|
162 | puts( "TA1 - rtems_task_start - RTEMS_INVALID_ID" ); |
---|
163 | |
---|
164 | /* already started */ |
---|
165 | status = rtems_task_start( RTEMS_SELF, Task_1, 0 ); |
---|
166 | fatal_directive_status( |
---|
167 | status, |
---|
168 | RTEMS_INCORRECT_STATE, |
---|
169 | "rtems_task_start of ready task" |
---|
170 | ); |
---|
171 | puts( "TA1 - rtems_task_start - RTEMS_INCORRECT_STATE" ); |
---|
172 | |
---|
173 | /* bad Id */ |
---|
174 | status = rtems_task_suspend( 100 ); |
---|
175 | fatal_directive_status( |
---|
176 | status, |
---|
177 | RTEMS_INVALID_ID, |
---|
178 | "rtems_task_suspend with illegal id" |
---|
179 | ); |
---|
180 | puts( "TA1 - rtems_task_suspend - RTEMS_INVALID_ID" ); |
---|
181 | |
---|
182 | /* NULL param */ |
---|
183 | status = rtems_task_mode( RTEMS_SELF, 0, NULL ); |
---|
184 | fatal_directive_status( |
---|
185 | status, |
---|
186 | RTEMS_INVALID_ADDRESS, |
---|
187 | "rtems_task_mode with NULL param" |
---|
188 | ); |
---|
189 | puts( "TA1 - rtems_task_mode - RTEMS_INVALID_ADDRESS" ); |
---|
190 | |
---|
191 | TEST_END(); |
---|
192 | |
---|
193 | rtems_test_exit( 0 ); |
---|
194 | } |
---|