2009-07-20 Joel Sherrill <joel.sherrill@OARcorp.com>

* Makefile.am, configure.ac: Add test case for the
	_Thread_queue_Enqueue_priority interrupt critical section where the
	TCB we are using as a current pointer is removed from the thread
	queue when we flash interrupts while searching forward.
	* spintrcritical06/.cvsignore, spintrcritical06/Makefile.am,
	spintrcritical06/init.c, spintrcritical06/spintrcritical06.doc,
	spintrcritical06/spintrcritical06.scn: New files.
This commit is contained in:
Joel Sherrill
2009-07-20 14:49:25 +00:00
parent 260e09260a
commit eecd655794
8 changed files with 238 additions and 4 deletions

View File

@@ -1,3 +1,13 @@
2009-07-20 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac: Add test case for the
_Thread_queue_Enqueue_priority interrupt critical section where the
TCB we are using as a current pointer is removed from the thread
queue when we flash interrupts while searching forward.
* spintrcritical06/.cvsignore, spintrcritical06/Makefile.am,
spintrcritical06/init.c, spintrcritical06/spintrcritical06.doc,
spintrcritical06/spintrcritical06.scn: New files.
2009-07-20 Joel Sherrill <joel.sherrill@OARcorp.com>
* spintrcritical_support/intrcritical.c,

View File

@@ -4,12 +4,14 @@
ACLOCAL_AMFLAGS = -I ../aclocal
## Test names are spaced to indicate gaps in numbering from tests being
## deleted over the years.
SUBDIRS = \
sp01 sp02 sp03 sp04 sp05 sp06 sp07 sp08 sp09 \
sp11 sp12 sp13 sp14 sp15 sp16 sp17 sp19 \
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 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
sp30 sp31 sp32 sp33 sp34 sp35 sp37 sp38 sp39 \
sp40 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
sp60 sp61 \
spchain spobjgetnext spprintk spsize spstkalloc spthreadq01 \
@@ -17,7 +19,7 @@ SUBDIRS = \
spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \
spfatal08 spfatal09 spfatal10 spfatal11 spfatal12 \
spintrcritical01 spintrcritical02 spintrcritical03 spintrcritical04 \
spintrcritical05
spintrcritical05 spintrcritical06
DIST_SUBDIRS = $(SUBDIRS) spfatal_support spintrcritical_support
EXTRA_DIST = spfatal_support/init.c spfatal_support/system.h

View File

@@ -103,6 +103,7 @@ spintrcritical02/Makefile
spintrcritical03/Makefile
spintrcritical04/Makefile
spintrcritical05/Makefile
spintrcritical06/Makefile
spobjgetnext/Makefile
spprintk/Makefile
spsize/Makefile

View File

@@ -0,0 +1,2 @@
Makefile
Makefile.in

View File

@@ -0,0 +1,31 @@
##
## $Id$
##
MANAGERS = all
rtems_tests_PROGRAMS = spintrcritical06
spintrcritical06_SOURCES = init.c \
../spintrcritical_support/intrcritical.c
dist_rtems_tests_DATA = spintrcritical06.scn
dist_rtems_tests_DATA += spintrcritical06.doc
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
spintrcritical06_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
AM_CPPFLAGS += -I$(top_srcdir)/spintrcritical_support
AM_CPPFLAGS += -DPRIORITY_NO_TIMEOUT_FORWARD
LINK_OBJS = $(spintrcritical06_OBJECTS) $(spintrcritical06_LDADD)
LINK_LIBS = $(spintrcritical06_LDLIBS)
spintrcritical06$(EXEEXT): $(spintrcritical06_OBJECTS) $(spintrcritical06_DEPENDENCIES)
@rm -f spintrcritical06$(EXEEXT)
$(make-exe)
include $(top_srcdir)/../automake/local.am

View File

@@ -0,0 +1,152 @@
/*
* 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$
*/
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 1
#include <tmacros.h>
#include <intrcritical.h>
/* common parameters */
#define SEMAPHORE_ATTRIBUTES RTEMS_PRIORITY
#define SEMAPHORE_OBTAIN_TIMEOUT 0
#if defined(PRIORITY_NO_TIMEOUT_FORWARD)
#define TEST_NAME "06"
#define TEST_STRING "Priority/Restart Search Task (Forward)"
#define INIT_PRIORITY 2
#define BLOCKER_PRIORITY 1
#elif defined(PRIORITY_NO_TIMEOUT_REVERSE)
#define TEST_NAME "07"
#define TEST_STRING "Priority/Restart Search Task (Backward)"
#define INIT_PRIORITY 126
#define BLOCKER_PRIORITY 127
#else
#error "Test Mode not defined"
#endif
rtems_id Main_task;
rtems_id Secondary_task_id;
rtems_id Semaphore;
volatile bool case_hit;
Thread_blocking_operation_States getState(void)
{
Objects_Locations location;
Semaphore_Control *sem;
sem = (Semaphore_Control *)_Objects_Get(
&_Semaphore_Information, Semaphore, &location );
if ( location != OBJECTS_LOCAL ) {
puts( "Bad object lookup" );
rtems_test_exit(0);
}
_Thread_Unnest_dispatch();
return sem->Core_control.semaphore.Wait_queue.sync_state;
}
rtems_timer_service_routine test_release_from_isr(
rtems_id timer,
void *arg
)
{
(void) rtems_task_restart( Secondary_task_id, 1 );
}
rtems_task Secondary_task(
rtems_task_argument arg
)
{
rtems_status_code status;
if ( arg )
(void) rtems_semaphore_flush( Semaphore );
status = rtems_semaphore_obtain(
Semaphore,
RTEMS_DEFAULT_OPTIONS,
SEMAPHORE_OBTAIN_TIMEOUT
);
directive_failed( status, "rtems_semaphore_obtain" );
}
rtems_task Init(
rtems_task_argument ignored
)
{
rtems_status_code status;
int resets;
puts( "\n\n*** TEST INTERRUPT CRITICAL SECTION " TEST_NAME " ***" );
puts( "Init - Trying to generate semaphore release from ISR while blocking" );
puts( "Init - Variation is: " TEST_STRING );
status = rtems_semaphore_create(
rtems_build_name( 'S', 'M', '1', ' ' ),
0,
SEMAPHORE_ATTRIBUTES,
RTEMS_NO_PRIORITY,
&Semaphore
);
directive_failed( status, "rtems_semaphore_create of SM1" );
Main_task = rtems_task_self();
status = rtems_task_create(
rtems_build_name( 'B', 'L', 'C', 'K' ),
1,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_NO_PREEMPT,
RTEMS_DEFAULT_ATTRIBUTES,
&Secondary_task_id
);
directive_failed( status, "rtems_task_create" );
status = rtems_task_start( Secondary_task_id, Secondary_task, 0 );
directive_failed( status, "rtems_task_start" );
interrupt_critical_section_test_support_initialize( test_release_from_isr );
for (resets=0 ; resets< 2 ;) {
if ( interrupt_critical_section_test_support_delay() )
resets++;
status = rtems_semaphore_obtain(
Semaphore,
RTEMS_DEFAULT_OPTIONS,
SEMAPHORE_OBTAIN_TIMEOUT
);
fatal_directive_status(status, RTEMS_UNSATISFIED, "rtems_semaphore_obtain");
}
puts( "*** END OF TEST INTERRUPT CRITICAL SECTION " TEST_NAME " ***" );
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_TIMERS 1
#define CONFIGURE_MAXIMUM_SEMAPHORES 1
#define CONFIGURE_INIT_TASK_PRIORITY INIT_PRIORITY
#define CONFIGURE_INIT_TASK_MODE RTEMS_PREEMPT
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* global variables */

View File

@@ -0,0 +1,31 @@
#
# $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: spintrcritical06
directives:
_Thread_queue_Enqueue_priority
- interrupt synchronization
rtems_task_restart
_Thread_queue_Extract_priority
concepts:
+ Ensure that removing the "search task" from the thread queue while we
are looping and enqueuing another works as expected. This case is where
the TCB we are using as a current pointer is removed from the thread queue
when we flash interrupts WHILE SEARCHING FORWARD.
NOTE: There is no way to know this case is hit from a test perspective. The
test just runs and we check the coverage report.

View File

@@ -0,0 +1,5 @@
*** TEST INTERRUPT CRITICAL SECTION 06 ***
Init - Trying to generate semaphore release from ISR while blocking
Init - Variation is: Priority/Without Timeout/Multiple Tasks (Forward)
Support - rtems_timer_create - creating timer 1
*** END OF TEST INTERRUPT CRITICAL SECTION 06 ***