source: rtems/testsuites/psxtests/psxfatal_support/init.c @ 698c2e50

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

tests/psxtests: Use <rtems/test.h>

  • 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
17const char rtems_test_name[] = FATAL_ERROR_TEST_NAME;
18
19static void print_test_begin_message(void)
20{
21  static bool done = false;
22
23  if (!done) {
24    done = true;
25    rtems_test_begink();
26  }
27}
28
29void *POSIX_Init(
30  void *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
39void Put_Error( uint32_t source, uint32_t error )
40{
41  if ( source == INTERNAL_ERROR_CORE ) {
42    printk( rtems_internal_error_text( error ) );
43  }
44  else if (source == INTERNAL_ERROR_RTEMS_API ){
45    if (error >  RTEMS_NOT_IMPLEMENTED )
46      printk("Unknown Internal Rtems Error (%d)", error);
47    else
48      printk( "%s", rtems_status_text( error ) );
49  }
50  else if (source == INTERNAL_ERROR_POSIX_API ) {
51      printk( "SOURCE=%d ERROR=%d %s", source, error, strerror( error ) );
52  }
53}
54
55void Put_Source( rtems_fatal_source source )
56{
57  printk( "%s", rtems_fatal_source_text( source ) );
58}
59
60void Fatal_extension(
61  rtems_fatal_source source,
62  bool               is_internal,
63  rtems_fatal_code   error
64)
65{
66  print_test_begin_message();
67  printk( "Fatal error (%s) hit\n", FATAL_ERROR_DESCRIPTION );
68
69  if ( source != FATAL_ERROR_EXPECTED_SOURCE ){
70    printk( "ERROR==> Fatal Extension source Expected (");
71    Put_Source( FATAL_ERROR_EXPECTED_SOURCE );
72    printk( ") received (");
73    Put_Source( source );
74    printk( ")\n" );
75  }
76
77  if ( is_internal !=  FATAL_ERROR_EXPECTED_IS_INTERNAL )
78  {
79    if ( is_internal == TRUE )
80      printk( "ERROR==> Fatal Extension is internal set to TRUE expected FALSE\n" );
81    else
82      printk( "ERROR==> Fatal Extension is internal set to FALSE expected TRUE\n" );
83  }
84
85  if ( error !=  FATAL_ERROR_EXPECTED_ERROR ) {
86    printk( "ERROR==> Fatal Error Expected (");
87    Put_Error( source, FATAL_ERROR_EXPECTED_ERROR );
88    printk( ") received (");
89    Put_Error( source, error );
90    printk( ")\n" );
91  }
92
93  if (
94    source == FATAL_ERROR_EXPECTED_SOURCE
95      && is_internal == FATAL_ERROR_EXPECTED_IS_INTERNAL
96      && error == FATAL_ERROR_EXPECTED_ERROR
97  ) {
98    rtems_test_endk();
99  }
100}
101
Note: See TracBrowser for help on using the repository browser.