diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog index 63be346d9e..5da65eae29 100644 --- a/testsuites/sptests/ChangeLog +++ b/testsuites/sptests/ChangeLog @@ -1,3 +1,16 @@ +2011-07-24 Joel Sherrill + + * sp04/tswitch.c, sp07/task1.c, sp07/task2.c, sp09/screen07.c, + sp11/task1.c, sp11/task2.c, sp12/pridrv.c, sp12/pritask.c, + sp13/task1.c, sp14/asr.c, sp14/task1.c, sp19/first.c, sp19/fptask.c, + sp19/inttest.h, sp19/task1.c, sp20/task1.c, sp25/task1.c, + sp26/task1.c, sp28/init.c, sp29/init.c, sp31/task1.c, sp32/init.c, + sp33/init.c, sp34/changepri.c, sp36/strict_order_mut.c, sp37/init.c, + sp43/init.c, sp44/init.c, sp48/init.c, sp54/init.c, sp59/init.c, + sp65/init.c, sp68/init.c, spchain/init.c, spclockget/init.c, + spfatal03/testcase.h, spfatal07/testcase.h, spfatal_support/init.c: + Do not line length exceed 80 columns. + 2011-07-08 Joel Sherrill * sp09/screen07.c, sp09/sp09.scn: Add a case where the multiply of diff --git a/testsuites/sptests/sp04/tswitch.c b/testsuites/sptests/sp04/tswitch.c index 1f58397df4..e94cebb9e7 100644 --- a/testsuites/sptests/sp04/tswitch.c +++ b/testsuites/sptests/sp04/tswitch.c @@ -1,14 +1,4 @@ -/* Task_switch - * - * This routine is the tswitch user extension. It determines which - * task is being switched to and displays a message indicating the - * time and date that it gained control. - * - * Input parameters: - * unused - pointer to currently running TCB - * heir - pointer to heir TCB - * - * Output parameters: NONE +/* * * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). @@ -29,7 +19,9 @@ /* * Only require 10 task switches on sis/gdb. --joel 2 Feb 2011 */ -struct taskSwitchLog taskSwitchLog[25]; +#define MAX_TASK_SWITCH_LOGS 25 + +struct taskSwitchLog taskSwitchLog[MAX_TASK_SWITCH_LOGS]; unsigned int taskSwitchLogIndex; volatile int testsFinished; @@ -53,7 +45,7 @@ void Task_switch( status = rtems_clock_get_tod( &time ); directive_failed_with_level( status, "rtems_clock_get_tod", 1 ); - if (taskSwitchLogIndex < (sizeof taskSwitchLog / sizeof taskSwitchLog[0])) { + if (taskSwitchLogIndex < MAX_TASK_SWITCH_LOGS ) { taskSwitchLog[taskSwitchLogIndex].taskIndex = index; taskSwitchLog[taskSwitchLogIndex].when = time; taskSwitchLogIndex++; diff --git a/testsuites/sptests/sp07/task1.c b/testsuites/sptests/sp07/task1.c index a6ad9045f8..344e54133c 100644 --- a/testsuites/sptests/sp07/task1.c +++ b/testsuites/sptests/sp07/task1.c @@ -1,14 +1,5 @@ -/* Task_1 - * - * This routine serves as a test task. It verifies intertask communication - * using task notepads and verifies the the user extensions (tcreate, etc). - * - * Input parameters: - * argument - task argument - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-1999. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -44,7 +35,8 @@ rtems_task Task_1( ); directive_failed( status, "rtems_task_set_priority" ); printf( - "TA1 - rtems_task_set_priority - get initial priority of self: %02" PRIdrtems_task_priority "\n", + "TA1 - rtems_task_set_priority - get initial " + "priority of self: %02" PRIdrtems_task_priority "\n", the_priority ); @@ -52,8 +44,9 @@ rtems_task Task_1( status = rtems_task_get_note( my_id, RTEMS_NOTEPAD_8, &the_priority ); directive_failed( status, "rtems_task_get_note" ); printf( -"TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: %02" PRIdrtems_task_priority "\n", - the_priority + "TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - " + "current priority: %02" PRIdrtems_task_priority "\n", + the_priority ); if ( --the_priority == 0 ) { @@ -72,14 +65,18 @@ rtems_task Task_1( directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); } - printf( "TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: %02" PRIdrtems_task_priority "\n", - the_priority + printf( + "TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: " + "%02" PRIdrtems_task_priority "\n", + the_priority ); status = rtems_task_set_note( Task_id[ 2 ], RTEMS_NOTEPAD_8, the_priority ); directive_failed( status, "rtems_task_set_note" ); - printf( "TA1 - rtems_task_set_priority - set TA2's priority: %02" PRIdrtems_task_priority "\n", - the_priority + printf( + "TA1 - rtems_task_set_priority - set TA2's priority: " + "%02" PRIdrtems_task_priority "\n", + the_priority ); status = rtems_task_set_priority( Task_id[ 2 ], diff --git a/testsuites/sptests/sp07/task2.c b/testsuites/sptests/sp07/task2.c index cfa8236ad1..2cc262654b 100644 --- a/testsuites/sptests/sp07/task2.c +++ b/testsuites/sptests/sp07/task2.c @@ -1,14 +1,5 @@ -/* Task_2 - * - * This routine serves as a test task. Plays with priorities to verify - * that the highest priority task is always executed. - * - * Input parameters: - * argument - task argument - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-1999. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -37,7 +28,8 @@ rtems_task Task_2( status = rtems_task_get_note( RTEMS_SELF, RTEMS_NOTEPAD_8, &the_priority ); directive_failed( status, "rtems_task_get_note" ); printf( -"TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: %02" PRIdrtems_task_priority "\n", + "TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - " + "current priority: %02" PRIdrtems_task_priority "\n", the_priority ); @@ -61,14 +53,18 @@ rtems_task Task_2( } else { - printf( "TA2 - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8: %02" PRIdrtems_task_priority "\n", - the_priority + printf( + "TA2 - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8: " + "%02" PRIdrtems_task_priority "\n", + the_priority ); status = rtems_task_set_note(Task_id[ 1 ], RTEMS_NOTEPAD_8, the_priority); directive_failed( status, "rtems_task_set_note" ); - printf( "TA2 - rtems_task_set_priority - set TA1's priority: %02" PRIdrtems_task_priority "\n", - the_priority + printf( + "TA2 - rtems_task_set_priority - set TA1's priority: " + "%02" PRIdrtems_task_priority "\n", + the_priority ); status = rtems_task_set_priority( Task_id[ 1 ], diff --git a/testsuites/sptests/sp09/screen07.c b/testsuites/sptests/sp09/screen07.c index 76a1f43175..d66abff8f7 100644 --- a/testsuites/sptests/sp09/screen07.c +++ b/testsuites/sptests/sp09/screen07.c @@ -1,12 +1,5 @@ -/* Screen7 - * - * This routine generates error screen 7 for test 9. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-2009. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -260,7 +253,10 @@ void Screen7() RTEMS_INVALID_ADDRESS, "rtems_message_queue_receive NULL buffer" ); - puts( "TA1 - rtems_message_queue_receive - Q 1 - RTEMS_INVALID_ADDRESS NULL buffer" ); + puts( + "TA1 - rtems_message_queue_receive - Q 1 - " + "RTEMS_INVALID_ADDRESS NULL buffer" + ); status = rtems_message_queue_receive( Queue_id[ 1 ], @@ -274,7 +270,10 @@ void Screen7() RTEMS_INVALID_ADDRESS, "rtems_message_queue_receive NULL size" ); - puts( "TA1 - rtems_message_queue_receive - Q 1 - RTEMS_INVALID_ADDRESS NULL size" ); + puts( + "TA1 - rtems_message_queue_receive - Q 1 - " + "RTEMS_INVALID_ADDRESS NULL size" + ); status = rtems_message_queue_receive( Queue_id[ 1 ], @@ -393,6 +392,8 @@ void Screen7() RTEMS_INVALID_ADDRESS, "rtems_message_queue_broadcast with NULL count" ); - puts( "TA1 - rtems_message_queue_broadcast - NULL count - RTEMS_INVALID_ADDRESS" ); + puts( + "TA1 - rtems_message_queue_broadcast - NULL count - RTEMS_INVALID_ADDRESS" + ); } diff --git a/testsuites/sptests/sp11/task1.c b/testsuites/sptests/sp11/task1.c index ae4542f9ba..62ab1b1ddf 100644 --- a/testsuites/sptests/sp11/task1.c +++ b/testsuites/sptests/sp11/task1.c @@ -1,13 +1,5 @@ -/* Task_1 - * - * This routine serves as a test task. It verifies the event maager. - * - * Input parameters: - * argument - task argument - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-2009. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -30,7 +22,7 @@ rtems_task Task_1( rtems_event_set eventout; rtems_time_of_day time; rtems_status_code status; - uint32_t index; + uint32_t index; puts( "TA1 - rtems_event_send - send RTEMS_EVENT_16 to TA2" ); status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_16 ); @@ -48,7 +40,8 @@ rtems_task Task_1( ); directive_failed( status, "rtems_event_receive" ); printf( - "TA1 - RTEMS_EVENT_14 and RTEMS_EVENT_15 received - eventout => %08" PRIxrtems_event_set "\n", + "TA1 - RTEMS_EVENT_14 and RTEMS_EVENT_15 received - " + "eventout => %08" PRIxrtems_event_set "\n", eventout ); @@ -57,7 +50,8 @@ rtems_task Task_1( directive_failed( status, "rtems_event_send" ); puts( - "TA1 - rtems_event_receive - waiting with 10 second timeout on RTEMS_EVENT_14" + "TA1 - rtems_event_receive - waiting with 10 second timeout " + "on RTEMS_EVENT_14" ); status = rtems_event_receive( RTEMS_EVENT_14, @@ -66,7 +60,11 @@ rtems_task Task_1( &eventout ); directive_failed( status, "rtems_event_receive" ); - printf( "TA1 - RTEMS_EVENT_14 received - eventout => %08" PRIxrtems_event_set "\n", eventout ); + printf( + "TA1 - RTEMS_EVENT_14 received - eventout => " + "%08" PRIxrtems_event_set "\n", + eventout + ); puts( "TA1 - rtems_event_send - send RTEMS_EVENT_19 to TA2" ); status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_19 ); @@ -95,7 +93,10 @@ rtems_test_pause(); &eventout ); directive_failed( status, "rtems_event_receive of 18" ); - printf( "TA1 - RTEMS_EVENT_18 received - eventout => %08" PRIxrtems_event_set "\n", eventout ); + printf( + "TA1 - RTEMS_EVENT_18 received - eventout => %08" PRIxrtems_event_set "\n", + eventout + ); status = rtems_clock_get_tod( &time ); directive_failed( status, "TA1 rtems_clock_get_tod" ); @@ -116,7 +117,10 @@ rtems_test_pause(); &eventout ); directive_failed( status, "rtems_event_receive of 3 and 22" ); - printf( "TA1 - RTEMS_EVENT_3 received - eventout => %08" PRIxrtems_event_set "\n", eventout ); + printf( + "TA1 - RTEMS_EVENT_3 received - eventout => %08" PRIxrtems_event_set "\n", + eventout + ); puts( "TA1 - rtems_event_send - send RTEMS_EVENT_4 to self" ); status = rtems_event_send( RTEMS_SELF, RTEMS_EVENT_4 ); @@ -133,7 +137,10 @@ rtems_test_pause(); &eventout ); directive_failed( status, "rtems_event_receive" ); - printf( "TA1 - RTEMS_EVENT_4 received - eventout => %08" PRIxrtems_event_set "\n", eventout ); + printf( + "TA1 - RTEMS_EVENT_4 received - eventout => %08" PRIxrtems_event_set "\n", + eventout + ); rtems_test_pause(); @@ -211,7 +218,11 @@ rtems_test_pause(); status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); - printf( "TA1 - RTEMS_EVENT_1 received - eventout => %08" PRIxrtems_event_set " - ", eventout ); + printf( + "TA1 - RTEMS_EVENT_1 received - eventout => %08" + PRIxrtems_event_set " - ", + eventout + ); print_time( "at ", &time, "\n" ); if ( index < 2 ) { @@ -292,7 +303,10 @@ rtems_test_pause(); &eventout ); directive_failed( status, "rtems_event_receive" ); - printf( "TA1 - RTEMS_EVENT_11 received - eventout => %08" PRIxrtems_event_set "\n", eventout ); + printf( + "TA1 - RTEMS_EVENT_11 received - eventout => %08" PRIxrtems_event_set "\n", + eventout + ); rtems_test_pause(); @@ -388,8 +402,10 @@ rtems_test_pause(); RTEMS_NO_TIMEOUT, &eventout ); - if ( eventout == RTEMS_EVENT_10 ) puts( "TA1 - RTEMS_EVENT_10 received" ); - else printf( "ERROR -0x%08" PRIxrtems_event_set " events received\n", eventout ); + if ( eventout == RTEMS_EVENT_10 ) + puts( "TA1 - RTEMS_EVENT_10 received" ); + else + printf( "ERROR -0x%08" PRIxrtems_event_set " events received\n", eventout ); directive_failed( status, "rtems_event_receive all events" ); puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 100 ticks"); diff --git a/testsuites/sptests/sp11/task2.c b/testsuites/sptests/sp11/task2.c index 99c6eddaa5..34145ccaab 100644 --- a/testsuites/sptests/sp11/task2.c +++ b/testsuites/sptests/sp11/task2.c @@ -1,14 +1,5 @@ -/* Task_2 - * - * This routine serves as a test task. Multiple tasks are required to - * verify all capabilities of the event manager. - * - * Input parameters: - * argument - task argument - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-2009. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -43,7 +34,10 @@ rtems_task Task_2( &eventout ); directive_failed( status, "rtems_event_receive" ); - printf( "TA2 - RTEMS_EVENT_16 received - eventout => %08" PRIxrtems_event_set "\n", eventout ); + printf( + "TA2 - RTEMS_EVENT_16 received - eventout => %08" PRIxrtems_event_set "\n", + eventout + ); puts( "TA2 - rtems_event_send - send RTEMS_EVENT_14 and RTEMS_EVENT_15 to TA1" @@ -63,7 +57,8 @@ rtems_task Task_2( ); directive_failed( status, "rtems_event_receive" ); printf( - "TA2 - RTEMS_EVENT_17 or RTEMS_EVENT_18 received - eventout => %08" PRIxrtems_event_set "\n", + "TA2 - RTEMS_EVENT_17 or RTEMS_EVENT_18 received - " + "eventout => %08" PRIxrtems_event_set "\n", eventout ); @@ -100,7 +95,10 @@ rtems_task Task_2( status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); - printf( "TA2 - RTEMS_EVENT_10 received - eventout => %08" PRIxrtems_event_set "\n", eventout ); + printf( + "TA2 - RTEMS_EVENT_10 received - eventout => %08" PRIxrtems_event_set "\n", + eventout + ); print_time( "TA2 - rtems_clock_get_tod - ", &time, "\n" ); puts( "TA2 - rtems_event_receive - RTEMS_PENDING_EVENTS" ); @@ -121,7 +119,10 @@ rtems_task Task_2( &eventout ); directive_failed( status, "rtems_event_receive" ); - printf( "TA2 - RTEMS_EVENT_19 received - eventout => %08" PRIxrtems_event_set "\n", eventout ); + printf( + "TA2 - RTEMS_EVENT_19 received - eventout => %08" PRIxrtems_event_set "\n", + eventout + ); puts( "TA2 - rtems_task_delete - deletes self" ); status = rtems_task_delete( Task_id[ 2 ] ); diff --git a/testsuites/sptests/sp12/pridrv.c b/testsuites/sptests/sp12/pridrv.c index cbd72e4da7..c634950e4f 100644 --- a/testsuites/sptests/sp12/pridrv.c +++ b/testsuites/sptests/sp12/pridrv.c @@ -1,17 +1,5 @@ -/* Priority_test_driver - * - * This routine is the initialization task for this test program. - * It is a user initialization task and has the responsibility for creating - * and starting the tasks that make up the test. If the time of day - * clock is required for the test, it should also be set to a known - * value by this function. - * - * Input parameters: - * priority_base - priority_base switch - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-2009. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -87,7 +75,9 @@ void Priority_test_driver( priority_base + 4, &previous_priority ); - printf( "PDRV - change priority of PRI5 from %" PRIdrtems_task_priority " to %" PRIdrtems_task_priority "\n", + printf( + "PDRV - change priority of PRI5 from %" PRIdrtems_task_priority + " to %" PRIdrtems_task_priority "\n", previous_priority, priority_base + 4 ); @@ -99,7 +89,10 @@ void Priority_test_driver( &previous_priority ); directive_failed( status, "PDRV rtems_task_set_priority CURRENT" ); - printf( "PDRV - priority of PRI5 is %" PRIdrtems_task_priority "\n", previous_priority ); + printf( + "PDRV - priority of PRI5 is %" PRIdrtems_task_priority "\n", + previous_priority + ); } } } diff --git a/testsuites/sptests/sp12/pritask.c b/testsuites/sptests/sp12/pritask.c index 9b53758775..87372309bf 100644 --- a/testsuites/sptests/sp12/pritask.c +++ b/testsuites/sptests/sp12/pritask.c @@ -1,13 +1,5 @@ -/* Priority_task - * - * This routine serves as a test task. It verifies the semaphore manager. - * - * Input parameters: - * its_index - priority index - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-2009. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -31,7 +23,7 @@ rtems_task Priority_task( rtems_task_priority its_priority; rtems_task_priority current_priority; rtems_status_code status; - uint32_t index; + uint32_t index; its_priority = Task_priority[ its_index ]; @@ -51,7 +43,12 @@ rtems_task Priority_task( directive_failed( status, "rtems_semaphore_obtain of SM2" ); if ( its_priority < PRIORITY_INHERIT_BASE_PRIORITY ) { - printf( "PRI%" PRIdrtems_task_argument " - WHY AM I HERE? (pri=%" PRIdrtems_task_priority ")", its_index, its_priority ); + printf( + "PRI%" PRIdrtems_task_argument " - WHY AM I HERE? (pri=%" + PRIdrtems_task_priority ")", + its_index, + its_priority + ); rtems_test_exit( 0 ); } @@ -67,7 +64,12 @@ rtems_task Priority_task( status = rtems_task_set_priority( RTEMS_SELF, priority, &old_priority ); directive_failed( status, "rtems_task_set_priority with resource" ); if ( priority != old_priority ) { - printf( "priority != old_priority (%" PRIdrtems_task_priority " != %" PRIdrtems_task_priority ")\n", priority, old_priority ); + printf( + "priority != old_priority (%" PRIdrtems_task_priority + " != %" PRIdrtems_task_priority ")\n", + priority, + old_priority + ); rtems_test_exit(0); } } @@ -105,7 +107,10 @@ rtems_task Priority_task( ¤t_priority ); directive_failed( status, "PRI5 rtems_task_set_priority CURRENT" ); - printf( "PRI5 - priority of PRI5 is %" PRIdrtems_task_priority "\n", current_priority ); + printf( + "PRI5 - priority of PRI5 is %" PRIdrtems_task_priority "\n", + current_priority + ); (void) rtems_task_suspend( RTEMS_SELF ); } diff --git a/testsuites/sptests/sp13/task1.c b/testsuites/sptests/sp13/task1.c index f332ce1e4d..ef0015bac4 100644 --- a/testsuites/sptests/sp13/task1.c +++ b/testsuites/sptests/sp13/task1.c @@ -1,13 +1,5 @@ -/* Task_1 - * - * This routine serves as a test task. It verifies the message manager. - * - * Input parameters: - * argument - task argument - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-2009. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -47,9 +39,9 @@ void dope_buffer( ch = (' ' + (v % (0x7f - ' '))); for (i=0; i= 0x7f) - ch = ' '; + *buff++ = ch++; + if (ch >= 0x7f) + ch = ' '; } } @@ -70,7 +62,10 @@ rtems_task Task_1( RTEMS_SEARCH_ALL_NODES, &qid ); - printf( "TA1 - rtems_message_queue_ident - qid => %08" PRIxrtems_id "\n", qid ); + printf( + "TA1 - rtems_message_queue_ident - qid => %08" PRIxrtems_id "\n", + qid + ); directive_failed( status, "rtems_message_queue_ident" ); Fill_buffer( "BUFFER 1 TO Q 1", buffer ); @@ -275,7 +270,10 @@ rtems_test_pause(); ); directive_failed( status, "rtems_message_queue_create of Q1; 20 bytes each" ); status = rtems_message_queue_send( Queue_id[ 1 ], big_send_buffer, 40 ); - fatal_directive_status(status, RTEMS_INVALID_SIZE, "expected RTEMS_INVALID_SIZE"); + fatal_directive_status(status, + RTEMS_INVALID_SIZE, + "expected RTEMS_INVALID_SIZE" + ); puts( "TA1 - rtems_message_queue_delete - delete queue 1" ); status = rtems_message_queue_delete( Queue_id[ 1 ] ); @@ -284,89 +282,86 @@ rtems_test_pause(); rtems_test_pause(); puts( "TA1 - rtems_message_queue_create - variable sizes " ); - for (queue_size = 1; queue_size < 1030; queue_size++) - { - status = rtems_message_queue_create( - Queue_name[ 1 ], - 2, /* just 2 msgs each */ - queue_size, - RTEMS_DEFAULT_ATTRIBUTES, - &Queue_id[ 1 ] - ); - if (status != RTEMS_SUCCESSFUL) - { - printf("TA1 - msq que size: %zu\n", queue_size); - directive_failed( status, "rtems_message_queue_create of Q1" ); - } + for (queue_size = 1; queue_size < 1030; queue_size++) { + status = rtems_message_queue_create( + Queue_name[ 1 ], + 2, /* just 2 msgs each */ + queue_size, + RTEMS_DEFAULT_ATTRIBUTES, + &Queue_id[ 1 ] + ); + if (status != RTEMS_SUCCESSFUL) { + printf("TA1 - msq que size: %zu\n", queue_size); + directive_failed( status, "rtems_message_queue_create of Q1" ); + } - status = rtems_message_queue_delete( Queue_id[ 1 ] ); - directive_failed( status, "rtems_message_queue_delete" ); + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete" ); } puts( "TA1 - rtems_message_queue_create and send - variable sizes " ); - for (queue_size = 1; queue_size < 1030; queue_size++) - { - /* printf("TA1 - message queue size: %d\n", queue_size); */ + for (queue_size = 1; queue_size < 1030; queue_size++) { + status = rtems_message_queue_create( + Queue_name[ 1 ], + 2, /* just 2 msgs each */ + queue_size, + RTEMS_DEFAULT_ATTRIBUTES, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create of Q1" ); - status = rtems_message_queue_create( - Queue_name[ 1 ], - 2, /* just 2 msgs each */ - queue_size, - RTEMS_DEFAULT_ATTRIBUTES, - &Queue_id[ 1 ] - ); + dope_buffer(big_send_buffer, sizeof(big_send_buffer), queue_size); + memset(big_receive_buffer, 'Z', sizeof(big_receive_buffer)); - directive_failed( status, "rtems_message_queue_create of Q1" ); + /* send a msg too big */ + status = rtems_message_queue_send( + Queue_id[ 1 ], + big_send_buffer, + queue_size + 1 + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_message_queue_send too large" + ); - dope_buffer(big_send_buffer, sizeof(big_send_buffer), queue_size); - memset(big_receive_buffer, 'Z', sizeof(big_receive_buffer)); + /* send a msg that is just right */ + status = rtems_message_queue_send( + Queue_id[ 1 ], + big_send_buffer, + queue_size); + directive_failed(status, "rtems_message_queue_send exact size"); - /* send a msg too big */ - status = rtems_message_queue_send( Queue_id[ 1 ], - big_send_buffer, - queue_size + 1 ); + /* now read and verify the message just sent */ + status = rtems_message_queue_receive( + Queue_id[ 1 ], + big_receive_buffer, + &size, + RTEMS_DEFAULT_OPTIONS, + 1 * rtems_clock_get_ticks_per_second() + ); + directive_failed(status, "rtems_message_queue_receive exact size"); + if (size != queue_size) { + puts("TA1 - exact size size match failed"); + rtems_test_exit(1); + } - fatal_directive_status(status, - RTEMS_INVALID_SIZE, - "rtems_message_queue_send too large"); + if (memcmp(big_send_buffer, big_receive_buffer, size) != 0) { + puts("TA1 - exact size data match failed"); + rtems_test_exit(1); + } - /* send a msg that is just right */ - status = rtems_message_queue_send(Queue_id[ 1 ], - big_send_buffer, - queue_size); - directive_failed(status, "rtems_message_queue_send exact size"); + for (cp = (big_receive_buffer + size); + cp < (big_receive_buffer + sizeof(big_receive_buffer)); + cp++) + if (*cp != 'Z') { + puts("TA1 - exact size overrun match failed"); + rtems_test_exit(1); + } - /* now read and verify the message just sent */ - status = rtems_message_queue_receive(Queue_id[ 1 ], - big_receive_buffer, - &size, - RTEMS_DEFAULT_OPTIONS, - 1 * rtems_clock_get_ticks_per_second()); - directive_failed(status, "rtems_message_queue_receive exact size"); - if (size != queue_size) - { - puts("TA1 - exact size size match failed"); - rtems_test_exit(1); - } - - if (memcmp(big_send_buffer, big_receive_buffer, size) != 0) - { - puts("TA1 - exact size data match failed"); - rtems_test_exit(1); - } - - for (cp = (big_receive_buffer + size); - cp < (big_receive_buffer + sizeof(big_receive_buffer)); - cp++) - if (*cp != 'Z') - { - puts("TA1 - exact size overrun match failed"); - rtems_test_exit(1); - } - - /* all done with this one; delete it */ - status = rtems_message_queue_delete( Queue_id[ 1 ] ); - directive_failed( status, "rtems_message_queue_delete" ); + /* all done with this one; delete it */ + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete" ); } puts( "*** END OF TEST 13 ***" ); diff --git a/testsuites/sptests/sp14/asr.c b/testsuites/sptests/sp14/asr.c index 7cec7a3b59..266b74b046 100644 --- a/testsuites/sptests/sp14/asr.c +++ b/testsuites/sptests/sp14/asr.c @@ -1,14 +1,5 @@ -/* Process_asr - * - * This is the asynchronous signal routine (asr) for task 1. - * It demonstrates that ASRs can block execute and block. - * - * Input parameters: - * the_signal_set - signal set - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-1999. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -31,7 +22,10 @@ rtems_asr Process_asr( { rtems_status_code status; - printf( "ASR - ENTRY - signal => %08" PRIxrtems_signal_set "\n", the_signal_set ); + printf( + "ASR - ENTRY - signal => %08" PRIxrtems_signal_set "\n", + the_signal_set + ); switch( the_signal_set ) { case RTEMS_SIGNAL_16: case RTEMS_SIGNAL_17: @@ -48,6 +42,9 @@ rtems_asr Process_asr( Asr_fired = TRUE; break; } - printf( "ASR - EXIT - signal => %08" PRIxrtems_signal_set "\n", the_signal_set ); + printf( + "ASR - EXIT - signal => %08" PRIxrtems_signal_set "\n", + the_signal_set + ); FLUSH_OUTPUT(); } diff --git a/testsuites/sptests/sp14/task1.c b/testsuites/sptests/sp14/task1.c index dd78cfc008..926716436e 100644 --- a/testsuites/sptests/sp14/task1.c +++ b/testsuites/sptests/sp14/task1.c @@ -1,14 +1,5 @@ -/* Task_1 - * - * This routine serves as a test task. It establishes an RTEMS_ASR and - * sends signal to itself to determine if the RTEMS_ASR gets to execute. - * - * Input parameters: - * argument - task argument - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-2009. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -100,7 +91,8 @@ rtems_test_pause(); puts( "TA1 - timer routine got the correct arguments" ); else printf( - "TA1 - timer got (0x%" PRIxrtems_id ", %p) instead of (0x%" PRIxrtems_id ", %p)!!!!\n", + "TA1 - timer got (0x%" PRIxrtems_id ", %p) instead of (0x%" + PRIxrtems_id ", %p)!!!!\n", Timer_got_this_id, Timer_got_this_pointer, Timer_id[ 1 ], diff --git a/testsuites/sptests/sp19/first.c b/testsuites/sptests/sp19/first.c index cbee33d91c..2699f345e2 100644 --- a/testsuites/sptests/sp19/first.c +++ b/testsuites/sptests/sp19/first.c @@ -1,15 +1,5 @@ -/* First_FP_task - * - * This routine serves as a floating point test task. It verifies the - * basic task switching capabilities of the executive when floating - * point is configured. - * - * Input parameters: - * argument - task argument - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-1999. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -47,13 +37,16 @@ rtems_task First_FP_task( FP_LOAD( FP_factors[ task_index ] ); put_name( Task_name[ task_index ], FALSE ); - printf( " - integer base = (0x%" PRIx32 ")\n", INTEGER_factors[ task_index ] ); + printf( + " - integer base = (0x%" PRIx32 ")\n", + INTEGER_factors[ task_index ] + ); put_name( Task_name[ task_index ], FALSE ); -#if ( RTEMS_HAS_HARDWARE_FP == 1 ) - printf( " - float base = (%g)\n", FP_factors[ task_index ] ); -#else - printf( " - float base = (NA)\n" ); -#endif + #if ( RTEMS_HAS_HARDWARE_FP == 1 ) + printf( " - float base = (%g)\n", FP_factors[ task_index ] ); + #else + printf( " - float base = (NA)\n" ); + #endif if ( argument == 0 ) { status = rtems_task_restart( RTEMS_SELF, 1 ); diff --git a/testsuites/sptests/sp19/fptask.c b/testsuites/sptests/sp19/fptask.c index d3acfce0c5..fe79f6d0e9 100644 --- a/testsuites/sptests/sp19/fptask.c +++ b/testsuites/sptests/sp19/fptask.c @@ -1,15 +1,5 @@ -/* FP_task - * - * This routine serves as a floating point test task. It verifies the - * basic task switching capabilities of the executive when floating - * point is configured. - * - * Input parameters: - * argument - task argument - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-2009. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -34,8 +24,8 @@ rtems_task FP_task( rtems_status_code status; rtems_id tid; rtems_time_of_day time; - uint32_t task_index; - uint32_t previous_seconds; + uint32_t task_index; + uint32_t previous_seconds; INTEGER_DECLARE; FP_DECLARE; @@ -48,13 +38,16 @@ rtems_task FP_task( FP_LOAD( FP_factors[ task_index ] ); put_name( Task_name[ task_index ], FALSE ); - printf( " - integer base = (0x%" PRIx32 ")\n", INTEGER_factors[ task_index ] ); + printf( + " - integer base = (0x%" PRIx32 ")\n", + INTEGER_factors[ task_index ] + ); put_name( Task_name[ task_index ], FALSE ); -#if ( RTEMS_HAS_HARDWARE_FP == 1 ) - printf( " - float base = (%g)\n", FP_factors[ task_index ] ); -#else - printf( " - float base = (NA)\n" ); -#endif + #if ( RTEMS_HAS_HARDWARE_FP == 1 ) + printf( " - float base = (%g)\n", FP_factors[ task_index ] ); + #else + printf( " - float base = (NA)\n" ); + #endif previous_seconds = (uint32_t)-1; @@ -64,7 +57,6 @@ rtems_task FP_task( directive_failed( status, "rtems_clock_get_tod" ); if ( time.second >= 16 ) { - if ( task_number( tid ) == 4 ) { puts( "TA4 - rtems_task_delete - self" ); status = rtems_task_delete( RTEMS_SELF ); @@ -78,8 +70,7 @@ rtems_task FP_task( rtems_test_exit( 0 ); } - if (previous_seconds != time.second) - { + if (previous_seconds != time.second) { put_name( Task_name[ task_index ], FALSE ); print_time( " - rtems_clock_get_tod - ", &time, "\n" ); previous_seconds = time.second; @@ -92,8 +83,7 @@ rtems_task FP_task( * so that we likely are interrupted * After that, we go to sleep for a second at a time */ - if (time.second >= 4) - { + if (time.second >= 4) { status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); } diff --git a/testsuites/sptests/sp19/inttest.h b/testsuites/sptests/sp19/inttest.h index bab14fef94..ed39f93d4c 100644 --- a/testsuites/sptests/sp19/inttest.h +++ b/testsuites/sptests/sp19/inttest.h @@ -1,6 +1,4 @@ -/* inttest.h - * - * XXX: ??? +/* * This include file contains the CPU dependent implementation * of the following routines needed to test RTEMS floating * point support: @@ -15,7 +13,7 @@ * inttest.h. These routines form the core of the * floating point context switch test. * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -103,10 +101,14 @@ } while (0) #define INTEGER_CHECK_ONE( _v, _base, _factor ) \ - if ( (_v) != ((_base) + (_factor)) ) { \ - printf("%" PRIu32 ": " #_v " wrong -- (0x%" PRIx32 " not 0x%" PRIx32 ")\n", \ - task_index, (_v), (_base + _factor)); \ - } + if ( (_v) != ((_base) + (_factor)) ) { \ + printf( \ + "%" PRIu32 ": " #_v " wrong -- (0x%" PRIx32 " not 0x%" PRIx32 ")\n", \ + task_index, \ + (_v), \ + (_base + _factor) \ + ); \ + } #define INTEGER_CHECK( _factor ) \ diff --git a/testsuites/sptests/sp19/task1.c b/testsuites/sptests/sp19/task1.c index 1d261f3f25..42a99fc4ed 100644 --- a/testsuites/sptests/sp19/task1.c +++ b/testsuites/sptests/sp19/task1.c @@ -1,14 +1,5 @@ -/* Task_1 - * - * This routine serves as a test task. It verifies the basic task - * switching capabilities of the executive. - * - * Input parameters: - * argument - task argument - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-2009. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -32,7 +23,7 @@ rtems_task Task_1( rtems_status_code status; rtems_id tid; rtems_time_of_day time; - uint32_t task_index; + uint32_t task_index; INTEGER_DECLARE; status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); @@ -43,7 +34,10 @@ rtems_task Task_1( INTEGER_LOAD( INTEGER_factors[ task_index ] ); put_name( Task_name[ task_index ], FALSE ); - printf( " - integer base = (0x%" PRIx32 ")\n", INTEGER_factors[ task_index ] ); + printf( + " - integer base = (0x%" PRIx32 ")\n", + INTEGER_factors[ task_index ] + ); while( FOREVER ) { status = rtems_clock_get_tod( &time ); diff --git a/testsuites/sptests/sp20/task1.c b/testsuites/sptests/sp20/task1.c index e9de2658c6..44134622ba 100644 --- a/testsuites/sptests/sp20/task1.c +++ b/testsuites/sptests/sp20/task1.c @@ -1,14 +1,5 @@ -/* Task_1_through_5 - * - * This routine serves as a test task for the period capabilities of the - * Rate Monotonic Manager. - * - * Input parameters: - * argument - task argument - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-1999. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -53,15 +44,26 @@ rtems_task Task_1_through_6( status = rtems_rate_monotonic_ident( argument, &test_rmid ); directive_failed( status, "rtems_rate_monotonic_ident" ); put_name( Task_name[ argument ], FALSE ); - printf( "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n", test_rmid ); + printf( + "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n", + test_rmid + ); if ( rmid != test_rmid ) { - printf( "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%" PRIxrtems_id ")\n", rmid, test_rmid ); - rtems_test_exit( 0 ); + printf( + "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%" PRIxrtems_id ")\n", + rmid, + test_rmid + ); + rtems_test_exit( 0 ); } put_name( Task_name[ argument ], FALSE ); - printf( "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n", rmid, Periods[ argument ] ); + printf( + "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n", + rmid, + Periods[ argument ] + ); status = rtems_task_wake_after( 2 ); directive_failed( status, "rtems_task_wake_after" ); @@ -134,8 +136,7 @@ rtems_task Task_1_through_6( time[0] = _Watchdog_Ticks_since_boot; /* timestamp */ /*printf("%d - %d\n", period, time[0]);*/ - for (index = 1; index <= TA6_ITERATIONS; index++) - { + for (index = 1; index <= TA6_ITERATIONS; index++) { period = (index+1)*TA6_PERIOD_FACTOR; status = rtems_rate_monotonic_period( rmid, period); directive_failed( status, "rtems_rate_monotonic_period of TA6" ); @@ -143,13 +144,17 @@ rtems_task Task_1_through_6( /*printf("%d - %d\n", period, time[index]);*/ } - for (index = 1; index <= TA6_ITERATIONS; index++) - { + for (index = 1; index <= TA6_ITERATIONS; index++) { rtems_interval meas = time[index] - time[index-1]; period = index*TA6_PERIOD_FACTOR; - printf("TA6 - Actual: %" PRIdrtems_interval " Expected: %" PRIdrtems_interval, meas, period); + printf( + "TA6 - Actual: %" PRIdrtems_interval + " Expected: %" PRIdrtems_interval, + meas, + period + ); if (period == meas) printf(" - OK\n"); - else printf(" - FAILED\n"); + else printf(" - FAILED\n"); } } rtems_task_suspend(RTEMS_SELF); diff --git a/testsuites/sptests/sp25/task1.c b/testsuites/sptests/sp25/task1.c index e158153b52..f09468f1c8 100644 --- a/testsuites/sptests/sp25/task1.c +++ b/testsuites/sptests/sp25/task1.c @@ -1,13 +1,5 @@ -/* Task_1 - * - * This routine serves as a test task. It tests the region manager. - * - * Input parameters: - * argument - task argument - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-2009. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -190,7 +182,10 @@ rtems_task Task_1( printf( "TA1 - got segment size of %" PRIuPTR "\n", segment_size ); /* Get information about the region */ - printf( "TA1 - rtems_region_get_information - 0x%08" PRIxrtems_id "\n", region_id ); + printf( + "TA1 - rtems_region_get_information - 0x%08" PRIxrtems_id "\n", + region_id + ); status = rtems_region_get_information(region_id, ®ion_info); directive_failed(status, "rtems_region_get_information of RN01"); printf( @@ -199,7 +194,10 @@ rtems_task Task_1( region_info.Used.number ); - printf( "TA1 - rtems_region_get_free_information - 0x%08" PRIxrtems_id "\n", region_id ); + printf( + "TA1 - rtems_region_get_free_information - 0x%08" PRIxrtems_id "\n", + region_id + ); status = rtems_region_get_free_information(region_id, ®ion_info); directive_failed(status, "rtems_region_get_free_information of RN01"); printf( diff --git a/testsuites/sptests/sp26/task1.c b/testsuites/sptests/sp26/task1.c index 43636d3515..619ad921c6 100644 --- a/testsuites/sptests/sp26/task1.c +++ b/testsuites/sptests/sp26/task1.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 1989-2009. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -62,7 +62,12 @@ subTask2 (rtems_task_argument arg) rtems_event_set ev; rtems_task_wake_after (ticksPerSecond * 1); - sc = rtems_event_receive (1, RTEMS_WAIT|RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &ev); + sc = rtems_event_receive( + 1, + RTEMS_WAIT|RTEMS_EVENT_ANY, + RTEMS_NO_TIMEOUT, + &ev + ); if (sc != RTEMS_SUCCESSFUL) { printf ("subTask2 - Can't receive event (%d)\n", sc); rtems_task_suspend (RTEMS_SELF); diff --git a/testsuites/sptests/sp28/init.c b/testsuites/sptests/sp28/init.c index cb4ab0cac7..8c84ed9f56 100644 --- a/testsuites/sptests/sp28/init.c +++ b/testsuites/sptests/sp28/init.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 1989-2009. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -37,13 +37,14 @@ volatile int nDeleted; rtems_task subtask (rtems_task_argument arg) { - uintptr_t localvar = arg; - int i; + uintptr_t localvar = arg; + int i; rtems_status_code sc; nRunning++; while (nRunning != 3) rtems_task_wake_after (0); + sc = rtems_task_variable_add(RTEMS_SELF, (void **)&taskvar, NULL); directive_failed( sc, "task variable add" ); @@ -54,8 +55,13 @@ subtask (rtems_task_argument arg) taskvar = (void *)((uintptr_t)taskvar + 1); rtems_task_wake_after (0); if ((uintptr_t)taskvar != localvar) { - printf ("Task:%" PRIdrtems_task_argument " taskvar:%" PRIuPTR " localvar:%" PRIuPTR "\n", - arg, (uintptr_t)taskvar, localvar); + printf( + "Task:%" PRIdrtems_task_argument " taskvar:%" PRIuPTR + " localvar:%" PRIuPTR "\n", + arg, + (uintptr_t)taskvar, + localvar + ); rtems_task_suspend (RTEMS_SELF); } } @@ -64,8 +70,13 @@ subtask (rtems_task_argument arg) directive_failed( sc, "task variable delete" ); if ((uintptr_t)taskvar == localvar) { - printf("Task:%" PRIdrtems_task_argument " deleted taskvar:%" PRIuPTR " localvar:%" PRIuPTR "\n", - arg, (uintptr_t)taskvar, localvar); + printf( + "Task:%" PRIdrtems_task_argument " deleted taskvar:%" PRIuPTR + " localvar:%" PRIuPTR "\n", + arg, + (uintptr_t)taskvar, + localvar + ); nRunning--; rtems_task_suspend (RTEMS_SELF); } @@ -77,8 +88,13 @@ subtask (rtems_task_argument arg) if (nRunning <= 1) break; if ((uintptr_t)taskvar == localvar) { - printf("Task:%" PRIdrtems_task_argument " taskvar:%" PRIuPTR " localvar:%" PRIuPTR "\n", - arg, (uintptr_t)taskvar, localvar); + printf( + "Task:%" PRIdrtems_task_argument " taskvar:%" PRIuPTR + " localvar:%" PRIuPTR "\n", + arg, + (uintptr_t)taskvar, + localvar + ); nRunning--; rtems_task_suspend(RTEMS_SELF); } @@ -241,7 +257,10 @@ void test_multiple_taskvars(void) directive_failed( sc, "delete multiple #3" ); if ( test_dtor_ran != 2 ) { - printf( "Test dtor ran %" PRIu32 " times not 2 times as expected\n", test_dtor_ran ); + printf( + "Test dtor ran %" PRIu32 " times not 2 times as expected\n", + test_dtor_ran + ); rtems_test_exit(0); } } @@ -323,7 +342,10 @@ void test_delete_from_other_task(void) rtems_task_wake_after( 100 ); if ( test_dtor_ran != 1 ) { - printf( "Test dtor ran %" PRIu32 " times not 1 times as expected\n", test_dtor_ran ); + printf( + "Test dtor ran %" PRIu32 " times not 1 times as expected\n", + test_dtor_ran + ); rtems_test_exit(0); } } @@ -370,7 +392,10 @@ void test_delete_as_side_effect(void) rtems_task_wake_after( 100 ); if ( test_dtor_ran != 2 ) { - printf( "Test dtor ran %" PRIu32 " times not 2 times as expected\n", test_dtor_ran ); + printf( + "Test dtor ran %" PRIu32 " times not 2 times as expected\n", + test_dtor_ran + ); rtems_test_exit(0); } } diff --git a/testsuites/sptests/sp29/init.c b/testsuites/sptests/sp29/init.c index 5d9e10448d..c8c8dffd04 100644 --- a/testsuites/sptests/sp29/init.c +++ b/testsuites/sptests/sp29/init.c @@ -1,6 +1,4 @@ /* - * Test for rtems_semaphore_flush - * * 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. @@ -12,6 +10,7 @@ #include "config.h" #endif +#include #include rtems_task Init (rtems_task_argument argument); @@ -42,156 +41,192 @@ void startTask(rtems_id arg); rtems_task subtask (rtems_task_argument arg) { - rtems_status_code sc; - rtems_id sem = (rtems_id)arg; + rtems_status_code sc; + rtems_id sem = (rtems_id)arg; - for (;;) { - rtems_task_wake_after (ticksPerSecond * 2); + for (;;) { + rtems_task_wake_after (ticksPerSecond * 2); - sc = rtems_semaphore_release (sem); - if (sc != RTEMS_SUCCESSFUL) - printf ("%d: Can't release semaphore: %s\n", __LINE__, rtems_status_text (sc)); - } + sc = rtems_semaphore_release (sem); + if (sc != RTEMS_SUCCESSFUL) { + printf( + "%d: Can't release semaphore: %s\n", __LINE__, + rtems_status_text (sc) + ); + } + } } void startTask (rtems_id arg) { - rtems_id tid; - rtems_status_code sc; + rtems_id tid; + rtems_status_code sc; - sc = rtems_task_create (rtems_build_name ('S', 'R', 'V', 'A'), - RTEMS_MAXIMUM_PRIORITY - 1u, - RTEMS_MINIMUM_STACK_SIZE * 2, - RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0), - RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL, - &tid); - if (sc != RTEMS_SUCCESSFUL) { - printf ("Can't create task: %s\n", rtems_status_text (sc)); - rtems_task_suspend (RTEMS_SELF); - } - sc = rtems_task_start (tid, subtask, arg); - if (sc != RTEMS_SUCCESSFUL) { - printf ("Can't start task: %s\n", rtems_status_text (sc)); - rtems_task_suspend (RTEMS_SELF); - } + sc = rtems_task_create (rtems_build_name ('S', 'R', 'V', 'A'), + RTEMS_MAXIMUM_PRIORITY - 1u, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0), + RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL, + &tid + ); + if (sc != RTEMS_SUCCESSFUL) { + printf ("Can't create task: %s\n", rtems_status_text (sc)); + rtems_task_suspend (RTEMS_SELF); + } + sc = rtems_task_start (tid, subtask, arg); + if (sc != RTEMS_SUCCESSFUL) { + printf ("Can't start task: %s\n", rtems_status_text (sc)); + rtems_task_suspend (RTEMS_SELF); + } } rtems_task Init (rtems_task_argument ignored) { - int i; - rtems_id semrec, semnorec; - rtems_status_code sc; - rtems_interval then, now; + int i; + rtems_id semrec, semnorec; + rtems_status_code sc; + rtems_interval then, now; - puts( "*** SP29 - SIMPLE SEMAPHORE TEST ***" ); - puts( "This test only prints on errors." ); + puts( "*** SP29 - SIMPLE SEMAPHORE TEST ***" ); + puts( "This test only prints on errors." ); - ticksPerSecond = rtems_clock_get_ticks_per_second(); - if (ticksPerSecond <= 0) { - printf ("Invalid ticks per second: %" PRIdrtems_interval "\n", ticksPerSecond); - exit (1); - } - sc = rtems_semaphore_create (rtems_build_name ('S', 'M', 'r', 'c'), - 1, - RTEMS_PRIORITY|RTEMS_BINARY_SEMAPHORE|RTEMS_INHERIT_PRIORITY |RTEMS_NO_PRIORITY_CEILING|RTEMS_LOCAL, - 0, - &semrec); - if (sc != RTEMS_SUCCESSFUL) { - printf ("%d: Can't create recursive-lock semaphore: %s\n", __LINE__, rtems_status_text (sc)); - exit (1); - } - sc = rtems_semaphore_create (rtems_build_name ('S', 'M', 'n', 'c'), - 1, - RTEMS_PRIORITY|RTEMS_SIMPLE_BINARY_SEMAPHORE|RTEMS_NO_INHERIT_PRIORITY |RTEMS_NO_PRIORITY_CEILING|RTEMS_LOCAL, - 0, - &semnorec); - if (sc != RTEMS_SUCCESSFUL) { - printf ("%d: Can't create non-recursive-lock semaphore: %s\n", __LINE__, rtems_status_text (sc)); - exit (1); - } + ticksPerSecond = rtems_clock_get_ticks_per_second(); + if (ticksPerSecond <= 0) { + printf( + "Invalid ticks per second: %" PRIdrtems_interval "\n", + ticksPerSecond + ); + exit (1); + } + sc = rtems_semaphore_create (rtems_build_name ('S', 'M', 'r', 'c'), + 1, + RTEMS_PRIORITY|RTEMS_BINARY_SEMAPHORE|RTEMS_INHERIT_PRIORITY| \ + RTEMS_NO_PRIORITY_CEILING|RTEMS_LOCAL, + 0, + &semrec + ); + directive_failed( sc, "create recursive lock" ); - sc = rtems_semaphore_obtain (semrec, RTEMS_NO_WAIT, 0); - if (sc != RTEMS_SUCCESSFUL) { - printf ("%d: Can't obtain recursive-lock semaphore: %s\n", __LINE__, rtems_status_text (sc)); - } - sc = rtems_semaphore_obtain (semrec, RTEMS_NO_WAIT, 0); - if (sc != RTEMS_SUCCESSFUL) { - printf ("%d: Can't reobtain recursive-lock semaphore: %s\n", __LINE__, rtems_status_text (sc)); - } + sc = rtems_semaphore_create (rtems_build_name ('S', 'M', 'n', 'c'), + 1, + RTEMS_PRIORITY|RTEMS_SIMPLE_BINARY_SEMAPHORE|RTEMS_NO_INHERIT_PRIORITY| \ + RTEMS_NO_PRIORITY_CEILING|RTEMS_LOCAL, + 0, + &semnorec + ); + directive_failed( sc, "create non-recursive lock" ); - sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); - if (sc != RTEMS_SUCCESSFUL) { - printf ("%d: Can't obtain non-recursive-lock semaphore: %s\n", __LINE__, rtems_status_text (sc)); - } - sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); - if (sc == RTEMS_SUCCESSFUL) { - printf ("%d: Reobtain non-recursive-lock semaphore -- and should not have.\n", __LINE__); - } + sc = rtems_semaphore_obtain (semrec, RTEMS_NO_WAIT, 0); + directive_failed( sc, "obtain recursive lock" ); - sc = rtems_semaphore_release (semnorec); - if (sc != RTEMS_SUCCESSFUL) { - printf ("%d: Can't release non-recursive-lock semaphore: %s\n", __LINE__, rtems_status_text (sc)); - } - sc = rtems_semaphore_release (semnorec); - if (sc != RTEMS_SUCCESSFUL) { - printf ("%d: Can't rerelease non-recursive-lock semaphore: %s\n", __LINE__, rtems_status_text (sc)); - } - sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); - if (sc != RTEMS_SUCCESSFUL) { - printf ("%d: Can't obtain non-recursive-lock semaphore: %s\n", __LINE__, rtems_status_text (sc)); - } - sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); - if (sc == RTEMS_SUCCESSFUL) { - printf ("%d: Reobtain non-recursive-lock semaphore -- and should not have.\n", __LINE__); - } - else if (sc != RTEMS_UNSATISFIED) { - printf ("%d: Reobtain non-recursive-lock semaphore failed, but error is %d (%s), not RTEMS_UNSATISFIED.\n", __LINE__, sc, rtems_status_text (sc)); - } + sc = rtems_semaphore_obtain (semrec, RTEMS_NO_WAIT, 0); + directive_failed( sc, "reobtain recursive lock" ); - sc = rtems_semaphore_release (semnorec); - if (sc != RTEMS_SUCCESSFUL) { - printf ("%d: Can't release non-recursive-lock semaphore: %s\n", __LINE__, rtems_status_text (sc)); - } - sc = rtems_semaphore_release (semnorec); - if (sc != RTEMS_SUCCESSFUL) { - printf ("%d: Can't rerelease non-recursive-lock semaphore: %s\n", __LINE__, rtems_status_text (sc)); - } - sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); - if (sc != RTEMS_SUCCESSFUL) { - printf ("%d: Can't obtain non-recursive-lock semaphore: %s\n", __LINE__, rtems_status_text (sc)); - } - /* - * Since this task is holding this, this task will block and timeout. - * Then the timeout error will be returned. - */ - then = rtems_clock_get_ticks_since_boot(); - sc = rtems_semaphore_obtain (semnorec, RTEMS_WAIT, 5); - now = rtems_clock_get_ticks_since_boot(); - if (sc == RTEMS_SUCCESSFUL) { - printf ("%d: Reobtain non-recursive-lock semaphore -- and should not have.\n", __LINE__); - } - else if (sc != RTEMS_TIMEOUT) { - printf ("%d: Reobtain non-recursive-lock semaphore failed, but error is %d (%s), not RTEMS_TIMEOUT.\n", __LINE__, sc, rtems_status_text (sc)); - } - if ((then - now) < 4) - printf ("%d: Reobtain non-recursive-lock semaphore failed without timeout.\n", __LINE__); + sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); + directive_failed( sc, "reobtain recursive lock" ); - startTask (semnorec); - then = rtems_clock_get_ticks_since_boot(); - for (i = 0 ; i < 5 ; i++) { - rtems_interval diff; + sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); + if (sc == RTEMS_SUCCESSFUL) { + printf( + "%d: Reobtain non-recursive-lock semaphore -- and should not have.\n", + __LINE__ + ); + rtems_test_exit(1); + } - sc = rtems_semaphore_obtain (semnorec, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - now = rtems_clock_get_ticks_since_boot(); - diff = (now - then); - then = now; - if (sc != RTEMS_SUCCESSFUL) - printf ("%d: Failed to obtain non-recursive-lock semaphore: %s\n", __LINE__, rtems_status_text (sc)); - else if (diff < (int) (2 * ticksPerSecond)) - printf ("%d: Obtained obtain non-recursive-lock semaphore too quickly -- %" PRIdrtems_interval " ticks not %" PRIdrtems_interval " ticks\n", __LINE__, diff, (2 * ticksPerSecond) ); - } + sc = rtems_semaphore_release (semnorec); + directive_failed( sc, "release non-recursive lock" ); - puts( "*** END OF TEST 29 ***" ); - exit (0); + sc = rtems_semaphore_release (semnorec); + directive_failed( sc, "re-release non-recursive lock" ); + + sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); + directive_failed( sc, "obtain non-recursive lock" ); + + sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); + if (sc == RTEMS_SUCCESSFUL) { + printf( + "%d: Reobtain non-recursive-lock semaphore -- and should not have.\n", + __LINE__ + ); + } else if (sc != RTEMS_UNSATISFIED) { + printf( + "%d: Reobtain non-recursive-lock semaphore failed, but error is " + "%d (%s), not RTEMS_UNSATISFIED.\n", + __LINE__, + sc, + rtems_status_text (sc) + ); + } + + sc = rtems_semaphore_release (semnorec); + directive_failed( sc, "release non-recursive lock" ); + + sc = rtems_semaphore_release (semnorec); + directive_failed( sc, "rerelease non-recursive lock" ); + + sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); + directive_failed( sc, "obtain non-recursive lock" ); + + /* + * Since this task is holding this, this task will block and timeout. + * Then the timeout error will be returned. + */ + then = rtems_clock_get_ticks_since_boot(); + sc = rtems_semaphore_obtain (semnorec, RTEMS_WAIT, 5); + now = rtems_clock_get_ticks_since_boot(); + if (sc == RTEMS_SUCCESSFUL) { + printf( + "%d: Reobtain non-recursive-lock semaphore -- and should not have.\n", + __LINE__ + ); + } else if (sc != RTEMS_TIMEOUT) { + printf( + "%d: Reobtain non-recursive-lock semaphore failed, but error is " + "%d (%s), not RTEMS_TIMEOUT.\n", + __LINE__, + sc, + rtems_status_text (sc) + ); + } + if ((then - now) < 4) { + printf( + "%d: Reobtain non-recursive-lock semaphore failed without timeout.\n", + __LINE__ + ); + } + + startTask (semnorec); + then = rtems_clock_get_ticks_since_boot(); + for (i = 0 ; i < 5 ; i++) { + rtems_interval diff; + + sc = rtems_semaphore_obtain( + semnorec, + RTEMS_WAIT, + RTEMS_NO_TIMEOUT + ); + now = rtems_clock_get_ticks_since_boot(); + diff = (now - then); + then = now; + if (sc != RTEMS_SUCCESSFUL) { + printf( + "%d: Failed to obtain non-recursive-lock semaphore: %s\n", + __LINE__, + rtems_status_text (sc) + ); + } else if (diff < (int) (2 * ticksPerSecond)) { + printf( + "%d: Obtained obtain non-recursive-lock semaphore too quickly -- %" + PRIdrtems_interval " ticks not %" PRIdrtems_interval " ticks\n", + __LINE__, + diff, + (2 * ticksPerSecond) + ); + } + } + + puts( "*** END OF TEST 29 ***" ); + rtems_test_exit (0); } diff --git a/testsuites/sptests/sp31/task1.c b/testsuites/sptests/sp31/task1.c index f559395b62..41614f94c6 100644 --- a/testsuites/sptests/sp31/task1.c +++ b/testsuites/sptests/sp31/task1.c @@ -1,14 +1,5 @@ -/* Task_1 - * - * This routine serves as a test task. It verifies the basic task - * switching capabilities of the executive. - * - * Input parameters: - * argument - task argument - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-2009. +/* + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * Copyright (c) 2009 embedded brains GmbH. @@ -124,10 +115,14 @@ rtems_task Task_1( directive_failed( status, "rtems_timer_server_fire_after" ); status = rtems_timer_get_information( tmid, &info ); - printf( "Timer 1 scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", - info.start_time + info.initial ); - printf( "Timer Server scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", - schedule_time() ); + printf( + "Timer 1 scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", + info.start_time + info.initial + ); + printf( + "Timer Server scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", + schedule_time() + ); puts( "TA1 - rtems_task_wake_after - 1 second" ); status = rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() ); @@ -140,10 +135,14 @@ rtems_task Task_1( status = rtems_timer_get_information( tmid, &info ); directive_failed( status, "rtems_timer_get_information" ); - printf( "Timer 1 scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", - info.start_time + info.initial ); - printf( "Timer Server scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", - schedule_time() ); + printf( + "Timer 1 scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", + info.start_time + info.initial + ); + printf( + "Timer Server scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", + schedule_time() + ); rtems_test_assert( (info.start_time + info.initial) == schedule_time() ); puts( "TA1 - rtems_task_wake_after - 1 second" ); @@ -157,10 +156,14 @@ rtems_task Task_1( status = rtems_timer_get_information( tmid, &info ); directive_failed( status, "rtems_timer_get_information" ); - printf( "Timer 1 scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", - info.start_time + info.initial ); - printf( "Timer Server scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", - schedule_time() ); + printf( + "Timer 1 scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", + info.start_time + info.initial + ); + printf( + "Timer Server scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", + schedule_time() + ); rtems_test_assert( (info.start_time + info.initial) == schedule_time() ); puts( "TA1 - rtems_timer_cancel - timer 1" ); diff --git a/testsuites/sptests/sp32/init.c b/testsuites/sptests/sp32/init.c index 0b484a865b..9fbd715ef1 100644 --- a/testsuites/sptests/sp32/init.c +++ b/testsuites/sptests/sp32/init.c @@ -68,13 +68,14 @@ rtems_task Init( /* tabulate and print results */ for (loopy = 0; loopy < 5; loopy++) { printf( - "period %d: measured %" PRIdrtems_interval " tick(s), wanted %" PRIdrtems_interval "\n", - loopy, timestamps[loopy+1] - timestamps[loopy], - wantintervals[loopy] + "period %d: measured %" PRIdrtems_interval " tick(s), wanted %" + PRIdrtems_interval "\n", + loopy, + timestamps[loopy+1] - timestamps[loopy], + wantintervals[loopy] ); } - /* the end */ puts("*** END OF TEST 32 ***"); rtems_test_exit(0); } diff --git a/testsuites/sptests/sp33/init.c b/testsuites/sptests/sp33/init.c index 3dac704a53..3a865a800b 100644 --- a/testsuites/sptests/sp33/init.c +++ b/testsuites/sptests/sp33/init.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 1989-2009. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -174,8 +174,11 @@ rtems_task Init( status = rtems_barrier_release( Barrier, &released ); directive_failed(status, "rtems_barrier_release"); if ( released != 0 ) { - printf( "ERROR -- rtems_barrier_release -- released != 0, = %" PRIu32, released); - exit(0); + printf( + "ERROR -- rtems_barrier_release -- released != 0, = %" PRIu32, + released + ); + rtems_test_exit(0); } /* Create some tasks to wait for the barrier */ @@ -206,9 +209,12 @@ rtems_task Init( status = rtems_barrier_release( Barrier, &released ); directive_failed(status, "rtems_barrier_release"); if ( released != (CONFIGURE_MAXIMUM_TASKS-1) ) { - printf( "ERROR -- rtems_barrier_release -- released != %d, = %" PRIu32, - (CONFIGURE_MAXIMUM_TASKS-1), released); - exit(0); + printf( + "ERROR -- rtems_barrier_release -- released != %d, = %" PRIu32, + (CONFIGURE_MAXIMUM_TASKS-1), + released + ); + rtems_test_exit(0); } puts( "Delay to let Waiters print a message" ); diff --git a/testsuites/sptests/sp34/changepri.c b/testsuites/sptests/sp34/changepri.c index 41ef4672ea..b50711ca7d 100644 --- a/testsuites/sptests/sp34/changepri.c +++ b/testsuites/sptests/sp34/changepri.c @@ -80,7 +80,12 @@ rtems_task BlockingTasks(rtems_task_argument arg) status = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &opri); directive_failed( status, "rtems_task_set_priority" ); - printf("semaphore_obtain -- BlockingTask %" PRIdrtems_task_argument " @ pri=%" PRIdrtems_task_priority ") blocks\n", arg, opri); + printf( + "semaphore_obtain -- BlockingTask %" PRIdrtems_task_argument + " @ pri=%" PRIdrtems_task_priority ") blocks\n", + arg, + opri + ); status = rtems_semaphore_obtain(Semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT); directive_failed( status, "rtems_semaphore_obtain" ); @@ -88,7 +93,12 @@ rtems_task BlockingTasks(rtems_task_argument arg) status = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &npri); directive_failed( status, "rtems_task_set_priority" ); - printf("semaphore_obtain -- BlockingTask %" PRIdrtems_task_argument " @ pri=%" PRIdrtems_task_priority ") returns\n", arg, npri); + printf( + "semaphore_obtain -- BlockingTask %" PRIdrtems_task_argument + " @ pri=%" PRIdrtems_task_priority ") returns\n", + arg, + npri + ); (void) rtems_task_delete( RTEMS_SELF ); } @@ -108,8 +118,8 @@ rtems_task Init(rtems_task_argument ignored) status = rtems_semaphore_create( rtems_build_name ('S', 'E', 'M', '1'), /* name */ 0, /* initial count = 0 */ - RTEMS_LOCAL | - RTEMS_COUNTING_SEMAPHORE | + RTEMS_LOCAL | + RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY, 0, &Semaphore); /* *id */ @@ -161,7 +171,7 @@ rtems_task Init(rtems_task_argument ignored) /* exit the test */ puts( "*** END OF TEST 34 ***" ); - exit(0); + rtems_test_exit(0); } /* configuration information */ diff --git a/testsuites/sptests/sp36/strict_order_mut.c b/testsuites/sptests/sp36/strict_order_mut.c index 6a545623bd..e5f7a4e330 100644 --- a/testsuites/sptests/sp36/strict_order_mut.c +++ b/testsuites/sptests/sp36/strict_order_mut.c @@ -1,5 +1,7 @@ /* - * Simple test program to demonstrate strict order mutex + * 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$ */ @@ -15,8 +17,9 @@ #include "tmacros.h" #include -#define BACK_TYPE(_type_in_ptr,_type_out,_type_in_name) \ - ((_type_out *)((unsigned int)_type_in_ptr - (unsigned int)(&((_type_out *)0)->_type_in_name))) +#define BACK_TYPE(_type_in_ptr,_type_out,_type_in_name) \ + ((_type_out *)((unsigned int)_type_in_ptr - \ + (unsigned int)(&((_type_out *)0)->_type_in_name))) /* configuration information */ @@ -31,22 +34,17 @@ #define CONFIGURE_MAXIMUM_TASKS 10 #define CONFIGURE_MAXIMUM_SEMAPHORES 10 - -void p_mutex_chain(Thread_Control *the_thread); rtems_task Task0(rtems_task_argument ignored); rtems_task Task1(rtems_task_argument ignored); rtems_task Init(rtems_task_argument ignored); rtems_task_priority Get_current_pri(void); - #include - - -rtems_id Task_id[4]; +rtems_id Task_id[4]; rtems_name Task_name[4]; -rtems_id Mutex_id[4]; +rtems_id Mutex_id[4]; rtems_name Mutex_name[4]; rtems_task Init(rtems_task_argument ignored) @@ -56,25 +54,27 @@ rtems_task Init(rtems_task_argument ignored) Mutex_name[0] = rtems_build_name( 'S','0',' ',' '); status = rtems_semaphore_create( - Mutex_name[0], - 1, - RTEMS_LOCAL| - RTEMS_SIMPLE_BINARY_SEMAPHORE| - RTEMS_PRIORITY, - 0, - &Mutex_id[0]); + Mutex_name[0], + 1, + RTEMS_LOCAL| + RTEMS_SIMPLE_BINARY_SEMAPHORE| + RTEMS_PRIORITY, + 0, + &Mutex_id[0] + ); directive_failed( status, "rtems_semaphore_create of S0"); printf("Create S0, Inherit_priority\n"); Mutex_name[1] = rtems_build_name( 'S','1',' ',' '); status = rtems_semaphore_create( - Mutex_name[1], - 1, - RTEMS_LOCAL| - RTEMS_SIMPLE_BINARY_SEMAPHORE| - RTEMS_PRIORITY, - 1, - &Mutex_id[1]); + Mutex_name[1], + 1, + RTEMS_LOCAL| + RTEMS_SIMPLE_BINARY_SEMAPHORE| + RTEMS_PRIORITY, + 1, + &Mutex_id[1] + ); directive_failed( status, "rtems_semaphore_create of S1"); printf("Create S1, Priority_celling is 1\n"); @@ -83,18 +83,16 @@ rtems_task Init(rtems_task_argument ignored) Task_name[0] = rtems_build_name( 'T','0',' ',' '); status = rtems_task_create( - Task_name[0], - 4, - RTEMS_MINIMUM_STACK_SIZE *2, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[0] - ); + Task_name[0], + 4, + RTEMS_MINIMUM_STACK_SIZE *2, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[0] + ); directive_failed( status,"rtems_task_create of T0"); printf("Create T0,priority is 4\n"); - - status = rtems_task_start( Task_id[0],Task0, 0); directive_failed( status,"rtems_task_start of T0"); @@ -107,19 +105,12 @@ rtems_task Task0(rtems_task_argument ignored) { rtems_status_code status; - - status = rtems_semaphore_obtain( - Mutex_id[0], - RTEMS_WAIT, - 0); + status = rtems_semaphore_obtain( Mutex_id[0], RTEMS_WAIT, 0 ); printf("T0 rtems_semaphore_obtain - S0\n"); directive_failed( status,"rtems_semaphore_obtain of S0\n"); printf("The current priority of T0 is %d\n",Get_current_pri()); - status = rtems_semaphore_obtain( - Mutex_id[1], - RTEMS_WAIT, - 0); + status = rtems_semaphore_obtain( Mutex_id[1], RTEMS_WAIT, 0 ); printf("T0 rtems_semaphore_obtain - S1\n"); directive_failed( status,"rtems_semaphore_obtain of S1"); printf("The current priority of T0 is %d\n",Get_current_pri()); @@ -136,20 +127,18 @@ rtems_task Task0(rtems_task_argument ignored) directive_failed( status,"rtems_semaphore_release of S1\n"); printf("The current priority of T0 is %d\n",Get_current_pri()); - Task_name[1] = rtems_build_name( 'T','1',' ',' '); status = rtems_task_create( - Task_name[1], - 1, - RTEMS_MINIMUM_STACK_SIZE *2, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[1] - ); + Task_name[1], + 1, + RTEMS_MINIMUM_STACK_SIZE *2, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[1] + ); directive_failed( status , "rtems_task_create of T1\n"); printf("Create S1,priority is 1\n"); - status = rtems_task_start( Task_id[1],Task1, 0); directive_failed( status, "rtems_task_start of T1\n"); @@ -158,50 +147,22 @@ rtems_task Task0(rtems_task_argument ignored) status = rtems_semaphore_release(Mutex_id[0]); printf("T0 - rtems_semaphore_release - S0\n"); directive_failed( status, "rtems_semaphore_release of S0\n"); - } - rtems_task Task1(rtems_task_argument ignored) { - rtems_status_code status; - status = rtems_semaphore_obtain( - Mutex_id[0], - RTEMS_WAIT, - 0); + status = rtems_semaphore_obtain( Mutex_id[0], RTEMS_WAIT, 0 ); printf("T1 - rtems_semaphore_obtain - S0"); directive_failed( status," rtems_semaphore_obtain S0"); } - rtems_task_priority Get_current_pri(void) { rtems_status_code status; rtems_task_priority pri; - status = rtems_task_set_priority(RTEMS_SELF, - RTEMS_CURRENT_PRIORITY, - &pri); + + status = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &pri); directive_failed( status, " rtems_task_set_priority "); return pri; } - -/*void p_mutex_chain(Thread_Control *the_thread) -{ - Chain_Control *con = &the_thread->lock_mutex; - Chain_Node * node = con->first; - CORE_mutex_Control * p_mutex ; - - if(!_Chain_Is_empty(&the_thread->lock_mutex)){ - while(node != _Chain_Tail(con)){ - p_mutex = BACK_TYPE(node,CORE_mutex_Control,queue); - printf("node:Id=%p,priority_before=%d," - "holder_id=%d,holder's current priority=%d\n",node, - ((CORE_mutex_order_list *)node)->priority_before,p_mutex->holder_id,p_mutex->holder->current_priority); - node = node->next; - } - } - else - printf("the Chain is empty\n"); -} -*/ diff --git a/testsuites/sptests/sp37/init.c b/testsuites/sptests/sp37/init.c index 824e2739ed..f62404a4fb 100644 --- a/testsuites/sptests/sp37/init.c +++ b/testsuites/sptests/sp37/init.c @@ -2,7 +2,7 @@ * Interrupt Disable/Enable Tests * Clock Tick from task level * - * COPYRIGHT (c) 1989-2009. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -48,8 +48,9 @@ rtems_timer_service_routine test_isr_in_progress( void test_interrupt_inline(void) { rtems_interrupt_level level; - rtems_attribute level_attribute, level_attribute_macro; - bool in_isr; + rtems_attribute level_attribute; + rtems_attribute level_attribute_macro; + bool in_isr; puts( "interrupt is in progress (use body)" ); in_isr = rtems_interrupt_is_in_progress(); @@ -250,7 +251,9 @@ rtems_task Init( } switch ( blocked_task_status ) { case -1: - puts( "clock_tick with task preempt -- task blocked, timer did not fire" ); + puts( + "clock_tick with task preempt -- task blocked, timer did not fire" + ); rtems_test_exit(0); break; case 1: @@ -316,7 +319,6 @@ rtems_task Init( check_isr_worked( "body", isr_in_progress_body ); - puts( "*** END OF TEST 37 ***" ); rtems_test_exit( 0 ); } diff --git a/testsuites/sptests/sp43/init.c b/testsuites/sptests/sp43/init.c index 18a3164b3d..6c90b9439c 100644 --- a/testsuites/sptests/sp43/init.c +++ b/testsuites/sptests/sp43/init.c @@ -1,7 +1,7 @@ /* * Exercise Object Manager Services * - * COPYRIGHT (c) 1989-2009. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -60,7 +60,8 @@ void print_class_info( { printf( "%s API %s Information\n" - " minimum id : 0x%08" PRIxrtems_id " maximum id: 0x%08" PRIxrtems_id "\n" + " minimum id : 0x%08" PRIxrtems_id + " maximum id: 0x%08" PRIxrtems_id "\n" " maximum : %7" PRIu32 " available : %" PRIu32 "\n" " auto_extend : %s\n", rtems_object_get_api_name(api), diff --git a/testsuites/sptests/sp44/init.c b/testsuites/sptests/sp44/init.c index 057a3a635d..5430de85c5 100644 --- a/testsuites/sptests/sp44/init.c +++ b/testsuites/sptests/sp44/init.c @@ -1,30 +1,10 @@ /* - * Original version submitted as part of PR1212 + * Original version submitted as part of PR1212 * - * This example shows a possible blocking of timeslicing if task mode is - * changed to timeslicing in the middle of its executing. + * This example shows a possible blocking of timeslicing if task mode is + * changed to timeslicing in the middle of its executing. * - * The expected output is: - * - * Task #0's turn. Now setting turn to 1 - * Task #1's turn. Now setting turn to 0 - * Task #0's turn. Now setting turn to 1 - * Task #1's turn. Now setting turn to 0 - * Task #0's turn. Now setting turn to 1 - * Task #1's turn. Now setting turn to 0 - * Task #0's turn. Now setting turn to 1 - * ... - * - * The actural output is: - * - * Task #0's turn. Now setting turn to 1 - * - * Task #1 can not be dispatched also both tasks have timeslice enabled. - * - * Setting TASK_A/B_INITMODE to RTEMS_DEFAULT_MODES | RTEMS_TIMESLICE - * will produce the expected output. - * - * $Id$ + * $Id$ */ #ifdef HAVE_CONFIG_H @@ -40,7 +20,7 @@ rtems_task Init(rtems_task_argument ignored); rtems_task TaskAB_entry(rtems_task_argument me); /*** Task priorities ***/ -#define TASK_A_PRIORITY 10 +#define TASK_A_PRIORITY 10 #define TASK_B_PRIORITY 10 /*** Task names ***/ @@ -60,12 +40,6 @@ rtems_task TaskAB_entry(rtems_task_argument me); volatile uint32_t turn; rtems_id TaskA_id, TaskB_id; -#define TEST_FAILED(_status, _msg) \ - do { \ - printf("Test failed, status code: %d, msg: %s\n", _status, _msg); \ - exit(1); \ - } while(0) - /* TASK A/B */ rtems_task TaskAB_entry(rtems_task_argument me) { @@ -73,15 +47,21 @@ rtems_task TaskAB_entry(rtems_task_argument me) rtems_status_code status; uint32_t iterations = 0; - status = rtems_task_mode(RTEMS_PREEMPT | RTEMS_TIMESLICE, - RTEMS_PREEMPT_MASK | RTEMS_TIMESLICE_MASK, - &previous_mode_set); - if (status != RTEMS_SUCCESSFUL) - TEST_FAILED(status, "Unable to change task mode."); + status = rtems_task_mode( + RTEMS_PREEMPT | RTEMS_TIMESLICE, + RTEMS_PREEMPT_MASK | RTEMS_TIMESLICE_MASK, + &previous_mode_set + ); + directive_failed(status, "Unable to change task mode."); while(1) { if (turn == me) { - printf("Task #%" PRIdrtems_task_argument "'s turn. Now setting turn to %" PRIdrtems_task_argument "\n", me, 1 - me); + printf( + "Task #%" PRIdrtems_task_argument "'s turn. Now setting turn to %" + PRIdrtems_task_argument "\n", + me, + 1 - me + ); turn = 1 - me; if ( ++iterations == 10 ) { @@ -99,37 +79,42 @@ rtems_task Init(rtems_task_argument ignored) puts( "\n\n*** SP44 TEST ***" ); /* Create Task A */ - status = rtems_task_create(TASK_A_NAME, TASK_A_PRIORITY, TASK_A_STACKSIZE, - TASK_A_INITMODE, TASK_A_MODEATTR, &TaskA_id); - - if (status != RTEMS_SUCCESSFUL) - TEST_FAILED(status,"rtems_task_create failed.\n"); + status = rtems_task_create( + TASK_A_NAME, + TASK_A_PRIORITY, + TASK_A_STACKSIZE, + TASK_A_INITMODE, + TASK_A_MODEATTR, + &TaskA_id + ); + directive_failed(status,"rtems_task_create"); /* Start Task A */ status = rtems_task_start(TaskA_id, TaskAB_entry, 0); - if (status != RTEMS_SUCCESSFUL) - TEST_FAILED(status,"rtems_task_start failed.\n"); + directive_failed(status,"rtems_task_start"); /* Create Task B */ - status = rtems_task_create(TASK_B_NAME, TASK_B_PRIORITY, TASK_B_STACKSIZE, - TASK_B_INITMODE, TASK_B_MODEATTR, &TaskB_id); - - if (status != RTEMS_SUCCESSFUL) - TEST_FAILED(status,"rtems_task_create failed.\n"); + status = rtems_task_create( + TASK_B_NAME, + TASK_B_PRIORITY, + TASK_B_STACKSIZE, + TASK_B_INITMODE, + TASK_B_MODEATTR, + &TaskB_id + ); + directive_failed( status, "rtems_task_create" ); /* Start Task B */ status = rtems_task_start(TaskB_id, TaskAB_entry, 1); - if (status != RTEMS_SUCCESSFUL) - TEST_FAILED(status,"rtems_task_start failed.\n"); + directive_failed( status, "rtems_task_start" ); /* Suspend itself */ status = rtems_task_suspend(RTEMS_SELF); - if (status != RTEMS_SUCCESSFUL) - TEST_FAILED(status,"rtems_task_suspend failed.\n"); + directive_failed( status, "rtems_task_suspend" ); /* This task is not suposed to be executed anymore */ printf("\nNOT SUPOSED TO RETURN HERE...\n"); - exit(1); + rtems_test_exit(1); } /* configuration information */ diff --git a/testsuites/sptests/sp48/init.c b/testsuites/sptests/sp48/init.c index 4ba99002e8..09b6b97bd4 100644 --- a/testsuites/sptests/sp48/init.c +++ b/testsuites/sptests/sp48/init.c @@ -1,7 +1,7 @@ /* * Verify creation of semaphores with unlimited attribute works. * - * COPYRIGHT (c) 1989-2009. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -31,7 +31,10 @@ rtems_task Init(rtems_task_argument ignored) puts( "\n\n*** TEST 48 ***" ); - printf( "Largest C program heap block available: %zu\n", malloc_free_space() ); + printf( + "Largest C program heap block available: %zu\n", + malloc_free_space() + ); for (i=0 ; i Fatal Extension is internal set to TRUE expected FALSE\n" ); + printk( + "ERROR==> Fatal Extension is internal set to TRUE expected FALSE\n" + ); else - printk( "ERROR==> Fatal Extension is internal set to FALSE expected TRUE\n" ); + printk( + "ERROR==> Fatal Extension is internal set to FALSE expected TRUE\n" + ); } if ( error != FATAL_ERROR_EXPECTED_ERROR ) {