diff options
Diffstat (limited to 'testsuites/sptests/sp25')
-rw-r--r-- | testsuites/sptests/sp25/init.c | 66 | ||||
-rw-r--r-- | testsuites/sptests/sp25/sp25.doc | 32 | ||||
-rw-r--r-- | testsuites/sptests/sp25/sp25.scn | 29 | ||||
-rw-r--r-- | testsuites/sptests/sp25/system.h | 57 | ||||
-rw-r--r-- | testsuites/sptests/sp25/task1.c | 241 |
5 files changed, 425 insertions, 0 deletions
diff --git a/testsuites/sptests/sp25/init.c b/testsuites/sptests/sp25/init.c new file mode 100644 index 0000000000..afb5e6f50e --- /dev/null +++ b/testsuites/sptests/sp25/init.c @@ -0,0 +1,66 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may in + * the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define TEST_INIT +#include "system.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 25 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + BASE_PRIORITY, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + Region_name[ 1 ] = rtems_build_name('R', 'N', '0', '1'); + + + status = rtems_region_create( + Region_name[ 1 ], + Area_1, + sizeof( Area_1 ), + 64, + RTEMS_DEFAULT_ATTRIBUTES, + &Region_id[ 1 ] + ); + directive_failed( status, "rtems_region_create of RN1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp25/sp25.doc b/testsuites/sptests/sp25/sp25.doc new file mode 100644 index 0000000000..f9e6d621e1 --- /dev/null +++ b/testsuites/sptests/sp25/sp25.doc @@ -0,0 +1,32 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989-1997. +# On-Line Applications Research Corporation (OAR). +# Copyright assigned to U.S. Government, 1994. +# +# The license and distribution terms for this file may in +# the file LICENSE in this distribution or at +# http://www.OARcorp.com/rtems/license.html. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test25 + +directives: + task_create + task_start + task_delete + region_create + region_ident + region_get_segment + region_return_segment + region_delete + +concepts: + + a. Verifies that the heap maintains it's integrity trhough a series + on region_get_segments and region_return_segments. + diff --git a/testsuites/sptests/sp25/sp25.scn b/testsuites/sptests/sp25/sp25.scn new file mode 100644 index 0000000000..af2599663d --- /dev/null +++ b/testsuites/sptests/sp25/sp25.scn @@ -0,0 +1,29 @@ +*** TEST 25 *** +TA1 - rtems_region_ident - 0x20010002 +TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f9b8 +TA1 - rtems_region_get_segment - wait on 128 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f930 +TA1 - rtems_region_get_segment - wait on 256 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f828 +TA1 - rtems_region_get_segment - wait on 512 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f620 +TA1 - rtems_region_get_segment - wait on 1024 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f218 +TA1 - rtems_region_get_segment - wait on 2048 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000ea10 +TA1 - rtems_region_get_segment - wait on 4096 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000da08 +TA1 - rtems_region_get_segment - wait on 8192 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000ba00 +<pause> +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f828 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f620 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f9b8 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f930 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000da08 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000ea10 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000ba00 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f218 +TA1 - rtems_region_delete - walks heap if debug enabled +*** END OF TEST 25 *** diff --git a/testsuites/sptests/sp25/system.h b/testsuites/sptests/sp25/system.h new file mode 100644 index 0000000000..b1eed6cf0f --- /dev/null +++ b/testsuites/sptests/sp25/system.h @@ -0,0 +1,57 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may in + * the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include <tmacros.h> + +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + +rtems_task Task_1( + rtems_task_argument argument +); + +/* configuration information */ + +#define CONFIGURE_SPTEST + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_REGIONS 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#include <confdefs.h> + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ +TEST_EXTERN rtems_id Region_id[ 2 ]; /* array of region ids */ +TEST_EXTERN rtems_name Region_name[ 2 ]; /* array of region names */ + +TEST_EXTERN rtems_unsigned8 Area_1[64000] CPU_STRUCTURE_ALIGNMENT; + +#define BASE_PRIORITY 140 + +#define Put_address_from_area_1( _to_be_printed ) \ + printf( "0x%08lx", \ + (unsigned long) ((rtems_unsigned8 *)(_to_be_printed) - Area_1 ) ) + +/* end of include file */ diff --git a/testsuites/sptests/sp25/task1.c b/testsuites/sptests/sp25/task1.c new file mode 100644 index 0000000000..e279d5c401 --- /dev/null +++ b/testsuites/sptests/sp25/task1.c @@ -0,0 +1,241 @@ +/* Task_1 + * + * This routine serves as a test task. It tests the region manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may in + * the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + void *address_1; + void *address_2; + void *address_3; + void *address_4; + void *address_5; + void *address_6; + void *address_7; + void *address_8; + rtems_status_code status; + rtems_id region_id; + + status = rtems_region_ident(Region_name[ 1 ], ®ion_id); + printf( "TA1 - rtems_region_ident - 0x%08x\n", region_id ); + directive_failed(status, "rtems_region_ident of RN01"); + + puts( + "TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 64, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_1 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 128 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 128, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_2 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_2 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 256 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 256, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_3 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_3 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 512 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 512, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_4 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_4 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 1024 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 1024, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_5 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_5 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 2048 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 2048, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_6 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_6 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 4096 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 4096, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_7 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_7 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 8192 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 8192, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_8 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_8 ); + new_line; + +rtems_test_pause(); + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_3 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_3 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_3 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_4 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_4 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_4 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_1 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_1 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_2 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_2 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_2 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_7 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_7 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_7 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_6 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_6 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_6 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_8 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_8 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_8 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_5 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_5 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_5 = 0; + + puts( "TA1 - rtems_region_delete - walks heap if debug enabled" ); + rtems_region_delete(Region_id[ 1 ]); + + puts( "*** END OF TEST 25 ***" ); + exit( 0 ); +} |