source: rtems/testsuites/psxtests/psxobj01/init.c @ 6c2de60

4.115
Last change on this file since 6c2de60 was 6c2de60, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/12 at 19:12:11

psxtests - Eliminate missing prototype warnings

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