diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-07-17 10:19:16 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-07-17 10:19:16 +0200 |
commit | 317ee8d7ffd4bb6c785f7a7d8a84ccd7f873513f (patch) | |
tree | f51362b3092abb782995f9c9d59e0252a660d3ac /testsuites | |
parent | Fix broken _endtext symbol (diff) | |
download | rtems-317ee8d7ffd4bb6c785f7a7d8a84ccd7f873513f.tar.bz2 |
score: Change greedy allocation API
Diffstat (limited to 'testsuites')
-rw-r--r-- | testsuites/fstests/fsimfsgeneric01/init.c | 2 | ||||
-rw-r--r-- | testsuites/libtests/block11/init.c | 10 | ||||
-rw-r--r-- | testsuites/libtests/devfs02/init.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxchroot01/test.c | 8 | ||||
-rw-r--r-- | testsuites/psxtests/psximfs02/init.c | 25 | ||||
-rw-r--r-- | testsuites/psxtests/psxkey01/init.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxmsgq02/init.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxobj01/init.c | 2 | ||||
-rw-r--r-- | testsuites/sptests/spfatal22/testcase.h | 2 | ||||
-rw-r--r-- | testsuites/sptests/spprivenv01/init.c | 4 |
10 files changed, 34 insertions, 25 deletions
diff --git a/testsuites/fstests/fsimfsgeneric01/init.c b/testsuites/fstests/fsimfsgeneric01/init.c index d7abad3ee2..9fd4bad43a 100644 --- a/testsuites/fstests/fsimfsgeneric01/init.c +++ b/testsuites/fstests/fsimfsgeneric01/init.c @@ -367,7 +367,7 @@ static void test_imfs_make_generic_node_errors(void) rtems_test_assert(errno == ENOTSUP); mt_entry->type = type; - opaque = rtems_heap_greedy_allocate(0); + opaque = rtems_heap_greedy_allocate(NULL, 0); errno = 0; rv = IMFS_make_generic_node( path, diff --git a/testsuites/libtests/block11/init.c b/testsuites/libtests/block11/init.c index 095d8bdf2d..b850aba950 100644 --- a/testsuites/libtests/block11/init.c +++ b/testsuites/libtests/block11/init.c @@ -229,6 +229,8 @@ static void test_blkdev_imfs_parameters(void) static void test_blkdev_imfs_errors(void) { + static uintptr_t disk_size [] = { sizeof(rtems_disk_device) + sizeof(int) }; + rtems_status_code sc; int rv; ramdisk *rd; @@ -257,7 +259,7 @@ static void test_blkdev_imfs_errors(void) ); rtems_test_assert(sc == RTEMS_INVALID_NUMBER); - opaque = rtems_heap_greedy_allocate(0); + opaque = rtems_heap_greedy_allocate(NULL, 0); sc = rtems_blkdev_create( rda, BLOCK_SIZE, @@ -268,7 +270,7 @@ static void test_blkdev_imfs_errors(void) rtems_test_assert(sc == RTEMS_NO_MEMORY); rtems_heap_greedy_free(opaque); - opaque = rtems_heap_greedy_allocate(sizeof(rtems_disk_device) + sizeof(int)); + opaque = rtems_heap_greedy_allocate(disk_size, 1); sc = rtems_blkdev_create( rda, BLOCK_SIZE, @@ -342,7 +344,7 @@ static void test_blkdev_imfs_errors(void) ); rtems_test_assert(sc == RTEMS_INVALID_NUMBER); - opaque = rtems_heap_greedy_allocate(0); + opaque = rtems_heap_greedy_allocate(NULL, 0); sc = rtems_blkdev_create_partition( rda1, rda, @@ -352,7 +354,7 @@ static void test_blkdev_imfs_errors(void) rtems_test_assert(sc == RTEMS_NO_MEMORY); rtems_heap_greedy_free(opaque); - opaque = rtems_heap_greedy_allocate(sizeof(rtems_disk_device) + sizeof(int)); + opaque = rtems_heap_greedy_allocate(disk_size, 1); sc = rtems_blkdev_create_partition( rda1, rda, diff --git a/testsuites/libtests/devfs02/init.c b/testsuites/libtests/devfs02/init.c index 47a70a8a50..ad37aeb94d 100644 --- a/testsuites/libtests/devfs02/init.c +++ b/testsuites/libtests/devfs02/init.c @@ -62,7 +62,7 @@ rtems_task Init( puts( "Init - restore device table size" ); rootloc->mt_entry->immutable_fs_info = data; - opaque = rtems_heap_greedy_allocate( 0 ); + opaque = rtems_heap_greedy_allocate( NULL, 0 ); puts( "Init - attempt to create a node - expect ENOMEM" ); status = mknod( "/node", S_IFBLK, 0LL ); diff --git a/testsuites/psxtests/psxchroot01/test.c b/testsuites/psxtests/psxchroot01/test.c index 1e3f3ffc91..70298c4742 100644 --- a/testsuites/psxtests/psxchroot01/test.c +++ b/testsuites/psxtests/psxchroot01/test.c @@ -65,6 +65,10 @@ int main( ) #endif { + static const uintptr_t global_location_size = { + sizeof(rtems_filesystem_global_location_t) + }; + int status; void *opaque; /* @@ -108,9 +112,7 @@ int main( rtems_test_assert( errno == ENOTDIR ); puts( "allocate most of memory - attempt to fail chroot - expect ENOMEM" ); - opaque = rtems_heap_greedy_allocate( - sizeof(rtems_filesystem_global_location_t) - ); + opaque = rtems_heap_greedy_allocate( global_location_size, 1 ); status = chroot( "/one" ); rtems_test_assert( status == -1 ); diff --git a/testsuites/psxtests/psximfs02/init.c b/testsuites/psxtests/psximfs02/init.c index 10e97bba60..73724bd62a 100644 --- a/testsuites/psxtests/psximfs02/init.c +++ b/testsuites/psxtests/psximfs02/init.c @@ -35,15 +35,24 @@ rtems_task Init( rtems_task_argument argument ) { + static const char mount_point [] = "dir01"; + static const char fs_type [] = RTEMS_FILESYSTEM_TYPE_IMFS; + static const char slink_2_name [] = "node-slink-2"; + static const uintptr_t mount_table_entry_size [] = { + sizeof( rtems_filesystem_mount_table_entry_t ) + + sizeof( fs_type ) + + sizeof( rtems_filesystem_global_location_t ) + }; + static const uintptr_t slink_2_name_size [] = { + sizeof( slink_2_name ) + }; + int status = 0; void *opaque; char linkname_n[20] = {0}; char linkname_p[20] = {0}; int i; struct stat stat_buf; - static const char mount_point [] = "dir01"; - static const char fs_type [] = RTEMS_FILESYSTEM_TYPE_IMFS; - static const char slink_2_name [] = "node-slink-2"; puts( "\n\n*** TEST IMFS 02 ***" ); @@ -97,11 +106,7 @@ rtems_task Init( rtems_test_assert( errno == EACCES ); puts( "Allocate most of heap" ); - opaque = rtems_heap_greedy_allocate( - sizeof( rtems_filesystem_mount_table_entry_t ) - + sizeof( fs_type ) - + sizeof( rtems_filesystem_global_location_t ) - ); + opaque = rtems_heap_greedy_allocate( mount_table_entry_size, 1 ); printf( "Attempt to mount a fs at %s -- expect ENOMEM", mount_point ); status = mount( NULL, @@ -120,7 +125,7 @@ rtems_task Init( rtems_test_assert( status == 0 ); puts( "Allocate most of heap" ); - opaque = rtems_heap_greedy_allocate( 0 ); + opaque = rtems_heap_greedy_allocate( NULL, 0 ); puts( "Attempt to create /node-link-2 for /node -- expect ENOMEM" ); status = link( "/node", "/node-link-2" ); @@ -136,7 +141,7 @@ rtems_task Init( rtems_heap_greedy_free( opaque ); puts( "Allocate most of heap" ); - opaque = rtems_heap_greedy_allocate( sizeof( slink_2_name ) ); + opaque = rtems_heap_greedy_allocate( slink_2_name_size, 1 ); printf( "Attempt to create %s for /node -- expect ENOMEM", slink_2_name ); status = symlink( "/node", slink_2_name ); diff --git a/testsuites/psxtests/psxkey01/init.c b/testsuites/psxtests/psxkey01/init.c index dbd73d10f8..3383c8da3c 100644 --- a/testsuites/psxtests/psxkey01/init.c +++ b/testsuites/psxtests/psxkey01/init.c @@ -41,7 +41,7 @@ void *POSIX_Init( Init_id = pthread_self(); printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id ); - rtems_workspace_greedy_allocate( 0 ); + rtems_workspace_greedy_allocate( NULL, 0 ); puts("Init: pthread_key_create - ENOMEM (Workspace not available)"); empty_line(); diff --git a/testsuites/psxtests/psxmsgq02/init.c b/testsuites/psxtests/psxmsgq02/init.c index 4f5910a675..53c4769ba2 100644 --- a/testsuites/psxtests/psxmsgq02/init.c +++ b/testsuites/psxtests/psxmsgq02/init.c @@ -47,7 +47,7 @@ void *POSIX_Init( Init_id = pthread_self(); printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id ); - rtems_workspace_greedy_allocate( 0 ); + rtems_workspace_greedy_allocate( NULL, 0 ); attr.mq_maxmsg = MAXMSG; attr.mq_msgsize = MSGSIZE; diff --git a/testsuites/psxtests/psxobj01/init.c b/testsuites/psxtests/psxobj01/init.c index aee8bf7e52..3f639da80a 100644 --- a/testsuites/psxtests/psxobj01/init.c +++ b/testsuites/psxtests/psxobj01/init.c @@ -74,7 +74,7 @@ rtems_task Init( /* out of memory error ONLY when POSIX is enabled */ puts( "INIT - _Objects_Set_name fails - out of memory" ); - rtems_workspace_greedy_allocate( 0 ); + rtems_workspace_greedy_allocate( NULL, 0 ); bc = _Objects_Set_name( &TestClass, &_Thread_Executing->Object, name ); rtems_test_assert( bc == false ); diff --git a/testsuites/sptests/spfatal22/testcase.h b/testsuites/sptests/spfatal22/testcase.h index 188ff1d43f..268c48aed5 100644 --- a/testsuites/sptests/spfatal22/testcase.h +++ b/testsuites/sptests/spfatal22/testcase.h @@ -18,7 +18,7 @@ void force_error() { - rtems_heap_greedy_allocate( 0 ); + rtems_heap_greedy_allocate( NULL, 0 ); rtems_libio_init(); } diff --git a/testsuites/sptests/spprivenv01/init.c b/testsuites/sptests/spprivenv01/init.c index 609f85cae5..29b3b98561 100644 --- a/testsuites/sptests/spprivenv01/init.c +++ b/testsuites/sptests/spprivenv01/init.c @@ -47,7 +47,7 @@ rtems_task Init( puts( "\n\n*** TEST USER ENVIRONMENT ROUTINE - 01 ***" ); puts( "Init - allocating most of heap -- OK" ); - opaque = rtems_heap_greedy_allocate( 0 ); + opaque = rtems_heap_greedy_allocate( NULL, 0 ); puts( "Init - attempt to reset env - expect RTEMS_NO_MEMORY" ); sc = rtems_libio_set_private_env(); @@ -57,7 +57,7 @@ rtems_task Init( rtems_heap_greedy_free( opaque ); puts( "Init - allocating most of workspace memory" ); - opaque = rtems_workspace_greedy_allocate( 0 ); + opaque = rtems_workspace_greedy_allocate( NULL, 0 ); puts( "Init - attempt to reset env - expect RTEMS_TOO_MANY" ); sc = rtems_libio_set_private_env(); |