mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 23:54:25 +08:00
2011-09-20 Petr Benes <benesp16@fel.cvut.cz>
PR 1916/testing * spcbssched02/init.c, spcbssched02/spcbssched02.scn, spcbssched02/system.h, spcbssched02/task_periodic.c, spedfsched03/init.c, spedfsched03/system.h, spedfsched03/tasks_aperiodic.c: Improve coverage.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2011-09-20 Petr Benes <benesp16@fel.cvut.cz>
|
||||
|
||||
PR 1916/testing
|
||||
* spcbssched02/init.c, spcbssched02/spcbssched02.scn,
|
||||
spcbssched02/system.h, spcbssched02/task_periodic.c,
|
||||
spedfsched03/init.c, spedfsched03/system.h,
|
||||
spedfsched03/tasks_aperiodic.c: Improve coverage.
|
||||
|
||||
2011-09-15 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* spcbssched01/Makefile.am, spcbssched02/Makefile.am,
|
||||
|
||||
@@ -47,6 +47,7 @@ rtems_task Init(
|
||||
puts( "\n\n*** TEST CBS SCHEDULER 2 ***" );
|
||||
|
||||
Task_name = rtems_build_name( 'P', 'T', '1', ' ' );
|
||||
Task_name2 = rtems_build_name( 'P', 'T', '2', ' ' );
|
||||
|
||||
status = rtems_task_create(
|
||||
Task_name,
|
||||
@@ -58,6 +59,16 @@ rtems_task Init(
|
||||
);
|
||||
directive_failed( status, "rtems_task_create loop" );
|
||||
|
||||
status = rtems_task_create(
|
||||
Task_name2,
|
||||
Priority,
|
||||
RTEMS_MINIMUM_STACK_SIZE * 4,
|
||||
RTEMS_NO_PREEMPT,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
&Task_id2
|
||||
);
|
||||
directive_failed( status, "rtems_task_create loop" );
|
||||
|
||||
printf( "Init: Initializing the CBS\n" );
|
||||
if ( rtems_cbs_initialize() )
|
||||
printf( "ERROR: CBS INITIALIZATION FAILED\n" );
|
||||
@@ -88,6 +99,8 @@ rtems_task Init(
|
||||
printf( "ERROR: CREATE SERVER FAILED\n" );
|
||||
if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) )
|
||||
printf( "ERROR: CREATE SERVER FAILED\n" );
|
||||
if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) )
|
||||
printf( "ERROR: CREATE SERVER FAILED\n" );
|
||||
if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) !=
|
||||
SCHEDULER_CBS_ERROR_FULL )
|
||||
printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" );
|
||||
@@ -217,11 +230,25 @@ rtems_task Init(
|
||||
if ( rtems_cbs_initialize() )
|
||||
printf( "ERROR: CBS INITIALIZATION FAILED\n" );
|
||||
|
||||
/* Start periodic task */
|
||||
/* Start periodic tasks */
|
||||
printf( "Init: Starting periodic task\n" );
|
||||
status = rtems_task_start( Task_id, Task_Periodic, 1 );
|
||||
directive_failed( status, "rtems_task_start periodic" );
|
||||
status = rtems_task_start( Task_id2, Task_Periodic, 2 );
|
||||
directive_failed( status, "rtems_task_start periodic" );
|
||||
|
||||
status = rtems_task_delete( RTEMS_SELF );
|
||||
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
|
||||
rtems_task_wake_after( 130 );
|
||||
|
||||
printf( "Init: Checking server with a deleted task\n" );
|
||||
if ( rtems_cbs_get_execution_time( 0, &exec_time, &abs_time ) )
|
||||
printf( "ERROR: GET EXECUTION TIME FAILED\n" );
|
||||
if ( rtems_cbs_get_remaining_budget( 0, &remaining_budget) )
|
||||
printf( "ERROR: GET REMAINING BUDGET FAILED\n" );
|
||||
|
||||
if ( rtems_cbs_cleanup() )
|
||||
printf( "ERROR: CBS CLEANUP\n" );
|
||||
|
||||
fflush(stdout);
|
||||
puts( "*** END OF TEST CBS SCHEDULER 2 ***" );
|
||||
rtems_test_exit( 0 );
|
||||
}
|
||||
|
||||
@@ -27,4 +27,6 @@ P1-F ticks:71
|
||||
P1-S ticks:91
|
||||
P1-F ticks:101
|
||||
P1-S ticks:121
|
||||
Periodic task: Deleting self
|
||||
Init: Checking server with a deleted task
|
||||
*** END OF TEST CBS SCHEDULER 2 ***
|
||||
|
||||
@@ -32,7 +32,7 @@ rtems_task Task_Periodic(
|
||||
|
||||
#define CONFIGURE_MICROSECONDS_PER_TICK 100000
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 2
|
||||
#define CONFIGURE_MAXIMUM_TASKS 3
|
||||
#define CONFIGURE_MAXIMUM_PERIODS 10
|
||||
|
||||
#define CONFIGURE_INIT_TASK_PRIORITY 100
|
||||
@@ -54,6 +54,8 @@ rtems_task Task_Periodic(
|
||||
|
||||
rtems_id Task_id;
|
||||
rtems_name Task_name;
|
||||
rtems_id Task_id2;
|
||||
rtems_name Task_name2;
|
||||
rtems_task_priority Priority;
|
||||
time_t Period;
|
||||
time_t Execution;
|
||||
|
||||
@@ -34,61 +34,64 @@ rtems_task Task_Periodic(
|
||||
params.deadline = Period;
|
||||
params.budget = Execution+1;
|
||||
|
||||
printf( "Periodic task: Create server and Attach thread\n" );
|
||||
if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) )
|
||||
printf( "ERROR: CREATE SERVER FAILED\n" );
|
||||
if ( rtems_cbs_attach_thread( server_id, Task_id ) )
|
||||
printf( "ERROR: ATTACH THREAD FAILED\n" );
|
||||
/* Taks 1 will be attached to a server, task 2 not. */
|
||||
if ( argument == 1 ) {
|
||||
printf( "Periodic task: Create server and Attach thread\n" );
|
||||
if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) )
|
||||
printf( "ERROR: CREATE SERVER FAILED\n" );
|
||||
if ( rtems_cbs_attach_thread( server_id, Task_id ) )
|
||||
printf( "ERROR: ATTACH THREAD FAILED\n" );
|
||||
|
||||
printf( "Periodic task: ID and Get parameters\n" );
|
||||
if ( rtems_cbs_get_server_id( Task_id, &tsid ) )
|
||||
printf( "ERROR: GET SERVER ID FAILED\n" );
|
||||
if ( tsid != server_id )
|
||||
printf( "ERROR: SERVER ID MISMATCH\n" );
|
||||
if ( rtems_cbs_get_parameters( server_id, &tparams ) )
|
||||
printf( "ERROR: GET PARAMETERS FAILED\n" );
|
||||
if ( params.deadline != tparams.deadline ||
|
||||
params.budget != tparams.budget )
|
||||
printf( "ERROR: PARAMETERS MISMATCH\n" );
|
||||
printf( "Periodic task: ID and Get parameters\n" );
|
||||
if ( rtems_cbs_get_server_id( Task_id, &tsid ) )
|
||||
printf( "ERROR: GET SERVER ID FAILED\n" );
|
||||
if ( tsid != server_id )
|
||||
printf( "ERROR: SERVER ID MISMATCH\n" );
|
||||
if ( rtems_cbs_get_parameters( server_id, &tparams ) )
|
||||
printf( "ERROR: GET PARAMETERS FAILED\n" );
|
||||
if ( params.deadline != tparams.deadline ||
|
||||
params.budget != tparams.budget )
|
||||
printf( "ERROR: PARAMETERS MISMATCH\n" );
|
||||
|
||||
printf( "Periodic task: Detach thread and Destroy server\n" );
|
||||
if ( rtems_cbs_detach_thread( server_id, Task_id ) )
|
||||
printf( "ERROR: DETACH THREAD FAILED\n" );
|
||||
if ( rtems_cbs_destroy_server( server_id ) )
|
||||
printf( "ERROR: DESTROY SERVER FAILED\n" );
|
||||
if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) )
|
||||
printf( "ERROR: CREATE SERVER FAILED\n" );
|
||||
printf( "Periodic task: Detach thread and Destroy server\n" );
|
||||
if ( rtems_cbs_detach_thread( server_id, Task_id ) )
|
||||
printf( "ERROR: DETACH THREAD FAILED\n" );
|
||||
if ( rtems_cbs_destroy_server( server_id ) )
|
||||
printf( "ERROR: DESTROY SERVER FAILED\n" );
|
||||
if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) )
|
||||
printf( "ERROR: CREATE SERVER FAILED\n" );
|
||||
|
||||
printf( "Periodic task: Remaining budget and Execution time\n" );
|
||||
if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget ) )
|
||||
printf( "ERROR: GET REMAINING BUDGET FAILED\n" );
|
||||
if ( remaining_budget != params.budget )
|
||||
printf( "ERROR: REMAINING BUDGET MISMATCH\n" );
|
||||
if ( rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) )
|
||||
printf( "ERROR: GET EXECUTION TIME FAILED\n" );
|
||||
printf( "Periodic task: Remaining budget and Execution time\n" );
|
||||
if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget ) )
|
||||
printf( "ERROR: GET REMAINING BUDGET FAILED\n" );
|
||||
if ( remaining_budget != params.budget )
|
||||
printf( "ERROR: REMAINING BUDGET MISMATCH\n" );
|
||||
if ( rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) )
|
||||
printf( "ERROR: GET EXECUTION TIME FAILED\n" );
|
||||
|
||||
printf( "Periodic task: Set parameters\n" );
|
||||
if ( rtems_cbs_attach_thread( server_id, Task_id ) )
|
||||
printf( "ERROR: ATTACH THREAD FAILED\n" );
|
||||
params.deadline = Period * 2;
|
||||
params.budget = Execution * 2 +1;
|
||||
if ( rtems_cbs_set_parameters( server_id, ¶ms ) )
|
||||
printf( "ERROR: SET PARAMS FAILED\n" );
|
||||
if ( rtems_cbs_get_parameters( server_id, &tparams ) )
|
||||
printf( "ERROR: GET PARAMS FAILED\n" );
|
||||
if ( params.deadline != tparams.deadline ||
|
||||
params.budget != tparams.budget )
|
||||
printf( "ERROR: PARAMS MISMATCH\n" );
|
||||
params.deadline = Period;
|
||||
params.budget = Execution+1;
|
||||
if ( rtems_cbs_set_parameters( server_id, ¶ms ) )
|
||||
printf( "ERROR: SET PARAMS FAILED\n" );
|
||||
if ( rtems_cbs_get_approved_budget( server_id, &approved_budget ) )
|
||||
printf( "ERROR: GET APPROVED BUDGET FAILED\n" );
|
||||
printf( "Periodic task: Set parameters\n" );
|
||||
if ( rtems_cbs_attach_thread( server_id, Task_id ) )
|
||||
printf( "ERROR: ATTACH THREAD FAILED\n" );
|
||||
params.deadline = Period * 2;
|
||||
params.budget = Execution * 2 +1;
|
||||
if ( rtems_cbs_set_parameters( server_id, ¶ms ) )
|
||||
printf( "ERROR: SET PARAMS FAILED\n" );
|
||||
if ( rtems_cbs_get_parameters( server_id, &tparams ) )
|
||||
printf( "ERROR: GET PARAMS FAILED\n" );
|
||||
if ( params.deadline != tparams.deadline ||
|
||||
params.budget != tparams.budget )
|
||||
printf( "ERROR: PARAMS MISMATCH\n" );
|
||||
params.deadline = Period;
|
||||
params.budget = Execution+1;
|
||||
if ( rtems_cbs_set_parameters( server_id, ¶ms ) )
|
||||
printf( "ERROR: SET PARAMS FAILED\n" );
|
||||
if ( rtems_cbs_get_approved_budget( server_id, &approved_budget ) )
|
||||
printf( "ERROR: GET APPROVED BUDGET FAILED\n" );
|
||||
|
||||
printf( "Periodic task: Approved budget\n" );
|
||||
if ( approved_budget != params.budget )
|
||||
printf( "ERROR: APPROVED BUDGET MISMATCH\n" );
|
||||
printf( "Periodic task: Approved budget\n" );
|
||||
if ( approved_budget != params.budget )
|
||||
printf( "ERROR: APPROVED BUDGET MISMATCH\n" );
|
||||
}
|
||||
|
||||
status = rtems_rate_monotonic_create( argument, &rmid );
|
||||
directive_failed( status, "rtems_rate_monotonic_create" );
|
||||
@@ -129,10 +132,7 @@ rtems_task Task_Periodic(
|
||||
printf("rtems_rate_monotonic_delete failed with status of %d.\n", status);
|
||||
rtems_test_exit( 0 );
|
||||
}
|
||||
if ( rtems_cbs_cleanup() )
|
||||
printf( "ERROR: CBS CLEANUP\n" );
|
||||
|
||||
fflush(stdout);
|
||||
puts( "*** END OF TEST CBS SCHEDULER 2 ***" );
|
||||
rtems_test_exit( 0 );
|
||||
printf( "Periodic task: Deleting self\n" );
|
||||
status = rtems_task_delete( RTEMS_SELF );
|
||||
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ rtems_task Init(
|
||||
directive_failed( status, "rtems_task_start loop" );
|
||||
}
|
||||
|
||||
rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
|
||||
|
||||
status = rtems_task_delete( RTEMS_SELF );
|
||||
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ rtems_task Tasks_Aperiodic(
|
||||
#define CONFIGURE_MAXIMUM_PERIODS 10
|
||||
|
||||
#define CONFIGURE_INIT_TASK_PRIORITY 100
|
||||
#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
|
||||
#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS (6 * 4 * RTEMS_MINIMUM_STACK_SIZE)
|
||||
|
||||
@@ -21,16 +21,21 @@ rtems_task Tasks_Aperiodic(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
{
|
||||
rtems_status_code status;
|
||||
int start;
|
||||
int stop;
|
||||
int now;
|
||||
rtems_status_code status;
|
||||
int start;
|
||||
int stop;
|
||||
int now;
|
||||
|
||||
put_name( Task_name[ argument ], FALSE );
|
||||
|
||||
status = rtems_task_wake_after( 2 + Phases[argument] );
|
||||
directive_failed( status, "rtems_task_wake_after" );
|
||||
|
||||
if ( argument == 6 ) {
|
||||
rtems_task_suspend( Task_id[5] );
|
||||
rtems_task_resume( Task_id[5] );
|
||||
}
|
||||
|
||||
rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
|
||||
printf("AT%" PRIdPTR "-S ticks:%d\n", argument, start);
|
||||
/* active computing */
|
||||
|
||||
Reference in New Issue
Block a user