source: rtems/testsuites/psxtests/psxfatal_support/init.c @ 22729053

4.115
Last change on this file since 22729053 was 22729053, checked in by Sebastian Huber <sebastian.huber@…>, on 03/25/14 at 07:06:06

tests: Use rtems_status_text()

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2010.
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
17static void print_test_begin_message(void)
18{
19  static bool done = false;
20
21  if (!done) {
22    done = true;
23    printk( "\n\n\n*** TEST POSIX FATAL " FATAL_ERROR_TEST_NAME " ***\n" );
24  }
25}
26
27void *POSIX_Init(
28  void *argument
29)
30{
31  print_test_begin_message();
32  force_error();
33  printk( "Fatal error (%s) NOT hit\n", FATAL_ERROR_DESCRIPTION );
34  rtems_test_exit(0);
35}
36
37void Put_Error( uint32_t source, uint32_t error )
38{
39  if ( source == INTERNAL_ERROR_CORE ) {
40    printk( rtems_internal_error_text( error ) );
41  }
42  else if (source == INTERNAL_ERROR_RTEMS_API ){
43    if (error >  RTEMS_NOT_IMPLEMENTED )
44      printk("Unknown Internal Rtems Error (%d)", error);
45    else
46      printk( "%s", rtems_status_text( error ) );
47  }
48  else if (source == INTERNAL_ERROR_POSIX_API ) {
49      printk( "SOURCE=%d ERROR=%d %s", source, error, strerror( error ) );
50  }
51}
52
53void Put_Source( rtems_fatal_source source )
54{
55  printk( "%s", rtems_fatal_source_text( source ) );
56}
57
58void Fatal_extension(
59  rtems_fatal_source source,
60  bool               is_internal,
61  rtems_fatal_code   error
62)
63{
64  print_test_begin_message();
65  printk( "Fatal error (%s) hit\n", FATAL_ERROR_DESCRIPTION );
66
67  if ( source != FATAL_ERROR_EXPECTED_SOURCE ){
68    printk( "ERROR==> Fatal Extension source Expected (");
69    Put_Source( FATAL_ERROR_EXPECTED_SOURCE );
70    printk( ") received (");
71    Put_Source( source );
72    printk( ")\n" );
73  }
74
75  if ( is_internal !=  FATAL_ERROR_EXPECTED_IS_INTERNAL )
76  {
77    if ( is_internal == TRUE )
78      printk( "ERROR==> Fatal Extension is internal set to TRUE expected FALSE\n" );
79    else
80      printk( "ERROR==> Fatal Extension is internal set to FALSE expected TRUE\n" );
81  }
82
83  if ( error !=  FATAL_ERROR_EXPECTED_ERROR ) {
84    printk( "ERROR==> Fatal Error Expected (");
85    Put_Error( source, FATAL_ERROR_EXPECTED_ERROR );
86    printk( ") received (");
87    Put_Error( source, error );
88    printk( ")\n" );
89  }
90
91  if (
92    source == FATAL_ERROR_EXPECTED_SOURCE
93      && is_internal == FATAL_ERROR_EXPECTED_IS_INTERNAL
94      && error == FATAL_ERROR_EXPECTED_ERROR
95  ) {
96    printk( "*** END OF TEST POSIX FATAL " FATAL_ERROR_TEST_NAME " ***\n" );
97  }
98}
99
Note: See TracBrowser for help on using the repository browser.