diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-07-14 16:02:40 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-07-14 16:02:40 +0000 |
commit | 16d1bd349b0f0381525add66b1534b86db697d12 (patch) | |
tree | 150dfeb1fbd8aca4b88ef616b428b7ae1fb62231 /testsuites/sptests/spfatal21 | |
parent | 2010-07-14 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-16d1bd349b0f0381525add66b1534b86db697d12.tar.bz2 |
2010-07-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* 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.
Diffstat (limited to 'testsuites/sptests/spfatal21')
-rw-r--r-- | testsuites/sptests/spfatal21/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/sptests/spfatal21/Makefile.am | 25 | ||||
-rw-r--r-- | testsuites/sptests/spfatal21/spfatal21.doc | 22 | ||||
-rw-r--r-- | testsuites/sptests/spfatal21/spfatal21.scn | 3 | ||||
-rw-r--r-- | testsuites/sptests/spfatal21/testcase.h | 35 |
5 files changed, 87 insertions, 0 deletions
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 <rtems/libcsupport.h> +#include <rtems/malloc.h> + +/* 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 ); +} |