From 8f9b2f6026dc42c84540388bd985c60b65040180 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 9 Jul 2009 20:23:38 +0000 Subject: 2009-07-09 Joel Sherrill * Makefile.am, configure.ac: Add sp59 to test path through _Thread_queue_First_priority where the task's priority was in the bottom 1/4 of the range. * sp59/.cvsignore, sp59/Makefile.am, sp59/init.c, sp59/sp59.doc, sp59/sp59.scn: New files. --- testsuites/sptests/ChangeLog | 8 +++ testsuites/sptests/Makefile.am | 2 +- testsuites/sptests/configure.ac | 1 + testsuites/sptests/sp59/.cvsignore | 2 + testsuites/sptests/sp59/Makefile.am | 28 +++++++++ testsuites/sptests/sp59/init.c | 120 ++++++++++++++++++++++++++++++++++++ testsuites/sptests/sp59/sp59.doc | 29 +++++++++ testsuites/sptests/sp59/sp59.scn | 13 ++++ 8 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 testsuites/sptests/sp59/.cvsignore create mode 100644 testsuites/sptests/sp59/Makefile.am create mode 100644 testsuites/sptests/sp59/init.c create mode 100644 testsuites/sptests/sp59/sp59.doc create mode 100644 testsuites/sptests/sp59/sp59.scn (limited to 'testsuites') diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog index 6af0c6a73d..6eb57db2ce 100644 --- a/testsuites/sptests/ChangeLog +++ b/testsuites/sptests/ChangeLog @@ -1,3 +1,11 @@ +2009-07-09 Joel Sherrill + + * Makefile.am, configure.ac: Add sp59 to test path through + _Thread_queue_First_priority where the task's priority was in the + bottom 1/4 of the range. + * sp59/.cvsignore, sp59/Makefile.am, sp59/init.c, sp59/sp59.doc, + sp59/sp59.scn: New files. + 2009-07-09 Joel Sherrill * Makefile.am, configure.ac: Add test for Thread Queue extract a thread diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 9bdb291ec6..f5935a9dd8 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -8,7 +8,7 @@ SUBDIRS = sp01 sp02 sp03 sp04 sp05 sp06 sp07 sp08 sp09 sp11 sp12 sp13 sp14 \ sp15 sp16 sp17 sp19 sp20 sp21 sp22 sp23 sp24 sp25 sp26 sp27 sp27a sp28 \ sp29 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 \ + sp58 sp59 \ spchain spobjgetnext spprintk spsize spstkalloc spthreadq01 \ spwatchdog spwkspace \ spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \ diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index c3507c955c..9972157d92 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -84,6 +84,7 @@ sp55/Makefile sp56/Makefile sp57/Makefile sp58/Makefile +sp59/Makefile spchain/Makefile spfatal01/Makefile spfatal02/Makefile diff --git a/testsuites/sptests/sp59/.cvsignore b/testsuites/sptests/sp59/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/sp59/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/sp59/Makefile.am b/testsuites/sptests/sp59/Makefile.am new file mode 100644 index 0000000000..2db9dc035a --- /dev/null +++ b/testsuites/sptests/sp59/Makefile.am @@ -0,0 +1,28 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = sp59 +sp59_SOURCES = init.c + +dist_rtems_tests_DATA = sp59.scn +dist_rtems_tests_DATA += sp59.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +sp59_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(sp59_OBJECTS) $(sp59_LDADD) +LINK_LIBS = $(sp59_LDLIBS) + +sp59$(EXEEXT): $(sp59_OBJECTS) $(sp59_DEPENDENCIES) + @rm -f sp59$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/sp59/init.c b/testsuites/sptests/sp59/init.c new file mode 100644 index 0000000000..fd0bce867f --- /dev/null +++ b/testsuites/sptests/sp59/init.c @@ -0,0 +1,120 @@ +/* + * 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 + +#define ALLOC_SIZE 400 +uint8_t Region_Memory[512]; +rtems_id Region; + +rtems_task Blocking_task( + rtems_task_argument ignored +) +{ + rtems_status_code status; + void *address_1; + + puts( "Blocking_task - wait for memory" ); + rtems_region_get_segment( + Region, + ALLOC_SIZE, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + + puts( "Blocking_task - Got memory segment after freed" ); + + puts( "Blocking_task - delete self" ); + status = rtems_task_delete(RTEMS_SELF); +} + +rtems_task Init( + rtems_task_argument ignored +) +{ + rtems_status_code status; + rtems_id task_id; + void *address_1; + rtems_task_priority priority; + + puts( "\n\n*** TEST 59 ***" ); + + priority = RTEMS_MAXIMUM_PRIORITY / 4; + priority = (priority * 3) + (priority / 2); + printf( "Init - blocking task priority will be %d\n", priority ); + + puts( "Init - rtems_task_create - delay task - OK" ); + status = rtems_task_create( + rtems_build_name( 'T', 'A', '1', ' ' ), + priority, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_OPTIONS, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Init - rtems_task_start - delay task - OK" ); + status = rtems_task_start( task_id, Blocking_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Init - rtems_region_create - OK" ); + status = rtems_region_create( + rtems_build_name('R', 'N', '0', '1'), + Region_Memory, + sizeof( Region_Memory ), + 64, + RTEMS_PRIORITY, + &Region + ); + directive_failed( status, "rtems_region_create of RN1" ); + + puts( "TA1 - rtems_region_get_segment - get segment to consume memory" ); + rtems_region_get_segment( + Region, + ALLOC_SIZE, + RTEMS_PRIORITY, + RTEMS_NO_TIMEOUT, + &address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + + puts( "Init - rtems_task_wake_after - let other task block - OK" ); + status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(1000) ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "Init1 - rtems_region_get_segment - return segment" ); + status = rtems_region_return_segment( Region, address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + + puts( "Init - rtems_task_wake_after - let other task run again - OK" ); + status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(1000) ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "*** END OF TEST 59 ***" ); + 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 + +/* global variables */ diff --git a/testsuites/sptests/sp59/sp59.doc b/testsuites/sptests/sp59/sp59.doc new file mode 100644 index 0000000000..3d08804e0f --- /dev/null +++ b/testsuites/sptests/sp59/sp59.doc @@ -0,0 +1,29 @@ +# +# $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: sp59 + +directives: + + _Thread_queue_First_priority + rtems_region_create + rtems_region_get_segment + rtems_region_return_segment + rtems_task_create + rtems_task_wake_after + +concepts: + ++ Ensure that the odd path of having a task in the bottom 1/4 of the + priority range blocked on a priority blocking based thread queue is + properly processed by _Thread_queue_First_priority. diff --git a/testsuites/sptests/sp59/sp59.scn b/testsuites/sptests/sp59/sp59.scn new file mode 100644 index 0000000000..b67699fbea --- /dev/null +++ b/testsuites/sptests/sp59/sp59.scn @@ -0,0 +1,13 @@ +*** TEST 59 *** +Init - blocking task priority will be 220 +Init - rtems_task_create - delay task - OK +Init - rtems_task_start - delay task - OK +Init - rtems_region_create - OK +TA1 - rtems_region_get_segment - get segment to consume memory +Init - rtems_task_wake_after - let other task block - OK +Blocking_task - wait for memory +Init1 - rtems_region_get_segment - return segment +Init - rtems_task_wake_after - let other task run again - OK +Blocking_task - Got memory segment after freed +Blocking_task - delete self +*** END OF TEST 59 *** -- cgit v1.2.3