diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-13 17:40:33 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-15 15:33:11 +0100 |
commit | dc6e830c108996c43e9267f05a51b7299dd3e6f9 (patch) | |
tree | fb18e0a10ef689e15aaa6054a25ab6bc3ee3eb00 /testsuites | |
parent | sapi: Add rtems_fatal_source and rtems_fatal_code (diff) | |
download | rtems-dc6e830c108996c43e9267f05a51b7299dd3e6f9.tar.bz2 |
sapi: Add and use rtems_internal_error_description
Diffstat (limited to 'testsuites')
-rw-r--r-- | testsuites/psxtests/psxfatal_support/init.c | 32 | ||||
-rw-r--r-- | testsuites/sptests/Makefile.am | 1 | ||||
-rw-r--r-- | testsuites/sptests/configure.ac | 1 | ||||
-rw-r--r-- | testsuites/sptests/spfatal_support/init.c | 32 | ||||
-rw-r--r-- | testsuites/sptests/spinternalerror02/Makefile.am | 19 | ||||
-rw-r--r-- | testsuites/sptests/spinternalerror02/init.c | 61 | ||||
-rw-r--r-- | testsuites/sptests/spinternalerror02/spinternalerror02.doc | 11 | ||||
-rw-r--r-- | testsuites/sptests/spinternalerror02/spinternalerror02.scn | 28 |
8 files changed, 123 insertions, 62 deletions
diff --git a/testsuites/psxtests/psxfatal_support/init.c b/testsuites/psxtests/psxfatal_support/init.c index e2ab2415fa..abd9a00ded 100644 --- a/testsuites/psxtests/psxfatal_support/init.c +++ b/testsuites/psxtests/psxfatal_support/init.c @@ -68,40 +68,10 @@ char *Errors_Rtems[] = { "RTEMS_NOT_IMPLEMENTED" /* directive not implemented */ }; -char *Errors_Core[] = { - "INTERNAL_ERROR_NO_CONFIGURATION_TABLE", - "INTERNAL_ERROR_NO_CPU_TABLE", - "INTERNAL_ERROR_TOO_LITTLE_WORKSPACE", - "INTERNAL_ERROR_WORKSPACE_ALLOCATION", - "INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL", - "INTERNAL_ERROR_THREAD_EXITTED", - "INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION", - "INTERNAL_ERROR_INVALID_NODE", - "INTERNAL_ERROR_NO_MPCI", - "INTERNAL_ERROR_BAD_PACKET", - "INTERNAL_ERROR_OUT_OF_PACKETS", - "INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS", - "INTERNAL_ERROR_OUT_OF_PROXIES", - "INTERNAL_ERROR_INVALID_GLOBAL_ID", - "INTERNAL_ERROR_BAD_STACK_HOOK", - "INTERNAL_ERROR_BAD_ATTRIBUTES", - "INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY", - "INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL", - "INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE", - "INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0", - "INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP", - "INTERNAL_ERROR_GXX_KEY_ADD_FAILED", - "INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED", - "INTERNAL_ERROR_NO_MEMORY_FOR_HEAP" -}; - void Put_Error( uint32_t source, uint32_t error ) { if ( source == INTERNAL_ERROR_CORE ) { - if ( error > INTERNAL_ERROR_NO_MEMORY_FOR_HEAP ) - printk("Unknown Internal Core Error (%d)", error); - else - printk( Errors_Core[ error ] ); + printk( rtems_internal_error_description( error ) ); } else if (source == INTERNAL_ERROR_RTEMS_API ){ if (error > RTEMS_NOT_IMPLEMENTED ) diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index b596961ee7..1e183eb846 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -31,6 +31,7 @@ SUBDIRS = \ SUBDIRS += speventtransient01 SUBDIRS += speventsystem01 SUBDIRS += spinternalerror01 +SUBDIRS += spinternalerror02 include $(top_srcdir)/../automake/subdirs.am include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index 0f0c9bdf97..a71746fc74 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -27,6 +27,7 @@ AC_CHECK_SIZEOF([time_t]) # Explicitly list all Makefiles here AC_CONFIG_FILES([Makefile +spinternalerror02/Makefile spinternalerror01/Makefile speventsystem01/Makefile speventtransient01/Makefile diff --git a/testsuites/sptests/spfatal_support/init.c b/testsuites/sptests/spfatal_support/init.c index 9822b13276..c9fb7f75df 100644 --- a/testsuites/sptests/spfatal_support/init.c +++ b/testsuites/sptests/spfatal_support/init.c @@ -69,40 +69,10 @@ char *Errors_Rtems[] = { "RTEMS_NOT_IMPLEMENTED" /* directive not implemented */ }; -char *Errors_Core[] = { - "INTERNAL_ERROR_NO_CONFIGURATION_TABLE", - "INTERNAL_ERROR_NO_CPU_TABLE", - "INTERNAL_ERROR_TOO_LITTLE_WORKSPACE", - "INTERNAL_ERROR_WORKSPACE_ALLOCATION", - "INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL", - "INTERNAL_ERROR_THREAD_EXITTED", - "INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION", - "INTERNAL_ERROR_INVALID_NODE", - "INTERNAL_ERROR_NO_MPCI", - "INTERNAL_ERROR_BAD_PACKET", - "INTERNAL_ERROR_OUT_OF_PACKETS", - "INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS", - "INTERNAL_ERROR_OUT_OF_PROXIES", - "INTERNAL_ERROR_INVALID_GLOBAL_ID", - "INTERNAL_ERROR_BAD_STACK_HOOK", - "INTERNAL_ERROR_BAD_ATTRIBUTES", - "INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY", - "INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL", - "INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE", - "INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0", - "INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP", - "INTERNAL_ERROR_GXX_KEY_ADD_FAILED", - "INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED", - "INTERNAL_ERROR_NO_MEMORY_FOR_HEAP" -}; - void Put_Error( uint32_t source, uint32_t error ) { if ( source == INTERNAL_ERROR_CORE ) { - if ( error > INTERNAL_ERROR_NO_MEMORY_FOR_HEAP ) - printk("Unknown Internal Core Error (%d)", error); - else - printk( Errors_Core[ error ] ); + printk( rtems_internal_error_description( error ) ); } else if (source == INTERNAL_ERROR_RTEMS_API ){ if (error > RTEMS_NOT_IMPLEMENTED ) diff --git a/testsuites/sptests/spinternalerror02/Makefile.am b/testsuites/sptests/spinternalerror02/Makefile.am new file mode 100644 index 0000000000..600e74b3c8 --- /dev/null +++ b/testsuites/sptests/spinternalerror02/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = spinternalerror02 +spinternalerror02_SOURCES = init.c + +dist_rtems_tests_DATA = spinternalerror02.scn spinternalerror02.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(spinternalerror02_OBJECTS) +LINK_LIBS = $(spinternalerror02_LDLIBS) + +spinternalerror02$(EXEEXT): $(spinternalerror02_OBJECTS) $(spinternalerror02_DEPENDENCIES) + @rm -f spinternalerror02$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spinternalerror02/init.c b/testsuites/sptests/spinternalerror02/init.c new file mode 100644 index 0000000000..357ea5b5e7 --- /dev/null +++ b/testsuites/sptests/spinternalerror02/init.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2012 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include "tmacros.h" + +#include <rtems.h> + +static void test(void) +{ + rtems_fatal_code error = 0; + const char *desc_last = NULL; + const char *desc; + + do { + desc_last = desc; + desc = rtems_internal_error_description( error ); + ++error; + puts( desc ); + } while ( desc != desc_last ); + + rtems_test_assert( error - 3 == INTERNAL_ERROR_NO_MEMORY_FOR_HEAP ); +} + +static void Init(rtems_task_argument arg) +{ + puts("\n\n*** TEST SPINTERNALERROR 2 ***"); + + test(); + + puts("*** END OF TEST SPINTERNALERROR 2 ***"); + + rtems_test_exit(0); +} + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> diff --git a/testsuites/sptests/spinternalerror02/spinternalerror02.doc b/testsuites/sptests/spinternalerror02/spinternalerror02.doc new file mode 100644 index 0000000000..ebae4f0bf1 --- /dev/null +++ b/testsuites/sptests/spinternalerror02/spinternalerror02.doc @@ -0,0 +1,11 @@ +This file describes the directives and concepts tested by this test set. + +test set name: spinternalerror02 + +directives: + + rtems_internal_error_description() + +concepts: + + - Ensure that rtems_internal_error_description() works for some values. diff --git a/testsuites/sptests/spinternalerror02/spinternalerror02.scn b/testsuites/sptests/spinternalerror02/spinternalerror02.scn new file mode 100644 index 0000000000..c1152c42fc --- /dev/null +++ b/testsuites/sptests/spinternalerror02/spinternalerror02.scn @@ -0,0 +1,28 @@ +*** TEST SPINTERNALERROR 2 *** +INTERNAL_ERROR_NO_CONFIGURATION_TABLE +INTERNAL_ERROR_NO_CPU_TABLE +INTERNAL_ERROR_TOO_LITTLE_WORKSPACE +INTERNAL_ERROR_WORKSPACE_ALLOCATION +INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL +INTERNAL_ERROR_THREAD_EXITTED +INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION +INTERNAL_ERROR_INVALID_NODE +INTERNAL_ERROR_NO_MPCI +INTERNAL_ERROR_BAD_PACKET +INTERNAL_ERROR_OUT_OF_PACKETS +INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS +INTERNAL_ERROR_OUT_OF_PROXIES +INTERNAL_ERROR_INVALID_GLOBAL_ID +INTERNAL_ERROR_BAD_STACK_HOOK +INTERNAL_ERROR_BAD_ATTRIBUTES +INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY +INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL +INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE +INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0 +INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP +INTERNAL_ERROR_GXX_KEY_ADD_FAILED +INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED +INTERNAL_ERROR_NO_MEMORY_FOR_HEAP +? +? +*** END OF TEST SPINTERNALERROR 2 *** |