From 3d2bf71da0b60faa35034580dc4fd53948f63f53 Mon Sep 17 00:00:00 2001 From: Glenn Humphrey Date: Thu, 18 Oct 2007 19:36:29 +0000 Subject: 2007-10-18 Glenn Humphrey * sptests/sp09/sp09.scn, sptests/sp09/sptest.adb, sptests/sp13/sp13.scn, sptests/sp13/sptest.adb, sptests/sp16/sp16.scn, sptests/sp16/sptest.adb, sptests/sp16/sptest.ads, sptests/sp20/sp20.scn, sptests/sp20/sptest.adb, sptests/sp20/sptest.ads: Updated tests to match the current C tests and regenerated the .scn files. --- c/src/ada-tests/ChangeLog | 9 ++ c/src/ada-tests/sptests/sp09/sp09.scn | 11 ++ c/src/ada-tests/sptests/sp09/sptest.adb | 132 ++++++++++++++++++++++ c/src/ada-tests/sptests/sp13/sp13.scn | 12 ++ c/src/ada-tests/sptests/sp13/sptest.adb | 189 ++++++++++++++++++++++++++++++-- c/src/ada-tests/sptests/sp16/sp16.scn | 48 ++++---- c/src/ada-tests/sptests/sp16/sptest.adb | 116 +++++++++++++++++++- c/src/ada-tests/sptests/sp16/sptest.ads | 7 +- c/src/ada-tests/sptests/sp20/sp20.scn | 13 +++ c/src/ada-tests/sptests/sp20/sptest.adb | 58 ++++++++-- c/src/ada-tests/sptests/sp20/sptest.ads | 24 ++-- 11 files changed, 566 insertions(+), 53 deletions(-) (limited to 'c/src/ada-tests') diff --git a/c/src/ada-tests/ChangeLog b/c/src/ada-tests/ChangeLog index 3d76f483ab..c5939f59e8 100644 --- a/c/src/ada-tests/ChangeLog +++ b/c/src/ada-tests/ChangeLog @@ -1,3 +1,12 @@ +2007-10-18 Glenn Humphrey + + * sptests/sp09/sp09.scn, sptests/sp09/sptest.adb, + sptests/sp13/sp13.scn, sptests/sp13/sptest.adb, + sptests/sp16/sp16.scn, sptests/sp16/sptest.adb, + sptests/sp16/sptest.ads, sptests/sp20/sp20.scn, + sptests/sp20/sptest.adb, sptests/sp20/sptest.ads: Updated tests to + match the current C tests and regenerated the .scn files. + 2007-10-10 Glenn Humphrey * configure.ac, samples/base_sp/base_sp.scn, samples/base_sp/config.h, diff --git a/c/src/ada-tests/sptests/sp09/sp09.scn b/c/src/ada-tests/sptests/sp09/sp09.scn index 2c38d7c0b1..8fb09cd35a 100644 --- a/c/src/ada-tests/sptests/sp09/sp09.scn +++ b/c/src/ada-tests/sptests/sp09/sp09.scn @@ -101,6 +101,7 @@ TA1 - message_queue_create - Q 2 - TOO_MANY TA1 - message_queue_delete - unknown INVALID_ID TA1 - message_queue_delete - local INVALID_ID TA1 - message_queue_ident - INVALID_NAME +TA1 - message_queue_get_number_pending - INVALID_ID TA1 - message_queue_flush - INVALID_ID TA1 - message_queue_receive - INVALID_ID TA1 - message_queue_receive - Q 1 - UNSATISFIED @@ -236,4 +237,14 @@ TA1 - timer_fire_after - INVALID_NUMBER TA1 - timer_fire_when - 8:30:45 2/ 5/1987 - INVALID_CLOCK TA1 - clock_get - 0: 0: 0 1/ 1/1992 TA1 - timer_fire_when - 8:30:45 2/ 5/1990 - before INVALID_CLOCK +TA1 - timer_server_fire_after - INCORRECT_STATE +TA1 - timer_server_fire_when - INCORRECT_STATE +TA1 - timer_initiate_server - INVALID_PRIORITY +TA1 - timer_initiate_server +TA1 - timer_server_fire_after - INVALID_ID +TA1 - timer_server_fire_when - INVALID_ID +TA1 - timer_server_fire_after - INVALID_NUMBER +TA1 - timer_server_fire_when - 8:30:45 2/ 5/1987 - INVALID_CLOCK +TA1 - clock_get - 0: 0: 0 1/ 1/1992 +TA1 - timer_server_fire_when - 8:30:45 2/ 5/1990 - before INVALID_CLOCK *** END OF TEST 9 *** diff --git a/c/src/ada-tests/sptests/sp09/sptest.adb b/c/src/ada-tests/sptests/sp09/sptest.adb index d2d6429663..63f1591eb6 100644 --- a/c/src/ada-tests/sptests/sp09/sptest.adb +++ b/c/src/ada-tests/sptests/sp09/sptest.adb @@ -1317,6 +1317,14 @@ package body SPTEST is ); TEXT_IO.PUT_LINE( "TA1 - message_queue_ident - INVALID_NAME" ); + RTEMS.MESSAGE_QUEUE_GET_NUMBER_PENDING( 100, COUNT, STATUS ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.INVALID_ID, + "MESSAGE_QUEUE_GET_NUMBER_PENDING WITH ILLEGAL ID" + ); + TEXT_IO.PUT_LINE( "TA1 - message_queue_get_number_pending - INVALID_ID" ); + RTEMS.MESSAGE_QUEUE_FLUSH( 100, COUNT, STATUS ); TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( STATUS, @@ -2882,6 +2890,130 @@ package body SPTEST is ); TEXT_IO.NEW_LINE; + RTEMS.TIMER_SERVER_FIRE_AFTER( + 0, 5, SPTEST.DELAYED_SUBPROGRAM'ACCESS, RTEMS.NULL_ADDRESS, STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.INCORRECT_STATE, + "TIMER_SERVER_FIRE_AFTER INCORRECT STATE" + ); + TEXT_IO.PUT_LINE( "TA1 - timer_server_fire_after - INCORRECT_STATE" ); + + RTEMS.TIMER_SERVER_FIRE_WHEN( + 0, TIME, SPTEST.DELAYED_SUBPROGRAM'ACCESS, RTEMS.NULL_ADDRESS, STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.INCORRECT_STATE, + "TIMER_SERVER_FIRE_WHEN INCORRECT STATE" + ); + TEXT_IO.PUT_LINE( "TA1 - timer_server_fire_when - INCORRECT_STATE" ); + + RTEMS.timer_initiate_server( 0, 0, 0, STATUS ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.INVALID_PRIORITY, + "timer_initiate_server invalid priority" + ); + TEXT_IO.PUT_LINE( "TA1 - timer_initiate_server - INVALID_PRIORITY" ); + + RTEMS.timer_initiate_server( +-- XXX ask Joel +-- RTEMS.TIMER_SERVER_DEFAULT_PRIORITY, 0, 0, STATUS + -1, 0, 0, STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "timer_initiate_server" ); + TEXT_IO.PUT_LINE( "TA1 - timer_initiate_server" ); + + RTEMS.TIMER_SERVER_FIRE_AFTER( + 16#010100#, + 5 * TEST_SUPPORT.TICKS_PER_SECOND, + SPTEST.DELAYED_SUBPROGRAM'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.INVALID_ID, + "TIMER_SERVER_FIRE_AFTER ILLEGAL ID" + ); + TEXT_IO.PUT_LINE( "TA1 - timer_server_fire_after - INVALID_ID" ); + + TIME := ( 1994, 12, 31, 9, 0, 0, 0 ); + RTEMS.TIMER_SERVER_FIRE_WHEN( + 16#010100#, + TIME, + SPTEST.DELAYED_SUBPROGRAM'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.INVALID_ID, + "TIMER_SERVER_FIRE_WHEN WITH ILLEGAL ID" + ); + TEXT_IO.PUT_LINE( "TA1 - timer_server_fire_when - INVALID_ID" ); + + RTEMS.TIMER_SERVER_FIRE_AFTER( + SPTEST.TIMER_ID( 1 ), + 0, + SPTEST.DELAYED_SUBPROGRAM'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.INVALID_NUMBER, + "TIMER_SERVER_FIRE_AFTER WITH 0 TICKS" + ); + TEXT_IO.PUT_LINE( "TA1 - timer_server_fire_after - INVALID_NUMBER" ); + + TIME := ( 1987, 2, 5, 8, 30, 45, 0 ); + RTEMS.TIMER_SERVER_FIRE_WHEN( + SPTEST.TIMER_ID( 1 ), + TIME, + SPTEST.DELAYED_SUBPROGRAM'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.INVALID_CLOCK, + "TIMER_SERVER_FIRE_WHEN WITH ILLEGAL TIME" + ); + TEST_SUPPORT.PRINT_TIME( + "TA1 - timer_server_fire_when - ", + TIME, + " - INVALID_CLOCK" + ); + TEXT_IO.NEW_LINE; + + RTEMS.CLOCK_GET( RTEMS.CLOCK_GET_TOD, TIME'ADDRESS, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "clock_set" ); + TEST_SUPPORT.PRINT_TIME( "TA1 - clock_get - ", TIME, "" ); + TEXT_IO.NEW_LINE; + + TIME := ( 1990, 2, 5, 8, 30, 45, 0 ); + RTEMS.TIMER_SERVER_FIRE_WHEN( + SPTEST.TIMER_ID( 1 ), + TIME, + SPTEST.DELAYED_SUBPROGRAM'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.INVALID_CLOCK, + "TIMER_SERVER_FIRE_WHEN BEFORE CURRENT TIME" + ); + TEST_SUPPORT.PRINT_TIME( + "TA1 - timer_server_fire_when - ", + TIME, + " - before INVALID_CLOCK" + ); + TEXT_IO.NEW_LINE; + end SCREEN_14; --PAGE diff --git a/c/src/ada-tests/sptests/sp13/sp13.scn b/c/src/ada-tests/sptests/sp13/sp13.scn index 3ca2ba7c2b..f54a497a58 100644 --- a/c/src/ada-tests/sptests/sp13/sp13.scn +++ b/c/src/ada-tests/sptests/sp13/sp13.scn @@ -52,10 +52,16 @@ TA1 - buffer received: BUFFER 3 TO Q 2 TA1 - message_queue_delete - delete queue 1 TA1 - message_queue_urgent - BUFFER 3 TO Q 2 TA1 - message_queue_delete - delete queue 2 +TA1 - message_queue_get_number_pending - check Q 3 +TA1 - 0 messages are pending on Q 3 TA1 - message_queue_flush - empty Q 3 TA1 - 0 messages were flushed from Q 3 TA1 - message_queue_send - BUFFER 1 TO Q 3 TA1 - message_queue_send - BUFFER 2 TO Q 3 +TA1 - message_queue_broadcast - NO BUFFER TO Q1 +TA1 - number of tasks awakened = 0 +TA1 - message_queue_get_number_pending - check Q 3 +TA1 - 2 messages are pending on Q 3 TA1 - message_queue_send - BUFFER 3 TO Q 3 TA1 - message_queue_flush - Q 3 TA1 - 3 messages were flushed from Q 3 @@ -63,4 +69,10 @@ TA1 - message_queue_send - until all message buffers consumed TA1 - message_queue_send - all message buffers consumed TA1 - message_queue_flush - Q 3 TA1 - 100 messages were flushed from Q 3 + +TA1 - create message queue of 20 bytes on queue 1 +TA1 - message_queue_delete - delete queue 1 + +TA1 - message_queue_create - variable sizes +TA1 - message_queue_create and send - variable sizes *** END OF TEST 13 *** diff --git a/c/src/ada-tests/sptests/sp13/sptest.adb b/c/src/ada-tests/sptests/sp13/sptest.adb index 568b7541af..5b631ffea6 100644 --- a/c/src/ada-tests/sptests/sp13/sptest.adb +++ b/c/src/ada-tests/sptests/sp13/sptest.adb @@ -25,9 +25,13 @@ with RTEMS; with TEST_SUPPORT; with TEXT_IO; with UNSIGNED32_IO; +use type RTEMS.STATUS_CODES; package body SPTEST is + type BIG_BUFFER_TYPE is array (1 .. 2048) of RTEMS.UNSIGNED8; + + --PAGE -- -- INIT @@ -216,16 +220,19 @@ package body SPTEST is procedure TASK_1 ( ARGUMENT : in RTEMS.TASK_ARGUMENT ) is - QID : RTEMS.ID; - BUFFER : SPTEST.BUFFER; - BUFFER_POINTER : RTEMS.ADDRESS; - COUNT : RTEMS.UNSIGNED32; - MESSAGE_SIZE : RTEMS.UNSIGNED32; - STATUS : RTEMS.STATUS_CODES; + QID : RTEMS.ID; + BIG_SEND_BUFFER : BIG_BUFFER_TYPE; + BIG_SEND_BUFFER_POINTER : RTEMS.ADDRESS := BIG_SEND_BUFFER'ADDRESS; + BIG_RECEIVE_BUFFER : BIG_BUFFER_TYPE; + BIG_RECEIVE_BUFFER_POINTER : RTEMS.ADDRESS := BIG_RECEIVE_BUFFER'ADDRESS; + BUFFER : SPTEST.BUFFER; + BUFFER_POINTER : RTEMS.ADDRESS := BUFFER'ADDRESS; + COUNT : RTEMS.UNSIGNED32; + MESSAGE_SIZE : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + SIZE : RTEMS.UNSIGNED32; begin - BUFFER_POINTER := BUFFER'ADDRESS; - RTEMS.MESSAGE_QUEUE_IDENT( SPTEST.QUEUE_NAME( 1 ), RTEMS.SEARCH_ALL_NODES, @@ -431,6 +438,17 @@ TEST_SUPPORT.PAUSE; RTEMS.MESSAGE_QUEUE_DELETE( SPTEST.QUEUE_ID( 2 ), STATUS ); TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_DELETE" ); + TEXT_IO.PUT_LINE( "TA1 - message_queue_get_number_pending - check Q 3" ); + RTEMS.MESSAGE_QUEUE_GET_NUMBER_PENDING( + SPTEST.QUEUE_ID( 3 ), COUNT, STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( + STATUS, "MESSAGE_QUEUE_GET_NUMBER_PENDING" + ); + TEXT_IO.PUT( "TA1 - " ); + UNSIGNED32_IO.PUT( COUNT, WIDTH => 3, BASE => 10 ); + TEXT_IO.PUT_LINE( " messages are pending on Q 3" ); + TEXT_IO.PUT_LINE( "TA1 - message_queue_flush - empty Q 3" ); RTEMS.MESSAGE_QUEUE_FLUSH( SPTEST.QUEUE_ID( 3 ), COUNT, STATUS ); TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_FLUSH" ); @@ -458,6 +476,31 @@ TEST_SUPPORT.PAUSE; ); TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" ); + -- this broadcast should have no effect on the queue + SPTEST.FIlL_BUFFER( "NO BUFFER TO Q1 ", BUFFER ); + TEXT_IO.PUT_LINE( "TA1 - message_queue_broadcast - NO BUFFER TO Q1" ); + RTEMS.MESSAGE_QUEUE_BROADCAST( + SPTEST.QUEUE_ID( 1 ), + BUFFER_POINTER, + 16, + COUNT, + STATUS + ); + TEXT_IO.PUT( "TA1 - number of tasks awakened = " ); + UNSIGNED32_IO.PUT( COUNT, WIDTH => 3, BASE => 10 ); + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT_LINE( "TA1 - message_queue_get_number_pending - check Q 3" ); + RTEMS.MESSAGE_QUEUE_GET_NUMBER_PENDING( + SPTEST.QUEUE_ID( 3 ), COUNT, STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( + STATUS, "MESSAGE_QUEUE_GET_NUMBER_PENDING" + ); + TEXT_IO.PUT( "TA1 - " ); + UNSIGNED32_IO.PUT( COUNT, WIDTH => 3, BASE => 10 ); + TEXT_IO.PUT_LINE( " messages are pending on Q 3" ); + SPTEST.FILL_BUFFER( "BUFFER 3 TO Q 3 ", BUFFER ); TEXT_IO.PUT_LINE( "TA1 - message_queue_send - BUFFER 3 TO Q 3" ); RTEMS.MESSAGE_QUEUE_SEND( @@ -503,7 +546,137 @@ TEST_SUPPORT.PAUSE; TEXT_IO.PUT( "TA1 - " ); UNSIGNED32_IO.PUT( COUNT, WIDTH => 3, BASE => 10 ); TEXT_IO.PUT_LINE( " messages were flushed from Q 3" ); + +TEST_SUPPORT.PAUSE; + TEXT_IO.PUT_LINE( "TA1 - create message queue of 20 bytes on queue 1" ); + RTEMS.MESSAGE_QUEUE_CREATE( + SPTEST.QUEUE_NAME( 1 ), + 100, + 20, + RTEMS.DEFAULT_ATTRIBUTES, + SPTEST.QUEUE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( + STATUS, "MESSAGE_QUEUE_CREATE of Q1; 20 bytes each" + ); + RTEMS.MESSAGE_QUEUE_SEND( + SPTEST.QUEUE_ID( 1 ), BIG_SEND_BUFFER_POINTER, 40, STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, RTEMS.INVALID_SIZE, "expected INVALID_SIZE" + ); + + TEXT_IO.PUT_LINE( "TA1 - message_queue_delete - delete queue 1" ); + RTEMS.MESSAGE_QUEUE_DELETE( SPTEST.QUEUE_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_DELETE" ); + +TEST_SUPPORT.PAUSE; + + TEXT_IO.PUT_LINE( "TA1 - message_queue_create - variable sizes " ); + for QUEUE_SIZE in 1 .. 1029 loop + RTEMS.MESSAGE_QUEUE_CREATE( + SPTEST.QUEUE_NAME( 1 ), + 2, -- just 2 msgs each + RTEMS.UNSIGNED32( QUEUE_SIZE ), + RTEMS.DEFAULT_ATTRIBUTES, + QUEUE_ID( 1 ), + STATUS + ); + if STATUS /= RTEMS.SUCCESSFUL then + TEXT_IO.PUT( "TA1 - msq que size: " ); + UNSIGNED32_IO.PUT( + RTEMS.UNSIGNED32( QUEUE_SIZE ), WIDTH => 3, BASE => 10 + ); + TEXT_IO.NEW_LINE; + TEST_SUPPORT.DIRECTIVE_FAILED( + STATUS, "message_queue_create of Q1" + ); + end if; + + RTEMS.MESSAGE_QUEUE_DELETE( SPTEST.QUEUE_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "message_queue_delete" ); + end loop; + + TEXT_IO.PUT_LINE( + "TA1 - message_queue_create and send - variable sizes " + ); + for QUEUE_SIZE in 1 .. 1029 loop + + RTEMS.MESSAGE_QUEUE_CREATE( + SPTEST.QUEUE_NAME( 1 ), + 2, -- just 2 msgs each + RTEMS.UNSIGNED32( QUEUE_SIZE ), + RTEMS.DEFAULT_ATTRIBUTES, + SPTEST.QUEUE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( status, "message_queue_create of Q1" ); + + BIG_SEND_BUFFER := (others => CHARACTER'POS( 'A' )); + BIG_RECEIVE_BUFFER := (others => CHARACTER'POS( 'Z' )); + + -- send a msg too big + RTEMS.MESSAGE_QUEUE_SEND( + SPTEST.QUEUE_ID( 1 ), + BIG_SEND_BUFFER_POINTER, + RTEMS.UNSIGNED32( QUEUE_SIZE + 1 ), + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, RTEMS.INVALID_SIZE, "message_queue_send too large" + ); + + -- send a msg that is just right + RTEMS.MESSAGE_QUEUE_SEND( + SPTEST.QUEUE_ID( 1 ), + BIG_SEND_BUFFER_POINTER, + RTEMS.UNSIGNED32( QUEUE_SIZE ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( + STATUS, "message_queue_send exact size" + ); + + -- now read and verify the message just sent + RTEMS.MESSAGE_QUEUE_RECEIVE( + SPTEST.QUEUE_ID( 1 ), + BIG_RECEIVE_BUFFER_POINTER, + RTEMS.DEFAULT_OPTIONS, + 1 * TEST_SUPPORT.TICKS_PER_SECOND, + SIZE, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( + STATUS, "message_queue_receive exact size" + ); + if SIZE /= RTEMS.UNSIGNED32( QUEUE_SIZE ) then + TEXT_IO.PUT( + "TA1 - exact size size match failed for queue_size = " + ); + UNSIGNED32_IO.PUT( + RTEMS.UNSIGNED32( QUEUE_SIZE ), WIDTH => 3, BASE => 10 + ); + TEXT_IO.NEW_LINE; + end if; + + if (BIG_SEND_BUFFER( BIG_SEND_BUFFER'FIRST .. Integer( SIZE )) /= + BIG_RECEIVE_BUFFER( BIG_RECEIVE_BUFFER'FIRST .. Integer( SIZE ))) then + TEXT_IO.PUT_LINE("TA1 - exact size data match failed"); + end if; + + for I in Integer( SIZE + 1 ) .. BIG_RECEIVE_BUFFER'LAST loop + if BIG_RECEIVE_BUFFER( I ) /= CHARACTER'POS( 'Z' ) then + TEXT_IO.PUT_LINE("TA1 - exact size overrun match failed"); + end if; + end loop; + + -- all done with this one; delete it + RTEMS.MESSAGE_QUEUE_DELETE( SPTEST.QUEUE_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "message_queue_delete" ); + end loop; + TEXT_IO.PUT_LINE( "*** END OF TEST 13 ***" ); RTEMS.SHUTDOWN_EXECUTIVE( 0 ); diff --git a/c/src/ada-tests/sptests/sp16/sp16.scn b/c/src/ada-tests/sptests/sp16/sp16.scn index 3e3f314b67..928dc4a9cf 100644 --- a/c/src/ada-tests/sptests/sp16/sp16.scn +++ b/c/src/ada-tests/sptests/sp16/sp16.scn @@ -1,48 +1,58 @@ *** TEST 16 *** TA1 - region_ident - rnid => 16#32010001# TA1 - region_get_segment - wait on 100 byte segment from region 2 -TA1 - got segment from region 2 - 16#30# +TA1 - got segment from region 2 - 16#70# TA1 - region_get_segment - wait on 3K segment from region 3 -TA1 - got segment from region 3 - 16#30# +TA1 - got segment from region 3 - 16#70# TA1 - region_get_segment - get 3080 byte segment from region 1 - NO_WAIT -TA1 - got segment from region 1 - 16#20# +TA1 - got segment from region 1 - 16#60# TA1 - task_wake_after - yield processor TA2 - region_get_segment - wait on 2K segment from region 1 TA3 - region_get_segment - wait on 3950 byte segment from region 2 -TA1 - region_return_segment - return segment to region 1 - 16#20# +TA1 - region_return_segment - return segment to region 1 - 16#60# TA1 - region_get_segment - wait 10 seconds for 3K segment from region 1 -TA2 - got segment from region 1 - 16#20# -TA2 - region_return_segment - return segment to region 1 - 16#20# +TA2 - got segment from region 1 - 16#60# +TA2 - region_return_segment - return segment to region 1 - 16#60# TA2 - task_set_priority - make self highest priority task TA2 - region_get_segment - wait on 3950 byte segment from region 2 -TA1 - got segment from region 1 - 16#20# -TA1 - region_return_segment - return segment to region 2 - 16#30# -TA2 - got segment from region 2 - 16#30# -TA2 - region_return_segment - return segment to region 2 - 16#30# +TA1 - got segment from region 1 - 16#60# +TA1 - region_return_segment - return segment to region 2 - 16#70# +TA2 - got segment from region 2 - 16#70# +TA2 - region_return_segment - return segment to region 2 - 16#70# TA2 - task_delete - delete self TA1 - task_wake_after - yield processor -TA3 - got segment from region 2 - 16#30# +TA3 - got segment from region 2 - 16#70# TA3 - region_get_segment - wait on 2K segment from region 3 TA1 - task_delete - delete TA3 TA1 - task_wake_after - yield processor TA4 - region_get_segment - wait on 1.5K segment from region 1 TA5 - region_get_segment - wait on 1.5K segment from region 1 -TA1 - region_return_segment - return segment to region 1 - 16#20# +TA1 - region_return_segment - return segment to region 1 - 16#60# TA1 - task_wake_after - yield processor -TA4 - got and returned 16#20# -TA5 - got and returned 16#6A0# +TA4 - got and returned 16#60# +TA5 - got and returned 16#6E0# TA1 - region_get_segment - wait 10 seconds for 3K segment from region 1 -TA1 - got segment from region 1 - 16#20# -TA1 - task_wake_after - sleep 1 second +TA1 - got segment from region 1 - 16#60# +TA1 - task_wake_after - yield processor TA5 - region_get_segment - wait on 3K segment from region 1 TA4 - region_get_segment - wait on 3K segment from region 1 TA1 - task_delete - delete TA4 -TA1 - region_return_segment - return segment to region 1 - 16#20# +TA1 - region_return_segment - return segment to region 1 - 16#60# TA1 - task_wake_after - yield processor -TA5 - got segment from region 1 - 16#20# -TA5 - region_return_segment - return segment to region 1 - 16#20# +TA5 - got segment from region 1 - 16#60# +TA5 - region_return_segment - return segment to region 1 - 16#60# TA5 - task_delete - delete self TA1 - region_delete - delete region 1 +TA1 - region_get_segment - get 3K segment from region 4 +TA1 - got segment from region 4 - 16#70# +TA1 - region_get_segment - attempt to get 3K segment from region 4 +TA1 - task_get_note - UNSATISFIED +TA1 - region_extend - extend region 4 by 4K +TA1 - region_get_segment - attempt to get 3K segment from region 4 +TA1 - got 3K segment from region 4 - 16#CF0# +TA1 - return_segment - return segment to region 4 - 16#70# +TA1 - region_return_segment - return segment to region 4 - 16#CF0# +TA1 - region_delete - delete region 4 *** END OF TEST 16 *** diff --git a/c/src/ada-tests/sptests/sp16/sptest.adb b/c/src/ada-tests/sptests/sp16/sptest.adb index 95463e01ee..0e6576ec79 100644 --- a/c/src/ada-tests/sptests/sp16/sptest.adb +++ b/c/src/ada-tests/sptests/sp16/sptest.adb @@ -106,8 +106,9 @@ package body SPTEST is TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" ); SPTEST.REGION_NAME( 1 ) := RTEMS.BUILD_NAME( 'R', 'N', '1', ' ' ); - SPTEST.REGION_NAME( 2 ) := RTEMS.BUILD_NAME( 'R', 'N', '1', ' ' ); - SPTEST.REGION_NAME( 3 ) := RTEMS.BUILD_NAME( 'R', 'N', '1', ' ' ); + SPTEST.REGION_NAME( 2 ) := RTEMS.BUILD_NAME( 'R', 'N', '2', ' ' ); + SPTEST.REGION_NAME( 3 ) := RTEMS.BUILD_NAME( 'R', 'N', '3', ' ' ); + SPTEST.REGION_NAME( 4 ) := RTEMS.BUILD_NAME( 'R', 'N', '4', ' ' ); RTEMS.REGION_CREATE( SPTEST.REGION_NAME( 1 ), @@ -142,7 +143,17 @@ package body SPTEST is ); TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_CREATE OF RN3" ); - + RTEMS.REGION_CREATE( + SPTEST.REGION_NAME( 4 ), + SPTEST.AREA_4'ADDRESS, + 4096, + 128, + RTEMS.DEFAULT_ATTRIBUTES, + SPTEST.REGION_ID( 4 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_CREATE OF RN4" ); + RTEMS.TASK_DELETE( RTEMS.SELF, STATUS ); TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); @@ -203,6 +214,24 @@ package body SPTEST is end PUT_ADDRESS_FROM_AREA_3; +--PAGE +-- +-- PUT_ADDRESS_FROM_AREA_4 +-- + + procedure PUT_ADDRESS_FROM_AREA_4 ( + TO_BE_PRINTED : in RTEMS.ADDRESS + ) is + begin + + UNSIGNED32_IO.PUT( + RTEMS.SUBTRACT( TO_BE_PRINTED, SPTEST.AREA_4'ADDRESS ), + WIDTH => 8, + BASE => 16 + ); + + end PUT_ADDRESS_FROM_AREA_4; + --PAGE -- -- TASK_1 @@ -398,7 +427,7 @@ TEST_SUPPORT.PAUSE; SPTEST.PUT_ADDRESS_FROM_AREA_1( SEGMENT_ADDRESS_4 ); TEXT_IO.NEW_LINE; - TEXT_IO.PUT_LINE( "TA1 - task_wake_after - sleep 1 second" ); + TEXT_IO.PUT_LINE( "TA1 - task_wake_after - yield processor" ); RTEMS.TASK_WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); @@ -425,6 +454,85 @@ TEST_SUPPORT.PAUSE; TEXT_IO.PUT_LINE( "TA1 - region_delete - delete region 1" ); RTEMS.REGION_DELETE( SPTEST.REGION_ID( 1 ), STATUS ); TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "REGION_DELETE OF RN1" ); +--XXX + TEXT_IO.PUT_LINE( + "TA1 - region_get_segment - get 3K segment from region 4" + ); + RTEMS.REGION_GET_SEGMENT( + SPTEST.REGION_ID( 4 ), + 3072, + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + segment_address_1, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "region_get_segment" ); + TEXT_IO.PUT( "TA1 - got segment from region 4 - " ); + PUT_ADDRESS_FROM_AREA_4( segment_address_1 ); + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT_LINE( + "TA1 - region_get_segment - attempt to get 3K segment from region 4" + ); + RTEMS.REGION_GET_SEGMENT( + SPTEST.REGION_ID( 4 ), + 3072, + RTEMS.NO_WAIT, + RTEMS.NO_TIMEOUT, + SEGMENT_ADDRESS_2, + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.UNSATISFIED, + "task_get_segment with no memory left" + ); + TEXT_IO.PUT_LINE( "TA1 - task_get_note - UNSATISFIED" ); + + TEXT_IO.PUT_LINE( "TA1 - region_extend - extend region 4 by 4K" ); + RTEMS.REGION_EXTEND( + SPTEST.REGION_ID( 4 ), + SPTEST.AREA_4( 4096 )'ADDRESS, + 4096, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( status, "region_extend" ); + + TEXT_IO.PUT_LINE( + "TA1 - region_get_segment - attempt to get 3K segment from region 4" + ); + RTEMS.REGION_GET_SEGMENT( + SPTEST.REGION_ID( 4 ), + 3072, + RTEMS.NO_WAIT, + RTEMS.NO_TIMEOUT, + segment_address_3, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( status, "region_get_segment" ); + TEXT_IO.PUT( "TA1 - got 3K segment from region 4 - " ); + PUT_ADDRESS_FROM_AREA_4( segment_address_3 ); + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT( + "TA1 - return_segment - return segment to region 4 - " + ); + PUT_ADDRESS_FROM_AREA_4( segment_address_1 ); + RTEMS.REGION_RETURN_SEGMENT( SPTEST.REGION_ID( 4 ), segment_address_1, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( status, "region_return_segment" ); + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT( + "TA1 - region_return_segment - return segment to region 4 - " + ); + PUT_ADDRESS_FROM_AREA_4( segment_address_3 ); + RTEMS.REGION_RETURN_SEGMENT( SPTEST.REGION_ID( 4 ), segment_address_3, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( status, "region_return_segment" ); + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT_LINE( "TA1 - region_delete - delete region 4" ); + RTEMS.REGION_DELETE( SPTEST.REGION_ID( 4 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( status, "region_delete" ); TEXT_IO.PUT_LINE( "*** END OF TEST 16 ***" ); RTEMS.SHUTDOWN_EXECUTIVE( 0 ); diff --git a/c/src/ada-tests/sptests/sp16/sptest.ads b/c/src/ada-tests/sptests/sp16/sptest.ads index 5ef71d9919..a2ea517801 100644 --- a/c/src/ada-tests/sptests/sp16/sptest.ads +++ b/c/src/ada-tests/sptests/sp16/sptest.ads @@ -37,8 +37,8 @@ package SPTEST is -- by this test. -- - REGION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; - REGION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + REGION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + REGION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; -- -- The following constant defines the priority of most of the @@ -62,6 +62,9 @@ package SPTEST is AREA_3 : array ( RTEMS.UNSIGNED32 range 0 .. 4095 ) of RTEMS.UNSIGNED8; for AREA_3'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT; + AREA_4 : array ( RTEMS.UNSIGNED32 range 0 .. 8191 ) of RTEMS.UNSIGNED8; + for AREA_4'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT; + -- -- INIT -- diff --git a/c/src/ada-tests/sptests/sp20/sp20.scn b/c/src/ada-tests/sptests/sp20/sp20.scn index f1a75283fe..5411361d76 100644 --- a/c/src/ada-tests/sptests/sp20/sp20.scn +++ b/c/src/ada-tests/sptests/sp20/sp20.scn @@ -14,11 +14,24 @@ TA4 - (16#42010004#) period 2 TA5 - rate_monotonic_create id = 16#42010005# TA5 - rate_monotonic_ident id = 16#42010005# TA5 - (16#42010005#) period 100 +TA6 - rate_monotonic_create id = 16#42010006# +TA6 - rate_monotonic_ident id = 16#42010006# +TA6 - (16#42010006#) period 0 TA5 - PERIODS CHECK OK (1) TA5 - PERIODS CHECK OK (2) TA5 - PERIODS CHECK OK (3) TA5 - PERIODS CHECK OK (4) TA5 - PERIODS CHECK OK (5) +TA6 - Actual: 10 Expected: 10 - OK +TA6 - Actual: 20 Expected: 20 - OK +TA6 - Actual: 30 Expected: 30 - OK +TA6 - Actual: 40 Expected: 40 - OK +TA6 - Actual: 50 Expected: 50 - OK +TA6 - Actual: 60 Expected: 60 - OK +TA6 - Actual: 70 Expected: 70 - OK +TA6 - Actual: 80 Expected: 80 - OK +TA6 - Actual: 90 Expected: 90 - OK +TA6 - Actual: 100 Expected: 100 - OK TA5 - PERIODS CHECK OK (6) TA5 - PERIODS CHECK OK (7) TA5 - PERIODS CHECK OK (8) diff --git a/c/src/ada-tests/sptests/sp20/sptest.adb b/c/src/ada-tests/sptests/sp20/sptest.adb index 8b7c9958dc..1f73df5d83 100644 --- a/c/src/ada-tests/sptests/sp20/sptest.adb +++ b/c/src/ada-tests/sptests/sp20/sptest.adb @@ -47,8 +47,9 @@ package body SPTEST is SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' ); SPTEST.TASK_NAME( 4 ) := RTEMS.BUILD_NAME( 'T', 'A', '4', ' ' ); SPTEST.TASK_NAME( 5 ) := RTEMS.BUILD_NAME( 'T', 'A', '5', ' ' ); + SPTEST.TASK_NAME( 6 ) := RTEMS.BUILD_NAME( 'T', 'A', '6', ' ' ); - for INDEX in 1 .. 5 + for INDEX in 1 .. 6 loop SPTEST.COUNT( INDEX ) := 0; @@ -66,12 +67,12 @@ package body SPTEST is end loop; - for INDEX in 1 .. 5 + for INDEX in 1 .. 6 loop RTEMS.TASK_START( SPTEST.TASK_ID( INDEX ), - SPTEST.TASK_1_THROUGH_5'ACCESS, + SPTEST.TASK_1_THROUGH_6'ACCESS, RTEMS.TASK_ARGUMENT( INDEX ), STATUS ); @@ -86,10 +87,10 @@ package body SPTEST is --PAGE -- --- TASK_1_THROUGH_5 +-- TASK_1_THROUGH_6 -- - procedure TASK_1_THROUGH_5 ( + procedure TASK_1_THROUGH_6 ( ARGUMENT : in RTEMS.TASK_ARGUMENT ) is RMID : RTEMS.ID; @@ -97,6 +98,9 @@ package body SPTEST is PASS : RTEMS.UNSIGNED32; FAILED : RTEMS.UNSIGNED32; STATUS : RTEMS.STATUS_CODES; + TIME : array( 0 .. 10 ) of RTEMS.INTERVAL; + PERIOD : RTEMS.INTERVAL; + MEASURE : RTEMS.INTERVAL; begin RTEMS.RATE_MONOTONIC_CREATE( ARGUMENT, RMID, STATUS ); @@ -183,8 +187,7 @@ package body SPTEST is SPTEST.GET_ALL_COUNTERS; - for INDEX in 1 .. 4 - loop + for INDEX in 1 .. 4 loop if SPTEST.TEMPORARY_COUNT( INDEX ) /= SPTEST.ITERATIONS( INDEX ) then @@ -230,12 +233,51 @@ package body SPTEST is end loop; + when 6 => + -- test changing periods + for INDEX in 0 .. 10 loop + PERIOD := RTEMS.INTERVAL( ( INDEX + 1 ) * 10 ); + RTEMS.RATE_MONOTONIC_PERIOD( RMID, PERIOD, STATUS); + TEST_SUPPORT.DIRECTIVE_FAILED( + STATUS, "rate_monotonic_period of TA6" + ); + + -- timestamp + RTEMS.CLOCK_GET( + RTEMS.CLOCK_GET_TICKS_SINCE_BOOT, + Time( INDEX )'ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( + STATUS, "clock_get of TA6" + ); + end loop; + + for INDEX in 1 .. 10 loop + MEASURE := TIME( INDEX ) - TIME( INDEX - 1 ); + PERIOD := RTEMS.INTERVAL( INDEX * 10 ); + TEXT_IO.PUT( "TA6 - Actual: " ); + UNSIGNED32_IO.PUT( MEASURE, WIDTH => 3, BASE => 10 ); + TEXT_IO.PUT( " Expected: " ); + UNSIGNED32_IO.PUT( PERIOD, WIDTH => 3, BASE => 10 ); + if PERIOD = MEASURE then + TEXT_IO.PUT_LINE( " - OK" ); + else + TEXT_IO.PUT_LINE( " - FAILED" ); + end if; + end loop; + + RTEMS.TASK_SUSPEND( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( + STATUS, "task_suspend of TA6" + ); + when others => NULL; end case; - end TASK_1_THROUGH_5; + end TASK_1_THROUGH_6; --PAGE -- diff --git a/c/src/ada-tests/sptests/sp20/sptest.ads b/c/src/ada-tests/sptests/sp20/sptest.ads index 95a3259fe4..43220a388c 100644 --- a/c/src/ada-tests/sptests/sp20/sptest.ads +++ b/c/src/ada-tests/sptests/sp20/sptest.ads @@ -29,30 +29,30 @@ package SPTEST is -- by this test. -- - TASK_ID : array ( 1 .. 5 ) of RTEMS.ID; - TASK_NAME : array ( 1 .. 5 ) of RTEMS.NAME; + TASK_ID : array ( 1 .. 6 ) of RTEMS.ID; + TASK_NAME : array ( 1 .. 6 ) of RTEMS.NAME; -- -- These arrays contain the parameters which define the execution -- characteristics and periods of each instantiation of the --- copies of the RTEMS task TASKS_1_THROUGH_5. +-- copies of the RTEMS task TASKS_1_THROUGH_6. -- - PERIODS : constant array ( 1 .. 5 ) - of RTEMS.UNSIGNED32 := ( 2, 2, 2, 2, 100 ); + PERIODS : constant array ( 1 .. 6 ) + of RTEMS.UNSIGNED32 := ( 2, 2, 2, 2, 100, 0 ); - ITERATIONS : constant array ( 1 .. 5 ) - of RTEMS.UNSIGNED32 := ( 50, 50, 50, 50, 1 ); + ITERATIONS : constant array ( 1 .. 6 ) + of RTEMS.UNSIGNED32 := ( 50, 50, 50, 50, 1, 10 ); - PRIORITIES : constant array ( 1 .. 5 ) - of RTEMS.UNSIGNED32 := ( 1, 1, 3, 4, 5 ); + PRIORITIES : constant array ( 1 .. 6 ) + of RTEMS.UNSIGNED32 := ( 1, 1, 3, 4, 5, 1 ); -- -- The following type defines the array used to manage the -- execution counts of each task's period. -- - type COUNT_ARRAY is array ( 1 .. 5 ) of RTEMS.UNSIGNED32; + type COUNT_ARRAY is array ( 1 .. 6 ) of RTEMS.UNSIGNED32; -- -- These arrays contains the number of periods successfully completed @@ -79,14 +79,14 @@ package SPTEST is ); -- --- TASK_1_THROUGH_5 +-- TASK_1_THROUGH_6 -- -- DESCRIPTION: -- -- These RTEMS tasks test the Rate Monotonic Manager. -- - procedure TASK_1_THROUGH_5 ( + procedure TASK_1_THROUGH_6 ( ARGUMENT : in RTEMS.TASK_ARGUMENT ); -- cgit v1.2.3