From 56b7951e4563580d96b5d2249e2d3e3d62d48120 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 7 May 2009 17:48:15 +0000 Subject: 2009-05-07 Joel Sherrill * Makefile.am, configure.ac: Add shell of heap walk test for Santosh. * heapwalk/.cvsignore, heapwalk/Makefile.am, heapwalk/heapwalk.scn, heapwalk/init.c, heapwalk/system.h: New files. --- testsuites/libtests/ChangeLog | 6 ++++ testsuites/libtests/Makefile.am | 4 +-- testsuites/libtests/configure.ac | 1 + testsuites/libtests/heapwalk/.cvsignore | 2 ++ testsuites/libtests/heapwalk/Makefile.am | 27 ++++++++++++++++ testsuites/libtests/heapwalk/heapwalk.scn | 3 ++ testsuites/libtests/heapwalk/init.c | 50 ++++++++++++++++++++++++++++++ testsuites/libtests/heapwalk/system.h | 51 +++++++++++++++++++++++++++++++ 8 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 testsuites/libtests/heapwalk/.cvsignore create mode 100644 testsuites/libtests/heapwalk/Makefile.am create mode 100644 testsuites/libtests/heapwalk/heapwalk.scn create mode 100644 testsuites/libtests/heapwalk/init.c create mode 100644 testsuites/libtests/heapwalk/system.h (limited to 'testsuites/libtests') diff --git a/testsuites/libtests/ChangeLog b/testsuites/libtests/ChangeLog index 63e31bc024..d80c48f10a 100644 --- a/testsuites/libtests/ChangeLog +++ b/testsuites/libtests/ChangeLog @@ -1,3 +1,9 @@ +2009-05-07 Joel Sherrill + + * Makefile.am, configure.ac: Add shell of heap walk test for Santosh. + * heapwalk/.cvsignore, heapwalk/Makefile.am, heapwalk/heapwalk.scn, + heapwalk/init.c, heapwalk/system.h: New files. + 2009-05-07 Santosh G Vattam * malloctest/init.c: Add test case for heap resize block when the diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am index e74bdafd59..38132baaab 100644 --- a/testsuites/libtests/Makefile.am +++ b/testsuites/libtests/Makefile.am @@ -4,8 +4,8 @@ ACLOCAL_AMFLAGS = -I ../aclocal -SUBDIRS = cpuuse malloctest putenvtest monitor monitor02 rtmonuse stackchk termios \ - rtems++ tztest +SUBDIRS = cpuuse malloctest heapwalk putenvtest monitor monitor02 rtmonuse \ + stackchk termios rtems++ tztest include $(top_srcdir)/../automake/subdirs.am include $(top_srcdir)/../automake/local.am diff --git a/testsuites/libtests/configure.ac b/testsuites/libtests/configure.ac index 145ffb4e65..48f6234a74 100644 --- a/testsuites/libtests/configure.ac +++ b/testsuites/libtests/configure.ac @@ -34,6 +34,7 @@ AM_CONDITIONAL(HAS_CXX,test "$rtems_cv_HAS_CPLUSPLUS" = "yes") # Explicitly list all Makefiles here AC_CONFIG_FILES([Makefile cpuuse/Makefile +heapwalk/Makefile malloctest/Makefile monitor/Makefile monitor02/Makefile diff --git a/testsuites/libtests/heapwalk/.cvsignore b/testsuites/libtests/heapwalk/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/libtests/heapwalk/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/libtests/heapwalk/Makefile.am b/testsuites/libtests/heapwalk/Makefile.am new file mode 100644 index 0000000000..46b972da00 --- /dev/null +++ b/testsuites/libtests/heapwalk/Makefile.am @@ -0,0 +1,27 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = heapwalk +heapwalk_SOURCES = init.c system.h + +dist_rtems_tests_DATA = heapwalk.scn + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +heapwalk_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(heapwalk_OBJECTS) $(heapwalk_LDADD) +LINK_LIBS = $(heapwalk_LDLIBS) + +heapwalk$(EXEEXT): $(heapwalk_OBJECTS) $(heapwalk_DEPENDENCIES) + @rm -f heapwalk$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/libtests/heapwalk/heapwalk.scn b/testsuites/libtests/heapwalk/heapwalk.scn new file mode 100644 index 0000000000..8a1f9cd806 --- /dev/null +++ b/testsuites/libtests/heapwalk/heapwalk.scn @@ -0,0 +1,3 @@ +*** HEAP WALK TEST *** +Walk freshly initialized heap +*** END OF HEAP WALK TEST *** diff --git a/testsuites/libtests/heapwalk/init.c b/testsuites/libtests/heapwalk/init.c new file mode 100644 index 0000000000..1aeadb4be4 --- /dev/null +++ b/testsuites/libtests/heapwalk/init.c @@ -0,0 +1,50 @@ +/* + * Test of Heap Walker + * + * COPYRIGHT (c) 1989-2008. + * 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$ + */ + +#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ +#define CONFIGURE_INIT +#include "system.h" + +#include +#include +#include +#include + +#define TEST_HEAP_SIZE 1024 +uint8_t TestHeapMemory[TEST_HEAP_SIZE]; +Heap_Control TestHeap; + +void test_heap_init(void) +{ + _Heap_Initialize( &TestHeap, TestHeapMemory, TEST_HEAP_SIZE, 0 ); +} + +void test_walk_freshly_initialized(void) +{ + puts( "Walk freshly initialized heap" ); + test_heap_init(); + + _Heap_Walk( &TestHeap, 0x01, true ); +} + +rtems_task Init( + rtems_task_argument argument +) +{ + puts( "\n\n*** HEAP WALK TEST ***" ); + + test_walk_freshly_initialized(); + + puts( "*** END OF HEAP WALK TEST ***" ); + rtems_test_exit(0); +} diff --git a/testsuites/libtests/heapwalk/system.h b/testsuites/libtests/heapwalk/system.h new file mode 100644 index 0000000000..eacd2d330f --- /dev/null +++ b/testsuites/libtests/heapwalk/system.h @@ -0,0 +1,51 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989-1999. + * 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 + +/* macros */ + +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + +rtems_task Task_1_through_5( + rtems_task_argument argument +); + +void blow_stack( void ); + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE*3) + +#define CONFIGURE_EXTRA_TASK_STACKS ((TASK_STACK_SIZE)*5) +#define CONFIGURE_MAXIMUM_TASKS 6 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#include + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ + +/* end of include file */ -- cgit v1.2.3