1 | /* |
---|
2 | * COPYRIGHT (c) 2014. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.org/license/LICENSE. |
---|
8 | */ |
---|
9 | |
---|
10 | #ifdef HAVE_CONFIG_H |
---|
11 | #include "config.h" |
---|
12 | #endif |
---|
13 | |
---|
14 | #define CONFIGURE_INIT |
---|
15 | #include "system.h" |
---|
16 | |
---|
17 | #include <rtems/rtems/tasksimpl.h> |
---|
18 | |
---|
19 | const char rtems_test_name[] = "TASK ERROR 04"; |
---|
20 | |
---|
21 | rtems_task Init( |
---|
22 | rtems_task_argument argument |
---|
23 | ) |
---|
24 | { |
---|
25 | rtems_status_code status; |
---|
26 | |
---|
27 | TEST_BEGIN(); |
---|
28 | |
---|
29 | Task_id[ 0 ] = rtems_task_self(); |
---|
30 | |
---|
31 | Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); |
---|
32 | |
---|
33 | /* priority of 0 error */ |
---|
34 | status = rtems_task_create( |
---|
35 | Task_name[1], |
---|
36 | 0, |
---|
37 | RTEMS_MINIMUM_STACK_SIZE, |
---|
38 | RTEMS_DEFAULT_MODES, |
---|
39 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
40 | &Task_id[ 1 ] |
---|
41 | ); |
---|
42 | fatal_directive_status( |
---|
43 | status, |
---|
44 | RTEMS_INVALID_PRIORITY, |
---|
45 | "rtems_task_create with illegal priority" |
---|
46 | ); |
---|
47 | puts( "INIT - rtems_task_create - priority of 0 - RTEMS_INVALID_PRIORITY" ); |
---|
48 | |
---|
49 | /* priority > 255 error */ |
---|
50 | status = rtems_task_create( |
---|
51 | Task_name[1], |
---|
52 | 257, |
---|
53 | RTEMS_MINIMUM_STACK_SIZE, |
---|
54 | RTEMS_DEFAULT_MODES, |
---|
55 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
56 | &Task_id[ 1 ] |
---|
57 | ); |
---|
58 | fatal_directive_status( |
---|
59 | status, |
---|
60 | RTEMS_INVALID_PRIORITY, |
---|
61 | "rtems_task_create with illegal priority" |
---|
62 | ); |
---|
63 | puts( |
---|
64 | "INIT - rtems_task_create - priority too high - RTEMS_INVALID_PRIORITY" |
---|
65 | ); |
---|
66 | |
---|
67 | status = rtems_task_create( |
---|
68 | Task_name[ 1 ], |
---|
69 | 4, |
---|
70 | RTEMS_MINIMUM_STACK_SIZE, |
---|
71 | RTEMS_DEFAULT_MODES, |
---|
72 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
73 | &Task_id[ 1 ] |
---|
74 | ); |
---|
75 | directive_failed( status, "rtems_task_create of TA1" ); |
---|
76 | |
---|
77 | status = rtems_task_restart( Task_id[ 1 ], 0 ); |
---|
78 | fatal_directive_status( |
---|
79 | status, |
---|
80 | RTEMS_INCORRECT_STATE, |
---|
81 | "rtems_task_restart of DORMANT task" |
---|
82 | ); |
---|
83 | puts( "INIT - rtems_task_restart - RTEMS_INCORRECT_STATE" ); |
---|
84 | |
---|
85 | status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); |
---|
86 | directive_failed( status, "rtems_task_start of TA1" ); |
---|
87 | |
---|
88 | status = rtems_task_delete( RTEMS_SELF ); |
---|
89 | directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); |
---|
90 | } |
---|