source: rtems/testsuites/sptests/spfatal_support/init.c @ 55658c6

4.115
Last change on this file since 55658c6 was 55658c6, checked in by Sebastian Huber <sebastian.huber@…>, on Aug 22, 2011 at 10:10:56 AM

2011-08-22 Sebastian Huber <sebastian.huber@…>

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