forked from Imagelibrary/rtems
2009-07-28 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac: Add new test to handle the case where a region resize frees enough memory to unblock a task. * sp62/.cvsignore, sp62/Makefile.am, sp62/init.c, sp62/sp62.doc, sp62/sp62.scn: New files. * sp61/init.c: Test does not need regions.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2009-07-28 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* Makefile.am, configure.ac: Add new test to handle the case where
|
||||
a region resize frees enough memory to unblock a task.
|
||||
* sp62/.cvsignore, sp62/Makefile.am, sp62/init.c, sp62/sp62.doc,
|
||||
sp62/sp62.scn: New files.
|
||||
* sp61/init.c: Test does not need regions.
|
||||
|
||||
2009-07-28 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* Makefile.am, configure.ac: Add test case for processing a timeout
|
||||
|
||||
@@ -13,7 +13,7 @@ SUBDIRS = \
|
||||
sp30 sp31 sp32 sp33 sp34 sp35 sp37 sp38 sp39 \
|
||||
sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
|
||||
sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
|
||||
sp60 sp61 \
|
||||
sp60 sp61 sp62 \
|
||||
spchain spobjgetnext spprintk spsize spstkalloc spthreadq01 \
|
||||
spwatchdog spwkspace \
|
||||
spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \
|
||||
|
||||
@@ -87,6 +87,7 @@ sp58/Makefile
|
||||
sp59/Makefile
|
||||
sp60/Makefile
|
||||
sp61/Makefile
|
||||
sp62/Makefile
|
||||
spchain/Makefile
|
||||
spfatal01/Makefile
|
||||
spfatal02/Makefile
|
||||
|
||||
@@ -38,7 +38,6 @@ rtems_task Init(
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 2
|
||||
#define CONFIGURE_MAXIMUM_REGIONS 1
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#define CONFIGURE_INIT
|
||||
|
||||
2
testsuites/sptests/sp62/.cvsignore
Normal file
2
testsuites/sptests/sp62/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
28
testsuites/sptests/sp62/Makefile.am
Normal file
28
testsuites/sptests/sp62/Makefile.am
Normal file
@@ -0,0 +1,28 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
MANAGERS = all
|
||||
|
||||
rtems_tests_PROGRAMS = sp62
|
||||
sp62_SOURCES = init.c
|
||||
|
||||
dist_rtems_tests_DATA = sp62.scn
|
||||
dist_rtems_tests_DATA += sp62.doc
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../automake/compile.am
|
||||
include $(top_srcdir)/../automake/leaf.am
|
||||
|
||||
sp62_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
|
||||
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
|
||||
|
||||
LINK_OBJS = $(sp62_OBJECTS) $(sp62_LDADD)
|
||||
LINK_LIBS = $(sp62_LDLIBS)
|
||||
|
||||
sp62$(EXEEXT): $(sp62_OBJECTS) $(sp62_DEPENDENCIES)
|
||||
@rm -f sp62$(EXEEXT)
|
||||
$(make-exe)
|
||||
|
||||
include $(top_srcdir)/../automake/local.am
|
||||
129
testsuites/sptests/sp62/init.c
Normal file
129
testsuites/sptests/sp62/init.c
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2009.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include <tmacros.h>
|
||||
|
||||
rtems_id Region;
|
||||
uint32_t Region_Memory[256];
|
||||
volatile bool case_hit;
|
||||
|
||||
#define FIRST_ALLOC 980
|
||||
#define BLOCK_ALLOC 900
|
||||
#define RESIZE 16
|
||||
|
||||
rtems_task Blocker(
|
||||
rtems_task_argument ignored
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
void *segment_address_1;
|
||||
|
||||
puts( "Blocker - rtems_region_get_segment - OK");
|
||||
sc = rtems_region_get_segment(
|
||||
Region,
|
||||
BLOCK_ALLOC,
|
||||
RTEMS_DEFAULT_OPTIONS,
|
||||
RTEMS_NO_TIMEOUT,
|
||||
&segment_address_1
|
||||
);
|
||||
directive_failed( sc, "rtems_region_get_segment" );
|
||||
|
||||
|
||||
puts( "Blocker - Got memory after resize" );
|
||||
case_hit = true;
|
||||
|
||||
(void) rtems_task_delete( RTEMS_SELF );
|
||||
|
||||
}
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument ignored
|
||||
)
|
||||
{
|
||||
rtems_id task_id;
|
||||
rtems_status_code sc;
|
||||
void *segment_address_1;
|
||||
intptr_t old_size;
|
||||
|
||||
puts( "\n\n*** TEST 62 ***" );
|
||||
|
||||
puts( "Init - rtems_task_create Blocker - OK" );
|
||||
sc = rtems_task_create(
|
||||
rtems_build_name( 'B', 'L', 'C', 'K' ),
|
||||
1,
|
||||
RTEMS_MINIMUM_STACK_SIZE,
|
||||
RTEMS_DEFAULT_MODES,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
&task_id
|
||||
);
|
||||
directive_failed( sc, "rtems_task_create of Blocker" );
|
||||
|
||||
puts( "Init - rtems_task_start Blocker - OK" );
|
||||
sc = rtems_task_start( task_id, Blocker, 0 );
|
||||
directive_failed( sc, "rtems_task_start of Blocker" );
|
||||
|
||||
|
||||
puts( "Init - rtems_task_create Region - OK" );
|
||||
sc = rtems_region_create(
|
||||
rtems_build_name( 'R', 'N', '1', ' ' ),
|
||||
Region_Memory,
|
||||
sizeof(Region_Memory),
|
||||
16,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
&Region
|
||||
);
|
||||
directive_failed( sc, "rtems_region_create" );
|
||||
|
||||
puts( "Init - rtems_region_get_segment - OK");
|
||||
sc = rtems_region_get_segment(
|
||||
Region,
|
||||
FIRST_ALLOC,
|
||||
RTEMS_DEFAULT_OPTIONS,
|
||||
RTEMS_NO_TIMEOUT,
|
||||
&segment_address_1
|
||||
);
|
||||
directive_failed( sc, "rtems_region_get_segment" );
|
||||
|
||||
puts( "Init - sleep 1 second for Blocker - OK");
|
||||
sleep(1);
|
||||
|
||||
/* Check resize_segment errors */
|
||||
sc = rtems_region_resize_segment(
|
||||
Region, segment_address_1, RESIZE, &old_size);
|
||||
directive_failed( sc, "rtems_region_resize_segment" );
|
||||
|
||||
case_hit = false;
|
||||
|
||||
puts( "Init - sleep 1 second for Blocker to run again - OK");
|
||||
sleep(1);
|
||||
|
||||
if ( case_hit ) {
|
||||
puts( "Init - successfully resized and unblocked a task" );
|
||||
puts( "*** END OF TEST 62 ***" );
|
||||
} else
|
||||
puts( "Init - failed to resize and unblock a task" );
|
||||
|
||||
rtems_test_exit(0);
|
||||
}
|
||||
|
||||
/* configuration information */
|
||||
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 2
|
||||
#define CONFIGURE_MAXIMUM_REGIONS 1
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#define CONFIGURE_INIT
|
||||
#include <rtems/confdefs.h>
|
||||
|
||||
/* global variables */
|
||||
27
testsuites/sptests/sp62/sp62.doc
Normal file
27
testsuites/sptests/sp62/sp62.doc
Normal file
@@ -0,0 +1,27 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# COPYRIGHT (c) 1989-2009.
|
||||
# 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: sp62
|
||||
|
||||
directives:
|
||||
|
||||
rtems_region_create
|
||||
rtems_region_get_segment
|
||||
rtems_region_resize_segment
|
||||
|
||||
concepts:
|
||||
|
||||
+ Ensure that where there is memory freed by the resize effort is
|
||||
sufficient to result in needing to look to see if we can unblock any
|
||||
tasks.
|
||||
|
||||
11
testsuites/sptests/sp62/sp62.scn
Normal file
11
testsuites/sptests/sp62/sp62.scn
Normal file
@@ -0,0 +1,11 @@
|
||||
*** TEST 62 ***
|
||||
Init - rtems_task_create Blocker - OK
|
||||
Init - rtems_task_start Blocker - OK
|
||||
Init - rtems_task_create Region - OK
|
||||
Init - rtems_region_get_segment - OK
|
||||
Init - sleep 1 second for Blocker - OK
|
||||
Blocker - rtems_region_get_segment - OK
|
||||
Init - sleep 1 second for Blocker to run again - OK
|
||||
Blocker - Got memory after resize
|
||||
Init - successfully resized and unblocked a task
|
||||
*** END OF TEST 62 ***
|
||||
Reference in New Issue
Block a user