2009-07-31 Joel Sherrill <joel.sherrill@oarcorp.com>

* Makefile.am, configure.ac, sp62/init.c: Add new test to ensure a
	particular path is taken through the _Heap_Resize_block code.
	* sp63/.cvsignore, sp63/Makefile.am, sp63/init.c, sp63/sp63.doc,
	sp63/sp63.scn: New files.
This commit is contained in:
Joel Sherrill
2009-08-01 00:25:20 +00:00
parent a764317842
commit ba23ff5e36
9 changed files with 129 additions and 4 deletions

View File

@@ -1,3 +1,10 @@
2009-07-31 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac, sp62/init.c: Add new test to ensure a
particular path is taken through the _Heap_Resize_block code.
* sp63/.cvsignore, sp63/Makefile.am, sp63/init.c, sp63/sp63.doc,
sp63/sp63.scn: New files.
2009-07-30 Joel Sherrill <joel.sherrill@OARcorp.com>
* sp42/Makefile.am, sp42/init.c, sp42/sp42.scn: Test was testing the

View File

@@ -13,7 +13,7 @@ SUBDIRS = \
sp30 sp31 sp32 sp33 sp34 sp35 sp37 sp38 sp39 \
sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
sp60 sp61 sp62 \
sp60 sp61 sp62 sp63 \
spchain spobjgetnext spprintk spsize spstkalloc spthreadq01 \
spwatchdog spwkspace \
spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \

View File

@@ -89,6 +89,7 @@ sp59/Makefile
sp60/Makefile
sp61/Makefile
sp62/Makefile
sp63/Makefile
spchain/Makefile
spfatal01/Makefile
spfatal02/Makefile

View File

@@ -36,12 +36,10 @@ rtems_task Blocker(
);
directive_failed( sc, "rtems_region_get_segment" );
puts( "Blocker - Got memory after resize" );
case_hit = true;
(void) rtems_task_delete( RTEMS_SELF );
}
rtems_task Init(
@@ -70,7 +68,6 @@ rtems_task Init(
sc = rtems_task_start( task_id, Blocker, 0 );
directive_failed( sc, "rtems_task_start of Blocker" );
puts( "Init - rtems_task_create Region - OK" );
sc = rtems_region_create(
rtems_build_name( 'R', 'N', '1', ' ' ),

View File

@@ -0,0 +1,2 @@
Makefile
Makefile.in

View File

@@ -0,0 +1,28 @@
##
## $Id$
##
MANAGERS = all
rtems_tests_PROGRAMS = sp63
sp63_SOURCES = init.c
dist_rtems_tests_DATA = sp63.scn
dist_rtems_tests_DATA += sp63.doc
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
sp63_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
LINK_OBJS = $(sp63_OBJECTS) $(sp63_LDADD)
LINK_LIBS = $(sp63_LDLIBS)
sp63$(EXEEXT): $(sp63_OBJECTS) $(sp63_DEPENDENCIES)
@rm -f sp63$(EXEEXT)
$(make-exe)
include $(top_srcdir)/../automake/local.am

View File

@@ -0,0 +1,58 @@
/*
* COPYRIGHT (c) 1989-2009.
* 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.
*
* $Id$
*/
#include <tmacros.h>
uint32_t Memory[256];
rtems_task Init(
rtems_task_argument ignored
)
{
Heap_Control Heap;
uint32_t heap_size;
void *ptr1;
intptr_t old;
intptr_t avail;
Heap_Resize_status hc;
puts( "\n\n*** TEST 63 ***" );
puts( "Init - _Heap_Initialize - OK" );
heap_size = _Heap_Initialize( &Heap, Memory, sizeof(Memory), 8 );
printf( "Init - Heap size=%d\n", heap_size );
puts( "Init - _Heap_Allocate_aligned - OK");
ptr1 = _Heap_Allocate_aligned( &Heap, 64, 32 );
assert( ptr1 );
puts( "Init - _Heap_Resize_block - OK");
hc = _Heap_Resize_block( &Heap, ptr1, 4, &old, &avail );
assert( !hc );
puts( "*** END OF TEST 63 ***" );
rtems_test_exit(0);
}
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_MAXIMUM_REGIONS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* global variables */

View File

@@ -0,0 +1,26 @@
#
# $Id$
#
# COPYRIGHT (c) 1989-2009.
# 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: sp63
directives:
_Heap_Initialize
_Heap_Allocate_aligned
_Heap_Resize_block
concepts:
+ Exercise the case where we shrink a block that creates a block that
is less than the minimum. This is mainly to ensure that a branch is taken.

View File

@@ -0,0 +1,6 @@
*** TEST 63 ***
Init - _Heap_Initialize - OK
Init - Heap size=1012
Init - _Heap_Allocate_aligned - OK
Init - _Heap_Resize_block - OK
*** END OF TEST 63 ***