From ba23ff5e3685e201d4338f4e1c566a3b84865a69 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Sat, 1 Aug 2009 00:25:20 +0000 Subject: 2009-07-31 Joel Sherrill * 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. --- testsuites/sptests/ChangeLog | 7 +++++ testsuites/sptests/Makefile.am | 2 +- testsuites/sptests/configure.ac | 1 + testsuites/sptests/sp62/init.c | 3 -- testsuites/sptests/sp63/.cvsignore | 2 ++ testsuites/sptests/sp63/Makefile.am | 28 ++++++++++++++++++ testsuites/sptests/sp63/init.c | 58 +++++++++++++++++++++++++++++++++++++ testsuites/sptests/sp63/sp63.doc | 26 +++++++++++++++++ testsuites/sptests/sp63/sp63.scn | 6 ++++ 9 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 testsuites/sptests/sp63/.cvsignore create mode 100644 testsuites/sptests/sp63/Makefile.am create mode 100644 testsuites/sptests/sp63/init.c create mode 100644 testsuites/sptests/sp63/sp63.doc create mode 100644 testsuites/sptests/sp63/sp63.scn diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog index 5cc80ffe10..b4cc7e95cb 100644 --- a/testsuites/sptests/ChangeLog +++ b/testsuites/sptests/ChangeLog @@ -1,3 +1,10 @@ +2009-07-31 Joel Sherrill + + * 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 * sp42/Makefile.am, sp42/init.c, sp42/sp42.scn: Test was testing the diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 142e32174e..40c65a62a5 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -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 \ diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index 779892706d..169f0a776f 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -89,6 +89,7 @@ sp59/Makefile sp60/Makefile sp61/Makefile sp62/Makefile +sp63/Makefile spchain/Makefile spfatal01/Makefile spfatal02/Makefile diff --git a/testsuites/sptests/sp62/init.c b/testsuites/sptests/sp62/init.c index 2757ff33f0..0a8f595685 100644 --- a/testsuites/sptests/sp62/init.c +++ b/testsuites/sptests/sp62/init.c @@ -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', ' ' ), diff --git a/testsuites/sptests/sp63/.cvsignore b/testsuites/sptests/sp63/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/sp63/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/sp63/Makefile.am b/testsuites/sptests/sp63/Makefile.am new file mode 100644 index 0000000000..d53442c0cb --- /dev/null +++ b/testsuites/sptests/sp63/Makefile.am @@ -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 diff --git a/testsuites/sptests/sp63/init.c b/testsuites/sptests/sp63/init.c new file mode 100644 index 0000000000..ac120cd6c9 --- /dev/null +++ b/testsuites/sptests/sp63/init.c @@ -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 + +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 + +/* global variables */ diff --git a/testsuites/sptests/sp63/sp63.doc b/testsuites/sptests/sp63/sp63.doc new file mode 100644 index 0000000000..6d6a155938 --- /dev/null +++ b/testsuites/sptests/sp63/sp63.doc @@ -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. + diff --git a/testsuites/sptests/sp63/sp63.scn b/testsuites/sptests/sp63/sp63.scn new file mode 100644 index 0000000000..766fbe9c9b --- /dev/null +++ b/testsuites/sptests/sp63/sp63.scn @@ -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 *** -- cgit v1.2.3