From 16d1bd349b0f0381525add66b1534b86db697d12 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 14 Jul 2010 16:02:40 +0000 Subject: 2010-07-14 Joel Sherrill * Makefile.am, configure.ac: Add tests for sbrk fatal error case and libio initialization fatal error case. * spfatal21/.cvsignore, spfatal21/Makefile.am, spfatal21/spfatal21.doc, spfatal21/spfatal21.scn, spfatal21/testcase.h, spfatal22/.cvsignore, spfatal22/Makefile.am, spfatal22/spfatal22.doc, spfatal22/spfatal22.scn, spfatal22/testcase.h: New files. --- testsuites/sptests/ChangeLog | 9 ++++++++ testsuites/sptests/Makefile.am | 5 +++-- testsuites/sptests/configure.ac | 2 ++ testsuites/sptests/spfatal21/.cvsignore | 2 ++ testsuites/sptests/spfatal21/Makefile.am | 25 +++++++++++++++++++++ testsuites/sptests/spfatal21/spfatal21.doc | 22 +++++++++++++++++++ testsuites/sptests/spfatal21/spfatal21.scn | 3 +++ testsuites/sptests/spfatal21/testcase.h | 35 ++++++++++++++++++++++++++++++ testsuites/sptests/spfatal22/.cvsignore | 2 ++ testsuites/sptests/spfatal22/Makefile.am | 25 +++++++++++++++++++++ testsuites/sptests/spfatal22/spfatal22.doc | 22 +++++++++++++++++++ testsuites/sptests/spfatal22/spfatal22.scn | 4 ++++ testsuites/sptests/spfatal22/testcase.h | 26 ++++++++++++++++++++++ 13 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 testsuites/sptests/spfatal21/.cvsignore create mode 100644 testsuites/sptests/spfatal21/Makefile.am create mode 100644 testsuites/sptests/spfatal21/spfatal21.doc create mode 100644 testsuites/sptests/spfatal21/spfatal21.scn create mode 100644 testsuites/sptests/spfatal21/testcase.h create mode 100644 testsuites/sptests/spfatal22/.cvsignore create mode 100644 testsuites/sptests/spfatal22/Makefile.am create mode 100644 testsuites/sptests/spfatal22/spfatal22.doc create mode 100644 testsuites/sptests/spfatal22/spfatal22.scn create mode 100644 testsuites/sptests/spfatal22/testcase.h (limited to 'testsuites/sptests') diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog index de8962e644..58a9e4482e 100644 --- a/testsuites/sptests/ChangeLog +++ b/testsuites/sptests/ChangeLog @@ -1,3 +1,12 @@ +2010-07-14 Joel Sherrill + + * Makefile.am, configure.ac: Add tests for sbrk fatal error case and + libio initialization fatal error case. + * spfatal21/.cvsignore, spfatal21/Makefile.am, spfatal21/spfatal21.doc, + spfatal21/spfatal21.scn, spfatal21/testcase.h, spfatal22/.cvsignore, + spfatal22/Makefile.am, spfatal22/spfatal22.doc, + spfatal22/spfatal22.scn, spfatal22/testcase.h: New files. + 2010-07-14 Sebastian Huber * spintrcritical06/init.c: Switch semaphore obtain timeouts of diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 80dc4956bb..b7f0d9b5bb 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -21,14 +21,15 @@ SUBDIRS = \ sperror01 sperror02 sperror03 \ spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \ spfatal08 spfatal09 spfatal10 spfatal11 spfatal12 spfatal13 spfatal14 \ - spfatal15 spfatal16 spfatal17 spfatal18 spfatal19 spfatal20 \ + spfatal15 spfatal16 spfatal17 spfatal18 spfatal19 spfatal20 spfatal21 \ + spfatal22 \ spfifo01 spfifo02 spfifo03 spfifo04 spfifo05 \ spintrcritical01 spintrcritical02 spintrcritical03 spintrcritical04 \ spintrcritical05 spintrcritical06 spintrcritical07 spintrcritical08 \ spintrcritical09 spintrcritical10 spintrcritical11 spintrcritical12 \ spintrcritical13 spintrcritical14 spintrcritical15 spintrcritical16 \ spintrcritical17 spmkdir - + DIST_SUBDIRS = $(SUBDIRS) spfatal_support spintrcritical_support EXTRA_DIST = spfatal_support/init.c spfatal_support/system.h diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index d4e25a0d3c..c8430891f9 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -124,6 +124,8 @@ spfatal17/Makefile spfatal18/Makefile spfatal19/Makefile spfatal20/Makefile +spfatal21/Makefile +spfatal22/Makefile spfifo01/Makefile spfifo02/Makefile spfifo03/Makefile diff --git a/testsuites/sptests/spfatal21/.cvsignore b/testsuites/sptests/spfatal21/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/spfatal21/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/spfatal21/Makefile.am b/testsuites/sptests/spfatal21/Makefile.am new file mode 100644 index 0000000000..465557de09 --- /dev/null +++ b/testsuites/sptests/spfatal21/Makefile.am @@ -0,0 +1,25 @@ +## +## $Id$ +## + +rtems_tests_PROGRAMS = spfatal21 +spfatal21_SOURCES = ../spfatal_support/init.c \ + ../spfatal_support/system.h ../../support/src/test_support.c testcase.h + +dist_rtems_tests_DATA = spfatal21.scn +dist_rtems_tests_DATA += spfatal21.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(spfatal21_OBJECTS) $(spfatal22_LDADD) +LINK_LIBS = $(spfatal21_LDLIBS) + +spfatal21$(EXEEXT): $(spfatal22_OBJECTS) $(spfatal22_DEPENDENCIES) + @rm -f spfatal21$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spfatal21/spfatal21.doc b/testsuites/sptests/spfatal21/spfatal21.doc new file mode 100644 index 0000000000..f912e2dee9 --- /dev/null +++ b/testsuites/sptests/spfatal21/spfatal21.doc @@ -0,0 +1,22 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989-2010. +# 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: spfatal21 + +directives: + + malloc_sbrk_initialize + +concepts: + ++ exercise fatal error when sbrk fails to extend memory on the initial call. diff --git a/testsuites/sptests/spfatal21/spfatal21.scn b/testsuites/sptests/spfatal21/spfatal21.scn new file mode 100644 index 0000000000..c548a1af40 --- /dev/null +++ b/testsuites/sptests/spfatal21/spfatal21.scn @@ -0,0 +1,3 @@ +*** TEST FATAL FATAL 21 *** +Fatal error (sbrk during init fails) hit +*** END OF TEST *** diff --git a/testsuites/sptests/spfatal21/testcase.h b/testsuites/sptests/spfatal21/testcase.h new file mode 100644 index 0000000000..ab2a26e7bc --- /dev/null +++ b/testsuites/sptests/spfatal21/testcase.h @@ -0,0 +1,35 @@ +/* + * COPYRIGHT (c) 1989-2010. + * 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 FATAL_ERROR_TEST_NAME "FATAL 21" +#define FATAL_ERROR_DESCRIPTION "sbrk during init fails" +#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_RTEMS_API +#define FATAL_ERROR_EXPECTED_IS_INTERNAL FALSE +#define FATAL_ERROR_EXPECTED_ERROR RTEMS_NO_MEMORY + +#include +#include + +/* Safe information on real heap */ +extern rtems_malloc_sbrk_functions_t *rtems_malloc_sbrk_helpers; +extern rtems_malloc_sbrk_functions_t rtems_malloc_sbrk_helpers_table; + +void * sbrk(ptrdiff_t incr) +{ + return (void *) -1; +} + +void force_error() +{ + rtems_malloc_sbrk_helpers = &rtems_malloc_sbrk_helpers_table; + + RTEMS_Malloc_Initialize( NULL, 0, 64 ); +} diff --git a/testsuites/sptests/spfatal22/.cvsignore b/testsuites/sptests/spfatal22/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/spfatal22/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/spfatal22/Makefile.am b/testsuites/sptests/spfatal22/Makefile.am new file mode 100644 index 0000000000..681c0d60ca --- /dev/null +++ b/testsuites/sptests/spfatal22/Makefile.am @@ -0,0 +1,25 @@ +## +## $Id$ +## + +rtems_tests_PROGRAMS = spfatal22 +spfatal22_SOURCES = ../spfatal_support/init.c \ + ../spfatal_support/system.h ../../support/src/test_support.c testcase.h + +dist_rtems_tests_DATA = spfatal22.scn +dist_rtems_tests_DATA += spfatal22.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(spfatal22_OBJECTS) $(spfatal22_LDADD) +LINK_LIBS = $(spfatal22_LDLIBS) + +spfatal22$(EXEEXT): $(spfatal22_OBJECTS) $(spfatal22_DEPENDENCIES) + @rm -f spfatal22$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spfatal22/spfatal22.doc b/testsuites/sptests/spfatal22/spfatal22.doc new file mode 100644 index 0000000000..493585763e --- /dev/null +++ b/testsuites/sptests/spfatal22/spfatal22.doc @@ -0,0 +1,22 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989-2010. +# 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: spfatal22 + +directives: + + rtems_libio_init + +concepts: + ++ Exercise path when unable to allocate memory. diff --git a/testsuites/sptests/spfatal22/spfatal22.scn b/testsuites/sptests/spfatal22/spfatal22.scn new file mode 100644 index 0000000000..23fe118c0c --- /dev/null +++ b/testsuites/sptests/spfatal22/spfatal22.scn @@ -0,0 +1,4 @@ +*** TEST FATAL FATAL 22 *** +Allocate_majority_of_heap: +Fatal error (libio init out of memory) hit +*** END OF TEST *** diff --git a/testsuites/sptests/spfatal22/testcase.h b/testsuites/sptests/spfatal22/testcase.h new file mode 100644 index 0000000000..d44e6475b7 --- /dev/null +++ b/testsuites/sptests/spfatal22/testcase.h @@ -0,0 +1,26 @@ +/* + * COPYRIGHT (c) 1989-2010. + * 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 FATAL_ERROR_TEST_NAME "FATAL 22" +#define FATAL_ERROR_DESCRIPTION "libio init out of memory" +#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_RTEMS_API +#define FATAL_ERROR_EXPECTED_IS_INTERNAL FALSE +#define FATAL_ERROR_EXPECTED_ERROR RTEMS_NO_MEMORY + +#include +#include "test_support.h" + +void force_error() +{ + Allocate_majority_of_heap( 1 ); + + rtems_libio_init(); +} -- cgit v1.2.3