2011-03-11 Joel Sherrill <joel.sherrilL@OARcorp.com>

* Makefile.am, configure.ac: Add sp73.  This is a new test designed
	to improve coverage of the thread yield logic.
	* sp73/.cvsignore, sp73/Makefile.am, sp73/init.c, sp73/sp73.doc,
	sp73/sp73.scn: New files.
This commit is contained in:
Joel Sherrill
2011-03-11 16:39:27 +00:00
parent a6a7aae35e
commit 89ed8a9055
8 changed files with 174 additions and 1 deletions

View File

@@ -1,3 +1,10 @@
2011-03-11 Joel Sherrill <joel.sherrilL@OARcorp.com>
* Makefile.am, configure.ac: Add sp73. This is a new test designed
to improve coverage of the thread yield logic.
* sp73/.cvsignore, sp73/Makefile.am, sp73/init.c, sp73/sp73.doc,
sp73/sp73.scn: New files.
2011-03-10 Sebastian Huber <sebastian.huber@embedded-brains.de>
* sp07/init.c: Improve coverage.

View File

@@ -14,7 +14,7 @@ SUBDIRS = \
sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
sp60 sp62 sp63 sp64 sp65 sp66 sp67 sp68 sp69 \
sp70 sp71 sp72 \
sp70 sp71 sp72 sp73 \
spassoc01 spchain spclockget spcoverage spobjgetnext \
spnotepad01 spprintk spprivenv01 spsize spstkalloc spthreadq01 \
spwatchdog spwkspace \

View File

@@ -98,6 +98,7 @@ sp69/Makefile
sp70/Makefile
sp71/Makefile
sp72/Makefile
sp73/Makefile
spassoc01/Makefile
spchain/Makefile
spclockget/Makefile

View File

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

View File

@@ -0,0 +1,26 @@
##
## $Id$
##
MANAGERS = all
rtems_tests_PROGRAMS = sp73
sp73_SOURCES = init.c
dist_rtems_tests_DATA = sp73.scn
dist_rtems_tests_DATA += sp73.doc
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
LINK_OBJS = $(sp73_OBJECTS) $(sp73_LDADD)
LINK_LIBS = $(sp73_LDLIBS)
sp73$(EXEEXT): $(sp73_OBJECTS) $(sp73_DEPENDENCIES)
@rm -f sp73$(EXEEXT)
$(make-exe)
include $(top_srcdir)/../automake/local.am

View File

@@ -0,0 +1,107 @@
/*
* COPYRIGHT (c) 2011.
* 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$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <bsp.h>
#include <inttypes.h>
#include "tmacros.h"
rtems_id Task_id[ 4 ]; /* array of task ids */
rtems_name Task_name[ 4 ]; /* array of task names */
rtems_task Test_task(
rtems_task_argument arg
)
{
rtems_time_of_day time;
uint32_t task_index;
rtems_status_code status;
task_index = arg;
for ( ; ; ) {
status = rtems_clock_get_tod( &time );
if ( time.second >= 15 ) {
puts( "*** END OF SP73 (YIELD) TEST ***" );
rtems_test_exit( 0 );
}
put_name( Task_name[ task_index ], FALSE );
print_time( " - rtems_clock_get_tod - ", &time, "\n" );
status = rtems_task_wake_after(
task_index * 5 * rtems_clock_get_ticks_per_second() );
}
}
rtems_task Init(
rtems_task_argument argument
)
{
rtems_status_code status;
rtems_time_of_day time;
rtems_task_priority old;
puts( "\n\n*** SP73 (YIELD) TEST ***" );
time.year = 1988;
time.month = 12;
time.day = 31;
time.hour = 9;
time.minute = 0;
time.second = 0;
time.ticks = 0;
status = rtems_clock_set( &time );
Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
status = rtems_task_create(
Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
);
status = rtems_task_create(
Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
);
status = rtems_task_create(
Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ]
);
status = rtems_task_start( Task_id[ 1 ], Test_task, 1 );
rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
status = rtems_task_start( Task_id[ 2 ], Test_task, 2 );
rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
status = rtems_task_start( Task_id[ 3 ], Test_task, 3 );
rtems_task_set_priority(Task_id[1], 1, &old);
rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
status = rtems_task_delete( RTEMS_SELF );
}
/* configuration information */
#define CONFIGURE_SCHEDULER_SIMPLE
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 4
#define CONFIGURE_INIT_TASK_PRIORITY 2
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* end of file */

View File

@@ -0,0 +1,22 @@
#
# $Id$
#
# COPYRIGHT (c) 2011.
# 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: sp73
directives:
+ rtems_task_wake_after - yield case
concepts:
+ The purpose of this test is to exercise paths in the yield scheduling
logic.

View File

@@ -0,0 +1,8 @@
*** SP73 (YIELD) TEST ***
TA1 - rtems_clock_get_tod - 09:00:00 12/31/1988
TA2 - rtems_clock_get_tod - 09:00:00 12/31/1988
TA3 - rtems_clock_get_tod - 09:00:00 12/31/1988
TA1 - rtems_clock_get_tod - 09:00:05 12/31/1988
TA1 - rtems_clock_get_tod - 09:00:10 12/31/1988
TA2 - rtems_clock_get_tod - 09:00:10 12/31/1988
*** END OF SP73 (YIELD) TEST ***