diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-05-13 17:09:14 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-05-13 17:09:14 +0000 |
commit | 4f7b4a88365ac991054affcc86aba178d3c86b16 (patch) | |
tree | 53af735f8615013c0932e4dbac388cc7a881a5a3 /testsuites/sptests/spwkspace | |
parent | 2009-05-13 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-4f7b4a88365ac991054affcc86aba178d3c86b16.tar.bz2 |
2009-05-13 Joel Sherrill <joel.sherrill@OARcorp.com>
* 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.
Diffstat (limited to 'testsuites/sptests/spwkspace')
-rw-r--r-- | testsuites/sptests/spwkspace/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/sptests/spwkspace/Makefile.am | 27 | ||||
-rw-r--r-- | testsuites/sptests/spwkspace/init.c | 63 | ||||
-rw-r--r-- | testsuites/sptests/spwkspace/spwkspace.scn | 10 | ||||
-rw-r--r-- | testsuites/sptests/spwkspace/system.h | 31 |
5 files changed, 133 insertions, 0 deletions
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 <tmacros.h> + +/* 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 <rtems/confdefs.h> + +/* end of include file */ |