summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-10-14 13:16:03 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-10-14 13:16:03 +0000
commitd7e739a96b39007252f66f0892c1bbb276aa3700 (patch)
treec23e4f1cbc5c59efd29b631ab854ae2567c4a9a3 /testsuites/libtests
parent2008-10-14 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-d7e739a96b39007252f66f0892c1bbb276aa3700.tar.bz2
2008-10-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* malloctest/init.c: Do not generate alignment factors larger that will not fit in a native integer.
Diffstat (limited to 'testsuites/libtests')
-rw-r--r--testsuites/libtests/ChangeLog5
-rw-r--r--testsuites/libtests/malloctest/init.c19
2 files changed, 22 insertions, 2 deletions
diff --git a/testsuites/libtests/ChangeLog b/testsuites/libtests/ChangeLog
index 38d33262d9..2e99ffbcba 100644
--- a/testsuites/libtests/ChangeLog
+++ b/testsuites/libtests/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-14 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * malloctest/init.c: Do not generate alignment factors larger that will
+ not fit in a native integer.
+
2008-09-17 Joel Sherrill <joel.sherrill@oarcorp.com>
* stackchk/system.h: Rename STACK_CHECKER_ON to more appropriate
diff --git a/testsuites/libtests/malloctest/init.c b/testsuites/libtests/malloctest/init.c
index b1028640b4..db973e2377 100644
--- a/testsuites/libtests/malloctest/init.c
+++ b/testsuites/libtests/malloctest/init.c
@@ -26,6 +26,7 @@
#include "system.h"
#include <stdlib.h>
+#include <inttypes.h>
#include <errno.h>
#include <rtems/score/protectedheap.h>
@@ -227,6 +228,7 @@ void test_posix_memalign(void)
void *p1, *p2;
int i;
int sc;
+ int maximumShift;
puts( "posix_memalign - NULL return pointer -- EINVAL" );
sc = posix_memalign( NULL, 32, 8 );
@@ -240,8 +242,17 @@ void test_posix_memalign(void)
sc = posix_memalign( &p1, 2, 8 );
fatal_posix_service_status( sc, EINVAL, "posix_memalign alignment of 2" );
- for ( i=2 ; i<32 ; i++ ) {
- printf( "posix_memalign - alignment of %d -- OK\n", 1 << i );
+ if ( sizeof(int) == 4 )
+ maximumShift = 31;
+ else if ( sizeof(int) == 2 )
+ maximumShift = 15;
+ else {
+ printf( "Unsupported int size == %d\n", sizeof(int) );
+ rtems_test_exit(0);
+ }
+ for ( i=2 ; i<maximumShift ; i++ ) {
+ printf( "posix_memalign - alignment of %" PRId32 " -- OK\n",
+ (int32_t) 1 << i );
sc = posix_memalign( &p1, 1 << i, 8 );
if ( sc == ENOMEM ) {
printf( "posix_memalign - ran out of memory trying %d\n", 1<<i );
@@ -251,6 +262,10 @@ void test_posix_memalign(void)
free( p1 );
}
+ for ( ; i<maximumShift ; i++ ) {
+ printf( "posix_memalign - alignment of %" PRId32 " -- SKIPPED\n",
+ (int32_t) 1 << i );
+ }
}