source: rtems/testsuites/sptests/sptask_err04/init.c @ d4edbdbc

4.115
Last change on this file since d4edbdbc was d4edbdbc, checked in by Sebastian Huber <sebastian.huber@…>, on 03/20/15 at 13:09:26

Replace www.rtems.com with www.rtems.org

  • Property mode set to 100644
File size: 2.1 KB
Line 
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
19const char rtems_test_name[] = "TASK ERROR 04";
20
21rtems_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}
Note: See TracBrowser for help on using the repository browser.