source: rtems/testsuites/sptests/spfatal_support/init.c @ 3b9247e

4.115
Last change on this file since 3b9247e was 3b9247e, checked in by Sebastian Huber <sebastian.huber@…>, on 09/05/11 at 09:54:34

2011-09-05 Sebastian Huber <sebastian.huber@…>

  • spfatal01/spfatal01.scn, spfatal02/spfatal02.scn, spfatal13/spfatal13.scn, spfatal14/spfatal14.scn, spfatal15/spfatal15.scn, spfatal16/spfatal16.scn, spfatal17/spfatal17.scn, spfatal18/spfatal18.scn, spfatal19/spfatal19.scn, spfatal20/spfatal20.scn, spfatal_support/init.c: Print proper begin message.
  • Property mode set to 100644
File size: 5.1 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
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.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#define CONFIGURE_INIT
17#include "system.h"
18
19static void print_test_begin_message(void)
20{
21  static bool done = false;
22
23  if (!done) {
24    done = true;
25    printk( "\n\n\n*** TEST FATAL " FATAL_ERROR_TEST_NAME " ***\n" );
26  }
27}
28
29rtems_task Init(
30  rtems_task_argument argument
31)
32{
33  print_test_begin_message();
34  force_error();
35  printk( "Fatal error (%s) NOT hit\n", FATAL_ERROR_DESCRIPTION );
36  rtems_test_exit(0);
37}
38
39char *Sources[] = {
40  "INTERNAL_ERROR_CORE",
41  "INTERNAL_ERROR_RTEMS_API",
42  "INTERNAL_ERROR_POSIX_API",
43};
44
45
46char *Errors_Rtems[] = {
47  "RTEMS_SUCCESSFUL",               /* successful completion */
48  "RTEMS_TASK_EXITTED",             /* returned from a task */
49  "RTEMS_MP_NOT_CONFIGURED",        /* multiprocessing not configured */
50  "RTEMS_INVALID_NAME",             /* invalid object name */
51  "RTEMS_INVALID_ID",               /* invalid object id */
52  "RTEMS_TOO_MANY",                 /* too many */
53  "RTEMS_TIMEOUT",                  /* timed out waiting */
54  "RTEMS_OBJECT_WAS_DELETED",       /* object was deleted while waiting */
55  "RTEMS_INVALID_SIZE",             /* specified size was invalid */
56  "RTEMS_INVALID_ADDRESS",          /* address specified is invalid */
57  "RTEMS_INVALID_NUMBER",           /* number was invalid */
58  "RTEMS_NOT_DEFINED",              /* item has not been initialized */
59  "RTEMS_RESOURCE_IN_USE",          /* resources still outstanding */
60  "RTEMS_UNSATISFIED",              /* request not satisfied */
61  "RTEMS_INCORRECT_STATE",          /* task is in wrong state */
62  "RTEMS_ALREADY_SUSPENDED",        /* task already in state */
63  "RTEMS_ILLEGAL_ON_SELF",          /* illegal operation on calling task */
64  "RTEMS_ILLEGAL_ON_REMOTE_OBJECT", /* illegal operation for remote object */
65  "RTEMS_CALLED_FROM_ISR",          /* called from ISR */
66  "RTEMS_INVALID_PRIORITY",         /* invalid task priority */
67  "RTEMS_INVALID_CLOCK",            /* invalid date/time */
68  "RTEMS_INVALID_NODE",             /* invalid node id */
69  "RTEMS_NOT_OWNER_OF_RESOURCE",    /* not owner of resource */
70  "RTEMS_NOT_CONFIGURED",           /* directive not configured */
71  "RTEMS_NOT_IMPLEMENTED"           /* directive not implemented */
72};
73
74char *Errors_Core[] = {
75  "INTERNAL_ERROR_NO_CONFIGURATION_TABLE",
76  "INTERNAL_ERROR_NO_CPU_TABLE",
77  "INTERNAL_ERROR_TOO_LITTLE_WORKSPACE",
78  "INTERNAL_ERROR_WORKSPACE_ALLOCATION",
79  "INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL",
80  "INTERNAL_ERROR_THREAD_EXITTED",
81  "INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION",
82  "INTERNAL_ERROR_INVALID_NODE",
83  "INTERNAL_ERROR_NO_MPCI",
84  "INTERNAL_ERROR_BAD_PACKET",
85  "INTERNAL_ERROR_OUT_OF_PACKETS",
86  "INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS",
87  "INTERNAL_ERROR_OUT_OF_PROXIES",
88  "INTERNAL_ERROR_INVALID_GLOBAL_ID",
89  "INTERNAL_ERROR_BAD_STACK_HOOK",
90  "INTERNAL_ERROR_BAD_ATTRIBUTES",
91  "INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY",
92  "INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL",
93  "INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE"
94};
95
96void Put_Error( uint32_t source, uint32_t error )
97{
98  if ( source == INTERNAL_ERROR_CORE ) {
99    if ( error >  INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE )
100      printk("Unknown Internal Core Error (%d)", error);
101    else
102      printk( Errors_Core[ error ] );
103  }
104  else if (source == INTERNAL_ERROR_RTEMS_API ){
105    if (error >  RTEMS_NOT_IMPLEMENTED )
106      printk("Unknown Internal Rtems Error (0x%08x)", error);
107    else
108      printk( Errors_Rtems[ error ] );
109  }
110}
111
112void Put_Source( uint32_t source )
113{
114  if ( source > INTERNAL_ERROR_POSIX_API )
115    printk("Unknown Source (%d)", source);
116  else
117    printk( Sources[ source ] );
118}
119
120
121void Fatal_extension(
122  uint32_t   source,
123  bool       is_internal,
124  uint32_t   error
125)
126{
127  print_test_begin_message();
128  printk( "Fatal error (%s) hit\n", FATAL_ERROR_DESCRIPTION );
129
130  if ( source != FATAL_ERROR_EXPECTED_SOURCE ){
131    printk( "ERROR==> Fatal Extension source Expected (");
132    Put_Source( FATAL_ERROR_EXPECTED_SOURCE );
133    printk( ") received (");
134    Put_Source( source );
135    printk( ")\n" );
136  }
137
138  if ( is_internal !=  FATAL_ERROR_EXPECTED_IS_INTERNAL )
139  {
140    if ( is_internal == TRUE )
141      printk(
142        "ERROR==> Fatal Extension is internal set to TRUE expected FALSE\n"
143      );
144    else
145      printk(
146        "ERROR==> Fatal Extension is internal set to FALSE expected TRUE\n"
147      );
148  }
149
150  if ( error !=  FATAL_ERROR_EXPECTED_ERROR ) {
151    printk( "ERROR==> Fatal Error Expected (");
152    Put_Error( source, FATAL_ERROR_EXPECTED_ERROR );
153    printk( ") received (");
154    Put_Error( source, error );
155    printk( ")\n" );
156  }
157
158  if (
159    source == FATAL_ERROR_EXPECTED_SOURCE
160      && is_internal == FATAL_ERROR_EXPECTED_IS_INTERNAL
161      && error == FATAL_ERROR_EXPECTED_ERROR
162  ) {
163    printk( "*** END OF TEST FATAL " FATAL_ERROR_TEST_NAME " ***\n" );
164  }
165
166  if ( _System_state_Is_up( _System_state_Get() ) )
167    _Thread_Stop_multitasking();
168}
169
Note: See TracBrowser for help on using the repository browser.