diff options
Diffstat (limited to 'testsuites')
-rw-r--r-- | testsuites/libtests/malloc04/init.c | 43 | ||||
-rw-r--r-- | testsuites/psxtests/psxfatal_support/init.c | 9 | ||||
-rw-r--r-- | testsuites/sptests/Makefile.am | 2 | ||||
-rw-r--r-- | testsuites/sptests/configure.ac | 1 | ||||
-rw-r--r-- | testsuites/sptests/spfatal06/testcase.h | 11 | ||||
-rw-r--r-- | testsuites/sptests/spfatal07/testcase.h | 6 | ||||
-rw-r--r-- | testsuites/sptests/spfatal08/testcase.h | 14 | ||||
-rw-r--r-- | testsuites/sptests/spfatal09/testcase.h | 11 | ||||
-rw-r--r-- | testsuites/sptests/spfatal12/testcase.h | 5 | ||||
-rw-r--r-- | testsuites/sptests/spfatal21/Makefile.am | 21 | ||||
-rw-r--r-- | testsuites/sptests/spfatal21/spfatal21.doc | 19 | ||||
-rw-r--r-- | testsuites/sptests/spfatal21/spfatal21.scn | 3 | ||||
-rw-r--r-- | testsuites/sptests/spfatal21/testcase.h | 34 | ||||
-rw-r--r-- | testsuites/sptests/spfatal_support/init.c | 9 |
14 files changed, 70 insertions, 118 deletions
diff --git a/testsuites/libtests/malloc04/init.c b/testsuites/libtests/malloc04/init.c index 72a397f6a1..00355dabd4 100644 --- a/testsuites/libtests/malloc04/init.c +++ b/testsuites/libtests/malloc04/init.c @@ -30,14 +30,20 @@ #include <rtems/confdefs.h> /* end of configuration */ +#ifndef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK +void *rtems_heap_null_extend( + Heap_Control *heap, + size_t alloc_size +) +{ + return rtems_heap_extend_via_sbrk( heap, alloc_size ); +} +#endif + char Malloc_Heap[ 128 ] CPU_STRUCTURE_ALIGNMENT; int sbrk_count; -Heap_Control Heap_Holder; Heap_Control TempHeap; -/* Heap variables we need to peek and poke at */ -extern size_t RTEMS_Malloc_Sbrk_amount; - size_t offset; void * sbrk(ptrdiff_t incr) @@ -66,7 +72,8 @@ rtems_task Init( rtems_task_argument argument ) { - Heap_Control *TempHeap; + Heap_Control *real_heap; + Heap_Area area; sbrk_count = 0; offset = 0; @@ -74,21 +81,26 @@ rtems_task Init( puts( "\n\n*** TEST MALLOC 04 ***" ); /* Safe information on real heap */ - TempHeap = malloc_get_heap_pointer(); - Heap_Holder = *TempHeap; - rtems_malloc_sbrk_helpers = &rtems_malloc_sbrk_helpers_table; + real_heap = malloc_get_heap_pointer(); + malloc_set_heap_pointer( &TempHeap ); + + rtems_heap_set_sbrk_amount( 64 ); puts( "Initialize heap with some memory" ); offset = 64; sbrk_count = 0; - RTEMS_Malloc_Initialize( Malloc_Heap, 64, 64 ); + area.begin = &Malloc_Heap [0]; + area.size = 64; + RTEMS_Malloc_Initialize( &area, 1, NULL ); p1 = malloc(64); p2 = malloc(64); p3 = malloc(48); p4 = malloc(48); puts( "Initialize heap with some memory - return address out of heap" ); - RTEMS_Malloc_Initialize( &Malloc_Heap[1], 64, 64 ); + area.begin = &Malloc_Heap [1]; + area.size = 64; + RTEMS_Malloc_Initialize( &area, 1, NULL ); offset = 64; sbrk_count = -1; p1 = malloc( 127 ); @@ -96,18 +108,21 @@ rtems_task Init( rtems_test_assert( errno == ENOMEM ); - RTEMS_Malloc_Initialize( Malloc_Heap, 64, 64 ); + area.begin = &Malloc_Heap [0]; + area.size = 64; + RTEMS_Malloc_Initialize( &area, 1, NULL ); puts( "Initialize heap with some unaligned memory" ); offset = 65; sbrk_count = 0; - RTEMS_Malloc_Initialize( &Malloc_Heap[1], 64, 64 ); + area.begin = &Malloc_Heap [1]; + area.size = 64; + RTEMS_Malloc_Initialize( &area, 1, NULL ); p1 = malloc(64); p2 = malloc(64); p3 = malloc(48); /* Restore information on real heap */ - malloc_set_heap_pointer( TempHeap ); - rtems_malloc_sbrk_helpers = NULL; + malloc_set_heap_pointer( real_heap ); puts( "*** END OF TEST MALLOC 04 ***" ); diff --git a/testsuites/psxtests/psxfatal_support/init.c b/testsuites/psxtests/psxfatal_support/init.c index c58aeafc64..e2ab2415fa 100644 --- a/testsuites/psxtests/psxfatal_support/init.c +++ b/testsuites/psxtests/psxfatal_support/init.c @@ -87,13 +87,18 @@ char *Errors_Core[] = { "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_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_MUTEX_OBTAIN_FROM_BAD_STATE ) + if ( error > INTERNAL_ERROR_NO_MEMORY_FOR_HEAP ) printk("Unknown Internal Core Error (%d)", error); else printk( Errors_Core[ error ] ); diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 479cdf6cd4..a0dc24af36 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -17,7 +17,7 @@ SUBDIRS = \ sperror01 sperror02 sperror03 \ spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \ spfatal08 spfatal09 spfatal10 spfatal11 spfatal12 spfatal13 spfatal14 \ - spfatal15 spfatal16 spfatal17 spfatal18 spfatal19 spfatal20 spfatal21 \ + spfatal15 spfatal16 spfatal17 spfatal18 spfatal19 spfatal20 \ spfatal22 spfatal23 spfatal24 spfatal25 \ spfifo01 spfifo02 spfifo03 spfifo04 spfifo05 \ spintrcritical01 spintrcritical02 spintrcritical03 spintrcritical04 \ diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index 33a0755615..32063e2221 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -139,7 +139,6 @@ spfatal17/Makefile spfatal18/Makefile spfatal19/Makefile spfatal20/Makefile -spfatal21/Makefile spfatal22/Makefile spfatal23/Makefile spfatal24/Makefile diff --git a/testsuites/sptests/spfatal06/testcase.h b/testsuites/sptests/spfatal06/testcase.h index 29669d96bf..27c615d7e7 100644 --- a/testsuites/sptests/spfatal06/testcase.h +++ b/testsuites/sptests/spfatal06/testcase.h @@ -38,6 +38,10 @@ rtems_initialization_tasks_table Initialization_tasks[] = { void *New_stack_allocate_hook(size_t unused); +#define CONFIGURE_TASK_STACK_ALLOCATOR New_stack_allocate_hook + +#define CONFIGURE_TASK_STACK_DEALLOCATOR NULL + void *New_stack_allocate_hook(size_t unused) { return NULL; @@ -45,12 +49,5 @@ void *New_stack_allocate_hook(size_t unused) void force_error() { - if (Configuration.stack_free_hook != NULL) - Configuration.stack_allocate_hook = NULL; - else - Configuration.stack_allocate_hook = New_stack_allocate_hook; - - rtems_initialize_data_structures(); /* we will not run this far */ } - diff --git a/testsuites/sptests/spfatal07/testcase.h b/testsuites/sptests/spfatal07/testcase.h index c95fc0df48..77ef6e8af7 100644 --- a/testsuites/sptests/spfatal07/testcase.h +++ b/testsuites/sptests/spfatal07/testcase.h @@ -37,11 +37,15 @@ rtems_initialization_tasks_table Initialization_tasks[] = { #define FATAL_ERROR_EXPECTED_ERROR \ INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL +#if CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE + #define CONFIGURE_MEMORY_OVERHEAD (sizeof(ISR_Handler_entry) * ISR_NUMBER_OF_VECTORS) +#endif + void force_error() { #if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE) Configuration.interrupt_stack_size = (STACK_MINIMUM_SIZE-1); - rtems_initialize_data_structures(); + _ISR_Handler_initialization(); #else printk( "WARNING - Test not applicable on this target architecture.\n" diff --git a/testsuites/sptests/spfatal08/testcase.h b/testsuites/sptests/spfatal08/testcase.h index 50a831f33f..83615f5b04 100644 --- a/testsuites/sptests/spfatal08/testcase.h +++ b/testsuites/sptests/spfatal08/testcase.h @@ -9,6 +9,8 @@ * http://www.rtems.com/license/LICENSE. */ +#include <rtems/score/wkspace.h> + /* * Way too much stack space. Should generate a fatal error * on the init task create. @@ -39,10 +41,16 @@ char Workspace[ 256 ] CPU_STRUCTURE_ALIGNMENT; void force_error() { - rtems_configuration_set_work_space_start( Workspace ); - rtems_configuration_set_work_space_size( sizeof(Workspace) ); + Heap_Area area = { + .begin = Workspace, + .size = sizeof( Workspace ) + }; + + rtems_configuration_set_work_space_size( 0 ); rtems_configuration_set_stack_space_size( 0 ); - rtems_initialize_data_structures();; + _Workspace_Handler_initialization( &area, 1, NULL ); + + _Workspace_Allocate_or_fatal_error( 2 * sizeof( Workspace ) ); /* we will not run this far */ } diff --git a/testsuites/sptests/spfatal09/testcase.h b/testsuites/sptests/spfatal09/testcase.h index eb50c30dfd..dc6dfa9f24 100644 --- a/testsuites/sptests/spfatal09/testcase.h +++ b/testsuites/sptests/spfatal09/testcase.h @@ -14,15 +14,12 @@ #define FATAL_ERROR_TEST_NAME "9" #define FATAL_ERROR_DESCRIPTION "Bad heap address to malloc" -#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_RTEMS_API -#define FATAL_ERROR_EXPECTED_IS_INTERNAL FALSE -#define FATAL_ERROR_EXPECTED_ERROR RTEMS_NO_MEMORY - -char Malloc_Heap[ 1 ] CPU_STRUCTURE_ALIGNMENT; +#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE +#define FATAL_ERROR_EXPECTED_IS_INTERNAL TRUE +#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_NO_MEMORY_FOR_HEAP void force_error() { - RTEMS_Malloc_Initialize( Malloc_Heap, sizeof(Malloc_Heap), 0 ); - + RTEMS_Malloc_Initialize( NULL, 0, NULL ); /* we will not run this far */ } diff --git a/testsuites/sptests/spfatal12/testcase.h b/testsuites/sptests/spfatal12/testcase.h index feeec46034..73cb7a9616 100644 --- a/testsuites/sptests/spfatal12/testcase.h +++ b/testsuites/sptests/spfatal12/testcase.h @@ -17,9 +17,8 @@ void force_error() { - rtems_configuration_set_work_space_size( sizeof(void *) ); - rtems_configuration_set_stack_space_size( 0 ); - rtems_initialize_data_structures(); + Heap_Area area = { .begin = NULL, .size = 0 }; + _Workspace_Handler_initialization( &area, 1, NULL ); /* we will not run this far */ } diff --git a/testsuites/sptests/spfatal21/Makefile.am b/testsuites/sptests/spfatal21/Makefile.am deleted file mode 100644 index 3a2439ac80..0000000000 --- a/testsuites/sptests/spfatal21/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -rtems_tests_PROGRAMS = spfatal21 -spfatal21_SOURCES = ../spfatal_support/init.c \ - ../spfatal_support/system.h ../../support/src/test_support.c testcase.h - -dist_rtems_tests_DATA = spfatal21.scn -dist_rtems_tests_DATA += spfatal21.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 = $(spfatal21_OBJECTS) -LINK_LIBS = $(spfatal21_LDLIBS) - -spfatal21$(EXEEXT): $(spfatal21_OBJECTS) $(spfatal21_DEPENDENCIES) - @rm -f spfatal21$(EXEEXT) - $(make-exe) - -include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spfatal21/spfatal21.doc b/testsuites/sptests/spfatal21/spfatal21.doc deleted file mode 100644 index ba1e65c0f2..0000000000 --- a/testsuites/sptests/spfatal21/spfatal21.doc +++ /dev/null @@ -1,19 +0,0 @@ -# COPYRIGHT (c) 1989-2010. -# On-Line Applications Research Corporation (OAR). -# -# 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. -# - -This file describes the directives and concepts tested by this test set. - -test set name: spfatal21 - -directives: - - malloc_sbrk_initialize - -concepts: - -+ exercise fatal error when sbrk fails to extend memory on the initial call. diff --git a/testsuites/sptests/spfatal21/spfatal21.scn b/testsuites/sptests/spfatal21/spfatal21.scn deleted file mode 100644 index 1ea32a5d3f..0000000000 --- a/testsuites/sptests/spfatal21/spfatal21.scn +++ /dev/null @@ -1,3 +0,0 @@ -*** TEST FATAL FATAL 21 *** -Fatal error (sbrk during init fails) hit -*** END OF TEST FATAL 21 *** diff --git a/testsuites/sptests/spfatal21/testcase.h b/testsuites/sptests/spfatal21/testcase.h deleted file mode 100644 index 788f06be5e..0000000000 --- a/testsuites/sptests/spfatal21/testcase.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * COPYRIGHT (c) 1989-2012. - * On-Line Applications Research Corporation (OAR). - * - * 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. - */ - -#define FATAL_ERROR_TEST_NAME "FATAL 21" -#define FATAL_ERROR_DESCRIPTION "sbrk during init fails" -#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_RTEMS_API -#define FATAL_ERROR_EXPECTED_IS_INTERNAL FALSE -#define FATAL_ERROR_EXPECTED_ERROR RTEMS_NO_MEMORY - -#include <rtems/libcsupport.h> -#include <rtems/malloc.h> -#include <unistd.h> - -/* Safe information on real heap */ -extern rtems_malloc_sbrk_functions_t *rtems_malloc_sbrk_helpers; -extern rtems_malloc_sbrk_functions_t rtems_malloc_sbrk_helpers_table; - -void * sbrk(ptrdiff_t incr) -{ - return (void *) -1; -} - -void force_error() -{ - rtems_malloc_sbrk_helpers = &rtems_malloc_sbrk_helpers_table; - - RTEMS_Malloc_Initialize( NULL, 0, 64 ); -} diff --git a/testsuites/sptests/spfatal_support/init.c b/testsuites/sptests/spfatal_support/init.c index 923c08f7db..9822b13276 100644 --- a/testsuites/sptests/spfatal_support/init.c +++ b/testsuites/sptests/spfatal_support/init.c @@ -88,13 +88,18 @@ char *Errors_Core[] = { "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_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_MUTEX_OBTAIN_FROM_BAD_STATE ) + if ( error > INTERNAL_ERROR_NO_MEMORY_FOR_HEAP ) printk("Unknown Internal Core Error (%d)", error); else printk( Errors_Core[ error ] ); |