summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp63
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-05 20:58:17 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-05 20:58:17 +0000
commitabc4af35f87e8e0122d3b26fef9ed830694c4156 (patch)
tree0283d44c1c228c963f423e9c817ca5a009acb4a7 /testsuites/sptests/sp63
parent2009-08-05 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-abc4af35f87e8e0122d3b26fef9ed830694c4156.tar.bz2
2009-08-05 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac, sp63/init.c: Add new test for exercising when we are unable to allocate the memory needed for an object extend. Make sure all is handled properly. * sp64/.cvsignore, sp64/Makefile.am, sp64/init.c, sp64/sp64.doc, sp64/sp64.scn: New files.
Diffstat (limited to 'testsuites/sptests/sp63')
-rw-r--r--testsuites/sptests/sp63/init.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/testsuites/sptests/sp63/init.c b/testsuites/sptests/sp63/init.c
index edb5eff805..4d4c63f73d 100644
--- a/testsuites/sptests/sp63/init.c
+++ b/testsuites/sptests/sp63/init.c
@@ -11,9 +11,14 @@
#include <tmacros.h>
-uint32_t Memory[256];
+#define MAX 256
+uint32_t Memory[MAX];
Heap_Control Heap;
+/*
+ * Exercise case in heapresize.c around line 125 when new_block_size
+ * < min_block_size
+ */
void test_case_one(void)
{
uint32_t heap_size;
@@ -35,6 +40,10 @@ void test_case_one(void)
assert( !hc );
}
+/*
+ * Exercise case in heapresize.c around line 140 when next_is_used AND
+ * free_block_size < min_block_size.
+ */
void test_case_two(void)
{
uint32_t heap_size;
@@ -56,6 +65,44 @@ void test_case_two(void)
assert( !hc );
}
+/*
+ * Exercise case in heapallocatealigned.c around line 223 when ...
+ */
+void test_case_three(void)
+{
+ uint32_t heap_size;
+ void *ptr1;
+ intptr_t old;
+ intptr_t avail;
+ Heap_Resize_status hc;
+ int pg, al, alloc, sz;
+
+ puts( "Init - _Heap_Allocate_aligned - request impossible - not OK");
+
+#if 0
+ heap_size =
+ _Heap_Initialize( &Heap, Memory[32], sizeof(Memory), 1 << 16 );
+ ptr1 = _Heap_Allocate_aligned( &Heap, 4, 1 << 16 );
+ ptr1 = _Heap_Allocate_aligned( &Heap, 256, 1 << 16 );
+#endif
+#if 1
+ for ( sz=32 ; sz <= 80 ; sz+=4 ) {
+ for ( pg=2 ; pg < 12 ; pg++ ) {
+
+ for ( al=16 ; al >=4 ; al-- ) {
+ for ( alloc=4 ; alloc < sizeof(Memory)/2 ; alloc+=4 ) {
+ heap_size =
+ _Heap_Initialize( &Heap, &Memory[sz], sizeof(Memory)/2, 1 << pg );
+ do {
+ ptr1 = _Heap_Allocate_aligned( &Heap, alloc, 1 <<al );
+ } while ( ptr1 );
+ }
+ }
+ }
+ }
+#endif
+}
+
rtems_task Init(
rtems_task_argument ignored
)
@@ -66,6 +113,8 @@ rtems_task Init(
test_case_two();
+ test_case_three();
+
puts( "*** END OF TEST 63 ***" );
rtems_test_exit(0);