File indexing completed on 2025-05-11 08:24:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 const char rtems_test_name[] = "PSXFATAL " FATAL_ERROR_TEST_NAME;
0030
0031 static void print_test_begin_message(void)
0032 {
0033 static bool done = false;
0034
0035 if (!done) {
0036 done = true;
0037 TEST_BEGIN();
0038 }
0039 }
0040
0041 void *POSIX_Init(
0042 void *argument
0043 )
0044 {
0045 print_test_begin_message();
0046 force_error();
0047 printk( "Fatal error (%s) NOT hit\n", FATAL_ERROR_DESCRIPTION );
0048 rtems_test_exit(0);
0049 }
0050
0051 static void Put_Error( rtems_fatal_source source, rtems_fatal_code error )
0052 {
0053 if ( source == INTERNAL_ERROR_CORE ) {
0054 printk( rtems_internal_error_text( error ) );
0055 }
0056 else if (source == INTERNAL_ERROR_RTEMS_API ){
0057 printk( "%s", rtems_status_text( error ) );
0058 }
0059 else if (source == INTERNAL_ERROR_POSIX_API ) {
0060 printk(
0061 "SOURCE=%d ERROR=%" PRIuMAX " %s",
0062 source,
0063 (uintmax_t) error,
0064 strerror( (int) error )
0065 );
0066 }
0067 }
0068
0069 static void Put_Source( rtems_fatal_source source )
0070 {
0071 printk( "%s", rtems_fatal_source_text( source ) );
0072 }
0073
0074 static void Fatal_extension(
0075 rtems_fatal_source source,
0076 bool always_set_to_false,
0077 rtems_fatal_code error
0078 )
0079 {
0080 print_test_begin_message();
0081 printk( "Fatal error (%s) hit\n", FATAL_ERROR_DESCRIPTION );
0082
0083 if ( source != FATAL_ERROR_EXPECTED_SOURCE ){
0084 printk( "ERROR==> Fatal Extension source Expected (");
0085 Put_Source( FATAL_ERROR_EXPECTED_SOURCE );
0086 printk( ") received (");
0087 Put_Source( source );
0088 printk( ")\n" );
0089 }
0090
0091 if ( always_set_to_false )
0092 printk( "ERROR==> Fatal Extension is internal set to true expected false\n" );
0093
0094 if ( error != FATAL_ERROR_EXPECTED_ERROR ) {
0095 printk( "ERROR==> Fatal Error Expected (");
0096 Put_Error( source, FATAL_ERROR_EXPECTED_ERROR );
0097 printk( ") received (");
0098 Put_Error( source, error );
0099 printk( ")\n" );
0100 }
0101
0102 if (
0103 source == FATAL_ERROR_EXPECTED_SOURCE
0104 && !always_set_to_false
0105 && error == FATAL_ERROR_EXPECTED_ERROR
0106 ) {
0107 TEST_END();
0108 }
0109 }
0110
0111 #define CONFIGURE_INIT
0112
0113 #define CONFIGURE_INITIAL_EXTENSIONS \
0114 { \
0115 NULL, \
0116 NULL, \
0117 NULL, \
0118 NULL, \
0119 NULL, \
0120 NULL, \
0121 NULL, \
0122 Fatal_extension \
0123 }, \
0124 RTEMS_TEST_INITIAL_EXTENSION
0125
0126
0127 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
0128 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
0129
0130
0131 #ifndef SPFATAL_TEST_CASE_EXTRA_THREADS
0132 #define SPFATAL_TEST_CASE_EXTRA_THREADS 0
0133 #endif
0134
0135 #define CONFIGURE_MAXIMUM_POSIX_THREADS \
0136 (SPFATAL_TEST_CASE_EXTRA_THREADS + 1)
0137
0138 #define CONFIGURE_POSIX_INIT_THREAD_TABLE
0139
0140 #include <rtems/confdefs.h>