source: rtems/testsuites/sptests/spport_err01/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: 3.4 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
17const char rtems_test_name[] = "SP PORT ERROR 01";
18
19rtems_task Init(
20  rtems_task_argument argument
21)
22{
23  void              *converted;
24  rtems_status_code status;
25 
26  TEST_BEGIN();
27  Port_name[ 1 ]       =  rtems_build_name( 'D', 'P', '1', ' ' );
28  status = rtems_port_create(
29     0,
30     Internal_port_area,
31     External_port_area,
32     sizeof( Internal_port_area ),
33     &Junk_id
34  );
35  fatal_directive_status(
36    status,
37    RTEMS_INVALID_NAME,
38    "rtems_port_create with illegal name"
39  );
40  puts( "TA1 - rtems_port_create - RTEMS_INVALID_NAME" );
41
42#if defined(_C3x) || defined(_C4x)
43  puts( "TA1 - rtems_port_create - RTEMS_INVALID_ADDRESS - SKIPPED" );
44#else
45  status = rtems_port_create(
46     Port_name[ 1 ],
47     &((char *)Internal_port_area)[ 1 ],
48     External_port_area,
49     sizeof( Internal_port_area ),
50     &Junk_id
51  );
52  fatal_directive_status(
53    status,
54    RTEMS_INVALID_ADDRESS,
55    "rtems_port_create with illegal address"
56  );
57  puts( "TA1 - rtems_port_create - bad range - RTEMS_INVALID_ADDRESS" );
58#endif
59
60  status = rtems_port_create(
61     Port_name[ 1 ],
62     Internal_port_area,
63     External_port_area,
64     sizeof( Internal_port_area ),
65     NULL
66  );
67  fatal_directive_status(
68    status,
69    RTEMS_INVALID_ADDRESS,
70    "rtems_port_create null Id"
71  );
72  puts( "TA1 - rtems_port_create - null id - RTEMS_INVALID_ADDRESS" );
73
74  status = rtems_port_create(
75     Port_name[ 1 ],
76     Internal_port_area,
77     External_port_area,
78     sizeof( Internal_port_area ),
79     &Junk_id
80  );
81  fatal_directive_status(
82    status,
83    RTEMS_TOO_MANY,
84    "rtems_port_create of too many"
85  );
86  puts( "TA1 - rtems_port_create - RTEMS_TOO_MANY" );
87
88  status = rtems_port_delete( 0 );
89  fatal_directive_status(
90    status,
91    RTEMS_INVALID_ID,
92    "rtems_port_delete with illegal id"
93  );
94  puts( "TA1 - rtems_port_delete - RTEMS_INVALID_ID" );
95
96  status = rtems_port_ident( 0, &Junk_id );
97  fatal_directive_status(
98    status,
99    RTEMS_INVALID_NAME,
100    "rtems_port_ident with illegal name"
101  );
102  puts( "TA1 - rtems_port_ident - RTEMS_INVALID_NAME" );
103
104  status = rtems_port_external_to_internal(
105    100,
106    Internal_port_area,
107    &converted
108  );
109  fatal_directive_status(
110    status,
111    RTEMS_INVALID_ID,
112    "rtems_port_external_to_internal with illegal id"
113  );
114
115  status = rtems_port_external_to_internal(
116    100,
117    Internal_port_area,
118    NULL
119  );
120  fatal_directive_status(
121    status,
122    RTEMS_INVALID_ADDRESS,
123    "rtems_port_external_to_internal with NULL param"
124  );
125  puts( "TA1 - rtems_port_external_to_internal - RTEMS_INVALID_ADDRESS" );
126
127  status = rtems_port_internal_to_external(
128    100,
129    Internal_port_area,
130    &converted
131  );
132  fatal_directive_status(
133    status,
134    RTEMS_INVALID_ID,
135    "rtems_port_internal_to_external with illegal id"
136  );
137  puts( "TA1 - rtems_port_internal_to_external - RTEMS_INVALID_ID" );
138
139  status = rtems_port_internal_to_external(
140    100,
141    Internal_port_area,
142    NULL
143  );
144  fatal_directive_status(
145    status,
146    RTEMS_INVALID_ADDRESS,
147    "rtems_port_internal_to_external with NULL param"
148  );
149  puts( "TA1 - rtems_port_external_to_internal - RTEMS_INVALID_ADDRESS" );
150 
151 TEST_END();
152}
Note: See TracBrowser for help on using the repository browser.