File indexing completed on 2025-05-11 08:24:47
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifdef HAVE_CONFIG_H
0010 #include "config.h"
0011 #endif
0012
0013 #include <stdlib.h>
0014
0015 #include <tmacros.h>
0016
0017 const char rtems_test_name[] = "SPGLOBALCON 2";
0018
0019 static int i;
0020
0021 static __attribute__((__constructor__(1000))) void c0(void)
0022 {
0023 rtems_test_assert(i == 0);
0024 ++i;
0025 }
0026
0027 static __attribute__((__constructor__(1001))) void c1(void)
0028 {
0029 rtems_test_assert(i == 1);
0030 ++i;
0031 }
0032
0033 static __attribute__((__constructor__(1002))) void c2(void)
0034 {
0035 rtems_test_assert(i == 2);
0036 ++i;
0037 }
0038
0039 static __attribute__((__constructor__)) void c(void)
0040 {
0041 rtems_test_assert(i == 3);
0042 ++i;
0043 }
0044
0045 static __attribute__((__destructor__(1000))) void d0(void)
0046 {
0047 rtems_test_assert(i == 8);
0048 ++i;
0049 }
0050
0051 static __attribute__((__destructor__(1001))) void d1(void)
0052 {
0053 rtems_test_assert(i == 7);
0054 ++i;
0055 }
0056
0057 static __attribute__((__destructor__(1002))) void d2(void)
0058 {
0059 rtems_test_assert(i == 6);
0060 ++i;
0061 }
0062
0063 static __attribute__((__destructor__)) void d(void)
0064 {
0065 rtems_test_assert(i == 5);
0066 ++i;
0067 }
0068
0069 static void Init(rtems_task_argument arg)
0070 {
0071 TEST_BEGIN();
0072 rtems_test_assert(i == 4);
0073 ++i;
0074 exit(0);
0075 }
0076
0077 static void fatal_extension(
0078 rtems_fatal_source source,
0079 bool always_set_to_false,
0080 rtems_fatal_code error
0081 )
0082 {
0083 if (
0084 source == RTEMS_FATAL_SOURCE_EXIT
0085 && !always_set_to_false
0086 && error == 0
0087 && i == 9
0088 ) {
0089 TEST_END();
0090 }
0091 }
0092
0093 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
0094 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
0095
0096 #define CONFIGURE_MAXIMUM_TASKS 1
0097
0098 #define CONFIGURE_INITIAL_EXTENSIONS \
0099 { .fatal = fatal_extension }, \
0100 RTEMS_TEST_INITIAL_EXTENSION
0101
0102 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
0103
0104 #define CONFIGURE_INIT
0105
0106 #include <rtems/confdefs.h>