source: rtems/testsuites/psxtests/psxobj01/init.c @ c0ae267

4.104.11
Last change on this file since c0ae267 was c0ae267, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 12, 2009 at 3:17:49 PM

Add new test for error cases in _Objects_Name_to_id_string which is currently only used by POSIX semaphores and message queues.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*  Odd Object Name/Id Error Cases
2 *
3 *  COPYRIGHT (c) 1989-2009.
4 *  On-Line Applications Research Corporation (OAR).
5 *
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *  http://www.rtems.com/license/LICENSE.
9 *
10 *  $Id$
11 */
12
13#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
14#include <tmacros.h>
15
16rtems_task Init(
17  rtems_task_argument ignored
18)
19{
20  Objects_Name_or_id_lookup_errors namerc;
21  Objects_Information              TestClass;
22  Objects_Id                       id;
23  char                             name[64];
24
25  puts( "\n\n*** POSIX OBJECT TEST 1 ***" );
26
27  /* very fake object class to test with */
28  _Objects_Initialize_information(
29    &TestClass,
30    1,           /* the_api */
31    4,           /* the_class */
32    0,           /* maximum */
33    4,           /* size */
34    true,        /* is_string */
35    10           /* maximum_name_length */
36    #if defined(RTEMS_MULTIPROCESSING)
37      ,
38      false,       /* supports_global */
39      NULL         /* Objects_Thread_queue_Extract_callout extract */
40    #endif
41  );
42
43  puts( "INIT - _Objects_Name_to_id_string - NULL name" );
44  namerc = _Objects_Name_to_id_string( &TestClass, NULL, &id );
45  if ( namerc != OBJECTS_INVALID_NAME ) {
46    printf( "ERROR - Status = %d\n", namerc );
47    rtems_test_exit(0);
48  }
49
50  puts( "INIT - _Objects_Name_to_id_string - NULL ID" );
51  namerc = _Objects_Name_to_id_string( &TestClass, name, NULL );
52  if ( namerc != OBJECTS_INVALID_ADDRESS ) {
53    printf( "ERROR - Status = %d\n", namerc );
54    rtems_test_exit(0);
55  }
56
57  puts( "INIT - _Objects_Name_to_id_string - name of non-existent object" );
58  strcpy( name, "NOT FOUND" );
59  namerc = _Objects_Name_to_id_string( &TestClass, name, &id );
60  if ( namerc != OBJECTS_INVALID_NAME ) {
61    printf( "ERROR - Status = %d\n", namerc );
62    rtems_test_exit(0);
63  }
64
65  puts( "*** END OF POSIX OBJECT TEST 1 ***" );
66  rtems_test_exit(0);
67}
68
69/* configuration information */
70
71#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
72#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
73
74#define CONFIGURE_MAXIMUM_TASKS  1
75#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
76
77#define CONFIGURE_INIT
78#include <rtems/confdefs.h>
79
80/* global variables */
Note: See TracBrowser for help on using the repository browser.