From 4f7b4a88365ac991054affcc86aba178d3c86b16 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 13 May 2009 17:09:14 +0000 Subject: 2009-05-13 Joel Sherrill * Makefile.am, configure.ac: New test to exercise rtems_workspace_XXX methods. * spwkspace/.cvsignore, spwkspace/Makefile.am, spwkspace/init.c, spwkspace/spwkspace.scn, spwkspace/system.h: New files. --- testsuites/sptests/ChangeLog | 7 ++++ testsuites/sptests/Makefile.am | 5 ++- testsuites/sptests/configure.ac | 1 + testsuites/sptests/spwkspace/.cvsignore | 2 + testsuites/sptests/spwkspace/Makefile.am | 27 +++++++++++++ testsuites/sptests/spwkspace/init.c | 63 ++++++++++++++++++++++++++++++ testsuites/sptests/spwkspace/spwkspace.scn | 10 +++++ testsuites/sptests/spwkspace/system.h | 31 +++++++++++++++ 8 files changed, 144 insertions(+), 2 deletions(-) create mode 100644 testsuites/sptests/spwkspace/.cvsignore create mode 100644 testsuites/sptests/spwkspace/Makefile.am create mode 100644 testsuites/sptests/spwkspace/init.c create mode 100644 testsuites/sptests/spwkspace/spwkspace.scn create mode 100644 testsuites/sptests/spwkspace/system.h (limited to 'testsuites') diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog index b06e2cc3a5..682fd29aa7 100644 --- a/testsuites/sptests/ChangeLog +++ b/testsuites/sptests/ChangeLog @@ -1,3 +1,10 @@ +2009-05-13 Joel Sherrill + + * Makefile.am, configure.ac: New test to exercise rtems_workspace_XXX + methods. + * spwkspace/.cvsignore, spwkspace/Makefile.am, spwkspace/init.c, + spwkspace/spwkspace.scn, spwkspace/system.h: New files. + 2009-05-10 Joel Sherrill * sp04/system.h, sp04/task1.c, sp04/tswitch.c, sp07/init.c, diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index cc32a3ec65..c01b6d21d7 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -9,8 +9,9 @@ SUBDIRS = sp01 sp02 sp03 sp04 sp05 sp06 sp07 sp08 sp09 sp11 sp12 sp13 sp14 \ sp15 sp16 sp17 sp19 sp20 sp21 sp22 sp23 sp24 sp25 sp26 sp27 sp28 sp29 \ sp30 sp31 sp32 sp33 sp34 sp35 sp37 sp38 sp39 sp40 sp41 sp42 sp43 sp44 \ sp45 sp46 sp47 sp48 spsize spwatchdog spfatal01 spfatal02 spfatal03 \ - spfatal04 spfatal05 spfatal06 spfatal07 spfatal08 spfatal09 spobjgetnext - + spfatal04 spfatal05 spfatal06 spfatal07 spfatal08 spfatal09 spobjgetnext \ + spwkspace + DIST_SUBDIRS = $(SUBDIRS) spfatal spfatal_support EXTRA_DIST = spfatal_support/init.c spfatal_support/system.h diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index b13885d10d..9e24f8b2bc 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -86,5 +86,6 @@ spfatal07/Makefile spfatal08/Makefile spfatal09/Makefile spobjgetnext/Makefile +spwkspace/Makefile ]) AC_OUTPUT diff --git a/testsuites/sptests/spwkspace/.cvsignore b/testsuites/sptests/spwkspace/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/spwkspace/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/spwkspace/Makefile.am b/testsuites/sptests/spwkspace/Makefile.am new file mode 100644 index 0000000000..50ab079cd6 --- /dev/null +++ b/testsuites/sptests/spwkspace/Makefile.am @@ -0,0 +1,27 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = spwkspace +spwkspace_SOURCES = init.c system.h + +dist_rtems_tests_DATA = spwkspace.scn + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +spwkspace_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(spwkspace_OBJECTS) $(spwkspace_LDADD) +LINK_LIBS = $(spwkspace_LDLIBS) + +spwkspace$(EXEEXT): $(spwkspace_OBJECTS) $(spwkspace_DEPENDENCIES) + @rm -f spwkspace$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spwkspace/init.c b/testsuites/sptests/spwkspace/init.c new file mode 100644 index 0000000000..0c4028b727 --- /dev/null +++ b/testsuites/sptests/spwkspace/init.c @@ -0,0 +1,63 @@ +/* + * Exercise SuperCore Object Get Next + * + * 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$ + */ + +#define CONFIGURE_INIT +#include "system.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + void *p1; + bool retbool; + Heap_Information_block info; + + puts( "\n\n*** TEST WORKSPACE CLASSIC API ***" ); + + puts( "rtems_workspace_get_information - null pointer" ); + retbool = rtems_workspace_get_information( NULL ); + assert( retbool == false ); + + puts( "rtems_workspace_get_information - OK" ); + retbool = rtems_workspace_get_information( &info ); + assert( retbool == true ); + + puts( "rtems_workspace_allocate - null pointer" ); + retbool = rtems_workspace_allocate( 42, NULL ); + assert( retbool == false ); + + puts( "rtems_workspace_allocate - 0 bytes" ); + retbool = rtems_workspace_allocate( 0, &p1 ); + assert( retbool == false ); + + puts( "rtems_workspace_allocate - too many bytes" ); + retbool = rtems_workspace_allocate( info.Free.largest * 2, &p1 ); + assert( retbool == false ); + + puts( "rtems_workspace_allocate - 42 bytes" ); + retbool = rtems_workspace_allocate( 42, &p1 ); + assert( retbool == true ); + assert( p1 != NULL ); + + puts( "rtems_workspace_free - NULL" ); + retbool = rtems_workspace_free( NULL ); + assert( retbool == false ); + + puts( "rtems_workspace_free - previous pointer to 42 bytes" ); + retbool = rtems_workspace_free( p1 ); + assert( retbool == true ); + + + puts( "*** END OF TEST WORKSPACE CLASSIC API ***" ); + rtems_test_exit( 0 ); +} diff --git a/testsuites/sptests/spwkspace/spwkspace.scn b/testsuites/sptests/spwkspace/spwkspace.scn new file mode 100644 index 0000000000..0fe8088abf --- /dev/null +++ b/testsuites/sptests/spwkspace/spwkspace.scn @@ -0,0 +1,10 @@ +*** TEST WORKSPACE CLASSIC API *** +rtems_workspace_get_information - null pointer +rtems_workspace_get_information - OK +rtems_workspace_allocate - null pointer +rtems_workspace_allocate - 0 bytes +rtems_workspace_allocate - too many bytes +rtems_workspace_allocate - 42 bytes +rtems_workspace_free - NULL +rtems_workspace_free - previous pointer to 42 bytes +*** END OF TEST WORKSPACE CLASSIC API *** diff --git a/testsuites/sptests/spwkspace/system.h b/testsuites/sptests/spwkspace/system.h new file mode 100644 index 0000000000..e595c3d9dd --- /dev/null +++ b/testsuites/sptests/spwkspace/system.h @@ -0,0 +1,31 @@ +/* + * 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 + +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#include + +/* end of include file */ -- cgit v1.2.3