From ac7d5ef06a6d6e8d84abbd1f0b82162725f98326 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 11 May 1995 17:39:37 +0000 Subject: Initial revision --- testsuites/README | 39 + testsuites/libtests/README | 10 + testsuites/libtests/stackchk/blow.c | 47 + testsuites/libtests/stackchk/init.c | 89 + testsuites/libtests/stackchk/stackchk.scn | 9 + testsuites/libtests/stackchk/task1.c | 44 + testsuites/mptests/README | 10 + testsuites/mptests/mp01/init.c | 99 ++ testsuites/mptests/mp01/node1/mp01.doc | 53 + testsuites/mptests/mp01/node1/mp01.scn | 15 + testsuites/mptests/mp01/node2/mp01.doc | 13 + testsuites/mptests/mp01/node2/mp01.scn | 15 + testsuites/mptests/mp01/system.h | 30 + testsuites/mptests/mp01/task1.c | 84 + testsuites/mptests/mp02/init.c | 63 + testsuites/mptests/mp02/node1/mp02.doc | 47 + testsuites/mptests/mp02/node1/mp02.scn | 14 + testsuites/mptests/mp02/node2/mp02.doc | 13 + testsuites/mptests/mp02/node2/mp02.scn | 14 + testsuites/mptests/mp02/system.h | 30 + testsuites/mptests/mp02/task1.c | 118 ++ testsuites/mptests/mp03/delay.c | 31 + testsuites/mptests/mp03/init.c | 68 + testsuites/mptests/mp03/node1/mp03.doc | 45 + testsuites/mptests/mp03/node1/mp03.scn | 24 + testsuites/mptests/mp03/node2/mp03.doc | 13 + testsuites/mptests/mp03/node2/mp03.scn | 24 + testsuites/mptests/mp03/system.h | 30 + testsuites/mptests/mp03/task1.c | 155 ++ testsuites/mptests/mp04/init.c | 63 + testsuites/mptests/mp04/node1/mp04.doc | 41 + testsuites/mptests/mp04/node1/mp04.scn | 8 + testsuites/mptests/mp04/node2/mp04.doc | 13 + testsuites/mptests/mp04/node2/mp04.scn | 8 + testsuites/mptests/mp04/system.h | 30 + testsuites/mptests/mp04/task1.c | 83 + testsuites/mptests/mp05/asr.c | 37 + testsuites/mptests/mp05/init.c | 68 + testsuites/mptests/mp05/node1/mp05.doc | 45 + testsuites/mptests/mp05/node1/mp05.scn | 11 + testsuites/mptests/mp05/node2/mp05.doc | 13 + testsuites/mptests/mp05/node2/mp05.scn | 10 + testsuites/mptests/mp05/system.h | 30 + testsuites/mptests/mp05/task1.c | 106 ++ testsuites/mptests/mp06/init.c | 68 + testsuites/mptests/mp06/node1/mp06.doc | 45 + testsuites/mptests/mp06/node1/mp06.scn | 11 + testsuites/mptests/mp06/node2/mp06.doc | 13 + testsuites/mptests/mp06/node2/mp06.scn | 12 + testsuites/mptests/mp06/system.h | 31 + testsuites/mptests/mp06/task1.c | 176 ++ testsuites/mptests/mp07/init.c | 68 + testsuites/mptests/mp07/node1/mp07.doc | 46 + testsuites/mptests/mp07/node1/mp07.scn | 10 + testsuites/mptests/mp07/node2/mp07.doc | 13 + testsuites/mptests/mp07/node2/mp07.scn | 9 + testsuites/mptests/mp07/system.h | 28 + testsuites/mptests/mp07/task1.c | 95 ++ testsuites/mptests/mp08/init.c | 76 + testsuites/mptests/mp08/node1/mp08.doc | 52 + testsuites/mptests/mp08/node1/mp08.scn | 11 + testsuites/mptests/mp08/node2/mp08.doc | 13 + testsuites/mptests/mp08/node2/mp08.scn | 12 + testsuites/mptests/mp08/system.h | 30 + testsuites/mptests/mp08/task1.c | 89 + testsuites/mptests/mp09/init.c | 76 + testsuites/mptests/mp09/node1/mp09.doc | 50 + testsuites/mptests/mp09/node1/mp09.scn | 21 + testsuites/mptests/mp09/node2/mp09.doc | 13 + testsuites/mptests/mp09/node2/mp09.scn | 27 + testsuites/mptests/mp09/recvmsg.c | 45 + testsuites/mptests/mp09/sendmsg.c | 59 + testsuites/mptests/mp09/system.h | 30 + testsuites/mptests/mp09/task1.c | 107 ++ testsuites/mptests/mp10/init.c | 144 ++ testsuites/mptests/mp10/node1/mp10.doc | 46 + testsuites/mptests/mp10/node1/mp10.scn | 4 + testsuites/mptests/mp10/node2/mp10.doc | 13 + testsuites/mptests/mp10/node2/mp10.scn | 19 + testsuites/mptests/mp10/system.h | 30 + testsuites/mptests/mp10/task1.c | 50 + testsuites/mptests/mp10/task2.c | 47 + testsuites/mptests/mp10/task3.c | 50 + testsuites/mptests/mp11/init.c | 106 ++ testsuites/mptests/mp11/node1/mp11.doc | 42 + testsuites/mptests/mp11/node1/mp11.scn | 10 + testsuites/mptests/mp11/node2/mp11.doc | 13 + testsuites/mptests/mp11/node2/mp11.scn | 2 + testsuites/mptests/mp11/system.h | 30 + testsuites/mptests/mp12/init.c | 116 ++ testsuites/mptests/mp12/node1/mp12.doc | 52 + testsuites/mptests/mp12/node1/mp12.scn | 6 + testsuites/mptests/mp12/node2/mp12.doc | 13 + testsuites/mptests/mp12/node2/mp12.scn | 10 + testsuites/mptests/mp12/system.h | 30 + testsuites/mptests/mp13/init.c | 116 ++ testsuites/mptests/mp13/node1/mp13.doc | 48 + testsuites/mptests/mp13/node1/mp13.scn | 14 + testsuites/mptests/mp13/node2/mp13.doc | 13 + testsuites/mptests/mp13/node2/mp13.scn | 16 + testsuites/mptests/mp13/system.h | 30 + testsuites/mptests/mp13/task1.c | 70 + testsuites/mptests/mp13/task2.c | 106 ++ testsuites/mptests/mp14/delay.c | 34 + testsuites/mptests/mp14/evtask1.c | 86 + testsuites/mptests/mp14/evtmtask.c | 65 + testsuites/mptests/mp14/exit.c | 33 + testsuites/mptests/mp14/init.c | 194 +++ testsuites/mptests/mp14/msgtask1.c | 102 ++ testsuites/mptests/mp14/node1/mp14.doc | 50 + testsuites/mptests/mp14/node1/mp14.scn | 38 + testsuites/mptests/mp14/node2/mp14.doc | 13 + testsuites/mptests/mp14/node2/mp14.scn | 35 + testsuites/mptests/mp14/pttask1.c | 65 + testsuites/mptests/mp14/smtask1.c | 70 + testsuites/mptests/mp14/system.h | 31 + testsuites/samples/README | 71 + testsuites/samples/base_mp/apptask.c | 38 + testsuites/samples/base_mp/init.c | 46 + testsuites/samples/base_mp/node1/base_mp.doc | 13 + testsuites/samples/base_mp/node1/base_mp.scn | 5 + testsuites/samples/base_mp/node2/base_mp.doc | 13 + testsuites/samples/base_mp/node2/base_mp.scn | 5 + testsuites/samples/base_mp/system.h | 31 + testsuites/samples/base_sp/apptask.c | 39 + testsuites/samples/base_sp/base_sp.doc | 13 + testsuites/samples/base_sp/base_sp.scn | 5 + testsuites/samples/base_sp/init.c | 51 + testsuites/samples/base_sp/system.h | 30 + testsuites/samples/cdtest/cdtest.scn | 31 + testsuites/samples/cdtest/init.c | 30 + testsuites/samples/cdtest/main.cc | 146 ++ testsuites/samples/cdtest/system.h | 30 + testsuites/samples/hello/hello.doc | 13 + testsuites/samples/hello/hello.scn | 3 + testsuites/samples/hello/init.c | 41 + testsuites/samples/hello/system.h | 30 + testsuites/samples/paranoia/init.c | 43 + testsuites/samples/paranoia/paranoia.c | 2300 ++++++++++++++++++++++++++ testsuites/samples/paranoia/paranoia.doc | 13 + testsuites/samples/paranoia/system.h | 30 + testsuites/samples/ticker/init.c | 58 + testsuites/samples/ticker/system.h | 30 + testsuites/samples/ticker/tasks.c | 44 + testsuites/samples/ticker/ticker.doc | 13 + testsuites/samples/ticker/ticker.scn | 16 + testsuites/sptests/README | 9 + testsuites/sptests/sp01/init.c | 89 + testsuites/sptests/sp01/sp01.doc | 43 + testsuites/sptests/sp01/sp01.scn | 18 + testsuites/sptests/sp01/system.h | 30 + testsuites/sptests/sp01/task1.c | 50 + testsuites/sptests/sp02/init.c | 155 ++ testsuites/sptests/sp02/preempt.c | 32 + testsuites/sptests/sp02/sp02.doc | 37 + testsuites/sptests/sp02/sp02.scn | 15 + testsuites/sptests/sp02/system.h | 31 + testsuites/sptests/sp02/task1.c | 66 + testsuites/sptests/sp02/task2.c | 34 + testsuites/sptests/sp02/task3.c | 37 + testsuites/sptests/sp03/init.c | 70 + testsuites/sptests/sp03/sp03.doc | 24 + testsuites/sptests/sp03/sp03.scn | 26 + testsuites/sptests/sp03/system.h | 30 + testsuites/sptests/sp03/task1.c | 59 + testsuites/sptests/sp03/task2.c | 46 + testsuites/sptests/sp04/init.c | 113 ++ testsuites/sptests/sp04/sp04.doc | 38 + testsuites/sptests/sp04/sp04.scn | 24 + testsuites/sptests/sp04/system.h | 30 + testsuites/sptests/sp04/task1.c | 104 ++ testsuites/sptests/sp04/task2.c | 29 + testsuites/sptests/sp04/task3.c | 29 + testsuites/sptests/sp04/tswitch.c | 59 + testsuites/sptests/sp05/init.c | 84 + testsuites/sptests/sp05/sp05.doc | 26 + testsuites/sptests/sp05/sp05.scn | 47 + testsuites/sptests/sp05/system.h | 30 + testsuites/sptests/sp05/task1.c | 78 + testsuites/sptests/sp05/task2.c | 39 + testsuites/sptests/sp05/task3.c | 39 + testsuites/sptests/sp06/init.c | 90 + testsuites/sptests/sp06/sp06.doc | 26 + testsuites/sptests/sp06/sp06.scn | 40 + testsuites/sptests/sp06/system.h | 30 + testsuites/sptests/sp06/task1.c | 61 + testsuites/sptests/sp06/task2.c | 40 + testsuites/sptests/sp06/task3.c | 32 + testsuites/sptests/sp07/init.c | 131 ++ testsuites/sptests/sp07/sp07.doc | 37 + testsuites/sptests/sp07/sp07.scn | 33 + testsuites/sptests/sp07/system.h | 35 + testsuites/sptests/sp07/task1.c | 85 + testsuites/sptests/sp07/task2.c | 78 + testsuites/sptests/sp07/task3.c | 34 + testsuites/sptests/sp07/task4.c | 30 + testsuites/sptests/sp07/taskexit.c | 33 + testsuites/sptests/sp07/tcreate.c | 34 + testsuites/sptests/sp07/tdelete.c | 37 + testsuites/sptests/sp07/trestart.c | 34 + testsuites/sptests/sp07/tstart.c | 34 + testsuites/sptests/sp08/init.c | 56 + testsuites/sptests/sp08/sp08.doc | 26 + testsuites/sptests/sp08/sp08.scn | 22 + testsuites/sptests/sp08/system.h | 33 + testsuites/sptests/sp08/task1.c | 256 +++ testsuites/sptests/sp09/delay.c | 28 + testsuites/sptests/sp09/init.c | 123 ++ testsuites/sptests/sp09/isr.c | 27 + testsuites/sptests/sp09/screen01.c | 168 ++ testsuites/sptests/sp09/screen02.c | 192 +++ testsuites/sptests/sp09/screen03.c | 204 +++ testsuites/sptests/sp09/screen04.c | 85 + testsuites/sptests/sp09/screen05.c | 148 ++ testsuites/sptests/sp09/screen06.c | 125 ++ testsuites/sptests/sp09/screen07.c | 184 +++ testsuites/sptests/sp09/screen08.c | 121 ++ testsuites/sptests/sp09/screen09.c | 140 ++ testsuites/sptests/sp09/screen10.c | 164 ++ testsuites/sptests/sp09/screen11.c | 250 +++ testsuites/sptests/sp09/screen12.c | 327 ++++ testsuites/sptests/sp09/screen13.c | 115 ++ testsuites/sptests/sp09/screen14.c | 162 ++ testsuites/sptests/sp09/sp09.doc | 36 + testsuites/sptests/sp09/sp09.scn | 249 +++ testsuites/sptests/sp09/system.h | 30 + testsuites/sptests/sp09/task1.c | 74 + testsuites/sptests/sp09/task2.c | 48 + testsuites/sptests/sp09/task3.c | 51 + testsuites/sptests/sp09/task4.c | 50 + testsuites/sptests/sp11/init.c | 95 ++ testsuites/sptests/sp11/sp11.doc | 26 + testsuites/sptests/sp11/sp11.scn | 74 + testsuites/sptests/sp11/system.h | 30 + testsuites/sptests/sp11/task1.c | 410 +++++ testsuites/sptests/sp11/task2.c | 126 ++ testsuites/sptests/sp11/timer.c | 97 ++ testsuites/sptests/sp12/init.c | 176 ++ testsuites/sptests/sp12/pridrv.c | 131 ++ testsuites/sptests/sp12/pritask.c | 91 + testsuites/sptests/sp12/sp12.doc | 27 + testsuites/sptests/sp12/sp12.scn | 78 + testsuites/sptests/sp12/system.h | 30 + testsuites/sptests/sp12/task1.c | 153 ++ testsuites/sptests/sp12/task2.c | 65 + testsuites/sptests/sp12/task3.c | 50 + testsuites/sptests/sp12/task4.c | 37 + testsuites/sptests/sp12/task5.c | 55 + testsuites/sptests/sp13/fillbuff.c | 31 + testsuites/sptests/sp13/init.c | 112 ++ testsuites/sptests/sp13/putbuff.c | 31 + testsuites/sptests/sp13/sp13.doc | 25 + testsuites/sptests/sp13/sp13.scn | 66 + testsuites/sptests/sp13/system.h | 30 + testsuites/sptests/sp13/task1.c | 213 +++ testsuites/sptests/sp13/task2.c | 132 ++ testsuites/sptests/sp13/task3.c | 74 + testsuites/sptests/sp14/asr.c | 47 + testsuites/sptests/sp14/init.c | 75 + testsuites/sptests/sp14/sp14.doc | 24 + testsuites/sptests/sp14/sp14.scn | 33 + testsuites/sptests/sp14/system.h | 30 + testsuites/sptests/sp14/task1.c | 116 ++ testsuites/sptests/sp14/task2.c | 48 + testsuites/sptests/sp15/init.c | 81 + testsuites/sptests/sp15/sp15.doc | 24 + testsuites/sptests/sp15/sp15.scn | 16 + testsuites/sptests/sp15/system.h | 30 + testsuites/sptests/sp15/task1.c | 129 ++ testsuites/sptests/sp16/init.c | 131 ++ testsuites/sptests/sp16/sp16.doc | 24 + testsuites/sptests/sp16/sp16.scn | 58 + testsuites/sptests/sp16/system.h | 32 + testsuites/sptests/sp16/task1.c | 282 ++++ testsuites/sptests/sp16/task2.c | 86 + testsuites/sptests/sp16/task3.c | 57 + testsuites/sptests/sp16/task4.c | 60 + testsuites/sptests/sp16/task5.c | 73 + testsuites/sptests/sp17/asr.c | 32 + testsuites/sptests/sp17/init.c | 72 + testsuites/sptests/sp17/sp17.doc | 35 + testsuites/sptests/sp17/sp17.scn | 8 + testsuites/sptests/sp17/system.h | 30 + testsuites/sptests/sp17/task1.c | 48 + testsuites/sptests/sp17/task2.c | 45 + testsuites/sptests/sp19/first.c | 66 + testsuites/sptests/sp19/fptask.c | 98 ++ testsuites/sptests/sp19/fptest.h | 165 ++ testsuites/sptests/sp19/init.c | 153 ++ testsuites/sptests/sp19/inttest.h | 149 ++ testsuites/sptests/sp19/sp19.doc | 23 + testsuites/sptests/sp19/sp19.scn | 55 + testsuites/sptests/sp19/system.h | 30 + testsuites/sptests/sp19/task1.c | 59 + testsuites/sptests/sp20/getall.c | 43 + testsuites/sptests/sp20/init.c | 71 + testsuites/sptests/sp20/sp20.doc | 24 + testsuites/sptests/sp20/sp20.scn | 27 + testsuites/sptests/sp20/system.h | 34 + testsuites/sptests/sp20/task1.c | 116 ++ testsuites/sptests/sp21/init.c | 56 + testsuites/sptests/sp21/sp21.doc | 28 + testsuites/sptests/sp21/sp21.scn | 19 + testsuites/sptests/sp21/system.h | 30 + testsuites/sptests/sp21/task1.c | 106 ++ testsuites/sptests/sp22/delay.c | 32 + testsuites/sptests/sp22/init.c | 69 + testsuites/sptests/sp22/prtime.c | 32 + testsuites/sptests/sp22/sp22.doc | 20 + testsuites/sptests/sp22/sp22.scn | 29 + testsuites/sptests/sp22/system.h | 30 + testsuites/sptests/sp22/task1.c | 164 ++ testsuites/sptests/sp23/init.c | 72 + testsuites/sptests/sp23/sp23.doc | 26 + testsuites/sptests/sp23/sp23.scn | 9 + testsuites/sptests/sp23/system.h | 30 + testsuites/sptests/sp23/task1.c | 96 ++ testsuites/sptests/sp24/init.c | 79 + testsuites/sptests/sp24/resume.c | 34 + testsuites/sptests/sp24/sp24.doc | 51 + testsuites/sptests/sp24/sp24.scn | 16 + testsuites/sptests/sp24/system.h | 30 + testsuites/sptests/sp24/task1.c | 58 + testsuites/sptests/sp25/init.c | 69 + testsuites/sptests/sp25/sp25.doc | 32 + testsuites/sptests/sp25/sp25.scn | 29 + testsuites/sptests/sp25/system.h | 32 + testsuites/sptests/sp25/task1.c | 241 +++ testsuites/sptests/spfatal/fatal.c | 134 ++ testsuites/sptests/spfatal/init.c | 54 + testsuites/sptests/spfatal/puterr.c | 68 + testsuites/sptests/spfatal/spfatal.doc | 28 + testsuites/sptests/spfatal/spfatal.scn | 8 + testsuites/sptests/spfatal/system.h | 30 + testsuites/sptests/spfatal/task1.c | 29 + testsuites/sptests/spsize/getint.c | 32 + testsuites/sptests/spsize/init.c | 58 + testsuites/sptests/spsize/size.c | 601 +++++++ testsuites/support/include/tmacros.h | 116 ++ testsuites/tmtests/README | 21 + testsuites/tmtests/include/timesys.h | 30 + testsuites/tmtests/tm01/system.h | 23 + testsuites/tmtests/tm01/task1.c | 187 +++ testsuites/tmtests/tm01/tm01.doc | 13 + testsuites/tmtests/tm02/system.h | 23 + testsuites/tmtests/tm02/task1.c | 156 ++ testsuites/tmtests/tm02/tm02.doc | 13 + testsuites/tmtests/tm03/system.h | 23 + testsuites/tmtests/tm03/task1.c | 149 ++ testsuites/tmtests/tm03/tm03.doc | 13 + testsuites/tmtests/tm04/system.h | 23 + testsuites/tmtests/tm04/task1.c | 387 +++++ testsuites/tmtests/tm04/tm04.doc | 13 + testsuites/tmtests/tm05/system.h | 23 + testsuites/tmtests/tm05/task1.c | 132 ++ testsuites/tmtests/tm05/tm05.doc | 13 + testsuites/tmtests/tm06/system.h | 23 + testsuites/tmtests/tm06/task1.c | 162 ++ testsuites/tmtests/tm06/tm06.doc | 13 + testsuites/tmtests/tm07/system.h | 23 + testsuites/tmtests/tm07/task1.c | 120 ++ testsuites/tmtests/tm07/tm07.doc | 13 + testsuites/tmtests/tm08/system.h | 23 + testsuites/tmtests/tm08/task1.c | 255 +++ testsuites/tmtests/tm08/tm08.doc | 13 + testsuites/tmtests/tm09/system.h | 23 + testsuites/tmtests/tm09/task1.c | 221 +++ testsuites/tmtests/tm09/tm09.doc | 13 + testsuites/tmtests/tm10/system.h | 23 + testsuites/tmtests/tm10/task1.c | 156 ++ testsuites/tmtests/tm10/tm10.doc | 13 + testsuites/tmtests/tm11/system.h | 23 + testsuites/tmtests/tm11/task1.c | 148 ++ testsuites/tmtests/tm11/tm11.doc | 13 + testsuites/tmtests/tm12/system.h | 23 + testsuites/tmtests/tm12/task1.c | 142 ++ testsuites/tmtests/tm12/tm12.doc | 13 + testsuites/tmtests/tm13/system.h | 23 + testsuites/tmtests/tm13/task1.c | 147 ++ testsuites/tmtests/tm13/tm13.doc | 13 + testsuites/tmtests/tm14/system.h | 23 + testsuites/tmtests/tm14/task1.c | 142 ++ testsuites/tmtests/tm14/tm14.doc | 13 + testsuites/tmtests/tm15/system.h | 23 + testsuites/tmtests/tm15/task1.c | 222 +++ testsuites/tmtests/tm15/tm15.doc | 13 + testsuites/tmtests/tm16/system.h | 23 + testsuites/tmtests/tm16/task1.c | 148 ++ testsuites/tmtests/tm16/tm16.doc | 13 + testsuites/tmtests/tm17/system.h | 23 + testsuites/tmtests/tm17/task1.c | 127 ++ testsuites/tmtests/tm17/tm17.doc | 13 + testsuites/tmtests/tm18/system.h | 23 + testsuites/tmtests/tm18/task1.c | 112 ++ testsuites/tmtests/tm18/tm18.doc | 13 + testsuites/tmtests/tm19/system.h | 23 + testsuites/tmtests/tm19/task1.c | 212 +++ testsuites/tmtests/tm19/tm19.doc | 13 + testsuites/tmtests/tm20/system.h | 23 + testsuites/tmtests/tm20/task1.c | 467 ++++++ testsuites/tmtests/tm20/tm20.doc | 13 + testsuites/tmtests/tm21/system.h | 23 + testsuites/tmtests/tm21/task1.c | 234 +++ testsuites/tmtests/tm21/tm21.doc | 13 + testsuites/tmtests/tm22/system.h | 23 + testsuites/tmtests/tm22/task1.c | 193 +++ testsuites/tmtests/tm22/tm22.doc | 13 + testsuites/tmtests/tm23/system.h | 23 + testsuites/tmtests/tm23/task1.c | 302 ++++ testsuites/tmtests/tm23/tm23.doc | 13 + testsuites/tmtests/tm24/system.h | 23 + testsuites/tmtests/tm24/task1.c | 124 ++ testsuites/tmtests/tm24/tm24.doc | 13 + testsuites/tmtests/tm25/system.h | 23 + testsuites/tmtests/tm25/task1.c | 108 ++ testsuites/tmtests/tm25/tm25.doc | 13 + testsuites/tmtests/tm26/fptest.h | 165 ++ testsuites/tmtests/tm26/system.h | 23 + testsuites/tmtests/tm26/task1.c | 470 ++++++ testsuites/tmtests/tm26/tm26.doc | 13 + testsuites/tmtests/tm27/system.h | 23 + testsuites/tmtests/tm27/task1.c | 237 +++ testsuites/tmtests/tm27/tm27.doc | 13 + testsuites/tmtests/tm28/system.h | 23 + testsuites/tmtests/tm28/task1.c | 134 ++ testsuites/tmtests/tm28/tm28.doc | 13 + testsuites/tmtests/tm29/system.h | 23 + testsuites/tmtests/tm29/task1.c | 207 +++ testsuites/tmtests/tm29/tm29.doc | 13 + testsuites/tmtests/tmck/system.h | 23 + testsuites/tmtests/tmck/task1.c | 180 ++ testsuites/tmtests/tmck/tmck.doc | 20 + testsuites/tmtests/tmoverhd/dumrtems.h | 255 +++ testsuites/tmtests/tmoverhd/empty.c | 41 + testsuites/tmtests/tmoverhd/system.h | 23 + testsuites/tmtests/tmoverhd/testtask.c | 1279 ++++++++++++++ testsuites/tmtests/tmoverhd/tmoverhd.doc | 13 + 437 files changed, 31435 insertions(+) create mode 100644 testsuites/README create mode 100644 testsuites/libtests/README create mode 100644 testsuites/libtests/stackchk/blow.c create mode 100644 testsuites/libtests/stackchk/init.c create mode 100644 testsuites/libtests/stackchk/stackchk.scn create mode 100644 testsuites/libtests/stackchk/task1.c create mode 100644 testsuites/mptests/README create mode 100644 testsuites/mptests/mp01/init.c create mode 100644 testsuites/mptests/mp01/node1/mp01.doc create mode 100644 testsuites/mptests/mp01/node1/mp01.scn create mode 100644 testsuites/mptests/mp01/node2/mp01.doc create mode 100644 testsuites/mptests/mp01/node2/mp01.scn create mode 100644 testsuites/mptests/mp01/system.h create mode 100644 testsuites/mptests/mp01/task1.c create mode 100644 testsuites/mptests/mp02/init.c create mode 100644 testsuites/mptests/mp02/node1/mp02.doc create mode 100644 testsuites/mptests/mp02/node1/mp02.scn create mode 100644 testsuites/mptests/mp02/node2/mp02.doc create mode 100644 testsuites/mptests/mp02/node2/mp02.scn create mode 100644 testsuites/mptests/mp02/system.h create mode 100644 testsuites/mptests/mp02/task1.c create mode 100644 testsuites/mptests/mp03/delay.c create mode 100644 testsuites/mptests/mp03/init.c create mode 100644 testsuites/mptests/mp03/node1/mp03.doc create mode 100644 testsuites/mptests/mp03/node1/mp03.scn create mode 100644 testsuites/mptests/mp03/node2/mp03.doc create mode 100644 testsuites/mptests/mp03/node2/mp03.scn create mode 100644 testsuites/mptests/mp03/system.h create mode 100644 testsuites/mptests/mp03/task1.c create mode 100644 testsuites/mptests/mp04/init.c create mode 100644 testsuites/mptests/mp04/node1/mp04.doc create mode 100644 testsuites/mptests/mp04/node1/mp04.scn create mode 100644 testsuites/mptests/mp04/node2/mp04.doc create mode 100644 testsuites/mptests/mp04/node2/mp04.scn create mode 100644 testsuites/mptests/mp04/system.h create mode 100644 testsuites/mptests/mp04/task1.c create mode 100644 testsuites/mptests/mp05/asr.c create mode 100644 testsuites/mptests/mp05/init.c create mode 100644 testsuites/mptests/mp05/node1/mp05.doc create mode 100644 testsuites/mptests/mp05/node1/mp05.scn create mode 100644 testsuites/mptests/mp05/node2/mp05.doc create mode 100644 testsuites/mptests/mp05/node2/mp05.scn create mode 100644 testsuites/mptests/mp05/system.h create mode 100644 testsuites/mptests/mp05/task1.c create mode 100644 testsuites/mptests/mp06/init.c create mode 100644 testsuites/mptests/mp06/node1/mp06.doc create mode 100644 testsuites/mptests/mp06/node1/mp06.scn create mode 100644 testsuites/mptests/mp06/node2/mp06.doc create mode 100644 testsuites/mptests/mp06/node2/mp06.scn create mode 100644 testsuites/mptests/mp06/system.h create mode 100644 testsuites/mptests/mp06/task1.c create mode 100644 testsuites/mptests/mp07/init.c create mode 100644 testsuites/mptests/mp07/node1/mp07.doc create mode 100644 testsuites/mptests/mp07/node1/mp07.scn create mode 100644 testsuites/mptests/mp07/node2/mp07.doc create mode 100644 testsuites/mptests/mp07/node2/mp07.scn create mode 100644 testsuites/mptests/mp07/system.h create mode 100644 testsuites/mptests/mp07/task1.c create mode 100644 testsuites/mptests/mp08/init.c create mode 100644 testsuites/mptests/mp08/node1/mp08.doc create mode 100644 testsuites/mptests/mp08/node1/mp08.scn create mode 100644 testsuites/mptests/mp08/node2/mp08.doc create mode 100644 testsuites/mptests/mp08/node2/mp08.scn create mode 100644 testsuites/mptests/mp08/system.h create mode 100644 testsuites/mptests/mp08/task1.c create mode 100644 testsuites/mptests/mp09/init.c create mode 100644 testsuites/mptests/mp09/node1/mp09.doc create mode 100644 testsuites/mptests/mp09/node1/mp09.scn create mode 100644 testsuites/mptests/mp09/node2/mp09.doc create mode 100644 testsuites/mptests/mp09/node2/mp09.scn create mode 100644 testsuites/mptests/mp09/recvmsg.c create mode 100644 testsuites/mptests/mp09/sendmsg.c create mode 100644 testsuites/mptests/mp09/system.h create mode 100644 testsuites/mptests/mp09/task1.c create mode 100644 testsuites/mptests/mp10/init.c create mode 100644 testsuites/mptests/mp10/node1/mp10.doc create mode 100644 testsuites/mptests/mp10/node1/mp10.scn create mode 100644 testsuites/mptests/mp10/node2/mp10.doc create mode 100644 testsuites/mptests/mp10/node2/mp10.scn create mode 100644 testsuites/mptests/mp10/system.h create mode 100644 testsuites/mptests/mp10/task1.c create mode 100644 testsuites/mptests/mp10/task2.c create mode 100644 testsuites/mptests/mp10/task3.c create mode 100644 testsuites/mptests/mp11/init.c create mode 100644 testsuites/mptests/mp11/node1/mp11.doc create mode 100644 testsuites/mptests/mp11/node1/mp11.scn create mode 100644 testsuites/mptests/mp11/node2/mp11.doc create mode 100644 testsuites/mptests/mp11/node2/mp11.scn create mode 100644 testsuites/mptests/mp11/system.h create mode 100644 testsuites/mptests/mp12/init.c create mode 100644 testsuites/mptests/mp12/node1/mp12.doc create mode 100644 testsuites/mptests/mp12/node1/mp12.scn create mode 100644 testsuites/mptests/mp12/node2/mp12.doc create mode 100644 testsuites/mptests/mp12/node2/mp12.scn create mode 100644 testsuites/mptests/mp12/system.h create mode 100644 testsuites/mptests/mp13/init.c create mode 100644 testsuites/mptests/mp13/node1/mp13.doc create mode 100644 testsuites/mptests/mp13/node1/mp13.scn create mode 100644 testsuites/mptests/mp13/node2/mp13.doc create mode 100644 testsuites/mptests/mp13/node2/mp13.scn create mode 100644 testsuites/mptests/mp13/system.h create mode 100644 testsuites/mptests/mp13/task1.c create mode 100644 testsuites/mptests/mp13/task2.c create mode 100644 testsuites/mptests/mp14/delay.c create mode 100644 testsuites/mptests/mp14/evtask1.c create mode 100644 testsuites/mptests/mp14/evtmtask.c create mode 100644 testsuites/mptests/mp14/exit.c create mode 100644 testsuites/mptests/mp14/init.c create mode 100644 testsuites/mptests/mp14/msgtask1.c create mode 100644 testsuites/mptests/mp14/node1/mp14.doc create mode 100644 testsuites/mptests/mp14/node1/mp14.scn create mode 100644 testsuites/mptests/mp14/node2/mp14.doc create mode 100644 testsuites/mptests/mp14/node2/mp14.scn create mode 100644 testsuites/mptests/mp14/pttask1.c create mode 100644 testsuites/mptests/mp14/smtask1.c create mode 100644 testsuites/mptests/mp14/system.h create mode 100644 testsuites/samples/README create mode 100644 testsuites/samples/base_mp/apptask.c create mode 100644 testsuites/samples/base_mp/init.c create mode 100644 testsuites/samples/base_mp/node1/base_mp.doc create mode 100644 testsuites/samples/base_mp/node1/base_mp.scn create mode 100644 testsuites/samples/base_mp/node2/base_mp.doc create mode 100644 testsuites/samples/base_mp/node2/base_mp.scn create mode 100644 testsuites/samples/base_mp/system.h create mode 100644 testsuites/samples/base_sp/apptask.c create mode 100644 testsuites/samples/base_sp/base_sp.doc create mode 100644 testsuites/samples/base_sp/base_sp.scn create mode 100644 testsuites/samples/base_sp/init.c create mode 100644 testsuites/samples/base_sp/system.h create mode 100644 testsuites/samples/cdtest/cdtest.scn create mode 100644 testsuites/samples/cdtest/init.c create mode 100644 testsuites/samples/cdtest/main.cc create mode 100644 testsuites/samples/cdtest/system.h create mode 100644 testsuites/samples/hello/hello.doc create mode 100644 testsuites/samples/hello/hello.scn create mode 100644 testsuites/samples/hello/init.c create mode 100644 testsuites/samples/hello/system.h create mode 100644 testsuites/samples/paranoia/init.c create mode 100644 testsuites/samples/paranoia/paranoia.c create mode 100644 testsuites/samples/paranoia/paranoia.doc create mode 100644 testsuites/samples/paranoia/system.h create mode 100644 testsuites/samples/ticker/init.c create mode 100644 testsuites/samples/ticker/system.h create mode 100644 testsuites/samples/ticker/tasks.c create mode 100644 testsuites/samples/ticker/ticker.doc create mode 100644 testsuites/samples/ticker/ticker.scn create mode 100644 testsuites/sptests/README create mode 100644 testsuites/sptests/sp01/init.c create mode 100644 testsuites/sptests/sp01/sp01.doc create mode 100644 testsuites/sptests/sp01/sp01.scn create mode 100644 testsuites/sptests/sp01/system.h create mode 100644 testsuites/sptests/sp01/task1.c create mode 100644 testsuites/sptests/sp02/init.c create mode 100644 testsuites/sptests/sp02/preempt.c create mode 100644 testsuites/sptests/sp02/sp02.doc create mode 100644 testsuites/sptests/sp02/sp02.scn create mode 100644 testsuites/sptests/sp02/system.h create mode 100644 testsuites/sptests/sp02/task1.c create mode 100644 testsuites/sptests/sp02/task2.c create mode 100644 testsuites/sptests/sp02/task3.c create mode 100644 testsuites/sptests/sp03/init.c create mode 100644 testsuites/sptests/sp03/sp03.doc create mode 100644 testsuites/sptests/sp03/sp03.scn create mode 100644 testsuites/sptests/sp03/system.h create mode 100644 testsuites/sptests/sp03/task1.c create mode 100644 testsuites/sptests/sp03/task2.c create mode 100644 testsuites/sptests/sp04/init.c create mode 100644 testsuites/sptests/sp04/sp04.doc create mode 100644 testsuites/sptests/sp04/sp04.scn create mode 100644 testsuites/sptests/sp04/system.h create mode 100644 testsuites/sptests/sp04/task1.c create mode 100644 testsuites/sptests/sp04/task2.c create mode 100644 testsuites/sptests/sp04/task3.c create mode 100644 testsuites/sptests/sp04/tswitch.c create mode 100644 testsuites/sptests/sp05/init.c create mode 100644 testsuites/sptests/sp05/sp05.doc create mode 100644 testsuites/sptests/sp05/sp05.scn create mode 100644 testsuites/sptests/sp05/system.h create mode 100644 testsuites/sptests/sp05/task1.c create mode 100644 testsuites/sptests/sp05/task2.c create mode 100644 testsuites/sptests/sp05/task3.c create mode 100644 testsuites/sptests/sp06/init.c create mode 100644 testsuites/sptests/sp06/sp06.doc create mode 100644 testsuites/sptests/sp06/sp06.scn create mode 100644 testsuites/sptests/sp06/system.h create mode 100644 testsuites/sptests/sp06/task1.c create mode 100644 testsuites/sptests/sp06/task2.c create mode 100644 testsuites/sptests/sp06/task3.c create mode 100644 testsuites/sptests/sp07/init.c create mode 100644 testsuites/sptests/sp07/sp07.doc create mode 100644 testsuites/sptests/sp07/sp07.scn create mode 100644 testsuites/sptests/sp07/system.h create mode 100644 testsuites/sptests/sp07/task1.c create mode 100644 testsuites/sptests/sp07/task2.c create mode 100644 testsuites/sptests/sp07/task3.c create mode 100644 testsuites/sptests/sp07/task4.c create mode 100644 testsuites/sptests/sp07/taskexit.c create mode 100644 testsuites/sptests/sp07/tcreate.c create mode 100644 testsuites/sptests/sp07/tdelete.c create mode 100644 testsuites/sptests/sp07/trestart.c create mode 100644 testsuites/sptests/sp07/tstart.c create mode 100644 testsuites/sptests/sp08/init.c create mode 100644 testsuites/sptests/sp08/sp08.doc create mode 100644 testsuites/sptests/sp08/sp08.scn create mode 100644 testsuites/sptests/sp08/system.h create mode 100644 testsuites/sptests/sp08/task1.c create mode 100644 testsuites/sptests/sp09/delay.c create mode 100644 testsuites/sptests/sp09/init.c create mode 100644 testsuites/sptests/sp09/isr.c create mode 100644 testsuites/sptests/sp09/screen01.c create mode 100644 testsuites/sptests/sp09/screen02.c create mode 100644 testsuites/sptests/sp09/screen03.c create mode 100644 testsuites/sptests/sp09/screen04.c create mode 100644 testsuites/sptests/sp09/screen05.c create mode 100644 testsuites/sptests/sp09/screen06.c create mode 100644 testsuites/sptests/sp09/screen07.c create mode 100644 testsuites/sptests/sp09/screen08.c create mode 100644 testsuites/sptests/sp09/screen09.c create mode 100644 testsuites/sptests/sp09/screen10.c create mode 100644 testsuites/sptests/sp09/screen11.c create mode 100644 testsuites/sptests/sp09/screen12.c create mode 100644 testsuites/sptests/sp09/screen13.c create mode 100644 testsuites/sptests/sp09/screen14.c create mode 100644 testsuites/sptests/sp09/sp09.doc create mode 100644 testsuites/sptests/sp09/sp09.scn create mode 100644 testsuites/sptests/sp09/system.h create mode 100644 testsuites/sptests/sp09/task1.c create mode 100644 testsuites/sptests/sp09/task2.c create mode 100644 testsuites/sptests/sp09/task3.c create mode 100644 testsuites/sptests/sp09/task4.c create mode 100644 testsuites/sptests/sp11/init.c create mode 100644 testsuites/sptests/sp11/sp11.doc create mode 100644 testsuites/sptests/sp11/sp11.scn create mode 100644 testsuites/sptests/sp11/system.h create mode 100644 testsuites/sptests/sp11/task1.c create mode 100644 testsuites/sptests/sp11/task2.c create mode 100644 testsuites/sptests/sp11/timer.c create mode 100644 testsuites/sptests/sp12/init.c create mode 100644 testsuites/sptests/sp12/pridrv.c create mode 100644 testsuites/sptests/sp12/pritask.c create mode 100644 testsuites/sptests/sp12/sp12.doc create mode 100644 testsuites/sptests/sp12/sp12.scn create mode 100644 testsuites/sptests/sp12/system.h create mode 100644 testsuites/sptests/sp12/task1.c create mode 100644 testsuites/sptests/sp12/task2.c create mode 100644 testsuites/sptests/sp12/task3.c create mode 100644 testsuites/sptests/sp12/task4.c create mode 100644 testsuites/sptests/sp12/task5.c create mode 100644 testsuites/sptests/sp13/fillbuff.c create mode 100644 testsuites/sptests/sp13/init.c create mode 100644 testsuites/sptests/sp13/putbuff.c create mode 100644 testsuites/sptests/sp13/sp13.doc create mode 100644 testsuites/sptests/sp13/sp13.scn create mode 100644 testsuites/sptests/sp13/system.h create mode 100644 testsuites/sptests/sp13/task1.c create mode 100644 testsuites/sptests/sp13/task2.c create mode 100644 testsuites/sptests/sp13/task3.c create mode 100644 testsuites/sptests/sp14/asr.c create mode 100644 testsuites/sptests/sp14/init.c create mode 100644 testsuites/sptests/sp14/sp14.doc create mode 100644 testsuites/sptests/sp14/sp14.scn create mode 100644 testsuites/sptests/sp14/system.h create mode 100644 testsuites/sptests/sp14/task1.c create mode 100644 testsuites/sptests/sp14/task2.c create mode 100644 testsuites/sptests/sp15/init.c create mode 100644 testsuites/sptests/sp15/sp15.doc create mode 100644 testsuites/sptests/sp15/sp15.scn create mode 100644 testsuites/sptests/sp15/system.h create mode 100644 testsuites/sptests/sp15/task1.c create mode 100644 testsuites/sptests/sp16/init.c create mode 100644 testsuites/sptests/sp16/sp16.doc create mode 100644 testsuites/sptests/sp16/sp16.scn create mode 100644 testsuites/sptests/sp16/system.h create mode 100644 testsuites/sptests/sp16/task1.c create mode 100644 testsuites/sptests/sp16/task2.c create mode 100644 testsuites/sptests/sp16/task3.c create mode 100644 testsuites/sptests/sp16/task4.c create mode 100644 testsuites/sptests/sp16/task5.c create mode 100644 testsuites/sptests/sp17/asr.c create mode 100644 testsuites/sptests/sp17/init.c create mode 100644 testsuites/sptests/sp17/sp17.doc create mode 100644 testsuites/sptests/sp17/sp17.scn create mode 100644 testsuites/sptests/sp17/system.h create mode 100644 testsuites/sptests/sp17/task1.c create mode 100644 testsuites/sptests/sp17/task2.c create mode 100644 testsuites/sptests/sp19/first.c create mode 100644 testsuites/sptests/sp19/fptask.c create mode 100644 testsuites/sptests/sp19/fptest.h create mode 100644 testsuites/sptests/sp19/init.c create mode 100644 testsuites/sptests/sp19/inttest.h create mode 100644 testsuites/sptests/sp19/sp19.doc create mode 100644 testsuites/sptests/sp19/sp19.scn create mode 100644 testsuites/sptests/sp19/system.h create mode 100644 testsuites/sptests/sp19/task1.c create mode 100644 testsuites/sptests/sp20/getall.c create mode 100644 testsuites/sptests/sp20/init.c create mode 100644 testsuites/sptests/sp20/sp20.doc create mode 100644 testsuites/sptests/sp20/sp20.scn create mode 100644 testsuites/sptests/sp20/system.h create mode 100644 testsuites/sptests/sp20/task1.c create mode 100644 testsuites/sptests/sp21/init.c create mode 100644 testsuites/sptests/sp21/sp21.doc create mode 100644 testsuites/sptests/sp21/sp21.scn create mode 100644 testsuites/sptests/sp21/system.h create mode 100644 testsuites/sptests/sp21/task1.c create mode 100644 testsuites/sptests/sp22/delay.c create mode 100644 testsuites/sptests/sp22/init.c create mode 100644 testsuites/sptests/sp22/prtime.c create mode 100644 testsuites/sptests/sp22/sp22.doc create mode 100644 testsuites/sptests/sp22/sp22.scn create mode 100644 testsuites/sptests/sp22/system.h create mode 100644 testsuites/sptests/sp22/task1.c create mode 100644 testsuites/sptests/sp23/init.c create mode 100644 testsuites/sptests/sp23/sp23.doc create mode 100644 testsuites/sptests/sp23/sp23.scn create mode 100644 testsuites/sptests/sp23/system.h create mode 100644 testsuites/sptests/sp23/task1.c create mode 100644 testsuites/sptests/sp24/init.c create mode 100644 testsuites/sptests/sp24/resume.c create mode 100644 testsuites/sptests/sp24/sp24.doc create mode 100644 testsuites/sptests/sp24/sp24.scn create mode 100644 testsuites/sptests/sp24/system.h create mode 100644 testsuites/sptests/sp24/task1.c create mode 100644 testsuites/sptests/sp25/init.c create mode 100644 testsuites/sptests/sp25/sp25.doc create mode 100644 testsuites/sptests/sp25/sp25.scn create mode 100644 testsuites/sptests/sp25/system.h create mode 100644 testsuites/sptests/sp25/task1.c create mode 100644 testsuites/sptests/spfatal/fatal.c create mode 100644 testsuites/sptests/spfatal/init.c create mode 100644 testsuites/sptests/spfatal/puterr.c create mode 100644 testsuites/sptests/spfatal/spfatal.doc create mode 100644 testsuites/sptests/spfatal/spfatal.scn create mode 100644 testsuites/sptests/spfatal/system.h create mode 100644 testsuites/sptests/spfatal/task1.c create mode 100644 testsuites/sptests/spsize/getint.c create mode 100644 testsuites/sptests/spsize/init.c create mode 100644 testsuites/sptests/spsize/size.c create mode 100644 testsuites/support/include/tmacros.h create mode 100644 testsuites/tmtests/README create mode 100644 testsuites/tmtests/include/timesys.h create mode 100644 testsuites/tmtests/tm01/system.h create mode 100644 testsuites/tmtests/tm01/task1.c create mode 100644 testsuites/tmtests/tm01/tm01.doc create mode 100644 testsuites/tmtests/tm02/system.h create mode 100644 testsuites/tmtests/tm02/task1.c create mode 100644 testsuites/tmtests/tm02/tm02.doc create mode 100644 testsuites/tmtests/tm03/system.h create mode 100644 testsuites/tmtests/tm03/task1.c create mode 100644 testsuites/tmtests/tm03/tm03.doc create mode 100644 testsuites/tmtests/tm04/system.h create mode 100644 testsuites/tmtests/tm04/task1.c create mode 100644 testsuites/tmtests/tm04/tm04.doc create mode 100644 testsuites/tmtests/tm05/system.h create mode 100644 testsuites/tmtests/tm05/task1.c create mode 100644 testsuites/tmtests/tm05/tm05.doc create mode 100644 testsuites/tmtests/tm06/system.h create mode 100644 testsuites/tmtests/tm06/task1.c create mode 100644 testsuites/tmtests/tm06/tm06.doc create mode 100644 testsuites/tmtests/tm07/system.h create mode 100644 testsuites/tmtests/tm07/task1.c create mode 100644 testsuites/tmtests/tm07/tm07.doc create mode 100644 testsuites/tmtests/tm08/system.h create mode 100644 testsuites/tmtests/tm08/task1.c create mode 100644 testsuites/tmtests/tm08/tm08.doc create mode 100644 testsuites/tmtests/tm09/system.h create mode 100644 testsuites/tmtests/tm09/task1.c create mode 100644 testsuites/tmtests/tm09/tm09.doc create mode 100644 testsuites/tmtests/tm10/system.h create mode 100644 testsuites/tmtests/tm10/task1.c create mode 100644 testsuites/tmtests/tm10/tm10.doc create mode 100644 testsuites/tmtests/tm11/system.h create mode 100644 testsuites/tmtests/tm11/task1.c create mode 100644 testsuites/tmtests/tm11/tm11.doc create mode 100644 testsuites/tmtests/tm12/system.h create mode 100644 testsuites/tmtests/tm12/task1.c create mode 100644 testsuites/tmtests/tm12/tm12.doc create mode 100644 testsuites/tmtests/tm13/system.h create mode 100644 testsuites/tmtests/tm13/task1.c create mode 100644 testsuites/tmtests/tm13/tm13.doc create mode 100644 testsuites/tmtests/tm14/system.h create mode 100644 testsuites/tmtests/tm14/task1.c create mode 100644 testsuites/tmtests/tm14/tm14.doc create mode 100644 testsuites/tmtests/tm15/system.h create mode 100644 testsuites/tmtests/tm15/task1.c create mode 100644 testsuites/tmtests/tm15/tm15.doc create mode 100644 testsuites/tmtests/tm16/system.h create mode 100644 testsuites/tmtests/tm16/task1.c create mode 100644 testsuites/tmtests/tm16/tm16.doc create mode 100644 testsuites/tmtests/tm17/system.h create mode 100644 testsuites/tmtests/tm17/task1.c create mode 100644 testsuites/tmtests/tm17/tm17.doc create mode 100644 testsuites/tmtests/tm18/system.h create mode 100644 testsuites/tmtests/tm18/task1.c create mode 100644 testsuites/tmtests/tm18/tm18.doc create mode 100644 testsuites/tmtests/tm19/system.h create mode 100644 testsuites/tmtests/tm19/task1.c create mode 100644 testsuites/tmtests/tm19/tm19.doc create mode 100644 testsuites/tmtests/tm20/system.h create mode 100644 testsuites/tmtests/tm20/task1.c create mode 100644 testsuites/tmtests/tm20/tm20.doc create mode 100644 testsuites/tmtests/tm21/system.h create mode 100644 testsuites/tmtests/tm21/task1.c create mode 100644 testsuites/tmtests/tm21/tm21.doc create mode 100644 testsuites/tmtests/tm22/system.h create mode 100644 testsuites/tmtests/tm22/task1.c create mode 100644 testsuites/tmtests/tm22/tm22.doc create mode 100644 testsuites/tmtests/tm23/system.h create mode 100644 testsuites/tmtests/tm23/task1.c create mode 100644 testsuites/tmtests/tm23/tm23.doc create mode 100644 testsuites/tmtests/tm24/system.h create mode 100644 testsuites/tmtests/tm24/task1.c create mode 100644 testsuites/tmtests/tm24/tm24.doc create mode 100644 testsuites/tmtests/tm25/system.h create mode 100644 testsuites/tmtests/tm25/task1.c create mode 100644 testsuites/tmtests/tm25/tm25.doc create mode 100644 testsuites/tmtests/tm26/fptest.h create mode 100644 testsuites/tmtests/tm26/system.h create mode 100644 testsuites/tmtests/tm26/task1.c create mode 100644 testsuites/tmtests/tm26/tm26.doc create mode 100644 testsuites/tmtests/tm27/system.h create mode 100644 testsuites/tmtests/tm27/task1.c create mode 100644 testsuites/tmtests/tm27/tm27.doc create mode 100644 testsuites/tmtests/tm28/system.h create mode 100644 testsuites/tmtests/tm28/task1.c create mode 100644 testsuites/tmtests/tm28/tm28.doc create mode 100644 testsuites/tmtests/tm29/system.h create mode 100644 testsuites/tmtests/tm29/task1.c create mode 100644 testsuites/tmtests/tm29/tm29.doc create mode 100644 testsuites/tmtests/tmck/system.h create mode 100644 testsuites/tmtests/tmck/task1.c create mode 100644 testsuites/tmtests/tmck/tmck.doc create mode 100644 testsuites/tmtests/tmoverhd/dumrtems.h create mode 100644 testsuites/tmtests/tmoverhd/empty.c create mode 100644 testsuites/tmtests/tmoverhd/system.h create mode 100644 testsuites/tmtests/tmoverhd/testtask.c create mode 100644 testsuites/tmtests/tmoverhd/tmoverhd.doc (limited to 'testsuites') diff --git a/testsuites/README b/testsuites/README new file mode 100644 index 0000000000..0b0e339b97 --- /dev/null +++ b/testsuites/README @@ -0,0 +1,39 @@ +# +# $Id$ +# + +This is the directory under which the RTEMS +test programs provided with the release are located. The +following is a description of the contents of each file and +subdirectory directly in this directory: + +NOTE: Other than the 'samples' directory these tests are intended + only to exercise RTEMS features and are *not* good examples + of programming for RTEMS. + + samples + + This directory contains a set of simple sample applications + which can be used either to test a board support package + or as the starting point for a custom application. + + mptest + + This directory contains the RTEMS Multiprocessor Test Suite. + The tests in this directory provide near complete (98%+) test + coverage of the multiprocessor specific code in RTEMS. + + sptest + + This directory contains the RTEMS Single Processor Test Suite. + The tests in this directory provide near complete (98%+) test + coverage of the non-multiprocessor code in RTEMS. + + tmtest + + This directory contains the RTEMS Timing Test Suite. + The tests in this directory are used to measure the execution + time of RTEMS directive and some critical internal functions. + The results of these test are reported in the Fact Sheets + and Supplental Manuals. + diff --git a/testsuites/libtests/README b/testsuites/libtests/README new file mode 100644 index 0000000000..bc4b217832 --- /dev/null +++ b/testsuites/libtests/README @@ -0,0 +1,10 @@ +# +# $Id$ +# + +This directory contains tests for some of the items in +the lib directories. The intent is to be able to +verify the basic functionality of a library. For example, +it is important to know that the stack checker successfully +detects tasks which both stay within and exceed their +stack limits. diff --git a/testsuites/libtests/stackchk/blow.c b/testsuites/libtests/stackchk/blow.c new file mode 100644 index 0000000000..9ad93d849c --- /dev/null +++ b/testsuites/libtests/stackchk/blow.c @@ -0,0 +1,47 @@ +/* task1.c + * + * This set of three tasks do some simple task switching for about + * 15 seconds and then call a routine to "blow the stack". + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include +#include + +void b() {} + +void blow_stack( void ) +{ + volatile unsigned32 *low, *high; + +b(); + /* + * Destroy the first and last 16 bytes of our stack... Hope it + * does not cause problems :) + */ + + low = _Thread_Executing->Start.Initial_stack.area + HEAP_OVERHEAD; + high = _Thread_Executing->Start.Initial_stack.area + + _Thread_Executing->Start.Initial_stack.size - 16; + + low[0] = 0x11111111; + low[1] = 0x22222222; + low[2] = 0x33333333; + low[3] = 0x44444444; + + high[0] = 0x55555555; + high[1] = 0x66666666; + high[2] = 0x77777777; + high[3] = 0x88888888; + +} diff --git a/testsuites/libtests/stackchk/init.c b/testsuites/libtests/stackchk/init.c new file mode 100644 index 0000000000..dc0d94931e --- /dev/null +++ b/testsuites/libtests/stackchk/init.c @@ -0,0 +1,89 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "app.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_time_of_day time; + rtems_status_code status; + + puts( "\n\n*** TEST STACK CHECKER ***" ); + + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + TASK_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 1, + TASK_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 1, + TASK_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1_through_3, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_1_through_3, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_1_through_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/libtests/stackchk/stackchk.scn b/testsuites/libtests/stackchk/stackchk.scn new file mode 100644 index 0000000000..84a5c5e342 --- /dev/null +++ b/testsuites/libtests/stackchk/stackchk.scn @@ -0,0 +1,9 @@ +*** TEST STACK CHECKER *** +TA1 - rtems_clock_get - 09:00:00 12/31/1988 +TA2 - rtems_clock_get - 09:00:00 12/31/1988 +TA3 - rtems_clock_get - 09:00:00 12/31/1988 +TA1 - rtems_clock_get - 09:00:05 12/31/1988 +TA1 - rtems_clock_get - 09:00:10 12/31/1988 +TA2 - rtems_clock_get - 09:00:10 12/31/1988 +TA1 - rtems_clock_get - 09:00:15 12/31/1988 +---> error indictation diff --git a/testsuites/libtests/stackchk/task1.c b/testsuites/libtests/stackchk/task1.c new file mode 100644 index 0000000000..d683619c7e --- /dev/null +++ b/testsuites/libtests/stackchk/task1.c @@ -0,0 +1,44 @@ +/* task1.c + * + * This set of three tasks do some simple task switching for about + * 15 seconds and then call a routine to "blow the stack". + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "app.h" + +rtems_task Task_1_through_3( + rtems_task_argument argument +) +{ + rtems_id tid; + rtems_time_of_day time; + rtems_status_code status; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident" ); + + while( FOREVER ) { + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + if ( time.second >= 15 && tid == Task_id[ 1 ] ) { + blow_stack(); + } + + put_name( Task_name[ task_number( tid ) ], FALSE ); + print_time( " - rtems_clock_get - ", &time, "\n" ); + + status = rtems_task_wake_after( task_number( tid ) * 5 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + } +} diff --git a/testsuites/mptests/README b/testsuites/mptests/README new file mode 100644 index 0000000000..68cb459b55 --- /dev/null +++ b/testsuites/mptests/README @@ -0,0 +1,10 @@ +# +# $Id$ +# + +This directory contains the RTEMS Multiprocessor Test Suite. +The tests in this directory provide near complete (98%+) test +coverage of the multiprocessor specific code in RTEMS. + +These tests are designed to test RTEMS in a two node configuration. + diff --git a/testsuites/mptests/mp01/init.c b/testsuites/mptests/mp01/init.c new file mode 100644 index 0000000000..2af49c8a6b --- /dev/null +++ b/testsuites/mptests/mp01/init.c @@ -0,0 +1,99 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_time_of_day time; + char c; + + printf( + "\n\n*** TEST 1 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + if ( Multiprocessing_configuration.node != 1 ) c = 'S'; + else c = 'M'; + + Task_name[ 1 ] = rtems_build_name( c, 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( c, 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( c, 'A', '3', ' ' ); + + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + puts( "Creating task 1 (Global)" ); + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_GLOBAL, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of Task 1" ); + + puts( "Creating task 2 (Global)" ); + status = rtems_task_create( + Task_name[ 2 ], + 1, + 2048, + RTEMS_TIMESLICE, + RTEMS_GLOBAL, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of Task 2" ); + + puts( "Creating task 3 (Local)" ); + status = rtems_task_create( + Task_name[ 3 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of Task 3" ); + + status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start of Task 1" ); + + status = rtems_task_start( Task_id[ 2 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start of Task 2" ); + + status = rtems_task_start( Task_id[ 3 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start of Task 3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/mptests/mp01/node1/mp01.doc b/testsuites/mptests/mp01/node1/mp01.doc new file mode 100644 index 0000000000..83e06e2357 --- /dev/null +++ b/testsuites/mptests/mp01/node1/mp01.doc @@ -0,0 +1,53 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test50 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + tm_set, tm_get, tm_wkafter, t_delete + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies that a task can get the task identification number of itself. + + h. Verifies that a task can get the task identification number + of a global task on the local processor. + + i. Verifies that a task can delete itself or a global task on + the local processor. + + j. Verifies Shared Memory Locked Queue driver for initialization, + getting a packet, broadcasting a packet, and returning a packet. + + k. Can be used to verify that global packet type P_SYSVERIFY, + P_OBJCREATE (task), and P_OBJDELETE (task) are sent and + correctly processed by a remote node. diff --git a/testsuites/mptests/mp01/node1/mp01.scn b/testsuites/mptests/mp01/node1/mp01.scn new file mode 100644 index 0000000000..d399f79b2a --- /dev/null +++ b/testsuites/mptests/mp01/node1/mp01.scn @@ -0,0 +1,15 @@ +*** TEST 1 -- NODE 1 *** +Creating task 1 (Global) +Creating task 2 (Global) +Creating task 3 (Local) +MA1 - rtems_clock_get - 09:00:00 12/31/1988 +MA2 - rtems_clock_get - 09:00:00 12/31/1988 +MA3 - rtems_clock_get - 09:00:00 12/31/1988 +MA1 - rtems_clock_get - 09:00:05 12/31/1988 +MA1 - deleting self +MA2 - rtems_clock_get - 09:00:10 12/31/1988 +MA2 - waiting to be deleted by MA3 +MA3 - rtems_clock_get - 09:00:15 12/31/1988 +MA3 - getting TID of MA2 +MA3 - deleting MA2 +*** END OF TEST 1 *** diff --git a/testsuites/mptests/mp01/node2/mp01.doc b/testsuites/mptests/mp01/node2/mp01.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp01/node2/mp01.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/mptests/mp01/node2/mp01.scn b/testsuites/mptests/mp01/node2/mp01.scn new file mode 100644 index 0000000000..c9831ff9db --- /dev/null +++ b/testsuites/mptests/mp01/node2/mp01.scn @@ -0,0 +1,15 @@ +*** TEST 1 -- NODE 2 *** +Creating task 1 (Global) +Creating task 2 (Global) +Creating task 3 (Local) +SA1 - rtems_clock_get - 09:00:00 12/31/1988 +SA2 - rtems_clock_get - 09:00:00 12/31/1988 +SA3 - rtems_clock_get - 09:00:00 12/31/1988 +SA1 - rtems_clock_get - 09:00:05 12/31/1988 +SA1 - deleting self +SA2 - rtems_clock_get - 09:00:10 12/31/1988 +SA2 - waiting to be deleted by SA3 +SA3 - rtems_clock_get - 09:00:15 12/31/1988 +SA3 - getting TID of SA2 +SA3 - deleting SA2 +*** END OF TEST 1 *** diff --git a/testsuites/mptests/mp01/system.h b/testsuites/mptests/mp01/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/mptests/mp01/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/mptests/mp01/task1.c b/testsuites/mptests/mp01/task1.c new file mode 100644 index 0000000000..a2c3ec3a1d --- /dev/null +++ b/testsuites/mptests/mp01/task1.c @@ -0,0 +1,84 @@ +/* Test_task + * + * This task is used for three test tasks. It obtains its task id and + * based upon that id, performs certain actions. + * + * Task_1 delays 5 seconds and deletes itself. + * Task_2 delays 10 seconds and then loops until + * deleted by the third task. + * Task 3 delays 15 seconds, then deletes task 2 and itself. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Test_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_id tid; + rtems_time_of_day time; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + put_name( Task_name[ task_number( tid ) ], FALSE ); + print_time( " - rtems_clock_get - ", &time, "\n" ); + + status = rtems_task_wake_after( task_number( tid ) * 5 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + put_name( Task_name[ task_number( tid ) ], FALSE ); + print_time( " - rtems_clock_get - ", &time, "\n" ); + + if ( task_number(tid) == 1 ) { /* TASK 1 */ + put_name( Task_name[ 1 ], FALSE ); + printf( " - deleting self\n" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); + } + else if ( task_number(tid) == 2 ) { /* TASK 2 */ + put_name( Task_name[ 2 ], FALSE ); + printf( " - waiting to be deleted by " ); + put_name( Task_name[ 3 ], TRUE ); + while ( FOREVER ); + } + else { /* TASK 3 */ + put_name( Task_name[ 3 ], FALSE ); + printf( " - getting TID of " ); + put_name( Task_name[ 2 ], TRUE ); + do { + status = rtems_task_ident( Task_name[ 2 ], RTEMS_SEARCH_ALL_NODES, &tid ); + } while ( status != RTEMS_SUCCESSFUL ); + directive_failed( status, "rtems_task_ident" ); + + put_name( Task_name[ 3 ], FALSE ); + printf( " - deleting " ); + put_name( Task_name[ 2 ], TRUE ); + status = rtems_task_delete( tid ); + directive_failed( status, "rtems_task_delete of Task 2" ); + + puts( "*** END OF TEST 1 ***" ); + exit(0); + } +} diff --git a/testsuites/mptests/mp02/init.c b/testsuites/mptests/mp02/init.c new file mode 100644 index 0000000000..75d8565785 --- /dev/null +++ b/testsuites/mptests/mp02/init.c @@ -0,0 +1,63 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + printf( + "\n\n*** TEST 2 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); + + puts( "Creating Test_task (Global)" ); + status = rtems_task_create( + Task_name[Multiprocessing_configuration.node], + 1, + 2048, + RTEMS_NO_PREEMPT, + RTEMS_GLOBAL, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task (Global)" ); + status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Deleting initialization task" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/mptests/mp02/node1/mp02.doc b/testsuites/mptests/mp02/node1/mp02.doc new file mode 100644 index 0000000000..e74807f7f1 --- /dev/null +++ b/testsuites/mptests/mp02/node1/mp02.doc @@ -0,0 +1,47 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test51 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + tm_set, tm_get, tm_wkafter, t_delete, t_restart, t_getreg, t_setreg + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + c. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + d. Verifies executive initialization performed correctly. + + e. Verifies that a task can get the task identification number of itself. + + f. Verifies that a task can get the task identification number + of another task. + + g. Verifies that a task can delete itself or another task. + + h. Verifies that errors are returned in the following situations: + 1) when attempting to delete a remote task. + 2) when attempting to start a remote task. + 3) when attempting to restart a remote task. + + i. Verifies that a remote task's registers can be set and read. diff --git a/testsuites/mptests/mp02/node1/mp02.scn b/testsuites/mptests/mp02/node1/mp02.scn new file mode 100644 index 0000000000..72fdefe69d --- /dev/null +++ b/testsuites/mptests/mp02/node1/mp02.scn @@ -0,0 +1,14 @@ +*** TEST 2 -- NODE 1 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Remote task's name is : 222 +Getting TID of remote task (all nodes) +Getting TID of remote task (1 node) +rtems_task_delete of remote task returned the correct error +rtems_task_start of remote task returned the correct error +rtems_task_restart of remote task returned the correct error +Setting notepad 1 of the remote task to 1 +Getting a notepad of the remote task +Remote notepad set and read correctly +*** END OF TEST 2 *** diff --git a/testsuites/mptests/mp02/node2/mp02.doc b/testsuites/mptests/mp02/node2/mp02.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp02/node2/mp02.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/mptests/mp02/node2/mp02.scn b/testsuites/mptests/mp02/node2/mp02.scn new file mode 100644 index 0000000000..233a910999 --- /dev/null +++ b/testsuites/mptests/mp02/node2/mp02.scn @@ -0,0 +1,14 @@ +*** TEST 2 -- NODE 2 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Remote task's name is : 111 +Getting TID of remote task (all nodes) +Getting TID of remote task (1 node) +rtems_task_delete of remote task returned the correct error +rtems_task_start of remote task returned the correct error +rtems_task_restart of remote task returned the correct error +Setting notepad 2 of the remote task to 2 +Getting a notepad of the remote task +Remote notepad set and read correctly +*** END OF TEST 2 *** diff --git a/testsuites/mptests/mp02/system.h b/testsuites/mptests/mp02/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/mptests/mp02/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/mptests/mp02/task1.c b/testsuites/mptests/mp02/task1.c new file mode 100644 index 0000000000..44764486b0 --- /dev/null +++ b/testsuites/mptests/mp02/task1.c @@ -0,0 +1,118 @@ +/* Test_task + * + * This task tests the rtems_task_set_note directive on a remote task and that + * errors are returned when attempting to delete, start, or restart + * a remote task. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +extern rtems_multiprocessing_table Multiprocessing_configuration; + +rtems_task Test_task( + rtems_task_argument argument +) +{ + rtems_id tid; + rtems_status_code status; + rtems_unsigned32 remote_node; + rtems_id remote_tid; + rtems_id test_tid; + rtems_unsigned32 note; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + + remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1; + printf( "Remote task's name is : " ); + put_name( Task_name[ remote_node ], TRUE ); + + puts( "Getting TID of remote task (all nodes)" ); + do { + status = rtems_task_ident( + Task_name[ remote_node ], + RTEMS_SEARCH_ALL_NODES, + &remote_tid + ); + } while ( status != RTEMS_SUCCESSFUL ); + + directive_failed( status, "rtems_task_ident" ); + + puts( "Getting TID of remote task (1 node)" ); + status = rtems_task_ident( Task_name[ remote_node ], remote_node, &test_tid ); + directive_failed( status, "rtems_task_ident" ); + + if ( test_tid != remote_tid ) { + puts( "rtems_task_ident tid's do not match!!" ); + rtems_fatal_error_occurred( status ); + } + + status = rtems_task_delete( remote_tid ); + fatal_directive_status( + status, + RTEMS_ILLEGAL_ON_REMOTE_OBJECT, + "rtems_task_delete of remote task" + ); + puts( "rtems_task_delete of remote task returned the correct error" ); + + status = rtems_task_start( remote_tid, Test_task, 0 ); + fatal_directive_status( + status, + RTEMS_ILLEGAL_ON_REMOTE_OBJECT, + "rtems_task_start of remote task" + ); + puts( "rtems_task_start of remote task returned the correct error" ); + + status = rtems_task_restart( remote_tid, 0 ); + fatal_directive_status( + status, + RTEMS_ILLEGAL_ON_REMOTE_OBJECT, + "rtems_task_restart of remote task" + ); + puts( "rtems_task_restart of remote task returned the correct error" ); + + printf( + "Setting notepad %d of the remote task to %d\n", + rtems_get_node(tid), + rtems_get_node(tid) + ); + status = rtems_task_set_note( + remote_tid, + rtems_get_node(tid), + rtems_get_node(tid) + ); + directive_failed( status, "rtems_task_set_note" ); + + puts( "Getting a notepad of the remote task" ); + status = rtems_task_get_note( remote_tid, rtems_get_node(tid), ¬e ); + directive_failed( status, "rtems_task_get_note" ); + + if ( note == rtems_get_node(tid) ) + puts( "Remote notepad set and read correctly" ); + else + printf( + "FAILURE!! Remote notepad was not set and read correctly (%d, %d)\n", + note, + rtems_get_node( tid ) + ); + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "*** END OF TEST 2 ***" ); + exit( 0 ); +} diff --git a/testsuites/mptests/mp03/delay.c b/testsuites/mptests/mp03/delay.c new file mode 100644 index 0000000000..6a6bb5f25e --- /dev/null +++ b/testsuites/mptests/mp03/delay.c @@ -0,0 +1,31 @@ +/* Delayed_send_event + * + * This routine is a timer service routine which sends an event to task 1. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_timer_service_routine Delayed_send_event( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_16 ); + directive_failed( status, "rtems_event_send" ); +} diff --git a/testsuites/mptests/mp03/init.c b/testsuites/mptests/mp03/init.c new file mode 100644 index 0000000000..a1f210dad1 --- /dev/null +++ b/testsuites/mptests/mp03/init.c @@ -0,0 +1,68 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + printf( + "\n\n*** TEST 3 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); + + puts( "Creating Test_task (Global)" ); + status = rtems_task_create( + Task_name[ Multiprocessing_configuration.node ], + 1, + 2048, + RTEMS_NO_PREEMPT, + RTEMS_GLOBAL, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task (Global)" ); + status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create" ); + + puts( "Deleting initialization task" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/mptests/mp03/node1/mp03.doc b/testsuites/mptests/mp03/node1/mp03.doc new file mode 100644 index 0000000000..348afef85f --- /dev/null +++ b/testsuites/mptests/mp03/node1/mp03.doc @@ -0,0 +1,45 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test52 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + tm_wkafter, t_suspend, t_resume + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies that a task can get the task identification number of itself. + + h. Verifies that a task can get the task identification number + of another task (on another node). + + i. Verifies that a task can suspend and resume a remote task. diff --git a/testsuites/mptests/mp03/node1/mp03.scn b/testsuites/mptests/mp03/node1/mp03.scn new file mode 100644 index 0000000000..129e5bccba --- /dev/null +++ b/testsuites/mptests/mp03/node1/mp03.scn @@ -0,0 +1,24 @@ +*** TEST 3 -- NODE 1 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Getting TID of remote task +Remote task's name is : 222 +111 - Suspending remote task +111 - Resuming remote task +111 - Suspending remote task +111 - Resuming remote task +111 - Suspending remote task +111 - Resuming remote task +111 - Have I been suspended????? +111 - Have I been suspended????? +111 - Have I been suspended????? +111 - Have I been suspended????? + + ........ + +111 - Have I been suspended????? +111 - Have I been suspended????? +111 - Have I been suspended????? +111 - Have I been suspended????? +*** END OF TEST 3 *** diff --git a/testsuites/mptests/mp03/node2/mp03.doc b/testsuites/mptests/mp03/node2/mp03.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp03/node2/mp03.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/mptests/mp03/node2/mp03.scn b/testsuites/mptests/mp03/node2/mp03.scn new file mode 100644 index 0000000000..d77c09e9f7 --- /dev/null +++ b/testsuites/mptests/mp03/node2/mp03.scn @@ -0,0 +1,24 @@ +*** TEST 3 -- NODE 2 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Getting TID of remote task +Remote task's name is : 111 +222 - Have I been suspended????? +222 - Have I been suspended????? +222 - Have I been suspended????? +222 - Have I been suspended????? + + ........ + +222 - Have I been suspended????? +222 - Have I been suspended????? +222 - Have I been suspended????? +222 - Have I been suspended????? +222 - Suspending remote task +222 - Resuming remote task +222 - Suspending remote task +222 - Resuming remote task +222 - Suspending remote task +222 - Resuming remote task +*** END OF TEST 3 *** diff --git a/testsuites/mptests/mp03/system.h b/testsuites/mptests/mp03/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/mptests/mp03/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/mptests/mp03/task1.c b/testsuites/mptests/mp03/task1.c new file mode 100644 index 0000000000..c1f0f777fd --- /dev/null +++ b/testsuites/mptests/mp03/task1.c @@ -0,0 +1,155 @@ +/* Test_task + * + * This task suspends and resumes a remote task. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +/*PAGE + * + * Test_Task_Support + * + */ + +void Test_Task_Support( + rtems_unsigned32 node +) +{ + rtems_event_set events; + rtems_status_code status; + + if ( Multiprocessing_configuration.node == node ) { + + for ( ; ; ) { + + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &events + ); + + if ( status == RTEMS_SUCCESSFUL ) + break; + + fatal_directive_status(status, RTEMS_UNSATISFIED, "rtems_event_receive"); + + status = rtems_task_wake_after( 2 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + put_name( Task_name[ node ], FALSE ); + puts( " - Suspending remote task" ); + + status = rtems_task_suspend( remote_tid ); + directive_failed( status, "rtems_task_suspend" ); + + status = rtems_task_wake_after( 2 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + put_name( Task_name[ node ], FALSE ); + puts( " - Resuming remote task" ); + + status = rtems_task_resume( remote_tid ) ; + directive_failed( status, "rtems_task_resume" ); + + } + + } else { + + for ( ; ; ) { + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &events + ); + + if ( status == RTEMS_SUCCESSFUL ) + break; + + fatal_directive_status(status, RTEMS_UNSATISFIED, "rtems_event_receive"); + + put_name( Task_name[ remote_node ], FALSE ); + puts( " - have I been suspended???" ); + + status = rtems_task_wake_after( TICKS_PER_SECOND / 2 ); + directive_failed( status, "rtems_task_wake_after" ); + } + + } + +} + +/*PAGE + * + * Test_task + */ + +rtems_task Test_task( + rtems_task_argument argument +) +{ + rtems_id tid; + rtems_status_code status; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident" ); + + puts( "Getting TID of remote task" ); + remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1; + printf( "Remote task's name is : " ); + put_name( Task_name[ remote_node ], TRUE ); + + do { + status = rtems_task_ident( + Task_name[ remote_node ], + RTEMS_SEARCH_ALL_NODES, + &remote_tid + ); + } while ( status != RTEMS_SUCCESSFUL ); + + directive_failed( status, "rtems_task_ident" ); + + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 5 * TICKS_PER_SECOND, + Delayed_send_event, + NULL + ); + directive_failed( status, "rtems_timer_fire_after" ); + + Test_Task_Support( 1 ); + + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 5 * TICKS_PER_SECOND, + Delayed_send_event, + NULL + ); + directive_failed( status, "rtems_timer_fire_after" ); + + if ( Multiprocessing_configuration.node == 1 ) { + status = rtems_task_wake_after( 2 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + } + + Test_Task_Support( 2 ); + + puts( "*** END OF TEST 3 ***" ); + exit( 0 ); +} diff --git a/testsuites/mptests/mp04/init.c b/testsuites/mptests/mp04/init.c new file mode 100644 index 0000000000..106176c6ca --- /dev/null +++ b/testsuites/mptests/mp04/init.c @@ -0,0 +1,63 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + printf( + "\n\n*** TEST 4 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); + + puts( "Creating Test_task (Global)" ); + status = rtems_task_create( + Task_name[ Multiprocessing_configuration.node ], + Multiprocessing_configuration.node, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_GLOBAL, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task (Global)" ); + status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Deleting initialization task" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/mptests/mp04/node1/mp04.doc b/testsuites/mptests/mp04/node1/mp04.doc new file mode 100644 index 0000000000..39a76d48a0 --- /dev/null +++ b/testsuites/mptests/mp04/node1/mp04.doc @@ -0,0 +1,41 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test53 + +directives: + ex_init, ex_start, t_create, t_start, i_return, t_ident, tm_get, + tm_wkafter, tm_setpri + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies that the system can get the id of a remote task. + + c. Verifies that the system can change the priority of a remote + task. + + d. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies that a task can get the task identification number of itself. + + h. Verifies that a task can delete itself or another task. diff --git a/testsuites/mptests/mp04/node1/mp04.scn b/testsuites/mptests/mp04/node1/mp04.scn new file mode 100644 index 0000000000..e9518f3ac2 --- /dev/null +++ b/testsuites/mptests/mp04/node1/mp04.scn @@ -0,0 +1,8 @@ +*** TEST 4 -- NODE 1 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Getting TID of remote task +Remote task's name is : 222 +Local task priority has been set +*** END OF TEST 4 *** diff --git a/testsuites/mptests/mp04/node2/mp04.doc b/testsuites/mptests/mp04/node2/mp04.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp04/node2/mp04.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/mptests/mp04/node2/mp04.scn b/testsuites/mptests/mp04/node2/mp04.scn new file mode 100644 index 0000000000..8ccfcfef79 --- /dev/null +++ b/testsuites/mptests/mp04/node2/mp04.scn @@ -0,0 +1,8 @@ +*** TEST 4 -- NODE 2 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Getting TID of remote task +Remote task's name is : 111 +Local task priority has been set +*** END OF TEST 4 *** diff --git a/testsuites/mptests/mp04/system.h b/testsuites/mptests/mp04/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/mptests/mp04/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/mptests/mp04/task1.c b/testsuites/mptests/mp04/task1.c new file mode 100644 index 0000000000..7e7e0ca849 --- /dev/null +++ b/testsuites/mptests/mp04/task1.c @@ -0,0 +1,83 @@ +/* Test_task + * + * This task tests the rtems_task_set_priority directive on a remote task. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +extern rtems_multiprocessing_table Multiprocessing_configuration; + +rtems_task Test_task( + rtems_task_argument argument +) +{ + rtems_id tid; + rtems_status_code status; + rtems_unsigned32 remote_node; + rtems_id remote_tid; + rtems_task_priority previous_priority; + rtems_task_priority previous_priority_1; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident" ); + + puts( "Getting TID of remote task" ); + remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1; + puts_nocr( "Remote task's name is : " ); + put_name( Task_name[ remote_node ], TRUE ); + + do { + status = rtems_task_ident( + Task_name[ remote_node ], + RTEMS_SEARCH_ALL_NODES, + &remote_tid + ); + } while ( status != RTEMS_SUCCESSFUL ); + + directive_failed( status, "rtems_task_ident" ); + + status = rtems_task_set_priority( + remote_tid, + Multiprocessing_configuration.node, + &previous_priority + ); + directive_failed( status, "rtems_task_set_priority" ); + + if ( previous_priority != remote_node ) { + printf( + "Remote priority (0x%x) does not match remote node (0x%x)!!!\n", + previous_priority, + remote_node + ); + exit( 0xf0000 ); + } + + do { + status = rtems_task_set_priority( + RTEMS_SELF, + RTEMS_CURRENT_PRIORITY, + &previous_priority_1 + ); + directive_failed( status, "rtems_task_set_priority" ); + } while ( previous_priority_1 != remote_node ); + + puts( "Local task priority has been set" ); + + puts( "*** END OF TEST 4 ***" ); + exit( 0 ); +} diff --git a/testsuites/mptests/mp05/asr.c b/testsuites/mptests/mp05/asr.c new file mode 100644 index 0000000000..9f98e42692 --- /dev/null +++ b/testsuites/mptests/mp05/asr.c @@ -0,0 +1,37 @@ +/* Process_asr + * + * This routine performs the processing for task 1's RTEMS_ASR. It is called + * by an assembly routine which saves the necessary registers. + * + * Input parameters: + * signal - signal set + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_asr Process_asr( + rtems_signal_set signal +) +{ + if ( signal != expected_signal ) { + printf( + "ERROR: I was expecting signal 0x%.8x got 0x%.8x\n", + expected_signal, + signal + ); + rtems_fatal_error_occurred( 0xf0000 ); + } + signal_caught = 1; +} diff --git a/testsuites/mptests/mp05/init.c b/testsuites/mptests/mp05/init.c new file mode 100644 index 0000000000..5db791d8f2 --- /dev/null +++ b/testsuites/mptests/mp05/init.c @@ -0,0 +1,68 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + printf( + "\n\n*** TEST 5 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); + + puts( "Creating Test_task (Global)" ); + status = rtems_task_create( + Task_name[Multiprocessing_configuration.node], + 1, + 1024, + RTEMS_TIMESLICE, + RTEMS_GLOBAL, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task (Global)" ); + status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create" ); + + puts( "Deleting initialization task" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/mptests/mp05/node1/mp05.doc b/testsuites/mptests/mp05/node1/mp05.doc new file mode 100644 index 0000000000..6b9ccd556d --- /dev/null +++ b/testsuites/mptests/mp05/node1/mp05.doc @@ -0,0 +1,45 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test54 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + tm_wkafter, as_catch, as_return + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies that a task can get the task identification number of itself. + + h. Verifies that a task can get the task identification number + of another task. + + i. Verifies that a signal can be sent to a remote task. diff --git a/testsuites/mptests/mp05/node1/mp05.scn b/testsuites/mptests/mp05/node1/mp05.scn new file mode 100644 index 0000000000..472740ba18 --- /dev/null +++ b/testsuites/mptests/mp05/node1/mp05.scn @@ -0,0 +1,11 @@ +*** TEST 5 -- NODE 1 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +rtems_signal_catch: initializing signal catcher +Remote task's name is : 222 +Getting TID of remote task +Sending signal to remote task +.................................................... +.................................................... +*** END OF TEST 5 *** diff --git a/testsuites/mptests/mp05/node2/mp05.doc b/testsuites/mptests/mp05/node2/mp05.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp05/node2/mp05.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/mptests/mp05/node2/mp05.scn b/testsuites/mptests/mp05/node2/mp05.scn new file mode 100644 index 0000000000..0c4b412f65 --- /dev/null +++ b/testsuites/mptests/mp05/node2/mp05.scn @@ -0,0 +1,10 @@ +*** TEST 5 -- NODE 2 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +rtems_signal_catch: initializing signal catcher +Remote task's name is : 111 +Getting TID of remote task +.................................................... +.................................................... +*** END OF TEST 5 *** diff --git a/testsuites/mptests/mp05/system.h b/testsuites/mptests/mp05/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/mptests/mp05/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/mptests/mp05/task1.c b/testsuites/mptests/mp05/task1.c new file mode 100644 index 0000000000..6934663850 --- /dev/null +++ b/testsuites/mptests/mp05/task1.c @@ -0,0 +1,106 @@ +/* Test_task + * + * This task initializes the signal catcher, sends the first signal + * if running on the first node, and loops while waiting for signals. + * + * NOTE: The signal catcher is not reentrant and hence RTEMS_NO_ASR must + * be a part of its execution mode. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +#define SIGNALS_PER_DOT 15 + +rtems_timer_service_routine Stop_Test_TSR( + rtems_id ignored_id, + void *ignored_address +) +{ + Stop_Test = TRUE; +} + +rtems_task Test_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + + Stop_Test = FALSE; + + signal_caught = 0; + signal_count = 0; + + puts( "rtems_signal_catch: initializing signal catcher" ); + status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR|RTEMS_NO_PREEMPT ); + directive_failed( status, "rtems_signal_catch" ); + + if (Multiprocessing_configuration.node == 1) { + remote_node = 2; + remote_signal = RTEMS_SIGNAL_18; + expected_signal = RTEMS_SIGNAL_17; + } + else { + remote_node = 1; + remote_signal = RTEMS_SIGNAL_17; + expected_signal = RTEMS_SIGNAL_18; + } + puts_nocr( "Remote task's name is : " ); + put_name( Task_name[ remote_node ], TRUE ); + + puts( "Getting TID of remote task" ); + do { + status = rtems_task_ident( + Task_name[ remote_node ], + RTEMS_SEARCH_ALL_NODES, + &remote_tid + ); + } while ( status != RTEMS_SUCCESSFUL ); + directive_failed( status, "rtems_task_ident" ); + + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 3 * TICKS_PER_SECOND, + Stop_Test_TSR, + NULL + ); + directive_failed( status, "rtems_timer_fire_after" ); + + if ( Multiprocessing_configuration.node == 1 ) { + puts( "Sending signal to remote task" ); + do { + status = rtems_signal_send( remote_tid, remote_signal ); + if ( status == RTEMS_NOT_DEFINED ) + continue; + } while ( status != RTEMS_SUCCESSFUL ); + directive_failed( status, "rtems_signal_send" ); + } + + while ( Stop_Test == FALSE ) { + if ( signal_caught ) { + signal_caught = 0; + if ( ++signal_count >= SIGNALS_PER_DOT ) { + signal_count = 0; + put_dot( '.' ); + } + status = rtems_signal_send( remote_tid, remote_signal ); + directive_failed( status, "rtems_signal_send" ); + } + } + puts( "\n*** END OF TEST 5 ***" ); + exit( 0 ); +} diff --git a/testsuites/mptests/mp06/init.c b/testsuites/mptests/mp06/init.c new file mode 100644 index 0000000000..ab41308954 --- /dev/null +++ b/testsuites/mptests/mp06/init.c @@ -0,0 +1,68 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + printf( + "\n\n*** TEST 6 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); + + puts( "Creating Test_task (Global)" ); + status = rtems_task_create( + Task_name[Multiprocessing_configuration.node], + 1, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_GLOBAL, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task (Global)" ); + status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create" ); + + puts( "Deleting initialization task" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/mptests/mp06/node1/mp06.doc b/testsuites/mptests/mp06/node1/mp06.doc new file mode 100644 index 0000000000..879c15d705 --- /dev/null +++ b/testsuites/mptests/mp06/node1/mp06.doc @@ -0,0 +1,45 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test55 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + ev_send, ev_receive + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies that a task can get the task identification number of itself. + + h. Verifies that a task can get the task identification number + of another task. + + i. Verifies that events can be sent to a remote task. diff --git a/testsuites/mptests/mp06/node1/mp06.scn b/testsuites/mptests/mp06/node1/mp06.scn new file mode 100644 index 0000000000..592777e5d7 --- /dev/null +++ b/testsuites/mptests/mp06/node1/mp06.scn @@ -0,0 +1,11 @@ +*** TEST 6 -- NODE 1 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Remote task's name is : 222 +Getting TID of remote task +Sending events to remote task +.................................................... +.................................................... +*** END OF TEST 6 *** + diff --git a/testsuites/mptests/mp06/node2/mp06.doc b/testsuites/mptests/mp06/node2/mp06.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp06/node2/mp06.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/mptests/mp06/node2/mp06.scn b/testsuites/mptests/mp06/node2/mp06.scn new file mode 100644 index 0000000000..9cb653c2f3 --- /dev/null +++ b/testsuites/mptests/mp06/node2/mp06.scn @@ -0,0 +1,12 @@ +*** TEST 6 -- NODE 2 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Remote task's name is : 111 +Getting TID of remote task +Receiving events from remote task +.................................................... +.................................................... +rtems_event_receive - correctly returned RTEMS_TIMEOUT +*** END OF TEST 6 *** + diff --git a/testsuites/mptests/mp06/system.h b/testsuites/mptests/mp06/system.h new file mode 100644 index 0000000000..60f2b1a0a2 --- /dev/null +++ b/testsuites/mptests/mp06/system.h @@ -0,0 +1,31 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/mptests/mp06/task1.c b/testsuites/mptests/mp06/task1.c new file mode 100644 index 0000000000..5b63a9ff76 --- /dev/null +++ b/testsuites/mptests/mp06/task1.c @@ -0,0 +1,176 @@ +/* Test_task + * + * This task tests global event operations. If running on node one, it + * continuously sends events. If running on node two, it continuously + * receives events. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +#define DOT_COUNT 25 + +/*PAGE + * + * Stop_Test_TSR + */ + +rtems_timer_service_routine Stop_Test_TSR( + rtems_id ignored_id, + void *ignored_address +) +{ + Stop_Test = TRUE; +} + +/*PAGE + * + * Event_set_table + */ + +rtems_event_set Event_set_table[] = { + RTEMS_EVENT_0, + RTEMS_EVENT_1, + RTEMS_EVENT_2, + RTEMS_EVENT_3, + RTEMS_EVENT_4, + RTEMS_EVENT_5, + RTEMS_EVENT_6, + RTEMS_EVENT_7, + RTEMS_EVENT_8, + RTEMS_EVENT_9, + RTEMS_EVENT_10, + RTEMS_EVENT_11, + RTEMS_EVENT_12, + RTEMS_EVENT_13, + RTEMS_EVENT_14, + RTEMS_EVENT_15, + RTEMS_EVENT_16, + RTEMS_EVENT_17, + RTEMS_EVENT_18, + RTEMS_EVENT_19, + RTEMS_EVENT_20, + RTEMS_EVENT_21, + RTEMS_EVENT_22, + RTEMS_EVENT_23, + RTEMS_EVENT_24, + RTEMS_EVENT_25, + RTEMS_EVENT_26, + RTEMS_EVENT_27, + RTEMS_EVENT_28, + RTEMS_EVENT_29, + RTEMS_EVENT_30, + RTEMS_EVENT_31 +}; + +/*PAGE + * + * Test_task + */ + +rtems_task Test_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_unsigned32 count; + rtems_unsigned32 remote_node; + rtems_id remote_tid; + rtems_event_set event_out; + rtems_event_set event_for_this_iteration; + + Stop_Test = FALSE; + + remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1; + puts_nocr( "Remote task's name is : " ); + put_name( Task_name[ remote_node ], TRUE ); + + puts( "Getting TID of remote task" ); + do { + status = rtems_task_ident( + Task_name[ remote_node ], + RTEMS_SEARCH_ALL_NODES, + &remote_tid + ); + } while ( status != RTEMS_SUCCESSFUL ); + directive_failed( status, "rtems_task_ident FAILED!!" ); + + if ( Multiprocessing_configuration.node == 1 ) + puts( "Sending events to remote task" ); + else + puts( "Receiving events from remote task" ); + + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 5 * TICKS_PER_SECOND, + Stop_Test_TSR, + NULL + ); + directive_failed( status, "rtems_timer_fire_after" ); + + count = 0; + + for ( ; ; ) { + if ( Stop_Test == TRUE ) + break; + + event_for_this_iteration = Event_set_table[ count % 32 ]; + + if ( Multiprocessing_configuration.node == 1 ) { + status = rtems_event_send( remote_tid, event_for_this_iteration ); + directive_failed( status, "rtems_event_send" ); + + status = rtems_task_wake_after( 1 ); + directive_failed( status, "rtems_task_wake_after" ); + } else { + status = rtems_event_receive( + event_for_this_iteration, + RTEMS_DEFAULT_OPTIONS, + 1 * TICKS_PER_SECOND, + &event_out + ); + if ( rtems_are_statuses_equal( status, RTEMS_TIMEOUT ) ) { + if ( Multiprocessing_configuration.node == 2 ) + puts( "\nCorrect behavior if the other node exitted." ); + else + puts( "\nERROR... node 1 died" ); + break; + } else + directive_failed( status, "rtems_event_receive" ); + } + + if ( (count % DOT_COUNT) == 0 ) + put_dot('.'); + + count++; + } + + putchar( '\n' ); + + if ( Multiprocessing_configuration.node == 2 ) { + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_DEFAULT_OPTIONS, + 1 * TICKS_PER_SECOND, + &event_out + ); + fatal_directive_status( status, RTEMS_TIMEOUT, "rtems_event_receive" ); + puts( "rtems_event_receive - correctly returned RTEMS_TIMEOUT" ); + } + puts( "*** END OF TEST 6 ***" ); + exit( 0 ); +} diff --git a/testsuites/mptests/mp07/init.c b/testsuites/mptests/mp07/init.c new file mode 100644 index 0000000000..665c3f0b72 --- /dev/null +++ b/testsuites/mptests/mp07/init.c @@ -0,0 +1,68 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + printf( + "\n\n*** TEST 7 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); + + puts( "Creating Test_task (Global)" ); + status = rtems_task_create( + Task_name[Multiprocessing_configuration.node], + 1, + 2048, + RTEMS_TIMESLICE, + RTEMS_GLOBAL, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task (Global)" ); + status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create" ); + + puts( "Deleting initialization task" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/mptests/mp07/node1/mp07.doc b/testsuites/mptests/mp07/node1/mp07.doc new file mode 100644 index 0000000000..ca09867ab6 --- /dev/null +++ b/testsuites/mptests/mp07/node1/mp07.doc @@ -0,0 +1,46 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test56 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + ev_send, ev_receive + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies that a task can get the task identification number of itself. + + h. Verifies that a task can get the task identification number + of another task. + + i. Verifies that two tasks on different processors can alternate + sending each other events. diff --git a/testsuites/mptests/mp07/node1/mp07.scn b/testsuites/mptests/mp07/node1/mp07.scn new file mode 100644 index 0000000000..d348f48612 --- /dev/null +++ b/testsuites/mptests/mp07/node1/mp07.scn @@ -0,0 +1,10 @@ +*** TEST 7 -- NODE 1 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Remote task's name is : 222 +Getting TID of remote task +Sending first event to remote task +.................................................... +.................................................... +*** END OF TEST 7 *** diff --git a/testsuites/mptests/mp07/node2/mp07.doc b/testsuites/mptests/mp07/node2/mp07.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp07/node2/mp07.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/mptests/mp07/node2/mp07.scn b/testsuites/mptests/mp07/node2/mp07.scn new file mode 100644 index 0000000000..9e361d713c --- /dev/null +++ b/testsuites/mptests/mp07/node2/mp07.scn @@ -0,0 +1,9 @@ +*** TEST 7 -- NODE 2 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Remote task's name is : 111 +Getting TID of remote task +.................................................... +.................................................... +*** END OF TEST 7 *** diff --git a/testsuites/mptests/mp07/system.h b/testsuites/mptests/mp07/system.h new file mode 100644 index 0000000000..34ec37a967 --- /dev/null +++ b/testsuites/mptests/mp07/system.h @@ -0,0 +1,28 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/mptests/mp07/task1.c b/testsuites/mptests/mp07/task1.c new file mode 100644 index 0000000000..70fc8c73c5 --- /dev/null +++ b/testsuites/mptests/mp07/task1.c @@ -0,0 +1,95 @@ +/* Test_task + * + * This task continuously sends an event to its counterpart on the + * other node, and then waits for it to send an event. The copy + * running on node one send the first event. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +#define DOT_COUNT 100 + +rtems_timer_service_routine Stop_Test_TSR( + rtems_id ignored_id, + void *ignored_address +) +{ + Stop_Test = TRUE; +} + +rtems_task Test_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_unsigned32 count; + rtems_unsigned32 remote_node; + rtems_id remote_tid; + rtems_event_set event_out; + + Stop_Test = FALSE; + + remote_node = (Multiprocessing_configuration.node == 1) ? 2 : 1; + puts_nocr( "Remote task's name is : " ); + put_name( Task_name[ remote_node ], TRUE ); + + puts( "Getting TID of remote task" ); + do { + status = rtems_task_ident( + Task_name[ remote_node ], + RTEMS_SEARCH_ALL_NODES, + &remote_tid + ); + } while ( !rtems_is_status_successful( status ) ); + + if ( Multiprocessing_configuration.node == 1 ) { + puts( "Sending first event to remote task" ); + status = rtems_event_send( remote_tid, RTEMS_EVENT_16 ); + directive_failed( status, "rtems_event_send" ); + } + + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 5 * TICKS_PER_SECOND, + Stop_Test_TSR, + NULL + ); + directive_failed( status, "rtems_timer_fire_after" ); + + while ( Stop_Test == FALSE ) { + for ( count=DOT_COUNT ; count ; count-- ) { + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &event_out + ); + if ( status == RTEMS_TIMEOUT ) { + puts( "\nTA1 - RTEMS_TIMEOUT .. probably OK if the other node exits" ); + break; + } else + directive_failed( status, "rtems_event_receive" ); + + status = rtems_event_send( remote_tid, RTEMS_EVENT_16 ); + directive_failed( status, "rtems_event_send" ); + } + put_dot('.'); + } + puts( "\n*** END OF TEST 7 ***" ); + exit( 0 ); +} diff --git a/testsuites/mptests/mp08/init.c b/testsuites/mptests/mp08/init.c new file mode 100644 index 0000000000..2a669d2b9a --- /dev/null +++ b/testsuites/mptests/mp08/init.c @@ -0,0 +1,76 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + printf( + "\n\n*** TEST 8 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); + + Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', '\0' ); + + if ( Multiprocessing_configuration.node == 1 ) { + puts( "Creating Sempahore (Global)" ); + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 1, + RTEMS_GLOBAL, + &Semaphore_id[ 1 ] + ); + directive_failed( status, "rtems_semaphore_create" ); + } + + puts( "Creating Test_task (Global)" ); + status = rtems_task_create( + Task_name[ Multiprocessing_configuration.node ], + 1, + 2048, + RTEMS_TIMESLICE, + RTEMS_GLOBAL, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task (Global)" ); + status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Deleting initialization task" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/mptests/mp08/node1/mp08.doc b/testsuites/mptests/mp08/node1/mp08.doc new file mode 100644 index 0000000000..3ec09a3335 --- /dev/null +++ b/testsuites/mptests/mp08/node1/mp08.doc @@ -0,0 +1,52 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + +This file describes the directives and concepts tested by this test set. + +test set name: test57 + +GLOBAL SEMAPHORE TEST + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + sm_create, sm_ident, sm_p, sm_v, sm_delete + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies that a task can get the identification number of + a global sempahore. + + h. Verifies that two tasks on different processors can + alternate accessing a semaphore. + + i. Verifies operation of sm_delete on global semaphores + for both normal and error case. + + j. Verifies Rpc and Process_pkt for packet types Q_SMP, Q_SMV, + P_OBJCREATE (semaphore), P_OBJDELETE (semaphore), P_SMDEL_TQ. + diff --git a/testsuites/mptests/mp08/node1/mp08.scn b/testsuites/mptests/mp08/node1/mp08.scn new file mode 100644 index 0000000000..cde263420c --- /dev/null +++ b/testsuites/mptests/mp08/node1/mp08.scn @@ -0,0 +1,11 @@ +*** TEST 8 -- NODE 1 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Getting SMID of semaphore +pvpvpvpvpvp....... +(continued) pvp + +Deleting global semaphore +*** END OF TEST 8 *** + diff --git a/testsuites/mptests/mp08/node2/mp08.doc b/testsuites/mptests/mp08/node2/mp08.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp08/node2/mp08.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/mptests/mp08/node2/mp08.scn b/testsuites/mptests/mp08/node2/mp08.scn new file mode 100644 index 0000000000..5a613f45e5 --- /dev/null +++ b/testsuites/mptests/mp08/node2/mp08.scn @@ -0,0 +1,12 @@ +*** TEST 8 -- NODE 2 *** +Creating Test_task (Global) +Starting Test_task (Global) +Deleting initialization task +Getting SMID of semaphore +rtems_semaphore_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT +pvpvpvpvpvp....... +(continued) pvp + +Global semaphore deleted +*** END OF TEST 8 *** + diff --git a/testsuites/mptests/mp08/system.h b/testsuites/mptests/mp08/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/mptests/mp08/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/mptests/mp08/task1.c b/testsuites/mptests/mp08/task1.c new file mode 100644 index 0000000000..dbd1526795 --- /dev/null +++ b/testsuites/mptests/mp08/task1.c @@ -0,0 +1,89 @@ +/* Test_task + * + * This task tests global semaphore operations. It verifies that + * global semaphore errors are correctly returned. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Test_task( + rtems_task_argument argument +) +{ + rtems_unsigned32 count; + rtems_status_code status; + + puts( "Getting SMID of semaphore" ); + + do { + status = rtems_semaphore_ident( + Semaphore_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &Semaphore_id[ 1 ] + ); + } while ( !rtems_is_status_successful( status ) ); + + if ( Multiprocessing_configuration.node == 2 ) { + status = rtems_semaphore_delete( Semaphore_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_ILLEGAL_ON_REMOTE_OBJECT, + "rtems_semaphore_delete did not return RTEMS_ILLEGAL_ON_REMOTE_OBJECT" + ); + puts( + "rtems_semaphore_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT" + ); + } + + count = 0; /* number of times node 1 releases semaphore */ + while ( FOREVER ) { + put_dot( 'p' ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + if ( status != RTEMS_SUCCESSFUL ) { + fatal_directive_status( + status, + RTEMS_OBJECT_WAS_DELETED, + "rtems_semaphore_obtain" + ); + puts( "\nGlobal semaphore deleted" ); + puts( "*** END OF TEST 8 ***" ); + exit( 0 ); + } + + if ( Multiprocessing_configuration.node == 1 && ++count == 1000 ) { + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "\nDeleting global semaphore" ); + status = rtems_semaphore_delete( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_delete" ); + + puts( "*** END OF TEST 8 ***" ); + exit( 0 ); + } + else { + put_dot( 'v' ); + status = rtems_semaphore_release( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_release FAILED!!" ); + } + } +} diff --git a/testsuites/mptests/mp09/init.c b/testsuites/mptests/mp09/init.c new file mode 100644 index 0000000000..bd19547cef --- /dev/null +++ b/testsuites/mptests/mp09/init.c @@ -0,0 +1,76 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + printf( + "\n\n*** TEST 9 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); + + Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' ); + + if ( Multiprocessing_configuration.node == 1 ) { + puts( "Creating Message Queue (Global)" ); + status = rtems_message_queue_create( + Queue_name[ 1 ], + 3, + RTEMS_GLOBAL|RTEMS_LIMIT, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create" ); + } + + puts( "Creating Test_task (local)" ); + status = rtems_task_create( + Task_name[Multiprocessing_configuration.node], + 1, + 1024, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task (local)" ); + status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Deleting initialization task" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/mptests/mp09/node1/mp09.doc b/testsuites/mptests/mp09/node1/mp09.doc new file mode 100644 index 0000000000..15e05aae58 --- /dev/null +++ b/testsuites/mptests/mp09/node1/mp09.doc @@ -0,0 +1,50 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + +This file describes the directives and concepts tested by this test set. + +test set name: test58 + +GLOBAL MESSAGE QUEUE TEST + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, + tm_wkafter, q_create, q_send, q_broadcast, q_urgent, q_receive, + q_delete + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies that a task can get the task identification number of itself. + + h. Verifies that a task can delete itself. + + i. Verifies Rpc and Process_pkt for message queue related packets. + + j. Verifies normal and error paths for global message queue handling. + +NOTE: The SLAVE must be started first for this test to successfully run. diff --git a/testsuites/mptests/mp09/node1/mp09.scn b/testsuites/mptests/mp09/node1/mp09.scn new file mode 100644 index 0000000000..2b612e4746 --- /dev/null +++ b/testsuites/mptests/mp09/node1/mp09.scn @@ -0,0 +1,21 @@ +*** TEST 9 -- NODE 1 *** +Creating Message Queue (Global) +Creating Test_task (local) +Starting Test_task (local) +Deleting initialization task +Getting QID of message queue +Receiving message ... +Received : 123456789012345 +Receiving message ... +Received : abcdefghijklmno +Receiving message ... +Received : ABCDEFGHIJKLMNO +rtems_message_queue_send: 123456789012345 +Delaying for a second +rtems_message_queue_urgent: abcdefghijklmno +Delaying for a second +rtems_message_queue_broadcast: ABCDEFGHIJKLMNO +Delaying for a second +Delaying for 5 seconds +Deleting Message queue +*** END OF TEST 9 *** diff --git a/testsuites/mptests/mp09/node2/mp09.doc b/testsuites/mptests/mp09/node2/mp09.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp09/node2/mp09.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/mptests/mp09/node2/mp09.scn b/testsuites/mptests/mp09/node2/mp09.scn new file mode 100644 index 0000000000..96708f7fe0 --- /dev/null +++ b/testsuites/mptests/mp09/node2/mp09.scn @@ -0,0 +1,27 @@ +*** TEST 9 -- NODE 2 *** +Creating Test_task (local) +Starting Test_task (local) +Deleting initialization task +Getting QID of message queue +rtems_message_queue_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT +rtems_message_queue_send: 123456789012345 +Delaying for a second +rtems_message_queue_urgent: abcdefghijklmno +Delaying for a second +rtems_message_queue_broadcast: ABCDEFGHIJKLMNO +Delaying for a second +Receiving message ... +Received : 123456789012345 +Receiving message ... +Received : abcdefghijklmno +Receiving message ... +Received : ABCDEFGHIJKLMNO +Flushing remote empty queue +00 messages were flushed on the remote queue +Send messages to be flushed from remote queue +Flushing remote queue +01 messages were flushed on the remote queue +Waiting for message queue to be deleted + +Global message queue deleted +*** END OF TEST 9 *** diff --git a/testsuites/mptests/mp09/recvmsg.c b/testsuites/mptests/mp09/recvmsg.c new file mode 100644 index 0000000000..c3c1a8ef8b --- /dev/null +++ b/testsuites/mptests/mp09/recvmsg.c @@ -0,0 +1,45 @@ +/* Receive_messages + * + * This routine receives and prints three messages. + * an error condition. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Receive_messages() +{ + rtems_status_code status; + rtems_unsigned32 index; + char receive_buffer[16]; + + for ( index=1 ; index <=3 ; index++ ) { + puts( "Receiving message ..." ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])receive_buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "Received : "); + puts( receive_buffer ); + } + + puts( "Receiver delaying for a second" ); + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); +} diff --git a/testsuites/mptests/mp09/sendmsg.c b/testsuites/mptests/mp09/sendmsg.c new file mode 100644 index 0000000000..d800eb47cf --- /dev/null +++ b/testsuites/mptests/mp09/sendmsg.c @@ -0,0 +1,59 @@ +/* Send_messages + * + * This routine sends a series of three messages. + * an error condition. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Send_messages() +{ + rtems_status_code status; + rtems_unsigned32 broadcast_count; + + puts_nocr( "rtems_message_queue_send: " ); + puts( buffer1 ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer1 ); + directive_failed( status, "rtems_message_queue_send" ); + + puts( "Delaying for a second" ); + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts_nocr( "rtems_message_queue_urgent: " ); + puts( buffer2 ); + status = rtems_message_queue_urgent( Queue_id[ 1 ], (long (*)[4])buffer2 ); + directive_failed( status, "rtems_message_queue_urgent" ); + + puts( "Delaying for a second" ); + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts_nocr( "rtems_message_queue_broadcast: " ); + puts( buffer3 ); + status = rtems_message_queue_broadcast( + Queue_id[ 1 ], + (long (*)[4])buffer3, + &broadcast_count + ); + directive_failed( status, "rtems_message_queue_broadcast" ); + + puts( "Delaying for a second" ); + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); +} diff --git a/testsuites/mptests/mp09/system.h b/testsuites/mptests/mp09/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/mptests/mp09/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/mptests/mp09/task1.c b/testsuites/mptests/mp09/task1.c new file mode 100644 index 0000000000..ece05592dd --- /dev/null +++ b/testsuites/mptests/mp09/task1.c @@ -0,0 +1,107 @@ +/* Test_task + * + * This task tests global message queue operations. It also generates + * an error condition. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +char buffer1[16] = "123456789012345"; +char buffer2[16] = "abcdefghijklmno"; +char buffer3[16] = "ABCDEFGHIJKLMNO"; +char buffer4[16] = "PQRSTUVWXYZ(){}"; + +rtems_task Test_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_unsigned32 count; + char receive_buffer[16]; + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "Getting QID of message queue" ); + + do { + status = rtems_message_queue_ident( + Queue_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &Queue_id[ 1 ] + ); + } while ( !rtems_is_status_successful( status ) ); + + if ( Multiprocessing_configuration.node == 2 ) { + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_ILLEGAL_ON_REMOTE_OBJECT, + "rtems_message_queue_delete" + ); + puts( + "rtems_message_queue_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT" + ); + + Send_messages(); + Receive_messages(); + + puts( "Flushing remote empty queue" ); + status = rtems_message_queue_flush( Queue_id[ 1 ], &count ); + directive_failed( status, "rtems_message_queue_flush" ); + printf( "%02d messages were flushed on the remote queue\n", count ); + + puts( "Send messages to be flushed from remote queue" ); + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer1 ); + directive_failed( status, "rtems_message_queue_send" ); + + puts( "Flushing remote queue" ); + status = rtems_message_queue_flush( Queue_id[ 1 ], &count ); + directive_failed( status, "rtems_message_queue_flush" ); + printf( "%02d messages were flushed on the remote queue\n", count ); + + puts( "Waiting for message queue to be deleted" ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])receive_buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + fatal_directive_status( + status, + RTEMS_OBJECT_WAS_DELETED, + "rtems_message_queue_receive" + ); + puts( "\nGlobal message queue deleted" ); + } + else { /* node == 1 */ + Receive_messages(); + Send_messages(); + + puts( "Delaying for 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "Deleting Message queue" ); + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete" ); + } + + puts( "*** END OF TEST 9 ***" ); + exit( 0 ); +} diff --git a/testsuites/mptests/mp10/init.c b/testsuites/mptests/mp10/init.c new file mode 100644 index 0000000000..7acf5ca411 --- /dev/null +++ b/testsuites/mptests/mp10/init.c @@ -0,0 +1,144 @@ +/* Init + * + * This routine is the initialization routine for this test program. + * Other than creating all objects needed by this test, if this routine + * is running on node one, it acquires a global semaphore to + * force all other tasks to pend. If running on node two, this task + * sleeps for a while, and then deletes two local tasks which are + * waiting on a remote message queue or a semaphore. + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + printf( + "\n\n*** TEST 10 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'S', 'A', '3', ' ' ); + + Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' ); + + Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' ); + + if ( Multiprocessing_configuration.node == 1 ) { + puts( "Creating Message Queue (Global)" ); + status = rtems_message_queue_create( + Queue_name[ 1 ], + 3, + RTEMS_GLOBAL|RTEMS_LIMIT, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create" ); + + puts( "Creating Semaphore (Global)" ); + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 0, + RTEMS_GLOBAL | RTEMS_PRIORITY, + &Semaphore_id[ 1 ] + ); + directive_failed( status, "rtems_semaphore_create" ); + + status = rtems_task_wake_after( 10 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + } else { + + puts( "Creating Test_task 1 (local)" ); + status = rtems_task_create( + Task_name[ 1 ], + 1, + 1024, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task 1 (local)" ); + status = rtems_task_start( Task_id[ 1 ], Test_task1, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Creating Test_task 2 (local)" ); + status = rtems_task_create( + Task_name[ 2 ], + 1, + 1024, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task 2 (local)" ); + status = rtems_task_start( Task_id[ 2 ], Test_task2, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Creating Test_task 3 (local)" ); + status = rtems_task_create( + Task_name[ 3 ], + 1, + 1024, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task 3 (local)" ); + status = rtems_task_start( Task_id[ 3 ], Test_task2, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Sleeping for 1 seconds ..." ); + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "Deleting Test_task2" ); + status = rtems_task_delete( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_delete of Task 2" ); + + puts( "Deleting Test_task1" ); + status = rtems_task_delete( Task_id[ 1 ] ); + directive_failed( status, "rtems_task_delete of Task 1" ); + + puts( "Restarting Test_task3" ); + status = rtems_task_restart( Task_id[ 3 ], 1 ); + directive_failed( status, "rtems_task_restart of Task 3" ); + + } + puts( "*** END OF TEST 10 ***" ); + exit( 0 ); +} diff --git a/testsuites/mptests/mp10/node1/mp10.doc b/testsuites/mptests/mp10/node1/mp10.doc new file mode 100644 index 0000000000..d75b176f8d --- /dev/null +++ b/testsuites/mptests/mp10/node1/mp10.doc @@ -0,0 +1,46 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + +This file describes the directives and concepts tested by this test set. + +test set name: test59 + +GLOBAL SEMAPHORE TEST + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + tm_set, tm_get, tm_wkafter + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies that a task can get the task identification number of itself. + + h. Verifies that a task can get the task identification number + of another task. + + i. Verifies that a task can delete itself or another task. diff --git a/testsuites/mptests/mp10/node1/mp10.scn b/testsuites/mptests/mp10/node1/mp10.scn new file mode 100644 index 0000000000..deeafc0a9a --- /dev/null +++ b/testsuites/mptests/mp10/node1/mp10.scn @@ -0,0 +1,4 @@ +*** TEST 10 -- NODE 1 *** +Creating Message Queue (Global) +Creating Semaphore (Global) +*** END OF TEST 10 *** diff --git a/testsuites/mptests/mp10/node2/mp10.doc b/testsuites/mptests/mp10/node2/mp10.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp10/node2/mp10.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/mptests/mp10/node2/mp10.scn b/testsuites/mptests/mp10/node2/mp10.scn new file mode 100644 index 0000000000..25c07e6202 --- /dev/null +++ b/testsuites/mptests/mp10/node2/mp10.scn @@ -0,0 +1,19 @@ +*** TEST 10 -- NODE 2 *** +Creating Test_task 1 (local) +Starting Test_task 1 (local) +Creating Test_task 2 (local) +Starting Test_task 2 (local) +Creating Test_task 3 (local) +Starting Test_task 3 (local) +Sleeping for 1 seconds ... +Getting QID of message queue +Attempting to receive message ... +Getting SMID of semaphore +Attempting to acquire semaphore ... +Getting SMID of semaphore +Attempting to acquire semaphore ... +Deleting Test_task2 +Deleting Test_task1 +Restarting Test_task3 +*** END OF TEST 10 *** + diff --git a/testsuites/mptests/mp10/system.h b/testsuites/mptests/mp10/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/mptests/mp10/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/mptests/mp10/task1.c b/testsuites/mptests/mp10/task1.c new file mode 100644 index 0000000000..ff6f4bd69a --- /dev/null +++ b/testsuites/mptests/mp10/task1.c @@ -0,0 +1,50 @@ +/* Test_task1 + * + * This task attempts to receive a message from a global message queue. + * It should never actually receive the message. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Test_task1( + rtems_task_argument argument +) +{ + char receive_buffer[16]; + rtems_status_code status; + + puts( "Getting QID of message queue" ); + + do { + status = rtems_message_queue_ident( + Queue_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &Queue_id[ 1 ] + ); + } while ( !rtems_is_status_successful( status ) ); + + puts( "Attempting to receive message ..." ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])receive_buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + +} diff --git a/testsuites/mptests/mp10/task2.c b/testsuites/mptests/mp10/task2.c new file mode 100644 index 0000000000..560f3946cf --- /dev/null +++ b/testsuites/mptests/mp10/task2.c @@ -0,0 +1,47 @@ +/* Test_task2 + * + * This task attempts to receive control of a global semaphore. + * It should never receive control of the semaphore. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Test_task2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "Getting SMID of semaphore" ); + + do { + status = rtems_semaphore_ident( + Semaphore_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &Semaphore_id[ 1 ] + ); + } while ( !rtems_is_status_successful( status ) ); + + puts( "Attempting to acquire semaphore ..." ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain" ); +} diff --git a/testsuites/mptests/mp10/task3.c b/testsuites/mptests/mp10/task3.c new file mode 100644 index 0000000000..905183268e --- /dev/null +++ b/testsuites/mptests/mp10/task3.c @@ -0,0 +1,50 @@ +/* Test_task3 + * + * This task attempts to receive control of a global semaphore. + * It should never receive control of the semaphore. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Test_task3( restart ) +rtems_task_argument restart; +{ + rtems_status_code status; + + if ( restart == 1 ) { + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete" ); + } + + puts( "Getting SMID of semaphore" ); + + do { + status = rtems_semaphore_ident( + Semaphore_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &Semaphore_id[ 1 ] + ); + } while ( !rtems_is_status_successful( status ) ); + + puts( "Attempting to acquire semaphore ..." ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain" ); +} diff --git a/testsuites/mptests/mp11/init.c b/testsuites/mptests/mp11/init.c new file mode 100644 index 0000000000..7adc391319 --- /dev/null +++ b/testsuites/mptests/mp11/init.c @@ -0,0 +1,106 @@ +/* Init + * + * This routine is the initialization and test routine for + * this test program. It attempts to create more global + * objects than are configured (zero should be configured). + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_unsigned8 my_partition[0x30000]; + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_id junk_id; + rtems_status_code status; + + printf( + "\n\n*** TEST 11 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); + + Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' ); + + Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' ); + + if ( Multiprocessing_configuration.node == 1 ) { + puts( "Attempting to create Test_task (Global)" ); + status = rtems_task_create( + Task_name[ 1 ], + 1, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_GLOBAL, + &junk_id + ); + fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_task_create" ); + puts( "rtems_task_create correctly returned RTEMS_TOO_MANY" ); + + puts( "Attempting to create Message Queue (Global)" ); + status = rtems_message_queue_create( + Queue_name[ 1 ], + 3, + RTEMS_GLOBAL|RTEMS_LIMIT, + &junk_id + ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_message_queue_create" + ); + puts( "rtems_message_queue_create correctly returned RTEMS_TOO_MANY" ); + + puts( "Attempting to create Semaphore (Global)" ); + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 1, + RTEMS_GLOBAL, + &junk_id + ); + fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_semaphore_create" ); + puts( "rtems_semaphore_create correctly returned RTEMS_TOO_MANY" ); + + puts( "Attempting to create Partition (Global)" ); + status = rtems_partition_create( + 1, + (rtems_unsigned8 *) my_partition, + 128, + 64, + RTEMS_GLOBAL, + &junk_id + ); + fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_partition_create" ); + puts( "rtems_partition_create correctly returned RTEMS_TOO_MANY" ); + } + puts( "*** END OF TEST 11 ***" ); + exit( 0 ); +} diff --git a/testsuites/mptests/mp11/node1/mp11.doc b/testsuites/mptests/mp11/node1/mp11.doc new file mode 100644 index 0000000000..05113ec6b6 --- /dev/null +++ b/testsuites/mptests/mp11/node1/mp11.doc @@ -0,0 +1,42 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + +This file describes the directives and concepts tested by this test set. + +test set name: test60 + +TOO MANY GLOBAL OBJECTS ERROR TEST + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, + t_create, q_create, sm_create, pt_create + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies that all object create directives correctly return + E_TOOMANYGOBJECTS. diff --git a/testsuites/mptests/mp11/node1/mp11.scn b/testsuites/mptests/mp11/node1/mp11.scn new file mode 100644 index 0000000000..fb26583852 --- /dev/null +++ b/testsuites/mptests/mp11/node1/mp11.scn @@ -0,0 +1,10 @@ +*** TEST 11 -- NODE 1 *** +Attempting to create Test_task (Global) +rtems_task_create correctly returned RTEMS_TOO_MANY +Attempting to create Message Queue (Global) +rtems_message_queue_create correctly returned RTEMS_TOO_MANY +Attempting to create Semaphore (Global) +rtems_semaphore_create correctly returned RTEMS_TOO_MANY +Attempting to create Partition (Global) +rtems_partition_create correctly returned RTEMS_TOO_MANY +*** END OF TEST 11 *** diff --git a/testsuites/mptests/mp11/node2/mp11.doc b/testsuites/mptests/mp11/node2/mp11.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp11/node2/mp11.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/mptests/mp11/node2/mp11.scn b/testsuites/mptests/mp11/node2/mp11.scn new file mode 100644 index 0000000000..49bd8a3219 --- /dev/null +++ b/testsuites/mptests/mp11/node2/mp11.scn @@ -0,0 +1,2 @@ +*** TEST 11 -- NODE 2 *** +*** END OF TEST 11 *** diff --git a/testsuites/mptests/mp11/system.h b/testsuites/mptests/mp11/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/mptests/mp11/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/mptests/mp12/init.c b/testsuites/mptests/mp12/init.c new file mode 100644 index 0000000000..8ef9552174 --- /dev/null +++ b/testsuites/mptests/mp12/init.c @@ -0,0 +1,116 @@ +/* Init + * + * This routine is the initialization routine and test code for + * global partitions. It creates a global partition, obtains and + * releases a buffer, and deletes the partition. The partition + * is created on node one, and an attempt is made to delete it + * by node two. + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_unsigned8 Partition_area[ 1024 ]; + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + void *bufaddr; + + printf( + "\n\n*** TEST 12 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); + + Partition_name[ 1 ] = rtems_build_name( 'P', 'A', 'R', ' ' ); + + puts( "Got to initialization task" ); + + if ( Multiprocessing_configuration.node == 2 ) { + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "Getting ID of remote Partition (Global)" ); + + do { + status = rtems_partition_ident( + Partition_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &Partition_id[ 1 ] + ); + } while ( !rtems_is_status_successful( status ) ); + + puts( "Attempting to delete remote Partition (Global)" ); + status = rtems_partition_delete( Partition_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_ILLEGAL_ON_REMOTE_OBJECT, + "rtems_partition_delete" + ); + puts( + "rtems_partition_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT" + ); + + puts( "Obtaining a buffer from the global partition" ); + status = rtems_partition_get_buffer( Partition_id[ 1 ], &bufaddr ); + directive_failed( status, "rtems_partition_get_buffer" ); + printf( "Address returned was : 0x%p\n", bufaddr ); + + puts( "Releasing a buffer to the global partition" ); + status = rtems_partition_return_buffer( Partition_id[ 1 ], bufaddr ); + directive_failed( status, "rtems_partition_return_buffer" ); + + status = rtems_task_wake_after( 2 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + } + else { + puts( "Creating Partition (Global)" ); + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_area, + 128, + 64, + RTEMS_GLOBAL, + &Partition_id[ 1 ] + ); + directive_failed( status, "rtems_partition_create" ); + + puts( "Sleeping for two seconds" ); + status = rtems_task_wake_after( 2 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "Deleting Partition (Global)" ); + status = rtems_partition_delete( Partition_id[ 1 ] ); + directive_failed( status, "rtems_partition_delete" ); + } + puts( "*** END OF TEST 12 ***" ); + exit( 0 ); +} diff --git a/testsuites/mptests/mp12/node1/mp12.doc b/testsuites/mptests/mp12/node1/mp12.doc new file mode 100644 index 0000000000..2bb7bc4518 --- /dev/null +++ b/testsuites/mptests/mp12/node1/mp12.doc @@ -0,0 +1,52 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + +This file describes the directives and concepts tested by this test set. + +test set name: test61 + +GLOBAL PARTITION TEST + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, tm_wkafter, + pt_create, pt_delete, pt_getbuf, pt_retbuf + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies the Shared Memory Locked Queue Driver. + + h. Verifies _Rpc() and _Process_pkt() for the following packet types: + P_OBJCREATE (partitions), + P_OBJDELETE (partitions), + P_PTGETBUF, and + P_PTRETBUF. + + i. Verifies normal and error paths (other than E_TOOMANYGOBJECTS) + for global partitions. + + j. Verifies that a task can delete itself. diff --git a/testsuites/mptests/mp12/node1/mp12.scn b/testsuites/mptests/mp12/node1/mp12.scn new file mode 100644 index 0000000000..605a2c11db --- /dev/null +++ b/testsuites/mptests/mp12/node1/mp12.scn @@ -0,0 +1,6 @@ +*** TEST 12 -- NODE 1 *** +Got to initialization task +Creating Partition (Global) +Sleeping for two seconds +Deleting Partition (Global) +*** END OF TEST 12 *** diff --git a/testsuites/mptests/mp12/node2/mp12.doc b/testsuites/mptests/mp12/node2/mp12.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp12/node2/mp12.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/mptests/mp12/node2/mp12.scn b/testsuites/mptests/mp12/node2/mp12.scn new file mode 100644 index 0000000000..ad65e9cb32 --- /dev/null +++ b/testsuites/mptests/mp12/node2/mp12.scn @@ -0,0 +1,10 @@ +*** TEST 12 -- NODE 2 *** +Got to initialization task +Getting ID of remote Partition (Global) +Attempting to delete remote Partition (Global) +rtems_partition_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT +Obtaining a buffer from the global partition +>>>>>>> address returned will differ +Address returned was : 0x200f0000 +Releasing a buffer to the global partition +*** END OF TEST 12 *** diff --git a/testsuites/mptests/mp12/system.h b/testsuites/mptests/mp12/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/mptests/mp12/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/mptests/mp13/init.c b/testsuites/mptests/mp13/init.c new file mode 100644 index 0000000000..0ec132e9ed --- /dev/null +++ b/testsuites/mptests/mp13/init.c @@ -0,0 +1,116 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + printf( + "\n\n*** TEST 13 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); + + Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' ); + + Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' ); + + if ( Multiprocessing_configuration.node == 1 ) { + puts( "Creating Message Queue (Global)" ); + status = rtems_message_queue_create( + Queue_name[ 1 ], + 3, + RTEMS_GLOBAL|RTEMS_LIMIT, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create" ); + + puts( "Creating Semaphore (Global)" ); + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 1, + RTEMS_GLOBAL | RTEMS_PRIORITY, + &Semaphore_id[ 1 ] + ); + directive_failed( status, "rtems_semaphore_create" ); + + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain" ); + } + + puts( "Creating Test_task 1 (local)" ); + status = rtems_task_create( + Task_name[ 1 ], + 1, + 1024, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task 1 (local)" ); + status = rtems_task_start( Task_id[ 1 ], Test_task1, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Creating Test_task 2 (local)" ); + status = rtems_task_create( + Task_name[ 2 ], + 1, + 1024, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Test_task 2 (local)" ); + status = rtems_task_start( Task_id[ 2 ], Test_task2, 0 ); + directive_failed( status, "rtems_task_start" ); + + if ( Multiprocessing_configuration.node == 1 ) { + status = rtems_task_wake_after( 5 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "*** END OF TEST 13 ***" ); + exit( 0 ); + } + puts( "Deleting initialization task" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/mptests/mp13/node1/mp13.doc b/testsuites/mptests/mp13/node1/mp13.doc new file mode 100644 index 0000000000..abf558b443 --- /dev/null +++ b/testsuites/mptests/mp13/node1/mp13.doc @@ -0,0 +1,48 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + +This file describes the directives and concepts tested by this test set. + +test set name: test62 + +GLOBAL SEMAPHORE TEST + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, tm_wkafter, + sm_create, q_create, sm_p, q_receive + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies the Shared Memory Locked Queue Driver. + + h. Verifies that E_MESSAGETIMEOUT is when waiting on a + remote message queue. + + i. Verifies that E_SEMTIMEOUT is when waiting on a remote semaphore. + + j. Verifies that a task can delete itself. diff --git a/testsuites/mptests/mp13/node1/mp13.scn b/testsuites/mptests/mp13/node1/mp13.scn new file mode 100644 index 0000000000..d3bd11f65e --- /dev/null +++ b/testsuites/mptests/mp13/node1/mp13.scn @@ -0,0 +1,14 @@ +*** TEST 13 -- NODE 1 *** +Creating Message Queue (Global) +Creating Semaphore (Global) +Creating Test_task 1 (local) +Starting Test_task 1 (local) +Creating Test_task 2 (local) +Starting Test_task 2 (local) +Getting QID of message queue +Receiving message ... +Getting SMID of semaphore +Releasing semaphore ... +Getting semaphore ... +Getting semaphore ... +*** END OF TEST 13 *** diff --git a/testsuites/mptests/mp13/node2/mp13.doc b/testsuites/mptests/mp13/node2/mp13.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp13/node2/mp13.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/mptests/mp13/node2/mp13.scn b/testsuites/mptests/mp13/node2/mp13.scn new file mode 100644 index 0000000000..e9df202a94 --- /dev/null +++ b/testsuites/mptests/mp13/node2/mp13.scn @@ -0,0 +1,16 @@ +*** TEST 13 -- NODE 2 *** +Creating Test_task 1 (local) +Starting Test_task 1 (local) +Creating Test_task 2 (local) +Starting Test_task 2 (local) +Deleting initialization task +Getting QID of message queue +Getting SMID of semaphore +Getting semaphore ... +Receiving message ... +Releasing semaphore ... +Getting semaphore ... +rtems_message_queue_receive correctly returned RTEMS_TIMEOUT +Deleting self +rtems_semaphore_obtain correctly returned RTEMS_TIMEOUT +*** END OF TEST 13 *** diff --git a/testsuites/mptests/mp13/system.h b/testsuites/mptests/mp13/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/mptests/mp13/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/mptests/mp13/task1.c b/testsuites/mptests/mp13/task1.c new file mode 100644 index 0000000000..180d0fd101 --- /dev/null +++ b/testsuites/mptests/mp13/task1.c @@ -0,0 +1,70 @@ +/* Test_task1 + * + * This task attempts to receive a message from a global message queue. + * If running on the node on which the queue resides, the wait is + * forever, otherwise it times out on a remote message queue. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Test_task1( + rtems_task_argument argument +) +{ + char receive_buffer[16]; + rtems_status_code status; + + puts( "Getting QID of message queue" ); + + do { + status = rtems_message_queue_ident( + Queue_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &Queue_id[ 1 ] + ); + } while ( !rtems_is_status_successful( status ) ); + + if ( Multiprocessing_configuration.node == 1 ) { + puts( "Receiving message ..." ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])receive_buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + puts( "How did I get back from here????" ); + directive_failed( status, "rtems_message_queue_receive" ); + } + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "Receiving message ..." ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])receive_buffer, + RTEMS_DEFAULT_OPTIONS, + 2 * TICKS_PER_SECOND + ); + fatal_directive_status(status, RTEMS_TIMEOUT, "rtems_message_queue_receive"); + puts( "rtems_message_queue_receive correctly returned RTEMS_TIMEOUT" ); + + puts( "Deleting self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/mptests/mp13/task2.c b/testsuites/mptests/mp13/task2.c new file mode 100644 index 0000000000..a43b64d3cf --- /dev/null +++ b/testsuites/mptests/mp13/task2.c @@ -0,0 +1,106 @@ +/* Test_task2 + * + * This task attempts to receive control of a global semaphore. + * If running on the node on which the semaphore resides, the wait is + * forever, otherwise it times out on a remote semaphore. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Test_task2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "Getting SMID of semaphore" ); + do { + status = rtems_semaphore_ident( + Semaphore_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &Semaphore_id[ 1 ] + ); + } while ( !rtems_is_status_successful( status ) ); + + directive_failed( status, "rtems_semaphore_ident" ); + + if ( Multiprocessing_configuration.node == 1 ) { + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "Releasing semaphore ..." ); + status = rtems_semaphore_release( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_release" ); + + status = rtems_task_wake_after( TICKS_PER_SECOND / 2 ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "Getting semaphore ..." ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain" ); + + puts( "Getting semaphore ..." ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + puts( "How did I get back from here????" ); + directive_failed( status, "rtems_semaphore_obtain" ); + } + +/* + status = rtems_task_wake_after( TICKS_PER_SECOND / 2 ); + directive_failed( status, "rtems_task_wake_after" ); +*/ + + puts( "Getting semaphore ..." ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain" ); + + puts( "Releasing semaphore ..." ); + status = rtems_semaphore_release( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_release" ); + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "Getting semaphore ..." ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + 2 * TICKS_PER_SECOND + ); + fatal_directive_status( + status, + RTEMS_TIMEOUT, + "rtems_semaphore_obtain" + ); + puts( "rtems_semaphore_obtain correctly returned RTEMS_TIMEOUT" ); + + puts( "*** END OF TEST 13 ***" ); + exit( 0 ); +} diff --git a/testsuites/mptests/mp14/delay.c b/testsuites/mptests/mp14/delay.c new file mode 100644 index 0000000000..7062c4ad21 --- /dev/null +++ b/testsuites/mptests/mp14/delay.c @@ -0,0 +1,34 @@ +/* Delayed_send_event + * + * This routine is a timer service routine which sends an event to a task. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_timer_service_routine Delayed_send_event( + rtems_id timer_id, + void *ignored +) +{ + rtems_status_code status; + + status = rtems_event_send( + Task_id[ rtems_get_index( timer_id ) ], + RTEMS_EVENT_16 + ); + directive_failed( status, "rtems_event_send" ); +} diff --git a/testsuites/mptests/mp14/evtask1.c b/testsuites/mptests/mp14/evtask1.c new file mode 100644 index 0000000000..6f8175e4d4 --- /dev/null +++ b/testsuites/mptests/mp14/evtask1.c @@ -0,0 +1,86 @@ +/* Test_task + * + * This task either continuously sends events to a remote task, or + * continuously receives events sent by a remote task. This decision + * is based upon the local node number. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +extern rtems_multiprocessing_table Multiprocessing_configuration; + +rtems_task Test_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_unsigned32 count; + rtems_unsigned32 remote_node; + rtems_id remote_tid; + rtems_event_set event_out; + + remote_node = ((Multiprocessing_configuration.node == 1) ? 2 : 1); + + puts( "About to go to sleep!" ); + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + puts( "Waking up!" ); + + puts_nocr( "Remote task's name is : " ); + put_name( Task_name[ remote_node ], TRUE ); + + puts( "Getting TID of remote task" ); + while ( FOREVER ) { + status = rtems_task_ident( + Task_name[ remote_node ], + RTEMS_SEARCH_ALL_NODES, + &remote_tid + ); + + if ( status == RTEMS_SUCCESSFUL ) + break; + puts( "rtems_task_ident" ); + } + + if ( Multiprocessing_configuration.node == 1 ) { + puts( "Sending events to remote task" ); + while ( Stop_Test == FALSE ) { + for ( count=EVENT_TASK_DOT_COUNT; Stop_Test == FALSE && count; count-- ) { + status = rtems_event_send( remote_tid, RTEMS_EVENT_16 ); + directive_failed( status, "rtems_event_send" ); + } + put_dot( 'e' ); + } + } + + puts( "Receiving events from remote task" ); + while ( Stop_Test == FALSE ) { + for ( count=EVENT_TASK_DOT_COUNT ; Stop_Test == FALSE && count ; count-- ) { + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &event_out + ); + directive_failed( status, "rtems_event_receive" ); + } + put_dot( 'e' ); + } + + Exit_test(); +} diff --git a/testsuites/mptests/mp14/evtmtask.c b/testsuites/mptests/mp14/evtmtask.c new file mode 100644 index 0000000000..c540eb98fb --- /dev/null +++ b/testsuites/mptests/mp14/evtmtask.c @@ -0,0 +1,65 @@ +/* Delayed_events_task + * + * This task continuously sends itself events at one tick + * intervals. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Delayed_events_task( + rtems_task_argument argument +) +{ + rtems_unsigned32 count; + rtems_unsigned32 previous_mode; + rtems_status_code status; + rtems_event_set events; + + status = rtems_task_mode( + RTEMS_PREEMPT | RTEMS_TIMESLICE, + RTEMS_PREEMPT_MASK | RTEMS_TIMESLICE_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create" ); + + while ( Stop_Test == FALSE ) { + for ( count=DELAYED_EVENT_DOT_COUNT; Stop_Test == FALSE && count; count-- ){ + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 1, + Delayed_send_event, + NULL + ); + directive_failed( status, "rtems_timer_reset" ); + + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &events + ); + directive_failed( status, "rtems_event_receive" ); + } + put_dot('.'); + } + + Exit_test(); +} diff --git a/testsuites/mptests/mp14/exit.c b/testsuites/mptests/mp14/exit.c new file mode 100644 index 0000000000..65fc0df49f --- /dev/null +++ b/testsuites/mptests/mp14/exit.c @@ -0,0 +1,33 @@ +/* Exit_test + * + * This routine safely stops the test and prints some information + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Exit_test( void ) +{ + rtems_status_code status; + rtems_mode old_mode; + + status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode ); + directive_failed( status, "rtems_task_mode" ); + + MPCI_Print_statistics(); + + rtems_shutdown_executive( 0 ); +} diff --git a/testsuites/mptests/mp14/init.c b/testsuites/mptests/mp14/init.c new file mode 100644 index 0000000000..ab403ad395 --- /dev/null +++ b/testsuites/mptests/mp14/init.c @@ -0,0 +1,194 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +#include "bsp.h" + +rtems_unsigned8 my_partition[0x30000] CPU_STRUCTURE_ALIGNMENT; + +rtems_timer_service_routine Stop_Test_TSR( + rtems_id ignored_id, + void *ignored_address +) +{ + Stop_Test = TRUE; +} + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_task_priority previous_priority; + + printf( + "\n\n*** TEST 14 -- NODE %d ***\n", + Multiprocessing_configuration.node + ); + + Stop_Test = FALSE; + + status = rtems_timer_create( + rtems_build_name('S', 'T', 'O', 'P'), + &timer_id + ); + directive_failed( status, "rtems_timer_create" ); + + status = rtems_timer_fire_after( + timer_id, + MAX_LONG_TEST_DURATION * TICKS_PER_SECOND, + Stop_Test_TSR, + NULL + ); + directive_failed( status, "rtems_timer_fire_after" ); + + Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' ); + + Queue_task_name[ 1 ] = rtems_build_name( 'M', 'T', '1', ' ' ); + Queue_task_name[ 2 ] = rtems_build_name( 'M', 'T', '2', ' ' ); + + Partition_task_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' ); + Partition_task_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' ); + + Semaphore_task_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' ); + Semaphore_task_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' ); + + Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' ); + + Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' ); + + Partition_name[ 1 ] = rtems_build_name( 'P', 'A', 'R', ' ' ); + + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', 'R', ' ' ); + + if ( Multiprocessing_configuration.node == 1 ) { + puts( "Creating Semaphore (Global)" ); + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 1, + RTEMS_GLOBAL, + &Semaphore_id[ 1 ] + ); + directive_failed( status, "rtems_semaphore_create" ); + + puts( "Creating Message Queue (Global)" ); + status = rtems_message_queue_create( + Queue_name[ 1 ], + 1, + RTEMS_GLOBAL, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create" ); + + puts( "Creating Partition (Global)" ); + status = rtems_partition_create( + Partition_name[ 1 ], + (void *)my_partition, + 0x8000, + 0x3800, + RTEMS_GLOBAL, + &Partition_id[ 1 ] + ); + directive_failed( status, "rtems_partition_create" ); + } + + puts( "Creating Event task (Global)" ); + status = rtems_task_create( + Task_name[ Multiprocessing_configuration.node ], + 2, + 2048, + RTEMS_TIMESLICE, + RTEMS_GLOBAL, + &Event_task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Event task (Global)" ); + status = rtems_task_start( Event_task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Creating Semaphore task (Global)" ); + status = rtems_task_create( + Semaphore_task_name[ Multiprocessing_configuration.node ], + 2, + 2048, + RTEMS_TIMESLICE, + RTEMS_GLOBAL, + &Semaphore_task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Semaphore task (Global)" ); + status = rtems_task_start( Semaphore_task_id[ 1 ], Semaphore_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Creating Message Queue task (Global)" ); + status = rtems_task_create( + Queue_task_name[ Multiprocessing_configuration.node ], + 2, + 2048, + RTEMS_TIMESLICE, + RTEMS_GLOBAL, + &Queue_task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + /* argument is index into Buffers */ + puts( "Starting Message Queue task (Global)" ); + status = rtems_task_start( Queue_task_id[ 1 ], Message_queue_task, 1 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Creating Partition task (Global)" ); + status = rtems_task_create( + Partition_task_name[ Multiprocessing_configuration.node ], + 2, + 2048, + RTEMS_TIMESLICE, + RTEMS_GLOBAL, + &Partition_task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Starting Partition task (Global)" ); + status = rtems_task_start( Partition_task_id[ 1 ], Partition_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + status = rtems_task_set_priority( RTEMS_SELF, 2, &previous_priority ); + directive_failed( status, "rtems_task_set_priority" ); + + status = rtems_task_ident( + RTEMS_SELF, + RTEMS_SEARCH_ALL_NODES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_ident" ); + + Delayed_events_task( 1 ); +} diff --git a/testsuites/mptests/mp14/msgtask1.c b/testsuites/mptests/mp14/msgtask1.c new file mode 100644 index 0000000000..2a9f6e235b --- /dev/null +++ b/testsuites/mptests/mp14/msgtask1.c @@ -0,0 +1,102 @@ +/* Message_queue_task + * + * This task continuously sends messages to and receives messages from + * a global message queue. The message buffer is viewed as an array + * of two sixty-four bit counts which are incremented when a message is + * received. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Message_queue_task( + rtems_task_argument index +) +{ + rtems_status_code status; + rtems_unsigned32 count; + rtems_unsigned32 yield_count; + rtems_unsigned32 *buffer_count; + rtems_unsigned32 *overflow_count; + + Msg_buffer[ index ][0] = 0; + Msg_buffer[ index ][1] = 0; + Msg_buffer[ index ][2] = 0; + Msg_buffer[ index ][3] = 0; + + puts( "Getting ID of msg queue" ); + while ( FOREVER ) { + status = rtems_message_queue_ident( + Queue_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &Queue_id[ 1 ] + ); + if ( status == RTEMS_SUCCESSFUL ) + break; + puts( "rtems_message_queue_ident FAILED!!" ); + } + + if ( Multiprocessing_configuration.node == 1 ) { + status = rtems_message_queue_send( + Queue_id[ 1 ], + (long (*)[4])Msg_buffer[ index ] + ); + directive_failed( status, "rtems_message_queue_send" ); + overflow_count = &Msg_buffer[ index ][0]; + buffer_count = &Msg_buffer[ index ][1]; + } else { + overflow_count = &Msg_buffer[ index ][2]; + buffer_count = &Msg_buffer[ index ][3]; + } + + while ( Stop_Test == FALSE ) { + yield_count = 100; + + for ( count=MESSAGE_DOT_COUNT ; Stop_Test == FALSE && count ; count-- ) { + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])Msg_buffer[ index ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + + if ( *buffer_count == (rtems_unsigned32)0xffffffff ) { + *buffer_count = 0; + *overflow_count += 1; + } else + *buffer_count += 1; + + status = rtems_message_queue_send( + Queue_id[ 1 ], + (long (*)[4])Msg_buffer[ index ] + ); + directive_failed( status, "rtems_message_queue_send" ); + + if (Stop_Test == FALSE) + if ( Multiprocessing_configuration.node == 1 && --yield_count == 0 ) { + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + yield_count = 100; + } + } + put_dot( 'm' ); + } + + Exit_test(); +} diff --git a/testsuites/mptests/mp14/node1/mp14.doc b/testsuites/mptests/mp14/node1/mp14.doc new file mode 100644 index 0000000000..5ac3f7e47a --- /dev/null +++ b/testsuites/mptests/mp14/node1/mp14.doc @@ -0,0 +1,50 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test63 + +INTERRUPT SATURATION TEST + +directives: + ex_init, ex_start, t_create, t_start, t_ident, tm_tick, + tm_evwhen, tm_wkafter, i_return, ev_send, ev_receive + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies printing of strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies printing of strings to the CRT on port 2 of the mvme136 board + using Write and Writeln and the TTY driver. + + e. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + f. Verifies executive initialization performed correctly. + + g. Verifies the executive trap handler except for the halt function. + + h. Verifies that a task can get the task identification number of itself. + + i. Verifies that a task can get the task identification number + of another task. + + j. Verifies that events can be sent to a remote task. diff --git a/testsuites/mptests/mp14/node1/mp14.scn b/testsuites/mptests/mp14/node1/mp14.scn new file mode 100644 index 0000000000..98202bc439 --- /dev/null +++ b/testsuites/mptests/mp14/node1/mp14.scn @@ -0,0 +1,38 @@ +*** TEST 14 -- NODE 1 *** +Creating Semaphore (Global) +Creating Message Queue (Global) +Creating Partition (Global) +Creating Event task (Global) +Starting Event task (Global) +Creating Semaphore task (Global) +About to go to sleep! +Starting Semaphore task (Global) +Creating Message Queue task (Global) +Getting SMID of semaphore +Starting Message Queue task (Global) +Creating Partition task (Global) +Getting ID of msg queue +Starting Partition task (Global) +Getting ID of partition +Waking up! +Remote task's name is : 222 +Getting TID of remote task +Sending events to remote task + + +. - indicates 100 iterations of + tm_evafter of 1 tick and rtems_event_receive. + +e - indicates that 100 + events have been sent to the remote task. + +m - indicates 100 iterations of + rtems_message_queue_send and rtems_message_queue_receive. + +p - indicates 100 iterations of + rtems_partition_get_buffer and rtems_partition_return_buffer. + +s - indicates 100 iterations of + rtems_semaphore_obtain and rtems_semaphore_release. + +NOTE: The messages could be interspersed. diff --git a/testsuites/mptests/mp14/node2/mp14.doc b/testsuites/mptests/mp14/node2/mp14.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/mptests/mp14/node2/mp14.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/mptests/mp14/node2/mp14.scn b/testsuites/mptests/mp14/node2/mp14.scn new file mode 100644 index 0000000000..cd82f3c81b --- /dev/null +++ b/testsuites/mptests/mp14/node2/mp14.scn @@ -0,0 +1,35 @@ +*** TEST 14 -- NODE 2 *** +Creating Event task (Global) +Starting Event task (Global) +Creating Semaphore task (Global) +About to go to sleep! +Starting Semaphore task (Global) +Creating Message Queue task (Global) +Getting SMID of semaphore +Starting Message Queue task (Global) +Creating Partition task (Global) +Getting ID of msg queue +Starting Partition task (Global) +Getting ID of partition +Waking up! +Remote task's name is : 111 +Getting TID of remote task +Receiving events from remote task + + +. - indicates 100 iterations of + tm_evafter of 1 tick and rtems_event_receive. + +e - indicates that 100 + events have been sent to the remote task. + +m - indicates 100 iterations of + rtems_message_queue_send and rtems_message_queue_receive. + +p - indicates 100 iterations of + rtems_partition_get_buffer and rtems_partition_return_buffer. + +s - indicates 100 iterations of + rtems_semaphore_obtain and rtems_semaphore_release. + +NOTE: The messages could be interspersed. diff --git a/testsuites/mptests/mp14/pttask1.c b/testsuites/mptests/mp14/pttask1.c new file mode 100644 index 0000000000..f6af1b0969 --- /dev/null +++ b/testsuites/mptests/mp14/pttask1.c @@ -0,0 +1,65 @@ +/* Partition_task + * + * This task continuously gets a buffer from and returns that buffer + * to a global partition. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +extern rtems_multiprocessing_table Multiprocessing_configuration; + +rtems_task Partition_task( + rtems_task_argument argument +) +{ + rtems_unsigned32 count; + rtems_status_code status; + void *buffer; + + puts( "Getting ID of partition" ); + while ( FOREVER ) { + status = rtems_partition_ident( + Partition_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &Partition_id[ 1 ] + ); + + if ( status == RTEMS_SUCCESSFUL ) + break; + + puts( "rtems_partition_ident FAILED!!" ); + } + + while ( Stop_Test == FALSE ) { + for ( count=PARTITION_DOT_COUNT ; Stop_Test == FALSE && count ; count-- ) { + status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer ); + directive_failed( status, "rtems_partition_get_buffer" ); + + status = rtems_partition_return_buffer( Partition_id[ 1 ], buffer ); + directive_failed( status, "rtems_partition_return_buffer" ); + + if ( Multiprocessing_configuration.node == 1 ) { + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + } + } + put_dot( 'p' ); + } + + Exit_test(); +} diff --git a/testsuites/mptests/mp14/smtask1.c b/testsuites/mptests/mp14/smtask1.c new file mode 100644 index 0000000000..c4d71c0101 --- /dev/null +++ b/testsuites/mptests/mp14/smtask1.c @@ -0,0 +1,70 @@ +/* Sm_test_task + * + * This task continuously obtains and releases a global semaphore. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +extern rtems_multiprocessing_table Multiprocessing_configuration; + +rtems_task Semaphore_task( + rtems_task_argument argument +) +{ + rtems_unsigned32 count; + rtems_status_code status; + rtems_unsigned32 yield_count; + + puts( "Getting SMID of semaphore" ); + while ( FOREVER ) { + status = rtems_semaphore_ident( + Semaphore_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &Semaphore_id[ 1 ] + ); + if ( status == RTEMS_SUCCESSFUL ) + break; + puts( "rtems_semaphore_ident FAILED!!" ); + } + + while ( Stop_Test == FALSE ) { + yield_count = 100; + + for ( count=SEMAPHORE_DOT_COUNT ; Stop_Test == FALSE && count ; count-- ) { + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain" ); + + status = rtems_semaphore_release( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_release" ); + + if ( Multiprocessing_configuration.node == 1 && --yield_count == 0 ) { + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + yield_count = 100; + } + } + put_dot( 's' ); + } + + Exit_test(); +} diff --git a/testsuites/mptests/mp14/system.h b/testsuites/mptests/mp14/system.h new file mode 100644 index 0000000000..f2393df080 --- /dev/null +++ b/testsuites/mptests/mp14/system.h @@ -0,0 +1,31 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" +#include "mpci.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/samples/README b/testsuites/samples/README new file mode 100644 index 0000000000..77a734193f --- /dev/null +++ b/testsuites/samples/README @@ -0,0 +1,71 @@ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + +This directory contains the RTEMS Sample Application Suite. +The tests in this directory perform two functions: + + + provide simple examples of applications which can be + used as a starting point for your application. + + + help test a new board support package + +The hello and ticker applications are useful when first bringing up +a new board support package. The base_mp test is useful when +performing initial checkout on a new MPCI layer. + +The following describes each of the sample applications: + + base_mp + + This is a very simple two node multiprocessor application. It consists + of a single initialization task on each node which print out + their respective node numbers and task IDs. This test can be + used as a simple test of a new MPCI layer because it minimizes + the number of packets sent by RTEMS. + + This is intended as a starting point for custom developed multiprocessor + applications. + + base_sp + + This is a simple single processor application which consists of + an initialization task which creates another task. + + This is intended as a starting point for custom developed single + processor applications. + + cdtest + + A very simple C++ application which demonstrates that it is + possible to use C++ contructors and destructors in an RTEMS + application. Also does a perfunctory iostream test. + + hello + + This is the RTEMS version of the classic hello world program. + It consists of single initialization task which prints out + a few messages. + + This test does not include a Clock Tick device driver and can + be used to test the startup code of the board support package + as well as console output. + + paranoia + + A public domain test of the floating point and math library + capabilities of a toolset. It reports discrepancies between + actual and expected results. It is a large test. + + ticker + + This is a simple test of the user's Clock Tick device driver. + This test has an initialization task create three application + tasks which sleep and periodically wake up and print the time. + diff --git a/testsuites/samples/base_mp/apptask.c b/testsuites/samples/base_mp/apptask.c new file mode 100644 index 0000000000..04f081ad5c --- /dev/null +++ b/testsuites/samples/base_mp/apptask.c @@ -0,0 +1,38 @@ +/* Application_task + * + * This routine is as an example of an application task which + * prints a message including its RTEMS task id. This task + * then invokes exit to return to the monitor. + * + * Input parameters: + * node - processor's node number + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#include "libcsupport.h" + +rtems_task Application_task( + rtems_task_argument node +) +{ + rtems_id tid; + rtems_status_code status; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + printf( "This task was invoked with the node argument (%d)\n", node ); + printf( "This task has the id of 0x%x\n", tid ); + printf( "*** END OF SAMPLE MULTIPROCESSOR APPLICATION ***\n" ); + exit( 0 ); +} diff --git a/testsuites/samples/base_mp/init.c b/testsuites/samples/base_mp/init.c new file mode 100644 index 0000000000..a844d9032b --- /dev/null +++ b/testsuites/samples/base_mp/init.c @@ -0,0 +1,46 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is called from init_exec 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 application, the current time might be + * set by this task. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "shm.h" +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_name task_name; + rtems_id tid; + rtems_status_code status; + + printf( "\n\n*** SAMPLE MULTIPROCESSOR APPLICATION ***\n" ); + printf( "Creating and starting an application task\n" ); + task_name = rtems_build_name( 'T', 'A', '1', ' ' ); + status = rtems_task_create( task_name, 1, 1024, + RTEMS_INTERRUPT_LEVEL(0), RTEMS_DEFAULT_ATTRIBUTES, &tid ); + status = rtems_task_start( tid, Application_task, Mp_conf_addr.node ); + status = rtems_task_delete( RTEMS_SELF ); +} diff --git a/testsuites/samples/base_mp/node1/base_mp.doc b/testsuites/samples/base_mp/node1/base_mp.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/samples/base_mp/node1/base_mp.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/samples/base_mp/node1/base_mp.scn b/testsuites/samples/base_mp/node1/base_mp.scn new file mode 100644 index 0000000000..a2d2f359be --- /dev/null +++ b/testsuites/samples/base_mp/node1/base_mp.scn @@ -0,0 +1,5 @@ +*** SAMPLE MULTIPROCESSOR APPLICATION *** +Creating and starting an application task +This task was invoked with the node argument (1) +This task has the id of 0x10002 +*** END OF SAMPLE MULTIPROCESSOR APPLICATION *** diff --git a/testsuites/samples/base_mp/node2/base_mp.doc b/testsuites/samples/base_mp/node2/base_mp.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/samples/base_mp/node2/base_mp.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/samples/base_mp/node2/base_mp.scn b/testsuites/samples/base_mp/node2/base_mp.scn new file mode 100644 index 0000000000..95bc96a808 --- /dev/null +++ b/testsuites/samples/base_mp/node2/base_mp.scn @@ -0,0 +1,5 @@ +*** SAMPLE MULTIPROCESSOR APPLICATION *** +Creating and starting an application task +This task was invoked with the node argument (2) +This task has the id of 0x20002 +*** END OF SAMPLE MULTIPROCESSOR APPLICATION *** diff --git a/testsuites/samples/base_mp/system.h b/testsuites/samples/base_mp/system.h new file mode 100644 index 0000000000..47347fe30a --- /dev/null +++ b/testsuites/samples/base_mp/system.h @@ -0,0 +1,31 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "stdio.h" +#include "libcsupport.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/samples/base_sp/apptask.c b/testsuites/samples/base_sp/apptask.c new file mode 100644 index 0000000000..c238d356a6 --- /dev/null +++ b/testsuites/samples/base_sp/apptask.c @@ -0,0 +1,39 @@ +/* Application_task + * + * This routine is as an example of an application task which + * prints a message including its RTEMS task id. This task + * then invokes exit to return to the monitor. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#include "libcsupport.h" + +rtems_task Application_task( + rtems_task_argument argument +) +{ + rtems_id tid; + rtems_status_code status; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + + printf( "Application task was invoked with argument (%d) " + "and has id of 0x%x\n", argument, tid ); + + printf( "*** END OF SAMPLE SINGLE PROCESSOR APPLICATION ***\n" ); + exit( 0 ); +} diff --git a/testsuites/samples/base_sp/base_sp.doc b/testsuites/samples/base_sp/base_sp.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/samples/base_sp/base_sp.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/samples/base_sp/base_sp.scn b/testsuites/samples/base_sp/base_sp.scn new file mode 100644 index 0000000000..117ddaecb8 --- /dev/null +++ b/testsuites/samples/base_sp/base_sp.scn @@ -0,0 +1,5 @@ +*** SAMPLE SINGLE PROCESSOR APPLICATION *** +Creating and starting an application task +Application task was invoked with argument (0) and has id of 0x10002 +*** END OF SAMPLE SINGLE PROCESSOR APPLICATION *** + diff --git a/testsuites/samples/base_sp/init.c b/testsuites/samples/base_sp/init.c new file mode 100644 index 0000000000..8c5a533074 --- /dev/null +++ b/testsuites/samples/base_sp/init.c @@ -0,0 +1,51 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is called from init_exec 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 application, the current time might be + * set by this task. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +#define ARGUMENT 0 + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_name task_name; + rtems_id tid; + rtems_status_code status; + + printf( "\n\n*** SAMPLE SINGLE PROCESSOR APPLICATION ***\n" ); + printf( "Creating and starting an application task\n" ); + + task_name = rtems_build_name( 'T', 'A', '1', ' ' ); + + status = rtems_task_create( task_name, 1, 1024, + RTEMS_INTERRUPT_LEVEL(0), RTEMS_DEFAULT_ATTRIBUTES, &tid ); + + status = rtems_task_start( tid, Application_task, ARGUMENT ); + + status = rtems_task_delete( RTEMS_SELF ); +} diff --git a/testsuites/samples/base_sp/system.h b/testsuites/samples/base_sp/system.h new file mode 100644 index 0000000000..88e60beb9a --- /dev/null +++ b/testsuites/samples/base_sp/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "stdio.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/samples/cdtest/cdtest.scn b/testsuites/samples/cdtest/cdtest.scn new file mode 100644 index 0000000000..a832a72372 --- /dev/null +++ b/testsuites/samples/cdtest/cdtest.scn @@ -0,0 +1,31 @@ +Hey I'm in base class constructor number 1 for 0x400010cc. +Hey I'm in base class constructor number 2 for 0x400010d4. +Hey I'm in derived class constructor number 3 for 0x400010d4. + + +*** CONSTRUCTOR/DESTRUCTOR TEST *** +Hey I'm in base class constructor number 4 for 0x4009ee08. +Hey I'm in base class constructor number 5 for 0x4009ee10. +Hey I'm in base class constructor number 6 for 0x4009ee18. +Hey I'm in base class constructor number 7 for 0x4009ee20. +Hey I'm in derived class constructor number 8 for 0x4009ee20. +Testing a C++ I/O stream +Hey I'm in derived class destructor number 8 for 0x4009ee20. +Derived class - Instantiation order 8 +Hey I'm in base class destructor number 7 for 0x4009ee20. +Instantiation order 8 +Hey I'm in base class destructor number 6 for 0x4009ee18. +Instantiation order 6 +Hey I'm in base class destructor number 5 for 0x4009ee10. +Instantiation order 5 +Hey I'm in base class destructor number 4 for 0x4009ee08. +Instantiation order 5 +*** END OF CONSTRUCTOR/DESTRUCTOR TEST *** + + +Hey I'm in derived class destructor number 3 for 0x400010d4. +Derived class - Instantiation order 3 +Hey I'm in base class destructor number 2 for 0x400010d4. +Instantiation order 3 +Hey I'm in base class destructor number 1 for 0x400010cc. +Instantiation order 1 diff --git a/testsuites/samples/cdtest/init.c b/testsuites/samples/cdtest/init.c new file mode 100644 index 0000000000..c233918d61 --- /dev/null +++ b/testsuites/samples/cdtest/init.c @@ -0,0 +1,30 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is called from init_exec 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: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" +#include +#include "libcsupport.h" diff --git a/testsuites/samples/cdtest/main.cc b/testsuites/samples/cdtest/main.cc new file mode 100644 index 0000000000..1a12431701 --- /dev/null +++ b/testsuites/samples/cdtest/main.cc @@ -0,0 +1,146 @@ +/* main + * + * This routine is the initialization task for this test program. + * It is called from init_exec 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: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1994 by Division Incorporated + * + * Based in part on OAR works. + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of Division Incorporated not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Division Incorporated makes no representations about the + * suitability of this software for any purpose. + * + * $Id$ + */ + +#include +#include +#include +#include + +extern "C" { +extern rtems_task main_task(rtems_task_argument); +} + +static int num_inst = 0; + +class A { +public: + A(void) + { + num_inst++; + printf( + "Hey I'm in base class constructor number %d for %p.\n", + num_inst, + this + ); + + /* + * Make sure we use some space + */ + + string = new char[50]; + sprintf(string, "Instantiation order %d", num_inst); + }; + + virtual ~A() + { + printf( + "Hey I'm in base class destructor number %d for %p.\n", + num_inst, + this + ); + print(); + num_inst--; + }; + + virtual void print() { printf("%s\n", string); }; + +protected: + char *string; +}; + +class B : public A { +public: + B(void) + { + num_inst++; + printf( + "Hey I'm in derived class constructor number %d for %p.\n", + num_inst, + this + ); + + /* + * Make sure we use some space + */ + + string = new char[50]; + sprintf(string, "Instantiation order %d", num_inst); + }; + + ~B() + { + printf( + "Hey I'm in derived class destructor number %d for %p.\n", + num_inst, + this + ); + print(); + num_inst--; + }; + + void print() { printf("Derived class - %s\n", string); } +}; + + +A foo; +B foobar; + +void +cdtest(void) +{ + A bar, blech, blah; + B bleak; + + cout << "Testing a C++ I/O stream" << endl; + + bar = blech; +} + +// +// main equivalent +// It can not be called 'main' since the bsp owns that name +// in many implementations in order to get global constructors +// run. +// +// Ref: c/src/lib/libbsp/hppa1_1/simhppa/startup/bspstart.c +// + + +rtems_task main_task( + rtems_task_argument ignored +) +{ + printf( "\n\n*** CONSTRUCTOR/DESTRUCTOR TEST ***\n" ); + + cdtest(); + + printf( "*** END OF CONSTRUCTOR/DESTRUCTOR TEST ***\n\n\n" ); + + exit(0); +} diff --git a/testsuites/samples/cdtest/system.h b/testsuites/samples/cdtest/system.h new file mode 100644 index 0000000000..88e60beb9a --- /dev/null +++ b/testsuites/samples/cdtest/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "stdio.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/samples/hello/hello.doc b/testsuites/samples/hello/hello.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/samples/hello/hello.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/samples/hello/hello.scn b/testsuites/samples/hello/hello.scn new file mode 100644 index 0000000000..d9e92d81d5 --- /dev/null +++ b/testsuites/samples/hello/hello.scn @@ -0,0 +1,3 @@ +*** HELLO WORLD TEST *** +Hello World +*** END OF HELLO WORLD TEST *** diff --git a/testsuites/samples/hello/init.c b/testsuites/samples/hello/init.c new file mode 100644 index 0000000000..f85562c238 --- /dev/null +++ b/testsuites/samples/hello/init.c @@ -0,0 +1,41 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is called from init_exec 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: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" +#include +#include "libcsupport.h" + + +rtems_task Init( + rtems_task_argument ignored +) +{ + printf( "\n\n*** HELLO WORLD TEST ***\n" ); + printf( "Hello World\n" ); + printf( "*** END OF HELLO WORLD TEST ***\n" ); + exit( 0 ); +} diff --git a/testsuites/samples/hello/system.h b/testsuites/samples/hello/system.h new file mode 100644 index 0000000000..88e60beb9a --- /dev/null +++ b/testsuites/samples/hello/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "stdio.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/samples/paranoia/init.c b/testsuites/samples/paranoia/init.c new file mode 100644 index 0000000000..4e9c9cde09 --- /dev/null +++ b/testsuites/samples/paranoia/init.c @@ -0,0 +1,43 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is called from init_exec 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: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" +#include "libcsupport.h" + +extern int paranoia(int, char **); + +char *args[2] = { "paranoia", 0 }; + +rtems_task Init( + rtems_task_argument ignored +) +{ + printf( "\n\n*** PARANOIA TEST ***\n" ); + paranoia(1, args); + printf( "*** END OF PARANOIA TEST ***\n" ); + exit( 0 ); +} diff --git a/testsuites/samples/paranoia/paranoia.c b/testsuites/samples/paranoia/paranoia.c new file mode 100644 index 0000000000..64ebdc7e5e --- /dev/null +++ b/testsuites/samples/paranoia/paranoia.c @@ -0,0 +1,2300 @@ +/* + * RTEMS RCS Id: $Id$ + * + * A C version of Kahan's Floating Point Test "Paranoia" + * + * Thos Sumner, UCSF, Feb. 1985 + * David Gay, BTL, Jan. 1986 + * + * This is a rewrite from the Pascal version by + * + * B. A. Wichmann, 18 Jan. 1985 + * + * (and does NOT exhibit good C programming style). + * + * Sun May 16 18:21:51 MDT 1993 Jeffrey Wheat (cassidy@cygnus.com) + * Removed KR_headers defines, removed ANSI prototyping + * Cleaned up and reformated code. Added special CYGNUS + * "verbose" mode type messages (-DCYGNUS). + * Note: This code is VERY NASTY. + * + * Adjusted to use Standard C headers 19 Jan. 1992 (dmg); + * compile with -DKR_headers or insert + * #define KR_headers + * at the beginning if you have an old-style C compiler. + * + * (C) Apr 19 1983 in BASIC version by: + * Professor W. M. Kahan, + * 567 Evans Hall + * Electrical Engineering & Computer Science Dept. + * University of California + * Berkeley, California 94720 + * USA + * + * converted to Pascal by: + * B. A. Wichmann + * National Physical Laboratory + * Teddington Middx + * TW11 OLW + * UK + * + * converted to C by: + * + * David M. Gay and Thos Sumner + * AT&T Bell Labs Computer Center, Rm. U-76 + * 600 Mountain Avenue University of California + * Murray Hill, NJ 07974 San Francisco, CA 94143 + * USA USA + * + * with simultaneous corrections to the Pascal source (reflected + * in the Pascal source available over netlib). + * [A couple of bug fixes from dgh = sun!dhough incorporated 31 July 1986.] + * + * Reports of results on various systems from all the versions + * of Paranoia are being collected by Richard Karpinski at the + * same address as Thos Sumner. This includes sample outputs, + * bug reports, and criticisms. + * + * You may copy this program freely if you acknowledge its source. + * Comments on the Pascal version to NPL, please. + * + * + * The C version catches signals from floating-point exceptions. + * If signal(SIGFPE,...) is unavailable in your environment, you may + * #define NOSIGNAL to comment out the invocations of signal. + * + * This source file is too big for some C compilers, but may be split + * into pieces. Comments containing "SPLIT" suggest convenient places + * for this splitting. At the end of these comments is an "ed script" + * (for the UNIX(tm) editor ed) that will do this splitting. + * + * By #defining SINGLE_PRECISION when you compile this source, you may + * obtain a single-precision C version of Paranoia. + * + * The following is from the introductory commentary from Wichmann's work: + * + * The BASIC program of Kahan is written in Microsoft BASIC using many + * facilities which have no exact analogy in Pascal. The Pascal + * version below cannot therefore be exactly the same. Rather than be + * a minimal transcription of the BASIC program, the Pascal coding + * follows the conventional style of block-structured languages. Hence + * the Pascal version could be useful in producing versions in other + * structured languages. + * + * Rather than use identifiers of minimal length (which therefore have + * little mnemonic significance), the Pascal version uses meaningful + * identifiers as follows [Note: A few changes have been made for C]: + * + * + * BASIC C BASIC C BASIC C + * + * A J S StickyBit + * A1 AInverse J0 NoErrors T + * B Radix [Failure] T0 Underflow + * B1 BInverse J1 NoErrors T2 ThirtyTwo + * B2 RadixD2 [SeriousDefect] T5 OneAndHalf + * B9 BMinusU2 J2 NoErrors T7 TwentySeven + * C [Defect] T8 TwoForty + * C1 CInverse J3 NoErrors U OneUlp + * D [Flaw] U0 UnderflowThreshold + * D4 FourD K PageNo U1 + * E0 L Milestone U2 + * E1 M V + * E2 Exp2 N V0 + * E3 N1 V8 + * E5 MinSqEr O Zero V9 + * E6 SqEr O1 One W + * E7 MaxSqEr O2 Two X + * E8 O3 Three X1 + * E9 O4 Four X8 + * F1 MinusOne O5 Five X9 Random1 + * F2 Half O8 Eight Y + * F3 Third O9 Nine Y1 + * F6 P Precision Y2 + * F9 Q Y9 Random2 + * G1 GMult Q8 Z + * G2 GDiv Q9 Z0 PseudoZero + * G3 GAddSub R Z1 + * H R1 RMult Z2 + * H1 HInverse R2 RDiv Z9 + * I R3 RAddSub + * IO NoTrials R4 RSqrt + * I3 IEEE R9 Random9 + * + * SqRWrng + * + * All the variables in BASIC are true variables and in consequence, + * the program is more difficult to follow since the "constants" must + * be determined (the glossary is very helpful). The Pascal version + * uses Real constants, but checks are added to ensure that the values + * are correctly converted by the compiler. + * + * The major textual change to the Pascal version apart from the + * identifiersis that named procedures are used, inserting parameters + * wherehelpful. New procedures are also introduced. The + * correspondence is as follows: + * + * + * BASIC Pascal + * lines + * + * 90- 140 Pause + * 170- 250 Instructions + * 380- 460 Heading + * 480- 670 Characteristics + * 690- 870 History + * 2940-2950 Random + * 3710-3740 NewD + * 4040-4080 DoesYequalX + * 4090-4110 PrintIfNPositive + * 4640-4850 TestPartialUnderflow + * +*/ + +#include +#include + +/* + * To compile this on host using only libm from newlib (and using host libc) + * do: + * gcc -g -DNEED_REENT -DCYGNUS paranoia.c .../newlib-1.6/newlib/libm.a + */ + +#ifdef NEED_REENT +#include "reent.h" +struct _reent libm_reent = _REENT_INIT(libm_reent); +struct _reent *_impure_ptr = &libm_reent; +#endif + +#ifndef NOSIGNAL +#include +#include +#else /* NOSIGNAL */ +#define longjmp(e,v) +#define setjmp(e) 0 +#define jmp_buf int +#endif /* NOSIGNAL */ + +#ifdef SINGLE_PRECISION +#define FLOAT float +#define FABS(x) (float)fabs((double)(x)) +#define FLOOR(x) (float)floor((double)(x)) +#define LOG(x) (float)log((double)(x)) +#define POW(x,y) (float)pow((double)(x),(double)(y)) +#define SQRT(x) (float)sqrt((double)(x)) +#else /* !SINGLE_PRECISION */ +#define FLOAT double +#define FABS(x) fabs(x) +#define FLOOR(x) floor(x) +#define LOG(x) log(x) +#define POW(x,y) pow(x,y) +#define SQRT(x) sqrt(x) +#endif /* SINGLE_PRECISION */ + +jmp_buf ovfl_buf; +extern double fabs (), floor (), log (), pow (), sqrt (); +extern void exit (); +typedef void (*Sig_type) (); +FLOAT Sign (), Random (); +extern void BadCond (); +extern void SqXMinX (); +extern void TstCond (); +extern void notify (); +extern int read (); +extern void Characteristics (); +extern void Heading (); +extern void History (); +extern void Instructions (); +extern void IsYeqX (); +extern void NewD (); +extern void Pause (); +extern void PrintIfNPositive (); +extern void SR3750 (); +extern void SR3980 (); +extern void TstPtUf (); + +Sig_type sigsave; + +#define KEYBOARD 0 + +FLOAT Radix, BInvrse, RadixD2, BMinusU2; + +/*Small floating point constants.*/ +FLOAT Zero = 0.0; +FLOAT Half = 0.5; +FLOAT One = 1.0; +FLOAT Two = 2.0; +FLOAT Three = 3.0; +FLOAT Four = 4.0; +FLOAT Five = 5.0; +FLOAT Eight = 8.0; +FLOAT Nine = 9.0; +FLOAT TwentySeven = 27.0; +FLOAT ThirtyTwo = 32.0; +FLOAT TwoForty = 240.0; +FLOAT MinusOne = -1.0; +FLOAT OneAndHalf = 1.5; + +/*Integer constants*/ +int NoTrials = 20; /*Number of tests for commutativity. */ +#define False 0 +#define True 1 + +/* + * Definitions for declared types + * Guard == (Yes, No); + * Rounding == (Chopped, Rounded, Other); + * Message == packed array [1..40] of char; + * Class == (Flaw, Defect, Serious, Failure); + */ +#define Yes 1 +#define No 0 +#define Chopped 2 +#define Rounded 1 +#define Other 0 +#define Flaw 3 +#define Defect 2 +#define Serious 1 +#define Failure 0 +typedef int Guard, Rounding, Class; +typedef char Message; + +/* Declarations of Variables */ +int Indx; +char ch[8]; +FLOAT AInvrse, A1; +FLOAT C, CInvrse; +FLOAT D, FourD; +FLOAT E0, E1, Exp2, E3, MinSqEr; +FLOAT SqEr, MaxSqEr, E9; +FLOAT Third; +FLOAT F6, F9; +FLOAT H, HInvrse; +int I; +FLOAT StickyBit, J; +FLOAT MyZero; +FLOAT Precision; +FLOAT Q, Q9; +FLOAT R, Random9; +FLOAT T, Underflow, S; +FLOAT OneUlp, UfThold, U1, U2; +FLOAT V, V0, V9; +FLOAT W; +FLOAT X, X1, X2, X8, Random1; +FLOAT Y, Y1, Y2, Random2; +FLOAT Z, PseudoZero, Z1, Z2, Z9; +int ErrCnt[4]; +int fpecount; +int Milestone; +int PageNo; +int M, N, N1; +Guard GMult, GDiv, GAddSub; +Rounding RMult, RDiv, RAddSub, RSqrt; +int Break, Done, NotMonot, Monot, Anomaly, IEEE, SqRWrng, UfNGrad; + +/* Computed constants. + * U1 gap below 1.0, i.e, 1.0 - U1 is next number below 1.0 + * U2 gap above 1.0, i.e, 1.0 + U2 is next number above 1.0 + */ + +int batchmode; /* global batchmode test */ + +/* program name and version variables and macro */ +char *temp; +char *program_name; +char *program_vers; + +#ifndef VERSION +#define VERSION "1.1 [cygnus]" +#endif /* VERSION */ + +#define basename(cp) ((temp=(char *)strrchr((cp), '/')) ? temp+1 : (cp)) + +#ifndef BATCHMODE +# ifdef CYGNUS +# define BATCHMODE +# endif +#endif + +/* floating point exception receiver */ +void +_sigfpe (x) +int x; +{ + fpecount++; + printf ("\n* * * FLOATING-POINT ERROR %d * * *\n", x); + fflush (stdout); + if (sigsave) { +#ifndef NOSIGNAL + signal (SIGFPE, sigsave); +#endif /* NOSIGNAL */ + sigsave = 0; + longjmp (ovfl_buf, 1); + } + exit (1); +} + +#ifdef NOMAIN +#define main paranoia +#endif + +int +main (argc, argv) +int argc; +char **argv; +{ + /* First two assignments use integer right-hand sides. */ + Zero = 0; + One = 1; + Two = One + One; + Three = Two + One; + Four = Three + One; + Five = Four + One; + Eight = Four + Four; + Nine = Three * Three; + TwentySeven = Nine * Three; + ThirtyTwo = Four * Eight; + TwoForty = Four * Five * Three * Four; + MinusOne = -One; + Half = One / Two; + OneAndHalf = One + Half; + ErrCnt[Failure] = 0; + ErrCnt[Serious] = 0; + ErrCnt[Defect] = 0; + ErrCnt[Flaw] = 0; + PageNo = 1; + +#ifdef BATCHMODE + batchmode = 1; /* run test in batchmode? */ +#else /* !BATCHMODE */ + batchmode = 0; /* run test interactively */ +#endif /* BATCHMODE */ + + program_name = basename (argv[0]); + program_vers = VERSION; + + printf ("%s version %s\n", program_name, program_vers); + + /*=============================================*/ + Milestone = 0; + /*=============================================*/ +#ifndef NOSIGNAL + signal (SIGFPE, _sigfpe); +#endif + + if (!batchmode) { + Instructions (); + Pause (); + Heading (); + Instructions (); + Pause (); + Heading (); + Pause (); + Characteristics (); + Pause (); + History (); + Pause (); + } + + /*=============================================*/ + Milestone = 7; + /*=============================================*/ + printf ("Program is now RUNNING tests on small integers:\n"); + TstCond (Failure, (Zero + Zero == Zero) && (One - One == Zero) + && (One > Zero) && (One + One == Two), + "0+0 != 0, 1-1 != 0, 1 <= 0, or 1+1 != 2"); + Z = -Zero; + if (Z != 0.0) { + ErrCnt[Failure] = ErrCnt[Failure] + 1; + printf ("Comparison alleges that -0.0 is Non-zero!\n"); + U1 = 0.001; + Radix = 1; + TstPtUf (); + } + TstCond (Failure, (Three == Two + One) && (Four == Three + One) + && (Four + Two * (-Two) == Zero) + && (Four - Three - One == Zero), + "3 != 2+1, 4 != 3+1, 4+2*(-2) != 0, or 4-3-1 != 0"); + TstCond (Failure, (MinusOne == (0 - One)) + && (MinusOne + One == Zero) && (One + MinusOne == Zero) + && (MinusOne + FABS (One) == Zero) + && (MinusOne + MinusOne * MinusOne == Zero), + "-1+1 != 0, (-1)+abs(1) != 0, or -1+(-1)*(-1) != 0"); + TstCond (Failure, Half + MinusOne + Half == Zero, + "1/2 + (-1) + 1/2 != 0"); + /*=============================================*/ + Milestone = 10; + /*=============================================*/ + TstCond (Failure, (Nine == Three * Three) + && (TwentySeven == Nine * Three) && (Eight == Four + Four) + && (ThirtyTwo == Eight * Four) + && (ThirtyTwo - TwentySeven - Four - One == Zero), + "9 != 3*3, 27 != 9*3, 32 != 8*4, or 32-27-4-1 != 0"); + TstCond (Failure, (Five == Four + One) && + (TwoForty == Four * Five * Three * Four) + && (TwoForty / Three - Four * Four * Five == Zero) + && (TwoForty / Four - Five * Three * Four == Zero) + && (TwoForty / Five - Four * Three * Four == Zero), + "5 != 4+1, 240/3 != 80, 240/4 != 60, or 240/5 != 48"); + if (ErrCnt[Failure] == 0) { + printf ("-1, 0, 1/2, 1, 2, 3, 4, 5, 9, 27, 32 & 240 are O.K.\n"); + printf ("\n"); + } + printf ("Searching for Radix and Precision.\n"); + W = One; + do { + W = W + W; + Y = W + One; + Z = Y - W; + Y = Z - One; + } + while (MinusOne + FABS (Y) < Zero); + /*.. now W is just big enough that |((W+1)-W)-1| >= 1 ...*/ + Precision = Zero; + Y = One; + do { + Radix = W + Y; + Y = Y + Y; + Radix = Radix - W; + } + while (Radix == Zero); + if (Radix < Two) + Radix = One; + printf ("Radix = %f .\n", Radix); + if (Radix != 1) { + W = One; + do { + Precision = Precision + One; + W = W * Radix; + Y = W + One; + } + while ((Y - W) == One); + } + /*... now W == Radix^Precision is barely too big to satisfy (W+1)-W == 1 + ...*/ + U1 = One / W; + U2 = Radix * U1; + printf ("Closest relative separation found is U1 = %.7e .\n\n", U1); + printf ("Recalculating radix and precision\n "); + + /*save old values*/ + E0 = Radix; + E1 = U1; + E9 = U2; + E3 = Precision; + + X = Four / Three; + Third = X - One; + F6 = Half - Third; + X = F6 + F6; + X = FABS (X - Third); + if (X < U2) + X = U2; + + /*... now X = (unknown no.) ulps of 1+...*/ + do { + U2 = X; + Y = Half * U2 + ThirtyTwo * U2 * U2; + Y = One + Y; + X = Y - One; + } + while (!((U2 <= X) || (X <= Zero))); + + /*... now U2 == 1 ulp of 1 + ... */ + X = Two / Three; + F6 = X - Half; + Third = F6 + F6; + X = Third - Half; + X = FABS (X + F6); + if (X < U1) + X = U1; + + /*... now X == (unknown no.) ulps of 1 -... */ + do { + U1 = X; + Y = Half * U1 + ThirtyTwo * U1 * U1; + Y = Half - Y; + X = Half + Y; + Y = Half - X; + X = Half + Y; + } + while (!((U1 <= X) || (X <= Zero))); + /*... now U1 == 1 ulp of 1 - ... */ + if (U1 == E1) + printf ("confirms closest relative separation U1 .\n"); + else + printf ("gets better closest relative separation U1 = %.7e .\n", U1); + W = One / U1; + F9 = (Half - U1) + Half; + Radix = FLOOR (0.01 + U2 / U1); + if (Radix == E0) + printf ("Radix confirmed.\n"); + else + printf ("MYSTERY: recalculated Radix = %.7e .\n", Radix); + TstCond (Defect, Radix <= Eight + Eight, + "Radix is too big: roundoff problems"); + TstCond (Flaw, (Radix == Two) || (Radix == 10) + || (Radix == One), "Radix is not as good as 2 or 10"); + /*=============================================*/ + Milestone = 20; + /*=============================================*/ + TstCond (Failure, F9 - Half < Half, + "(1-U1)-1/2 < 1/2 is FALSE, prog. fails?"); + X = F9; + I = 1; + Y = X - Half; + Z = Y - Half; + TstCond (Failure, (X != One) + || (Z == Zero), "Comparison is fuzzy,X=1 but X-1/2-1/2 != 0"); + X = One + U2; + I = 0; + /*=============================================*/ + Milestone = 25; + /*=============================================*/ + /*... BMinusU2 = nextafter(Radix, 0) */ + BMinusU2 = Radix - One; + BMinusU2 = (BMinusU2 - U2) + One; + /* Purify Integers */ + if (Radix != One) { + X = -TwoForty * LOG (U1) / LOG (Radix); + Y = FLOOR (Half + X); + if (FABS (X - Y) * Four < One) + X = Y; + Precision = X / TwoForty; + Y = FLOOR (Half + Precision); + if (FABS (Precision - Y) * TwoForty < Half) + Precision = Y; + } + if ((Precision != FLOOR (Precision)) || (Radix == One)) { + printf ("Precision cannot be characterized by an Integer number\n"); + printf ("of significant digits but, by itself, this is a minor flaw.\n"); + } + if (Radix == One) + printf ("logarithmic encoding has precision characterized solely by U1.\n"); + else + printf ("The number of significant digits of the Radix is %f .\n", + Precision); + TstCond (Serious, U2 * Nine * Nine * TwoForty < One, + "Precision worse than 5 decimal figures "); + /*=============================================*/ + Milestone = 30; + /*=============================================*/ + /* Test for extra-precise subepressions */ + X = FABS (((Four / Three - One) - One / Four) * Three - One / Four); + do { + Z2 = X; + X = (One + (Half * Z2 + ThirtyTwo * Z2 * Z2)) - One; + } + while (!((Z2 <= X) || (X <= Zero))); + X = Y = Z = FABS ((Three / Four - Two / Three) * Three - One / Four); + do { + Z1 = Z; + Z = (One / Two - ((One / Two - (Half * Z1 + ThirtyTwo * Z1 * Z1)) + + One / Two)) + One / Two; + } + while (!((Z1 <= Z) || (Z <= Zero))); + do { + do { + Y1 = Y; + Y = (Half - ((Half - (Half * Y1 + ThirtyTwo * Y1 * Y1)) + Half + )) + Half; + } + while (!((Y1 <= Y) || (Y <= Zero))); + X1 = X; + X = ((Half * X1 + ThirtyTwo * X1 * X1) - F9) + F9; + } + while (!((X1 <= X) || (X <= Zero))); + if ((X1 != Y1) || (X1 != Z1)) { + BadCond (Serious, "Disagreements among the values X1, Y1, Z1,\n"); + printf ("respectively %.7e, %.7e, %.7e,\n", X1, Y1, Z1); + printf ("are symptoms of inconsistencies introduced\n"); + printf ("by extra-precise evaluation of arithmetic subexpressions.\n"); + notify ("Possibly some part of this"); + if ((X1 == U1) || (Y1 == U1) || (Z1 == U1)) + printf ( + "That feature is not tested further by this program.\n"); + } else { + if ((Z1 != U1) || (Z2 != U2)) { + if ((Z1 >= U1) || (Z2 >= U2)) { + BadCond (Failure, ""); + notify ("Precision"); + printf ("\tU1 = %.7e, Z1 - U1 = %.7e\n", U1, Z1 - U1); + printf ("\tU2 = %.7e, Z2 - U2 = %.7e\n", U2, Z2 - U2); + } else { + if ((Z1 <= Zero) || (Z2 <= Zero)) { + printf ("Because of unusual Radix = %f", Radix); + printf (", or exact rational arithmetic a result\n"); + printf ("Z1 = %.7e, or Z2 = %.7e ", Z1, Z2); + notify ("of an\nextra-precision"); + } + if (Z1 != Z2 || Z1 > Zero) { + X = Z1 / U1; + Y = Z2 / U2; + if (Y > X) + X = Y; + Q = -LOG (X); + printf ("Some subexpressions appear to be calculated extra\n"); + printf ("precisely with about %g extra B-digits, i.e.\n", + (Q / LOG (Radix))); + printf ("roughly %g extra significant decimals.\n", + Q / LOG (10.)); + } + printf ("That feature is not tested further by this program.\n"); + } + } + } + Pause (); + /*=============================================*/ + Milestone = 35; + /*=============================================*/ + if (Radix >= Two) { + X = W / (Radix * Radix); + Y = X + One; + Z = Y - X; + T = Z + U2; + X = T - Z; + TstCond (Failure, X == U2, + "Subtraction is not normalized X=Y,X+Z != Y+Z!"); + if (X == U2) + printf ( + "Subtraction appears to be normalized, as it should be."); + } + printf ("\nChecking for guard digit in *, /, and -.\n"); + Y = F9 * One; + Z = One * F9; + X = F9 - Half; + Y = (Y - Half) - X; + Z = (Z - Half) - X; + X = One + U2; + T = X * Radix; + R = Radix * X; + X = T - Radix; + X = X - Radix * U2; + T = R - Radix; + T = T - Radix * U2; + X = X * (Radix - One); + T = T * (Radix - One); + if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero)) + GMult = Yes; + else { + GMult = No; + TstCond (Serious, False, + "* lacks a Guard Digit, so 1*X != X"); + } + Z = Radix * U2; + X = One + Z; + Y = FABS ((X + Z) - X * X) - U2; + X = One - U2; + Z = FABS ((X - U2) - X * X) - U1; + TstCond (Failure, (Y <= Zero) + && (Z <= Zero), "* gets too many final digits wrong.\n"); + Y = One - U2; + X = One + U2; + Z = One / Y; + Y = Z - X; + X = One / Three; + Z = Three / Nine; + X = X - Z; + T = Nine / TwentySeven; + Z = Z - T; + TstCond (Defect, X == Zero && Y == Zero && Z == Zero, + "Division lacks a Guard Digit, so error can exceed 1 ulp\n\ +or 1/3 and 3/9 and 9/27 may disagree"); + Y = F9 / One; + X = F9 - Half; + Y = (Y - Half) - X; + X = One + U2; + T = X / One; + X = T - X; + if ((X == Zero) && (Y == Zero) && (Z == Zero)) + GDiv = Yes; + else { + GDiv = No; + TstCond (Serious, False, + "Division lacks a Guard Digit, so X/1 != X"); + } + X = One / (One + U2); + Y = X - Half - Half; + TstCond (Serious, Y < Zero, + "Computed value of 1/1.000..1 >= 1"); + X = One - U2; + Y = One + Radix * U2; + Z = X * Radix; + T = Y * Radix; + R = Z / Radix; + StickyBit = T / Radix; + X = R - X; + Y = StickyBit - Y; + TstCond (Failure, X == Zero && Y == Zero, + "* and/or / gets too many last digits wrong"); + Y = One - U1; + X = One - F9; + Y = One - Y; + T = Radix - U2; + Z = Radix - BMinusU2; + T = Radix - T; + if ((X == U1) && (Y == U1) && (Z == U2) && (T == U2)) + GAddSub = Yes; + else { + GAddSub = No; + TstCond (Serious, False, + "- lacks Guard Digit, so cancellation is obscured"); + } + if (F9 != One && F9 - One >= Zero) { + BadCond (Serious, "comparison alleges (1-U1) < 1 although\n"); + printf (" subtraction yields (1-U1) - 1 = 0 , thereby vitiating\n"); + printf (" such precautions against division by zero as\n"); + printf (" ... if (X == 1.0) {.....} else {.../(X-1.0)...}\n"); + } + if (GMult == Yes && GDiv == Yes && GAddSub == Yes) + printf ( + " *, /, and - appear to have guard digits, as they should.\n"); + /*=============================================*/ + Milestone = 40; + /*=============================================*/ + Pause (); + printf ("Checking rounding on multiply, divide and add/subtract.\n"); + RMult = Other; + RDiv = Other; + RAddSub = Other; + RadixD2 = Radix / Two; + A1 = Two; + Done = False; + do { + AInvrse = Radix; + do { + X = AInvrse; + AInvrse = AInvrse / A1; + } + while (!(FLOOR (AInvrse) != AInvrse)); + Done = (X == One) || (A1 > Three); + if (!Done) + A1 = Nine + One; + } + while (!(Done)); + if (X == One) + A1 = Radix; + AInvrse = One / A1; + X = A1; + Y = AInvrse; + Done = False; + do { + Z = X * Y - Half; + TstCond (Failure, Z == Half, + "X * (1/X) differs from 1"); + Done = X == Radix; + X = Radix; + Y = One / X; + } + while (!(Done)); + Y2 = One + U2; + Y1 = One - U2; + X = OneAndHalf - U2; + Y = OneAndHalf + U2; + Z = (X - U2) * Y2; + T = Y * Y1; + Z = Z - X; + T = T - X; + X = X * Y2; + Y = (Y + U2) * Y1; + X = X - OneAndHalf; + Y = Y - OneAndHalf; + if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T <= Zero)) { + X = (OneAndHalf + U2) * Y2; + Y = OneAndHalf - U2 - U2; + Z = OneAndHalf + U2 + U2; + T = (OneAndHalf - U2) * Y1; + X = X - (Z + U2); + StickyBit = Y * Y1; + S = Z * Y2; + T = T - Y; + Y = (U2 - Y) + StickyBit; + Z = S - (Z + U2 + U2); + StickyBit = (Y2 + U2) * Y1; + Y1 = Y2 * Y1; + StickyBit = StickyBit - Y2; + Y1 = Y1 - Half; + if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero) + && (StickyBit == Zero) && (Y1 == Half)) { + RMult = Rounded; + printf ("Multiplication appears to round correctly.\n"); + } else if ((X + U2 == Zero) && (Y < Zero) && (Z + U2 == Zero) + && (T < Zero) && (StickyBit + U2 == Zero) + && (Y1 < Half)) { + RMult = Chopped; + printf ("Multiplication appears to chop.\n"); + } else + printf ("* is neither chopped nor correctly rounded.\n"); + if ((RMult == Rounded) && (GMult == No)) + notify ("Multiplication"); + } else + printf ("* is neither chopped nor correctly rounded.\n"); + /*=============================================*/ + Milestone = 45; + /*=============================================*/ + Y2 = One + U2; + Y1 = One - U2; + Z = OneAndHalf + U2 + U2; + X = Z / Y2; + T = OneAndHalf - U2 - U2; + Y = (T - U2) / Y1; + Z = (Z + U2) / Y2; + X = X - OneAndHalf; + Y = Y - T; + T = T / Y1; + Z = Z - (OneAndHalf + U2); + T = (U2 - OneAndHalf) + T; + if (!((X > Zero) || (Y > Zero) || (Z > Zero) || (T > Zero))) { + X = OneAndHalf / Y2; + Y = OneAndHalf - U2; + Z = OneAndHalf + U2; + X = X - Y; + T = OneAndHalf / Y1; + Y = Y / Y1; + T = T - (Z + U2); + Y = Y - Z; + Z = Z / Y2; + Y1 = (Y2 + U2) / Y2; + Z = Z - OneAndHalf; + Y2 = Y1 - Y2; + Y1 = (F9 - U1) / F9; + if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero) + && (Y2 == Zero) && (Y2 == Zero) + && (Y1 - Half == F9 - Half)) { + RDiv = Rounded; + printf ("Division appears to round correctly.\n"); + if (GDiv == No) + notify ("Division"); + } else if ((X < Zero) && (Y < Zero) && (Z < Zero) && (T < Zero) + && (Y2 < Zero) && (Y1 - Half < F9 - Half)) { + RDiv = Chopped; + printf ("Division appears to chop.\n"); + } + } + if (RDiv == Other) + printf ("/ is neither chopped nor correctly rounded.\n"); + BInvrse = One / Radix; + TstCond (Failure, (BInvrse * Radix - Half == Half), + "Radix * ( 1 / Radix ) differs from 1"); + /*=============================================*/ + Milestone = 50; + /*=============================================*/ + TstCond (Failure, ((F9 + U1) - Half == Half) + && ((BMinusU2 + U2) - One == Radix - One), + "Incomplete carry-propagation in Addition"); + X = One - U1 * U1; + Y = One + U2 * (One - U2); + Z = F9 - Half; + X = (X - Half) - Z; + Y = Y - One; + if ((X == Zero) && (Y == Zero)) { + RAddSub = Chopped; + printf ("Add/Subtract appears to be chopped.\n"); + } + if (GAddSub == Yes) { + X = (Half + U2) * U2; + Y = (Half - U2) * U2; + X = One + X; + Y = One + Y; + X = (One + U2) - X; + Y = One - Y; + if ((X == Zero) && (Y == Zero)) { + X = (Half + U2) * U1; + Y = (Half - U2) * U1; + X = One - X; + Y = One - Y; + X = F9 - X; + Y = One - Y; + if ((X == Zero) && (Y == Zero)) { + RAddSub = Rounded; + printf ("Addition/Subtraction appears to round correctly.\n"); + if (GAddSub == No) + notify ("Add/Subtract"); + } else + printf ("Addition/Subtraction neither rounds nor chops.\n"); + } else + printf ("Addition/Subtraction neither rounds nor chops.\n"); + } else + printf ("Addition/Subtraction neither rounds nor chops.\n"); + S = One; + X = One + Half * (One + Half); + Y = (One + U2) * Half; + Z = X - Y; + T = Y - X; + StickyBit = Z + T; + if (StickyBit != Zero) { + S = Zero; + BadCond (Flaw, "(X - Y) + (Y - X) is non zero!\n"); + } + StickyBit = Zero; + if ((GMult == Yes) && (GDiv == Yes) && (GAddSub == Yes) + && (RMult == Rounded) && (RDiv == Rounded) + && (RAddSub == Rounded) && (FLOOR (RadixD2) == RadixD2)) { + printf ("Checking for sticky bit.\n"); + X = (Half + U1) * U2; + Y = Half * U2; + Z = One + Y; + T = One + X; + if ((Z - One <= Zero) && (T - One >= U2)) { + Z = T + Y; + Y = Z - X; + if ((Z - T >= U2) && (Y - T == Zero)) { + X = (Half + U1) * U1; + Y = Half * U1; + Z = One - Y; + T = One - X; + if ((Z - One == Zero) && (T - F9 == Zero)) { + Z = (Half - U1) * U1; + T = F9 - Z; + Q = F9 - Y; + if ((T - F9 == Zero) && (F9 - U1 - Q == Zero)) { + Z = (One + U2) * OneAndHalf; + T = (OneAndHalf + U2) - Z + U2; + X = One + Half / Radix; + Y = One + Radix * U2; + Z = X * Y; + if (T == Zero && X + Radix * U2 - Z == Zero) { + if (Radix != Two) { + X = Two + U2; + Y = X / Two; + if ((Y - One == Zero)) + StickyBit = S; + } else + StickyBit = S; + } + } + } + } + } + } + if (StickyBit == One) + printf ("Sticky bit apparently used correctly.\n"); + else + printf ("Sticky bit used incorrectly or not at all.\n"); + TstCond (Flaw, !(GMult == No || GDiv == No || GAddSub == No || + RMult == Other || RDiv == Other || RAddSub == Other), + "lack(s) of guard digits or failure(s) to correctly round or chop\n\ +(noted above) count as one flaw in the final tally below"); + /*=============================================*/ + Milestone = 60; + /*=============================================*/ + printf ("\n"); + printf ("Does Multiplication commute? "); + printf ("Testing on %d random pairs.\n", NoTrials); + Random9 = SQRT (3.0); + Random1 = Third; + I = 1; + do { + X = Random (); + Y = Random (); + Z9 = Y * X; + Z = X * Y; + Z9 = Z - Z9; + I = I + 1; + } + while (!((I > NoTrials) || (Z9 != Zero))); + if (I == NoTrials) { + Random1 = One + Half / Three; + Random2 = (U2 + U1) + One; + Z = Random1 * Random2; + Y = Random2 * Random1; + Z9 = (One + Half / Three) * ((U2 + U1) + One) - (One + Half / + Three) * ((U2 + U1) + One); + } + if (!((I == NoTrials) || (Z9 == Zero))) + BadCond (Defect, "X * Y == Y * X trial fails.\n"); + else + printf (" No failures found in %d integer pairs.\n", NoTrials); + /*=============================================*/ + Milestone = 70; + /*=============================================*/ + printf ("\nRunning test of square root(x).\n"); + TstCond (Failure, (Zero == SQRT (Zero)) + && (-Zero == SQRT (-Zero)) + && (One == SQRT (One)), "Square root of 0.0, -0.0 or 1.0 wrong"); + MinSqEr = Zero; + MaxSqEr = Zero; + J = Zero; + X = Radix; + OneUlp = U2; + SqXMinX (Serious); + X = BInvrse; + OneUlp = BInvrse * U1; + SqXMinX (Serious); + X = U1; + OneUlp = U1 * U1; + SqXMinX (Serious); + if (J != Zero) + Pause (); + printf ("Testing if sqrt(X * X) == X for %d Integers X.\n", NoTrials); + J = Zero; + X = Two; + Y = Radix; + if ((Radix != One)) + do { + X = Y; + Y = Radix * Y; + } + while (!((Y - X >= NoTrials))); + OneUlp = X * U2; + I = 1; + while (I <= NoTrials) { + X = X + One; + SqXMinX (Defect); + if (J > Zero) + break; + I = I + 1; + } + printf ("Test for sqrt monotonicity.\n"); + I = -1; + X = BMinusU2; + Y = Radix; + Z = Radix + Radix * U2; + NotMonot = False; + Monot = False; + while (!(NotMonot || Monot)) { + I = I + 1; + X = SQRT (X); + Q = SQRT (Y); + Z = SQRT (Z); + if ((X > Q) || (Q > Z)) + NotMonot = True; + else { + Q = FLOOR (Q + Half); + if ((I > 0) || (Radix == Q * Q)) + Monot = True; + else if (I > 0) { + if (I > 1) + Monot = True; + else { + Y = Y * BInvrse; + X = Y - U1; + Z = Y + U1; + } + } else { + Y = Q; + X = Y - U2; + Z = Y + U2; + } + } + } + if (Monot) + printf ("sqrt has passed a test for Monotonicity.\n"); + else { + BadCond (Defect, ""); + printf ("sqrt(X) is non-monotonic for X near %.7e .\n", Y); + } + /*=============================================*/ + Milestone = 80; + /*=============================================*/ + MinSqEr = MinSqEr + Half; + MaxSqEr = MaxSqEr - Half; + Y = (SQRT (One + U2) - One) / U2; + SqEr = (Y - One) + U2 / Eight; + if (SqEr > MaxSqEr) + MaxSqEr = SqEr; + SqEr = Y + U2 / Eight; + if (SqEr < MinSqEr) + MinSqEr = SqEr; + Y = ((SQRT (F9) - U2) - (One - U2)) / U1; + SqEr = Y + U1 / Eight; + if (SqEr > MaxSqEr) + MaxSqEr = SqEr; + SqEr = (Y + One) + U1 / Eight; + if (SqEr < MinSqEr) + MinSqEr = SqEr; + OneUlp = U2; + X = OneUlp; + for (Indx = 1; Indx <= 3; ++Indx) { + Y = SQRT ((X + U1 + X) + F9); + Y = ((Y - U2) - ((One - U2) + X)) / OneUlp; + Z = ((U1 - X) + F9) * Half * X * X / OneUlp; + SqEr = (Y + Half) + Z; + if (SqEr < MinSqEr) + MinSqEr = SqEr; + SqEr = (Y - Half) + Z; + if (SqEr > MaxSqEr) + MaxSqEr = SqEr; + if (((Indx == 1) || (Indx == 3))) + X = OneUlp * Sign (X) * FLOOR (Eight / (Nine * SQRT (OneUlp))); + else { + OneUlp = U1; + X = -OneUlp; + } + } + /*=============================================*/ + Milestone = 85; + /*=============================================*/ + SqRWrng = False; + Anomaly = False; + RSqrt = Other; /* ~dgh */ + if (Radix != One) { + printf ("Testing whether sqrt is rounded or chopped.\n"); + D = FLOOR (Half + POW (Radix, One + Precision - FLOOR (Precision))); + /* ... == Radix^(1 + fract) if (Precision == Integer + fract. */ + X = D / Radix; + Y = D / A1; + if ((X != FLOOR (X)) || (Y != FLOOR (Y))) { + Anomaly = True; + } else { + X = Zero; + Z2 = X; + Y = One; + Y2 = Y; + Z1 = Radix - One; + FourD = Four * D; + do { + if (Y2 > Z2) { + Q = Radix; + Y1 = Y; + do { + X1 = FABS (Q + FLOOR (Half - Q / Y1) * Y1); + Q = Y1; + Y1 = X1; + } + while (!(X1 <= Zero)); + if (Q <= One) { + Z2 = Y2; + Z = Y; + } + } + Y = Y + Two; + X = X + Eight; + Y2 = Y2 + X; + if (Y2 >= FourD) + Y2 = Y2 - FourD; + } + while (!(Y >= D)); + X8 = FourD - Z2; + Q = (X8 + Z * Z) / FourD; + X8 = X8 / Eight; + if (Q != FLOOR (Q)) + Anomaly = True; + else { + Break = False; + do { + X = Z1 * Z; + X = X - FLOOR (X / Radix) * Radix; + if (X == One) + Break = True; + else + Z1 = Z1 - One; + } + while (!(Break || (Z1 <= Zero))); + if ((Z1 <= Zero) && (!Break)) + Anomaly = True; + else { + if (Z1 > RadixD2) + Z1 = Z1 - Radix; + do { + NewD (); + } + while (!(U2 * D >= F9)); + if (D * Radix - D != W - D) + Anomaly = True; + else { + Z2 = D; + I = 0; + Y = D + (One + Z) * Half; + X = D + Z + Q; + SR3750 (); + Y = D + (One - Z) * Half + D; + X = D - Z + D; + X = X + Q + X; + SR3750 (); + NewD (); + if (D - Z2 != W - Z2) + Anomaly = True; + else { + Y = (D - Z2) + (Z2 + (One - Z) * Half); + X = (D - Z2) + (Z2 - Z + Q); + SR3750 (); + Y = (One + Z) * Half; + X = Q; + SR3750 (); + if (I == 0) + Anomaly = True; + } + } + } + } + } + if ((I == 0) || Anomaly) { + BadCond (Failure, "Anomalous arithmetic with Integer < "); + printf ("Radix^Precision = %.7e\n", W); + printf (" fails test whether sqrt rounds or chops.\n"); + SqRWrng = True; + } + } + if (!Anomaly) { + if (!((MinSqEr < Zero) || (MaxSqEr > Zero))) { + RSqrt = Rounded; + printf ("Square root appears to be correctly rounded.\n"); + } else { + if ((MaxSqEr + U2 > U2 - Half) || (MinSqEr > Half) + || (MinSqEr + Radix < Half)) + SqRWrng = True; + else { + RSqrt = Chopped; + printf ("Square root appears to be chopped.\n"); + } + } + } + if (SqRWrng) { + printf ("Square root is neither chopped nor correctly rounded.\n"); + printf ("Observed errors run from %.7e ", MinSqEr - Half); + printf ("to %.7e ulps.\n", Half + MaxSqEr); + TstCond (Serious, MaxSqEr - MinSqEr < Radix * Radix, + "sqrt gets too many last digits wrong"); + } + /*=============================================*/ + Milestone = 90; + /*=============================================*/ + Pause (); + printf ("Testing powers Z^i for small Integers Z and i.\n"); + N = 0; + /* ... test powers of zero. */ + I = 0; + Z = -Zero; + M = 3; + Break = False; + do { + X = One; + SR3980 (); + if (I <= 10) { + I = 1023; + SR3980 (); + } + if (Z == MinusOne) + Break = True; + else { + Z = MinusOne; + /* .. if(-1)^N is invalid, replace MinusOne by One. */ + I = -4; + } + } + while (!Break); + PrintIfNPositive (); + N1 = N; + N = 0; + Z = A1; + M = (int) FLOOR (Two * LOG (W) / LOG (A1)); + Break = False; + do { + X = Z; + I = 1; + SR3980 (); + if (Z == AInvrse) + Break = True; + else + Z = AInvrse; + } + while (!(Break)); + /*=============================================*/ + Milestone = 100; + /*=============================================*/ + /* Powers of Radix have been tested, */ + /* next try a few primes */ + M = NoTrials; + Z = Three; + do { + X = Z; + I = 1; + SR3980 (); + do { + Z = Z + Two; + } + while (Three * FLOOR (Z / Three) == Z); + } + while (Z < Eight * Three); + if (N > 0) { + printf ("Errors like this may invalidate financial calculations\n"); + printf ("\tinvolving interest rates.\n"); + } + PrintIfNPositive (); + N += N1; + if (N == 0) + printf ("... no discrepancies found.\n"); + if (N > 0) + Pause (); + else + printf ("\n"); + /*=============================================*/ + Milestone = 110; + /*=============================================*/ + printf ("Seeking Underflow thresholds UfThold and E0.\n"); + D = U1; + if (Precision != FLOOR (Precision)) { + D = BInvrse; + X = Precision; + do { + D = D * BInvrse; + X = X - One; + } + while (X > Zero); + } + Y = One; + Z = D; + /* ... D is power of 1/Radix < 1. */ + do { + C = Y; + Y = Z; + Z = Y * Y; + } + while ((Y > Z) && (Z + Z > Z)); + Y = C; + Z = Y * D; + do { + C = Y; + Y = Z; + Z = Y * D; + } + while ((Y > Z) && (Z + Z > Z)); + if (Radix < Two) + HInvrse = Two; + else + HInvrse = Radix; + H = One / HInvrse; + /* ... 1/HInvrse == H == Min(1/Radix, 1/2) */ + CInvrse = One / C; + E0 = C; + Z = E0 * H; + /* ...1/Radix^(BIG Integer) << 1 << CInvrse == 1/C */ + do { + Y = E0; + E0 = Z; + Z = E0 * H; + } + while ((E0 > Z) && (Z + Z > Z)); + UfThold = E0; + E1 = Zero; + Q = Zero; + E9 = U2; + S = One + E9; + D = C * S; + if (D <= C) { + E9 = Radix * U2; + S = One + E9; + D = C * S; + if (D <= C) { + BadCond (Failure, "multiplication gets too many last digits wrong.\n"); + Underflow = E0; + Y1 = Zero; + PseudoZero = Z; + Pause (); + } + } else { + Underflow = D; + PseudoZero = Underflow * H; + UfThold = Zero; + do { + Y1 = Underflow; + Underflow = PseudoZero; + if (E1 + E1 <= E1) { + Y2 = Underflow * HInvrse; + E1 = FABS (Y1 - Y2); + Q = Y1; + if ((UfThold == Zero) && (Y1 != Y2)) + UfThold = Y1; + } + PseudoZero = PseudoZero * H; + } + while ((Underflow > PseudoZero) + && (PseudoZero + PseudoZero > PseudoZero)); + } + /* Comment line 4530 .. 4560 */ + if (PseudoZero != Zero) { + printf ("\n"); + Z = PseudoZero; + /* ... Test PseudoZero for "phoney- zero" violates */ + /* ... PseudoZero < Underflow or PseudoZero < PseudoZero + PseudoZero + ... */ + if (PseudoZero <= Zero) { + BadCond (Failure, "Positive expressions can underflow to an\n"); + printf ("allegedly negative value\n"); + printf ("PseudoZero that prints out as: %g .\n", PseudoZero); + X = -PseudoZero; + if (X <= Zero) { + printf ("But -PseudoZero, which should be\n"); + printf ("positive, isn't; it prints out as %g .\n", X); + } + } else { + BadCond (Flaw, "Underflow can stick at an allegedly positive\n"); + printf ("value PseudoZero that prints out as %g .\n", PseudoZero); + } + TstPtUf (); + } + /*=============================================*/ + Milestone = 120; + /*=============================================*/ + if (CInvrse * Y > CInvrse * Y1) { + S = H * S; + E0 = Underflow; + } + if (!((E1 == Zero) || (E1 == E0))) { + BadCond (Defect, ""); + if (E1 < E0) { + printf ("Products underflow at a higher"); + printf (" threshold than differences.\n"); + if (PseudoZero == Zero) + E0 = E1; + } else { + printf ("Difference underflows at a higher"); + printf (" threshold than products.\n"); + } + } + printf ("Smallest strictly positive number found is E0 = %g .\n", E0); + Z = E0; + TstPtUf (); + Underflow = E0; + if (N == 1) + Underflow = Y; + I = 4; + if (E1 == Zero) + I = 3; + if (UfThold == Zero) + I = I - 2; + UfNGrad = True; + switch (I) { + case 1: + UfThold = Underflow; + if ((CInvrse * Q) != ((CInvrse * Y) * S)) { + UfThold = Y; + BadCond (Failure, "Either accuracy deteriorates as numbers\n"); + printf ("approach a threshold = %.17e\n", UfThold);; + printf (" coming down from %.17e\n", C); + printf (" or else multiplication gets too many last digits wrong.\n"); + } + Pause (); + break; + + case 2: + BadCond (Failure, "Underflow confuses Comparison, which alleges that\n"); + printf ("Q == Y while denying that |Q - Y| == 0; these values\n"); + printf ("print out as Q = %.17e, Y = %.17e .\n", Q, Y2); + printf ("|Q - Y| = %.17e .\n", FABS (Q - Y2)); + UfThold = Q; + break; + + case 3: + X = X; + break; + + case 4: + if ((Q == UfThold) && (E1 == E0) + && (FABS (UfThold - E1 / E9) <= E1)) { + UfNGrad = False; + printf ("Underflow is gradual; it incurs Absolute Error =\n"); + printf ("(roundoff in UfThold) < E0.\n"); + Y = E0 * CInvrse; + Y = Y * (OneAndHalf + U2); + X = CInvrse * (One + U2); + Y = Y / X; + IEEE = (Y == E0); + } + } + if (UfNGrad) { + printf ("\n"); + sigsave = _sigfpe; + if (setjmp (ovfl_buf)) { + printf ("Underflow / UfThold failed!\n"); + R = H + H; + } else + R = SQRT (Underflow / UfThold); + sigsave = 0; + if (R <= H) { + Z = R * UfThold; + X = Z * (One + R * H * (One + H)); + } else { + Z = UfThold; + X = Z * (One + H * H * (One + H)); + } + if (!((X == Z) || (X - Z != Zero))) { + BadCond (Flaw, ""); + printf ("X = %.17e\n\tis not equal to Z = %.17e .\n", X, Z); + Z9 = X - Z; + printf ("yet X - Z yields %.17e .\n", Z9); + printf (" Should this NOT signal Underflow, "); + printf ("this is a SERIOUS DEFECT\nthat causes "); + printf ("confusion when innocent statements like\n");; + printf (" if (X == Z) ... else"); + printf (" ... (f(X) - f(Z)) / (X - Z) ...\n"); + printf ("encounter Division by Zero although actually\n"); + sigsave = _sigfpe; + if (setjmp (ovfl_buf)) + printf ("X / Z fails!\n"); + else + printf ("X / Z = 1 + %g .\n", (X / Z - Half) - Half); + sigsave = 0; + } + } + printf ("The Underflow threshold is %.17e, %s\n", UfThold, + " below which"); + printf ("calculation may suffer larger Relative error than "); + printf ("merely roundoff.\n"); + Y2 = U1 * U1; + Y = Y2 * Y2; + Y2 = Y * U1; + if (Y2 <= UfThold) { + if (Y > E0) { + BadCond (Defect, ""); + I = 5; + } else { + BadCond (Serious, ""); + I = 4; + } + printf ("Range is too narrow; U1^%d Underflows.\n", I); + } + /*=============================================*/ + Milestone = 130; + /*=============================================*/ + Y = -FLOOR (Half - TwoForty * LOG (UfThold) / LOG (HInvrse)) / TwoForty; + Y2 = Y + Y; + printf ("Since underflow occurs below the threshold\n"); + printf ("UfThold = (%.17e) ^ (%.17e)\nonly underflow ", HInvrse, Y); + printf ("should afflict the expression\n\t(%.17e) ^ (%.17e);\n", + HInvrse, Y2); + printf ("actually calculating yields:"); + if (setjmp (ovfl_buf)) { + sigsave = 0; + BadCond (Serious, "trap on underflow.\n"); + } else { + sigsave = _sigfpe; + V9 = POW (HInvrse, Y2); + sigsave = 0; + printf (" %.17e .\n", V9); + if (!((V9 >= Zero) && (V9 <= (Radix + Radix + E9) * UfThold))) { + BadCond (Serious, "this is not between 0 and underflow\n"); + printf (" threshold = %.17e .\n", UfThold); + } else if (!(V9 > UfThold * (One + E9))) + printf ("This computed value is O.K.\n"); + else { + BadCond (Defect, "this is not between 0 and underflow\n"); + printf (" threshold = %.17e .\n", UfThold); + } + } + /*=============================================*/ + Milestone = 140; + /*=============================================*/ + printf ("\n"); + /* ...calculate Exp2 == exp(2) == 7.389056099... */ + X = Zero; + I = 2; + Y = Two * Three; + Q = Zero; + N = 0; + do { + Z = X; + I = I + 1; + Y = Y / (I + I); + R = Y + Q; + X = Z + R; + Q = (Z - X) + R; + } + while (X > Z); + Z = (OneAndHalf + One / Eight) + X / (OneAndHalf * ThirtyTwo); + X = Z * Z; + Exp2 = X * X; + X = F9; + Y = X - U1; + printf ("Testing X^((X + 1) / (X - 1)) vs. exp(2) = %.17e as X -> 1.\n", + Exp2); + for (I = 1;;) { + Z = X - BInvrse; + Z = (X + One) / (Z - (One - BInvrse)); + Q = POW (X, Z) - Exp2; + if (FABS (Q) > TwoForty * U2) { + N = 1; + V9 = (X - BInvrse) - (One - BInvrse); + BadCond (Defect, "Calculated"); + printf (" %.17e for\n", POW (X, Z)); + printf ("\t(1 + (%.17e) ^ (%.17e);\n", V9, Z); + printf ("\tdiffers from correct value by %.17e .\n", Q); + printf ("\tThis much error may spoil financial\n"); + printf ("\tcalculations involving tiny interest rates.\n"); + break; + } else { + Z = (Y - X) * Two + Y; + X = Y; + Y = Z; + Z = One + (X - F9) * (X - F9); + if (Z > One && I < NoTrials) + I++; + else { + if (X > One) { + if (N == 0) + printf ("Accuracy seems adequate.\n"); + break; + } else { + X = One + U2; + Y = U2 + U2; + Y += X; + I = 1; + } + } + } + } + /*=============================================*/ + Milestone = 150; + /*=============================================*/ + printf ("Testing powers Z^Q at four nearly extreme values.\n"); + N = 0; + Z = A1; + Q = FLOOR (Half - LOG (C) / LOG (A1)); + Break = False; + do { + X = CInvrse; + Y = POW (Z, Q); + IsYeqX (); + Q = -Q; + X = C; + Y = POW (Z, Q); + IsYeqX (); + if (Z < One) + Break = True; + else + Z = AInvrse; + } + while (!(Break)); + PrintIfNPositive (); + if (N == 0) + printf (" ... no discrepancies found.\n"); + printf ("\n"); + + /*=============================================*/ + Milestone = 160; + /*=============================================*/ + Pause (); + printf ("Searching for Overflow threshold:\n"); + printf ("This may generate an error.\n"); + Y = -CInvrse; + V9 = HInvrse * Y; + sigsave = _sigfpe; + if (setjmp (ovfl_buf)) { + I = 0; + V9 = Y; + goto overflow; + } + do { + V = Y; + Y = V9; + V9 = HInvrse * Y; + } + while (V9 < Y); + I = 1; + overflow: + sigsave = 0; + Z = V9; + printf ("Can `Z = -Y' overflow?\n"); + printf ("Trying it on Y = %.17e .\n", Y); + V9 = -Y; + V0 = V9; + if (V - Y == V + V0) + printf ("Seems O.K.\n"); + else { + printf ("finds a "); + BadCond (Flaw, "-(-Y) differs from Y.\n"); + } + if (Z != Y) { + BadCond (Serious, ""); + printf ("overflow past %.17e\n\tshrinks to %.17e .\n", Y, Z); + } + if (I) { + Y = V * (HInvrse * U2 - HInvrse); + Z = Y + ((One - HInvrse) * U2) * V; + if (Z < V0) + Y = Z; + if (Y < V0) + V = Y; + if (V0 - V < V0) + V = V0; + } else { + V = Y * (HInvrse * U2 - HInvrse); + V = V + ((One - HInvrse) * U2) * Y; + } + printf ("Overflow threshold is V = %.17e .\n", V); + if (I) + printf ("Overflow saturates at V0 = %.17e .\n", V0); + else + printf ("There is no saturation value because \ +the system traps on overflow.\n"); + V9 = V * One; + printf ("No Overflow should be signaled for V * 1 = %.17e\n", V9); + V9 = V / One; + printf (" nor for V / 1 = %.17e .\n", V9); + printf ("Any overflow signal separating this * from the one\n"); + printf ("above is a DEFECT.\n"); + /*=============================================*/ + Milestone = 170; + /*=============================================*/ + if (!(-V < V && -V0 < V0 && -UfThold < V && UfThold < V)) { + BadCond (Failure, "Comparisons involving "); + printf ("+-%g, +-%g\nand +-%g are confused by Overflow.", + V, V0, UfThold); + } + /*=============================================*/ + Milestone = 175; + /*=============================================*/ + printf ("\n"); + for (Indx = 1; Indx <= 3; ++Indx) { + switch (Indx) { + case 1: + Z = UfThold; + break; + case 2: + Z = E0; + break; + case 3: + Z = PseudoZero; + break; + } + if (Z != Zero) { + V9 = SQRT (Z); + Y = V9 * V9; + if (Y / (One - Radix * E9) < Z + || Y > (One + Radix * E9) * Z) { /* dgh: + E9 --> * E9 */ + if (V9 > U1) + BadCond (Serious, ""); + else + BadCond (Defect, ""); + printf ("Comparison alleges that what prints as Z = %.17e\n", Z); + printf (" is too far from sqrt(Z) ^ 2 = %.17e .\n", Y); + } + } + } + /*=============================================*/ + Milestone = 180; + /*=============================================*/ + for (Indx = 1; Indx <= 2; ++Indx) { + if (Indx == 1) + Z = V; + else + Z = V0; + V9 = SQRT (Z); + X = (One - Radix * E9) * V9; + V9 = V9 * X; + if (((V9 < (One - Two * Radix * E9) * Z) || (V9 > Z))) { + Y = V9; + if (X < W) + BadCond (Serious, ""); + else + BadCond (Defect, ""); + printf ("Comparison alleges that Z = %17e\n", Z); + printf (" is too far from sqrt(Z) ^ 2 (%.17e) .\n", Y); + } + } + /*=============================================*/ + Milestone = 190; + /*=============================================*/ + Pause (); + X = UfThold * V; + Y = Radix * Radix; + if (X * Y < One || X > Y) { + if (X * Y < U1 || X > Y / U1) + BadCond (Defect, "Badly"); + else + BadCond (Flaw, ""); + + printf (" unbalanced range; UfThold * V = %.17e\n\t%s\n", + X, "is too far from 1.\n"); + } + /*=============================================*/ + Milestone = 200; + /*=============================================*/ + for (Indx = 1; Indx <= 5; ++Indx) { + X = F9; + switch (Indx) { + case 2: + X = One + U2; + break; + case 3: + X = V; + break; + case 4: + X = UfThold; + break; + case 5: + X = Radix; + } + Y = X; + sigsave = _sigfpe; + if (setjmp (ovfl_buf)) + printf (" X / X traps when X = %g\n", X); + else { + V9 = (Y / X - Half) - Half; + if (V9 == Zero) + continue; + if (V9 == -U1 && Indx < 5) + BadCond (Flaw, ""); + else + BadCond (Serious, ""); + printf (" X / X differs from 1 when X = %.17e\n", X); + printf (" instead, X / X - 1/2 - 1/2 = %.17e .\n", V9); + } + sigsave = 0; + } + /*=============================================*/ + Milestone = 210; + /*=============================================*/ + MyZero = Zero; + printf ("\n"); + printf ("What message and/or values does Division by Zero produce?\n"); +#ifndef BATCHMODE + printf ("This can interupt your program. You can "); + printf ("skip this part if you wish.\n"); + printf ("Do you wish to compute 1 / 0? "); + fflush (stdout); + read (KEYBOARD, ch, 8); + if ((ch[0] == 'Y') || (ch[0] == 'y')) { +#endif /* !BATCHMODE */ + sigsave = _sigfpe; + printf (" Trying to compute 1 / 0 produces ..."); + if (!setjmp (ovfl_buf)) + printf (" %.7e .\n", One / MyZero); + sigsave = 0; +#ifndef BATCHMODE + } else + printf ("O.K.\n"); + printf ("\nDo you wish to compute 0 / 0? "); + fflush (stdout); + read (KEYBOARD, ch, 80); + if ((ch[0] == 'Y') || (ch[0] == 'y')) { +#endif /* !BATCHMODE */ + sigsave = _sigfpe; + printf ("\n Trying to compute 0 / 0 produces ..."); + if (!setjmp (ovfl_buf)) + printf (" %.7e .\n", Zero / MyZero); + sigsave = 0; +#ifndef BATCHMODE + } else + printf ("O.K.\n"); +#endif /* !BATCHMODE */ + /*=============================================*/ + Milestone = 220; + /*=============================================*/ + + Pause (); + printf ("\n"); + { + static char *msg[] = + { + "FAILUREs encountered =", + "SERIOUS DEFECTs discovered =", + "DEFECTs discovered =", + "FLAWs discovered ="}; + int i; + for (i = 0; i < 4; i++) + if (ErrCnt[i]) + printf ("The number of %-29s %d.\n", + msg[i], ErrCnt[i]); + } + + printf ("\n"); + if ((ErrCnt[Failure] + ErrCnt[Serious] + ErrCnt[Defect] + + ErrCnt[Flaw]) > 0) { + if ((ErrCnt[Failure] + ErrCnt[Serious] + ErrCnt[ + Defect] == 0) && (ErrCnt[Flaw] > 0)) { + printf ("The arithmetic diagnosed seems "); + printf ("Satisfactory though flawed.\n"); + } + if ((ErrCnt[Failure] + ErrCnt[Serious] == 0) + && (ErrCnt[Defect] > 0)) { + printf ("The arithmetic diagnosed may be Acceptable\n"); + printf ("despite inconvenient Defects.\n"); + } + if ((ErrCnt[Failure] + ErrCnt[Serious]) > 0) { + printf ("The arithmetic diagnosed has "); + printf ("unacceptable Serious Defects.\n"); + } + if (ErrCnt[Failure] > 0) { + printf ("Potentially fatal FAILURE may have spoiled this"); + printf (" program's subsequent diagnoses.\n"); + } + } else { + + printf ("No failures, defects nor flaws have been discovered.\n"); + if (!((RMult == Rounded) && (RDiv == Rounded) + && (RAddSub == Rounded) && (RSqrt == Rounded))) + printf ("The arithmetic diagnosed seems Satisfactory.\n"); + else { + if (StickyBit >= One && + (Radix - Two) * (Radix - Nine - One) == Zero) { + printf ("Rounding appears to conform to "); + printf ("the proposed IEEE standard P"); + if ((Radix == Two) && + ((Precision - Four * Three * Two) * + (Precision - TwentySeven - + TwentySeven + One) == Zero)) + printf ("754"); + else + printf ("854"); + if (IEEE) + printf (".\n"); + else { + printf (",\nexcept for possibly Double Rounding"); + printf (" during Gradual Underflow.\n"); + } + } + printf ("The arithmetic diagnosed appears to be Excellent!\n"); + } + } + + if (fpecount) + printf ("\nA total of %d floating point exceptions were registered.\n", + fpecount); + printf ("END OF TEST.\n"); + return 0; +} + +FLOAT +Sign (X) + FLOAT X; +{ + return X >= 0. ? 1.0 : -1.0; +} + +void +Pause () +{ +#ifndef BATCHMODE + char ch[8]; + + printf ("\nTo continue, press RETURN"); + fflush (stdout); + read (KEYBOARD, ch, 8); +#endif /* !BATCHMODE */ +#ifndef CYGNUS + printf ("\nDiagnosis resumes after milestone Number %d", Milestone); + printf (" Page: %d\n\n", PageNo); + ++Milestone; + ++PageNo; +#endif /* !CYGNUS */ +} + +void +TstCond (K, Valid, T) + int K, Valid; + char *T; +{ +#ifdef CYGNUS + printf ("TEST: %s\n", T); +#endif /* CYGNUS */ + if (!Valid) { + BadCond (K, T); + printf (".\n"); + } +#ifdef CYGNUS + printf ("PASS: %s\n", T); +#endif /* CYGNUS */ +} + +void +BadCond (K, T) + int K; + char *T; +{ + static char *msg[] = + {"FAILURE", "SERIOUS DEFECT", "DEFECT", "FLAW"}; + + ErrCnt[K] = ErrCnt[K] + 1; +#ifndef CYGNUS + printf ("%s: %s", msg[K], T); +#else + printf ("ERROR: Severity: %s: %s", msg[K], T); +#endif /* CYGNUS */ +} + +/* + * Random computes + * X = (Random1 + Random9)^5 + * Random1 = X - FLOOR(X) + 0.000005 * X; + * and returns the new value of Random1 +*/ +FLOAT +Random () +{ + FLOAT X, Y; + + X = Random1 + Random9; + Y = X * X; + Y = Y * Y; + X = X * Y; + Y = X - FLOOR (X); + Random1 = Y + X * 0.000005; + return (Random1); +} + +void +SqXMinX (ErrKind) + int ErrKind; +{ + FLOAT XA, XB; + + XB = X * BInvrse; + XA = X - XB; + SqEr = ((SQRT (X * X) - XB) - XA) / OneUlp; + if (SqEr != Zero) { + if (SqEr < MinSqEr) + MinSqEr = SqEr; + if (SqEr > MaxSqEr) + MaxSqEr = SqEr; + J = J + 1.0; + BadCond (ErrKind, "\n"); + printf ("sqrt( %.17e) - %.17e = %.17e\n", X * X, X, OneUlp * SqEr); + printf ("\tinstead of correct value 0 .\n"); + } +} + +void +NewD () +{ + X = Z1 * Q; + X = FLOOR (Half - X / Radix) * Radix + X; + Q = (Q - X * Z) / Radix + X * X * (D / Radix); + Z = Z - Two * X * D; + if (Z <= Zero) { + Z = -Z; + Z1 = -Z1; + } + D = Radix * D; +} + +void +SR3750 () +{ + if (!((X - Radix < Z2 - Radix) || (X - Z2 > W - Z2))) { + I = I + 1; + X2 = SQRT (X * D); + Y2 = (X2 - Z2) - (Y - Z2); + X2 = X8 / (Y - Half); + X2 = X2 - Half * X2 * X2; + SqEr = (Y2 + Half) + (Half - X2); + if (SqEr < MinSqEr) + MinSqEr = SqEr; + SqEr = Y2 - X2; + if (SqEr > MaxSqEr) + MaxSqEr = SqEr; + } +} + +void +IsYeqX () +{ + if (Y != X) { + if (N <= 0) { + if (Z == Zero && Q <= Zero) + printf ("WARNING: computing\n"); + else + BadCond (Defect, "computing\n"); + printf ("\t(%.17e) ^ (%.17e)\n", Z, Q); + printf ("\tyielded %.17e;\n", Y); + printf ("\twhich compared unequal to correct %.17e ;\n", + X); + printf ("\t\tthey differ by %.17e .\n", Y - X); + } + N = N + 1; /* ... count discrepancies. */ + } +} + +void +SR3980 () +{ + do { + Q = (FLOAT) I; + Y = POW (Z, Q); + IsYeqX (); + if (++I > M) + break; + X = Z * X; + } + while (X < W); +} + +void +PrintIfNPositive () +{ + if (N > 0) + printf ("Similar discrepancies have occurred %d times.\n", N); +} + +void +TstPtUf () +{ + N = 0; + if (Z != Zero) { + printf ("Since comparison denies Z = 0, evaluating "); + printf ("(Z + Z) / Z should be safe.\n"); + sigsave = _sigfpe; + if (setjmp (ovfl_buf)) + goto very_serious; + Q9 = (Z + Z) / Z; + printf ("What the machine gets for (Z + Z) / Z is %.17e .\n", + Q9); + if (FABS (Q9 - Two) < Radix * U2) { + printf ("This is O.K., provided Over/Underflow"); + printf (" has NOT just been signaled.\n"); + } else { + if ((Q9 < One) || (Q9 > Two)) { + very_serious: + N = 1; + ErrCnt[Serious] = ErrCnt[Serious] + 1; + printf ("This is a VERY SERIOUS DEFECT!\n"); + } else { + N = 1; + ErrCnt[Defect] = ErrCnt[Defect] + 1; + printf ("This is a DEFECT!\n"); + } + } + sigsave = 0; + V9 = Z * One; + Random1 = V9; + V9 = One * Z; + Random2 = V9; + V9 = Z / One; + if ((Z == Random1) && (Z == Random2) && (Z == V9)) { + if (N > 0) + Pause (); + } else { + N = 1; + BadCond (Defect, "What prints as Z = "); + printf ("%.17e\n\tcompares different from ", Z); + if (Z != Random1) + printf ("Z * 1 = %.17e ", Random1); + if (!((Z == Random2) + || (Random2 == Random1))) + printf ("1 * Z == %g\n", Random2); + if (!(Z == V9)) + printf ("Z / 1 = %.17e\n", V9); + if (Random2 != Random1) { + ErrCnt[Defect] = ErrCnt[Defect] + 1; + BadCond (Defect, "Multiplication does not commute!\n"); + printf ("\tComparison alleges that 1 * Z = %.17e\n", + Random2); + printf ("\tdiffers from Z * 1 = %.17e\n", Random1); + } + Pause (); + } + } +} + +void +notify (s) + char *s; +{ + printf ("%s test appears to be inconsistent...\n", s); + printf (" PLEASE NOTIFY KARPINKSI!\n"); +} + +void +msglist (s) + char **s; +{ + while (*s) + printf ("%s\n", *s++); +} + +void +Instructions () +{ + static char *instr[] = + { + "Lest this program stop prematurely, i.e. before displaying\n", + " `END OF TEST',\n", + "try to persuade the computer NOT to terminate execution when an", + "error like Over/Underflow or Division by Zero occurs, but rather", + "to persevere with a surrogate value after, perhaps, displaying some", + "warning. If persuasion avails naught, don't despair but run this", + "program anyway to see how many milestones it passes, and then", + "amend it to make further progress.\n", + "Answer questions with Y, y, N or n (unless otherwise indicated).\n", + 0}; + + msglist (instr); +} + +void +Heading () +{ + static char *head[] = + { + "Users are invited to help debug and augment this program so it will", + "cope with unanticipated and newly uncovered arithmetic pathologies.\n", + "Please send suggestions and interesting results to", + "\tRichard Karpinski", + "\tComputer Center U-76", + "\tUniversity of California", + "\tSan Francisco, CA 94143-0704, USA\n", + "In doing so, please include the following information:", +#ifdef SINGLE_PRECISION + "\tPrecision:\tsingle;", +#else /* !SINGLE_PRECISION */ + "\tPrecision:\tdouble;", +#endif /* SINGLE_PRECISION */ + "\tVersion:\t10 February 1989;", + "\tComputer:\n", + "\tCompiler:\n", + "\tOptimization level:\n", + "\tOther relevant compiler options:", + 0}; + + msglist (head); +} + +void +Characteristics () +{ + static char *chars[] = + { + "Running this program should reveal these characteristics:", + " Radix = 1, 2, 4, 8, 10, 16, 100, 256 ...", + " Precision = number of significant digits carried.", + " U2 = Radix/Radix^Precision = One Ulp", + "\t(OneUlpnit in the Last Place) of 1.000xxx .", + " U1 = 1/Radix^Precision = One Ulp of numbers a little less than 1.0 .", + " Adequacy of guard digits for Mult., Div. and Subt.", + " Whether arithmetic is chopped, correctly rounded, or something else", + "\tfor Mult., Div., Add/Subt. and Sqrt.", + " Whether a Sticky Bit used correctly for rounding.", + " UnderflowThreshold = an underflow threshold.", + " E0 and PseudoZero tell whether underflow is abrupt, gradual, or fuzzy.", + " V = an overflow threshold, roughly.", + " V0 tells, roughly, whether Infinity is represented.", + " Comparisions are checked for consistency with subtraction", + "\tand for contamination with pseudo-zeros.", + " Sqrt is tested. Y^X is not tested.", + " Extra-precise subexpressions are revealed but NOT YET tested.", + " Decimal-Binary conversion is NOT YET tested for accuracy.", + 0}; + + msglist (chars); +} + +void +History () +{ /* History */ + /* Converted from Brian Wichmann's Pascal version to C by Thos Sumner, + with further massaging by David M. Gay. */ + + static char *hist[] = + { + "The program attempts to discriminate among", + " FLAWs, like lack of a sticky bit,", + " Serious DEFECTs, like lack of a guard digit, and", + " FAILUREs, like 2+2 == 5 .", + "Failures may confound subsequent diagnoses.\n", + "The diagnostic capabilities of this program go beyond an earlier", + "program called `MACHAR', which can be found at the end of the", + "book `Software Manual for the Elementary Functions' (1980) by", + "W. J. Cody and W. Waite. Although both programs try to discover", + "the Radix, Precision and range (over/underflow thresholds)", + "of the arithmetic, this program tries to cope with a wider variety", + "of pathologies, and to say how well the arithmetic is implemented.", + "\nThe program is based upon a conventional radix representation for", + "floating-point numbers, but also allows logarithmic encoding", + "as used by certain early WANG machines.\n", + "BASIC version of this program (C) 1983 by Prof. W. M. Kahan;", + "see source comments for more history.", + 0}; + + msglist (hist); +} diff --git a/testsuites/samples/paranoia/paranoia.doc b/testsuites/samples/paranoia/paranoia.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/samples/paranoia/paranoia.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/samples/paranoia/system.h b/testsuites/samples/paranoia/system.h new file mode 100644 index 0000000000..88e60beb9a --- /dev/null +++ b/testsuites/samples/paranoia/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "stdio.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/samples/ticker/init.c b/testsuites/samples/ticker/init.c new file mode 100644 index 0000000000..3caa16ecd7 --- /dev/null +++ b/testsuites/samples/ticker/init.c @@ -0,0 +1,58 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is called from init_exec 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: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_time_of_day time; + + puts( "\n\n*** CLOCK TICK TEST ***" ); + + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + status = rtems_clock_set( &time ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + status = rtems_task_create( Task_name[ 1 ], 1, 1024, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ] ); + status = rtems_task_create( Task_name[ 2 ], 1, 1024, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ] ); + status = rtems_task_create( Task_name[ 3 ], 1, 1024, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ] ); + + status = rtems_task_start( Task_id[ 1 ], Test_task, 1 ); + status = rtems_task_start( Task_id[ 2 ], Test_task, 2 ); + status = rtems_task_start( Task_id[ 3 ], Test_task, 3 ); + + status = rtems_task_delete( RTEMS_SELF ); +} diff --git a/testsuites/samples/ticker/system.h b/testsuites/samples/ticker/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/samples/ticker/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/samples/ticker/tasks.c b/testsuites/samples/ticker/tasks.c new file mode 100644 index 0000000000..ec7c6baa2e --- /dev/null +++ b/testsuites/samples/ticker/tasks.c @@ -0,0 +1,44 @@ +/* Test_task + * + * This routine serves as a test task. It verifies the basic task + * switching capabilities of the executive. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Test_task( + rtems_task_argument unused +) +{ + rtems_id tid; + rtems_time_of_day time; + rtems_unsigned32 task_index; + rtems_status_code status; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + task_index = task_number( tid ); + while( FOREVER ) { + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + if ( time.second >= 35 ) { + puts( "*** END OF CLOCK TICK TEST ***" ); + exit( 0 ); + } + put_name( Task_name[ task_index ], FALSE ); + print_time( " - rtems_clock_get - ", &time, "\n" ); + status = rtems_task_wake_after( task_index * 5 * TICKS_PER_SECOND ); + } +} diff --git a/testsuites/samples/ticker/ticker.doc b/testsuites/samples/ticker/ticker.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/samples/ticker/ticker.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/samples/ticker/ticker.scn b/testsuites/samples/ticker/ticker.scn new file mode 100644 index 0000000000..35952e6170 --- /dev/null +++ b/testsuites/samples/ticker/ticker.scn @@ -0,0 +1,16 @@ +*** CLOCK TICK TEST *** +TA1 - tm_get - 09:00:00 12/31/1988 +TA2 - tm_get - 09:00:00 12/31/1988 +TA3 - tm_get - 09:00:00 12/31/1988 +TA1 - tm_get - 09:00:05 12/31/1988 +TA1 - tm_get - 09:00:10 12/31/1988 +TA2 - tm_get - 09:00:10 12/31/1988 +TA1 - tm_get - 09:00:15 12/31/1988 +TA3 - tm_get - 09:00:15 12/31/1988 +TA1 - tm_get - 09:00:20 12/31/1988 +TA2 - tm_get - 09:00:20 12/31/1988 +TA1 - tm_get - 09:00:25 12/31/1988 +TA1 - tm_get - 09:00:30 12/31/1988 +TA2 - tm_get - 09:00:30 12/31/1988 +TA3 - tm_get - 09:00:30 12/31/1988 +*** END OF CLOCK TICK TEST *** diff --git a/testsuites/sptests/README b/testsuites/sptests/README new file mode 100644 index 0000000000..2843063c31 --- /dev/null +++ b/testsuites/sptests/README @@ -0,0 +1,9 @@ +# +# $Id$ +# + +This directory contains the RTEMS Single Processor Test Suite. +The tests in this directory provide near complete (98%+) test +coverage of the non-multiprocessor code in RTEMS. + + diff --git a/testsuites/sptests/sp01/init.c b/testsuites/sptests/sp01/init.c new file mode 100644 index 0000000000..82ffd0015c --- /dev/null +++ b/testsuites/sptests/sp01/init.c @@ -0,0 +1,89 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_time_of_day time; + rtems_status_code status; + + puts( "\n\n*** TEST 1 ***" ); + + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2 * 1024, + RTEMS_INTERRUPT_LEVEL(31), + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 1, + 2 * 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 1, + 2 * 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1_through_3, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_1_through_3, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_1_through_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp01/sp01.doc b/testsuites/sptests/sp01/sp01.doc new file mode 100644 index 0000000000..79b1aaaa87 --- /dev/null +++ b/testsuites/sptests/sp01/sp01.doc @@ -0,0 +1,43 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + +This file describes the directives and concepts tested by this test set. + +test set name: test1 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + tm_set, tm_get, tm_wkafter + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handle a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies that a task can get the task identification number of itself. + +output: + "TA1" is printed once every 5 seconds. "TA2" is printed once + every 10 seconds. "TA3" is printed once every 15 seconds. diff --git a/testsuites/sptests/sp01/sp01.scn b/testsuites/sptests/sp01/sp01.scn new file mode 100644 index 0000000000..d4fcc4561b --- /dev/null +++ b/testsuites/sptests/sp01/sp01.scn @@ -0,0 +1,18 @@ +*** TEST 1 *** +TA1 - rtems_clock_get - 09:00:00 12/31/1988 +TA2 - rtems_clock_get - 09:00:00 12/31/1988 +TA3 - rtems_clock_get - 09:00:00 12/31/1988 +TA1 - rtems_clock_get - 09:00:05 12/31/1988 +TA2 - rtems_clock_get - 09:00:10 12/31/1988 +TA1 - rtems_clock_get - 09:00:10 12/31/1988 +TA3 - rtems_clock_get - 09:00:15 12/31/1988 +TA1 - rtems_clock_get - 09:00:15 12/31/1988 +TA2 - rtems_clock_get - 09:00:20 12/31/1988 +TA1 - rtems_clock_get - 09:00:20 12/31/1988 +TA1 - rtems_clock_get - 09:00:25 12/31/1988 +TA3 - rtems_clock_get - 09:00:30 12/31/1988 +TA1 - rtems_clock_get - 09:00:30 12/31/1988 +TA2 - rtems_clock_get - 09:00:30 12/31/1988 +*** END OF TEST 1 *** + +NOTE: The order of the prints at each time interval is irrelevant. diff --git a/testsuites/sptests/sp01/system.h b/testsuites/sptests/sp01/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp01/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp01/task1.c b/testsuites/sptests/sp01/task1.c new file mode 100644 index 0000000000..b45d3abce6 --- /dev/null +++ b/testsuites/sptests/sp01/task1.c @@ -0,0 +1,50 @@ +/* Task_1_through_3 + * + * 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1_through_3( + rtems_task_argument argument +) +{ + rtems_id tid; + rtems_time_of_day time; + rtems_status_code status; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident" ); + + while( FOREVER ) { + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + if ( time.second >= 35 ) { + puts( "*** END OF TEST 1 ***" ); + exit( 0 ); + } + + put_name( Task_name[ task_number( tid ) ], FALSE ); + print_time( " - rtems_clock_get - ", &time, "\n" ); + + status = rtems_task_wake_after( task_number( tid ) * 5 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + } +} diff --git a/testsuites/sptests/sp02/init.c b/testsuites/sptests/sp02/init.c new file mode 100644 index 0000000000..b3ada92914 --- /dev/null +++ b/testsuites/sptests/sp02/init.c @@ -0,0 +1,155 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 2 ***" ); + + Preempt_task_name = rtems_build_name( 'P', 'R', 'M', 'T' ); + + status = rtems_task_create( + Preempt_task_name, + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Preempt_task_id + ); + directive_failed( status, "rtems_task_create of RTEMS_PREEMPT" ); + + status = rtems_task_start( Preempt_task_id, Preempt_task, 0 ); + directive_failed( status, "rtems_task_start of RTEMS_PREEMPT" ); + + puts( "INIT - rtems_task_wake_after - yielding processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 3, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 3, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 3, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + puts( "INIT - suspending TA2 while middle task on a ready chain" ); + status = rtems_task_suspend( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_suspend of TA2" ); + + status = rtems_task_delete( Task_id[ 1 ] ); + directive_failed( status, "rtems_task_delete of TA1" ); + + status = rtems_task_delete( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_delete of TA2" ); + + status = rtems_task_delete( Task_id[ 3 ] ); + directive_failed( status, "rtems_task_delete of TA3" ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 3, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 3, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp02/preempt.c b/testsuites/sptests/sp02/preempt.c new file mode 100644 index 0000000000..7e93f7af57 --- /dev/null +++ b/testsuites/sptests/sp02/preempt.c @@ -0,0 +1,32 @@ +/* Preempt_task + * + * This routine serves as a test task. It verifies the task manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Preempt_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "PREEMPT - rtems_task_delete - deleting self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_PREEMPT" ); +} diff --git a/testsuites/sptests/sp02/sp02.doc b/testsuites/sptests/sp02/sp02.doc new file mode 100644 index 0000000000..00f2e0e7b3 --- /dev/null +++ b/testsuites/sptests/sp02/sp02.doc @@ -0,0 +1,37 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test2 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + t_delete, tm_wkafter, t_setpri, t_suspend + +concepts: + + a. Verifies that a task can delete another task and also delete itself. + + b. Verifies that memory is freed back to the heap correctly. + + c. Verifies that TCBs are freed back to the inactive chain correctly. + + d. Verifies that a task can get the task identification number of + another task. + + e. Verifies the _Set_state routine where the task is not READY. + + f. Verifies the break statement in the _Block_activate routine. + + g. Verifies the while loop in the _Prev_tcb routine. diff --git a/testsuites/sptests/sp02/sp02.scn b/testsuites/sptests/sp02/sp02.scn new file mode 100644 index 0000000000..57a4627284 --- /dev/null +++ b/testsuites/sptests/sp02/sp02.scn @@ -0,0 +1,15 @@ +*** TEST 2 *** +INIT - rtems_task_wake_after - yielding processor +PREEMPT - rtems_task_delete - deleting self +INIT - suspending TA2 while middle task on a ready chain +TA1 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 minute +TA3 - rtems_task_wake_after - sleep 5 seconds +TA1 - rtems_task_ident - tid of TA2 (0x00010007) +TA1 - rtems_task_ident - tid of TA3 (0x00010008) +TA1 - rtems_task_set_priority - set TA3's priority to 2 +TA1 - rtems_task_suspend - suspend TA2 +TA1 - rtems_task_delete - delete TA2 +TA1 - rtems_task_wake_after - sleep for 5 seconds +TA3 - rtems_task_delete - delete self +*** END OF TEST 2 *** diff --git a/testsuites/sptests/sp02/system.h b/testsuites/sptests/sp02/system.h new file mode 100644 index 0000000000..c9d89a1e8b --- /dev/null +++ b/testsuites/sptests/sp02/system.h @@ -0,0 +1,31 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp02/task1.c b/testsuites/sptests/sp02/task1.c new file mode 100644 index 0000000000..0f6152dbb2 --- /dev/null +++ b/testsuites/sptests/sp02/task1.c @@ -0,0 +1,66 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies the task manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id tid2; + rtems_id tid3; + rtems_status_code status; + rtems_unsigned32 previous_priority; + + puts( "TA1 - rtems_task_wake_after - sleep 1 second" ); + status = rtems_task_wake_after( 1*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + status = rtems_task_ident( Task_name[ 2 ], RTEMS_SEARCH_ALL_NODES, &tid2 ); + directive_failed( status, "rtems_task_ident of TA2" ); + + printf( "TA1 - rtems_task_ident - tid of TA2 (0x%.8x)\n", tid2 ); + + status = rtems_task_ident( Task_name[ 3 ], RTEMS_SEARCH_ALL_NODES, &tid3 ); + directive_failed( status, "rtems_task_ident of TA3" ); + + printf( "TA1 - rtems_task_ident - tid of TA3 (0x%.8x)\n", tid3 ); + + status = rtems_task_set_priority( tid3, 2, &previous_priority ); + directive_failed( status, "rtems_task_set_priority" ); + + puts( "TA1 - rtems_task_set_priority - set TA3's priority to 2" ); + + + puts( "TA1 - rtems_task_suspend - suspend TA2" ); + status = rtems_task_suspend( tid2 ); + directive_failed( status, "rtems_task_suspend of TA2" ); + + puts( "TA1 - rtems_task_delete - delete TA2" ); + status = rtems_task_delete( tid2 ); + directive_failed( status, "rtems_task_delete of TA2" ); + + puts( "TA1 - rtems_task_wake_after - sleep for 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "*** END OF TEST 2 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp02/task2.c b/testsuites/sptests/sp02/task2.c new file mode 100644 index 0000000000..f39cc5b9fc --- /dev/null +++ b/testsuites/sptests/sp02/task2.c @@ -0,0 +1,34 @@ +/* Task_2 + * + * This routine serves as a test task. It sleeps for 1 minute but + * does not expect to wake up. Task 1 should suspend then delete it + * so that it appears to never wake up. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA2 - rtems_task_wake_after - sleep 1 minute" ); + status = rtems_task_wake_after( 60*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after in TA2" ); +} diff --git a/testsuites/sptests/sp02/task3.c b/testsuites/sptests/sp02/task3.c new file mode 100644 index 0000000000..89bda38b7c --- /dev/null +++ b/testsuites/sptests/sp02/task3.c @@ -0,0 +1,37 @@ +/* Task_3 + * + * This routine serves as a test task. It simply sleeps for 5 seconds + * and then deletes itself. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA3 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after in TA3" ); + + puts( "TA3 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA3" ); +} diff --git a/testsuites/sptests/sp03/init.c b/testsuites/sptests/sp03/init.c new file mode 100644 index 0000000000..962d434284 --- /dev/null +++ b/testsuites/sptests/sp03/init.c @@ -0,0 +1,70 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 3 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp03/sp03.doc b/testsuites/sptests/sp03/sp03.doc new file mode 100644 index 0000000000..96d6d41d94 --- /dev/null +++ b/testsuites/sptests/sp03/sp03.doc @@ -0,0 +1,24 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test3 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, tm_wkafter, + tm_wkwhen, tm_set, tm_get + +concepts: + + a. Verifies conversion routines - _Utd_to_etd and _Etd_to_utd diff --git a/testsuites/sptests/sp03/sp03.scn b/testsuites/sptests/sp03/sp03.scn new file mode 100644 index 0000000000..496982e86f --- /dev/null +++ b/testsuites/sptests/sp03/sp03.scn @@ -0,0 +1,26 @@ +*** TEST 3 *** +TA1 sets clock: 09:15:00 12/31/1988 +TA1 going to sleep: 09:15:00 12/31/1988 +TA2 09:15:01 12/31/1988 +TA2 09:15:02 12/31/1988 +TA2 09:15:03 12/31/1988 +TA2 09:15:04 12/31/1988 +TA1 awakened: 09:15:05 12/31/1988 +TA1 going to sleep: 09:15:05 12/31/1988 +TA2 09:15:05 12/31/1988 +TA2 09:15:06 12/31/1988 +TA2 09:15:07 12/31/1988 +TA2 09:15:08 12/31/1988 +TA2 09:15:09 12/31/1988 +TA1 awakened: 09:15:10 12/31/1988 +TA1 going to sleep: 09:15:10 12/31/1988 +TA2 09:15:10 12/31/1988 +TA2 09:15:11 12/31/1988 +TA2 09:15:12 12/31/1988 +TA2 09:15:13 12/31/1988 +TA2 09:15:14 12/31/1988 +TA1 awakened: 09:15:15 12/31/1988 +TA1 going to sleep: 09:15:15 12/31/1988 +TA2 09:15:15 12/31/1988 +TA2 09:15:16 12/31/1988 +*** END OF TEST 3 *** diff --git a/testsuites/sptests/sp03/system.h b/testsuites/sptests/sp03/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp03/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp03/task1.c b/testsuites/sptests/sp03/task1.c new file mode 100644 index 0000000000..e59fad45cf --- /dev/null +++ b/testsuites/sptests/sp03/task1.c @@ -0,0 +1,59 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies the capability to + * set and read the executives calender and clock. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_time_of_day time; + + build_time( &time, 12, 31, 1988, 9, 15, 0, 0 ); + + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + put_name( Task_name[ 1 ], FALSE ); + print_time( " sets clock: ", &time, "\n" ); + + while( FOREVER ) { + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + put_name( Task_name[ 1 ], FALSE ); + print_time( " going to sleep: ", &time, "\n" ); + + time.second += 5; + time.minute += ( time.second / 60 ); + time.second %= 60; + time.hour += ( time.minute / 60 ); + time.minute %= 60; + time.hour %= 24; + + status = rtems_task_wake_when( &time ); + directive_failed( status, "rtems_task_wake_when" ); + + put_name( Task_name[ 1 ], FALSE ); + print_time( " awakened: ", &time, "\n" ); + } +} diff --git a/testsuites/sptests/sp03/task2.c b/testsuites/sptests/sp03/task2.c new file mode 100644 index 0000000000..8838c1db67 --- /dev/null +++ b/testsuites/sptests/sp03/task2.c @@ -0,0 +1,46 @@ +/* Task_2 + * + * This routine serves as a test task. It repeatedly gets the system time + * and date, converts it to printable form, and print it. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_time_of_day time; + + while( FOREVER ) { + status = rtems_task_wake_after( 1*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + if ( time.second >= 17 ) { + puts( "*** END OF TEST 3 *** " ); + exit( 0 ); + } + + put_name( Task_name[ 2 ], FALSE ); + print_time( " ", &time, "\n" ); + } +} diff --git a/testsuites/sptests/sp04/init.c b/testsuites/sptests/sp04/init.c new file mode 100644 index 0000000000..b9fd541103 --- /dev/null +++ b/testsuites/sptests/sp04/init.c @@ -0,0 +1,113 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_extensions_table Extensions = { + NULL, /* task create user extension */ + NULL, /* task start user extension */ + NULL, /* task restart user extension */ + NULL, /* task delete user extension */ + Task_switch, /* task switch user extension */ + NULL, /* task begin user extension */ + NULL, /* task exitted user extension */ + NULL /* fatal error user extension */ +}; + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_time_of_day time; + + puts( "\n\n*** TEST 4 ***" ); + build_time( &time, 12, 31, 1988, 9, 15, 0, 0 ); + + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', ' ' ); + + status = rtems_extension_create( + Extension_name[ 1 ], + &Extensions, + &Extension_id[ 1 ] + ); + directive_failed( status, "rtems_extension_create" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + Run_count[ 1 ] = 0; + Run_count[ 2 ] = 0; + Run_count[ 3 ] = 0; + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 1, + 2048, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 1, + 2048, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp04/sp04.doc b/testsuites/sptests/sp04/sp04.doc new file mode 100644 index 0000000000..6f6355abfa --- /dev/null +++ b/testsuites/sptests/sp04/sp04.doc @@ -0,0 +1,38 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test4 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, + tm_set, tm_get, ev_receive, t_mode + +concepts: + + a. Verifies timeslicing ( all tasks are in timeslice mode ). + + b. Verifies the tswitch user extension. + + c. Verifies the no preemption mode. + + d. Verifies time-slice gets reset even if only one task ready. + +output: + The task name and the current time are printed out each time that a new + task is being dispatched. The configured timeslice is 100 ticks + ( 1 second ); therefore, a task name and the time are printed once + every second. After each task runs 3 times, task 1 changes its mode to + no preempt and runs for about 6 seconds and then changes its mode back to + preempt mode. diff --git a/testsuites/sptests/sp04/sp04.scn b/testsuites/sptests/sp04/sp04.scn new file mode 100644 index 0000000000..f104c0c482 --- /dev/null +++ b/testsuites/sptests/sp04/sp04.scn @@ -0,0 +1,24 @@ +*** TEST 4 *** +TA1 - 09:15:00 12/31/1988 +TA1 - rtems_task_suspend - on Task 2 +TA1 - rtems_task_suspend - on Task 3 +TA1 - killing time +TA1 - rtems_task_resume - on Task 2 +TA1 - rtems_task_resume - on Task 3 +TA2 - 09:15:03 12/31/1988 +TA3 - 09:15:04 12/31/1988 +TA1 - 09:15:05 12/31/1988 +TA2 - 09:15:06 12/31/1988 +TA3 - 09:15:07 12/31/1988 +TA1 - 09:15:08 12/31/1988 +TA1 - rtems_task_mode - change mode to NO RTEMS_PREEMPT +TA1 - 09:15:09 12/31/1988 +TA1 - 09:15:10 12/31/1988 +TA1 - 09:15:11 12/31/1988 +TA1 - 09:15:12 12/31/1988 +TA1 - 09:15:13 12/31/1988 +TA1 - 09:15:14 12/31/1988 +TA1 - rtems_task_mode - change mode to RTEMS_PREEMPT +TA2 - 09:15:15 12/31/1988 +TA3 - 09:15:16 12/31/1988 +*** END OF TEST 4 *** diff --git a/testsuites/sptests/sp04/system.h b/testsuites/sptests/sp04/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp04/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp04/task1.c b/testsuites/sptests/sp04/task1.c new file mode 100644 index 0000000000..8d0a620ec3 --- /dev/null +++ b/testsuites/sptests/sp04/task1.c @@ -0,0 +1,104 @@ +/* Task_1 + * + * This test serves as a test task. It verifies timeslicing activities + * and tswitch extension processing. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#include "clockdrv.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_unsigned32 seconds; + rtems_unsigned32 old_seconds; + rtems_mode previous_mode; + rtems_time_of_day time; + rtems_status_code status; + rtems_unsigned32 start; + rtems_unsigned32 end; + + puts( "TA1 - rtems_task_suspend - on Task 2" ); + status = rtems_task_suspend( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_suspend of TA2" ); + + puts( "TA1 - rtems_task_suspend - on Task 3" ); + status = rtems_task_suspend( Task_id[ 3 ] ); + directive_failed( status, "rtems_task_suspend of TA3" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &start ); + directive_failed( status, "rtems_clock_get" ); + + puts( "TA1 - killing time" ); + + for ( ; ; ) { + status = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &end ); + directive_failed( status, "rtems_clock_get" ); + + if ( end > (start + 2) ) + break; + } + + puts( "TA1 - rtems_task_resume - on Task 2" ); + status = rtems_task_resume( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_resume of TA2" ); + + puts( "TA1 - rtems_task_resume - on Task 3" ); + status = rtems_task_resume( Task_id[ 3 ] ); + directive_failed( status, "rtems_task_resume of TA3" ); + + while ( FOREVER ) { + if ( Run_count[ 1 ] == 3 ) { + puts( "TA1 - rtems_task_mode - change mode to NO RTEMS_PREEMPT" ); + + status = rtems_task_mode( + RTEMS_NO_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + old_seconds = time.second; + + for ( seconds = 0 ; seconds < 6 ; ) { + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + if ( time.second != old_seconds ) { + old_seconds = time.second; + seconds++; + print_time( "TA1 - ", &time, "\n" ); + } + } + + puts( "TA1 - rtems_task_mode - change mode to RTEMS_PREEMPT" ); + status = rtems_task_mode( + RTEMS_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + + while ( FOREVER ); + } + } +} diff --git a/testsuites/sptests/sp04/task2.c b/testsuites/sptests/sp04/task2.c new file mode 100644 index 0000000000..7574e7dc9f --- /dev/null +++ b/testsuites/sptests/sp04/task2.c @@ -0,0 +1,29 @@ +/* Task_2 + * + * This routine serves as a test task. It is just a CPU bound task + * requiring timesliced operation. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + while( FOREVER ); +} diff --git a/testsuites/sptests/sp04/task3.c b/testsuites/sptests/sp04/task3.c new file mode 100644 index 0000000000..a0e7482944 --- /dev/null +++ b/testsuites/sptests/sp04/task3.c @@ -0,0 +1,29 @@ +/* Task_3 + * + * This routine serves as a test task. It is just a CPU bound task + * requiring timesliced operation. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + while( FOREVER ); +} diff --git a/testsuites/sptests/sp04/tswitch.c b/testsuites/sptests/sp04/tswitch.c new file mode 100644 index 0000000000..3f0c2047bc --- /dev/null +++ b/testsuites/sptests/sp04/tswitch.c @@ -0,0 +1,59 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_extension Task_switch( + rtems_tcb *unused, + rtems_tcb *heir +) +{ + rtems_unsigned32 index; + rtems_time_of_day time; + rtems_status_code status; + + index = task_number( heir->Object.id ); + + switch( index ) { + case 1: + case 2: + case 3: + Run_count[ index ] += 1; + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + put_name( Task_name[ index ], FALSE ); + print_time( " - ", &time, "\n" ); + + if ( time.second >= 16 ) { + puts( "*** END OF TEST 4 ***" ); + exit( 0 ); + } + break; + + case 0: + default: + break; + } +} diff --git a/testsuites/sptests/sp05/init.c b/testsuites/sptests/sp05/init.c new file mode 100644 index 0000000000..2f6b8a6eac --- /dev/null +++ b/testsuites/sptests/sp05/init.c @@ -0,0 +1,84 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 5 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp05/sp05.doc b/testsuites/sptests/sp05/sp05.doc new file mode 100644 index 0000000000..583381a37e --- /dev/null +++ b/testsuites/sptests/sp05/sp05.doc @@ -0,0 +1,26 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test5 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident + tm_wkafter, t_suspend, t_resume + +concepts: + + a. Verifies that a task can be suspended and resumed. + + b. Verifies that a task can suspend itself. diff --git a/testsuites/sptests/sp05/sp05.scn b/testsuites/sptests/sp05/sp05.scn new file mode 100644 index 0000000000..40afb2d4b2 --- /dev/null +++ b/testsuites/sptests/sp05/sp05.scn @@ -0,0 +1,47 @@ +*** TEST 5 *** +TA1 - rtems_task_wake_after - sleep 5 seconds +TA2 - rtems_task_suspend - suspend self +TA3 - rtems_task_suspend - suspend self +TA1 - rtems_task_suspend - suspend TA3 +TA1 - rtems_task_resume - resume TA2 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA1 - rtems_task_suspend - suspend TA2 +TA1 - rtems_task_resume - resume TA3 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA1 - rtems_task_suspend - suspend TA3 +TA1 - rtems_task_resume - resume TA2 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA1 - rtems_task_suspend - suspend TA2 +TA1 - rtems_task_resume - resume TA3 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA1 - rtems_task_suspend - suspend TA3 +TA1 - rtems_task_resume - resume TA2 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA1 - rtems_task_suspend - suspend TA2 +TA1 - rtems_task_resume - resume TA3 +*** END OF TEST 5 *** diff --git a/testsuites/sptests/sp05/system.h b/testsuites/sptests/sp05/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp05/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp05/task1.c b/testsuites/sptests/sp05/task1.c new file mode 100644 index 0000000000..9b99586fc8 --- /dev/null +++ b/testsuites/sptests/sp05/task1.c @@ -0,0 +1,78 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies that tasks can + * be suspended and resumed. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * NOTE: The rtems_task_suspend() directives fail on the first iteration. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id tid2; + rtems_id tid3; + rtems_unsigned32 pass; + rtems_status_code status; + + status = rtems_task_ident( Task_name[ 2 ], 1, &tid2 ); + directive_failed( status, "rtems_task_ident of TA2" ); + + status = rtems_task_ident( Task_name[ 3 ], 1, &tid3 ); + directive_failed( status, "rtems_task_ident of TA3" ); + + for ( pass=1 ; pass <= 3 ; pass++ ) { + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after of TA1" ); + + puts( "TA1 - rtems_task_suspend - suspend TA3" ); + status = rtems_task_suspend( tid3 ); + if ( pass == 1 ) { + fatal_directive_status( + status, + RTEMS_ALREADY_SUSPENDED, + "rtems_task_suspend of TA3" + ); + } else { + directive_failed( status, "rtems_task_suspend of TA3" ); + } + + puts( "TA1 - rtems_task_resume - resume TA2" ); + status = rtems_task_resume( tid2 ); + directive_failed( status, "rtems_task_resume of TA2" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_task_suspend - suspend TA2" ); + status = rtems_task_suspend( tid2 ); + directive_failed( status, "rtems_task_suspend of TA2" ); + + puts( "TA1 - rtems_task_resume - resume TA3" ); + status = rtems_task_resume( tid3 ); + directive_failed( status, "rtems_task_resume" ); + } + + puts( "*** END OF TEST 5 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp05/task2.c b/testsuites/sptests/sp05/task2.c new file mode 100644 index 0000000000..3878d8106d --- /dev/null +++ b/testsuites/sptests/sp05/task2.c @@ -0,0 +1,39 @@ +/* Task_2 + * + * This routine serves as a test task. Makes sure a task can suspend + * itself. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA2 - rtems_task_suspend - suspend self" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend of TA2" ); + + while( FOREVER ) { + puts( "TA2 - rtems_task_wake_after - sleep 1 second" ); + status = rtems_task_wake_after( 1*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after of TA2" ); + } +} diff --git a/testsuites/sptests/sp05/task3.c b/testsuites/sptests/sp05/task3.c new file mode 100644 index 0000000000..c03c6de75b --- /dev/null +++ b/testsuites/sptests/sp05/task3.c @@ -0,0 +1,39 @@ +/* Task_3 + * + * This routine serves as a test task. Makes sure a task can suspend + * itself. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA3 - rtems_task_suspend - suspend self" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend of TA3" ); + + while( FOREVER ) { + puts( "TA3 - rtems_task_wake_after - sleep 1 second" ); + status = rtems_task_wake_after( 1*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after of TA3" ); + } +} diff --git a/testsuites/sptests/sp06/init.c b/testsuites/sptests/sp06/init.c new file mode 100644 index 0000000000..08bab06594 --- /dev/null +++ b/testsuites/sptests/sp06/init.c @@ -0,0 +1,90 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_task_priority previous_priority; + + puts( "\n\n*** TEST 6 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + Argument = 0; + Restart_argument = 1; + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 10, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, Argument ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, Argument ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_set_priority( Task_id[ 3 ], 5, &previous_priority ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp06/sp06.doc b/testsuites/sptests/sp06/sp06.doc new file mode 100644 index 0000000000..e8b96f1f6b --- /dev/null +++ b/testsuites/sptests/sp06/sp06.doc @@ -0,0 +1,26 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test6 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, + tm_wkafter, t_restart + +concepts: + + a. Verifies that a task can restart a task other than itself. + + b. Verifies that a task can restart itself. diff --git a/testsuites/sptests/sp06/sp06.scn b/testsuites/sptests/sp06/sp06.scn new file mode 100644 index 0000000000..64f6489dc8 --- /dev/null +++ b/testsuites/sptests/sp06/sp06.scn @@ -0,0 +1,40 @@ +*** TEST 6 *** +TA1 - is beginning to run +TA1 - restarting TA3 +TA2 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting TA2 +TA2 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting self +TA1 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting TA2 +TA2 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting self +TA1 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting TA2 +TA2 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting self +TA1 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting TA2 +TA2 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting self +TA1 - is beginning to run +*** END OF TEST 6 *** + +NOTE: The prints from TA2 may not be as regular as indicated in the screen. + The important point is that TA2 is running and gets restarted. diff --git a/testsuites/sptests/sp06/system.h b/testsuites/sptests/sp06/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp06/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp06/task1.c b/testsuites/sptests/sp06/task1.c new file mode 100644 index 0000000000..6d0f67f395 --- /dev/null +++ b/testsuites/sptests/sp06/task1.c @@ -0,0 +1,61 @@ +/* Task_1 + * + * This task serves as a test task. Verifies that a task can restart + * both itself and other tasks. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( argument ) +rtems_unsigned32 argument; +{ + rtems_unsigned32 pass; + rtems_status_code status; + + puts( "TA1 - is beginning to run" ); + + pass = argument + 1; + + if ( pass == 5 ) { + puts( "*** END OF TEST 6 ***" ); + exit( 0 ); + } + + if ( pass == 1 ) { + puts( "TA1 - restarting TA3" ); + status = rtems_task_restart( Task_id[ 3 ], Restart_argument ); + directive_failed( status, "rtems_task_restart of TA3" ); + + status = rtems_task_wake_after( 2 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + } + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_task_restart - restarting TA2" ); + status = rtems_task_restart( Task_id[ 2 ], Restart_argument ); + directive_failed( status, "rtems_task_restart TA2" ); + + status = rtems_task_wake_after( 1*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_task_restart - restarting self" ); + status = rtems_task_restart( Task_id[ 1 ], pass ); + directive_failed( status, "rtems_task_restart of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp06/task2.c b/testsuites/sptests/sp06/task2.c new file mode 100644 index 0000000000..0c9e10bc07 --- /dev/null +++ b/testsuites/sptests/sp06/task2.c @@ -0,0 +1,40 @@ +/* Task_2 + * + * This routine serves as a test task. It simply runs forever so + * another task can restart it. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( argument ) +rtems_task_argument argument; +{ + rtems_status_code status; + + puts( "TA2 - is beginning to run" ); + if ( argument == Argument ) { + status = rtems_task_wake_after( 2 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + } + + while( FOREVER ) { + puts( "TA2 - rtems_task_wake_after - sleep 1/2 second" ); + status = rtems_task_wake_after( TICKS_PER_SECOND / 2 ); + directive_failed( status, "rtems_task_wake_after" ); + } +} diff --git a/testsuites/sptests/sp06/task3.c b/testsuites/sptests/sp06/task3.c new file mode 100644 index 0000000000..379ef8de92 --- /dev/null +++ b/testsuites/sptests/sp06/task3.c @@ -0,0 +1,32 @@ +/* Task_3 + * + * This routine serves as a test task. It is started, has its priority + * changed, and when it runs it deletes itself. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + rtems_status_code status; + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp07/init.c b/testsuites/sptests/sp07/init.c new file mode 100644 index 0000000000..f5d00eae8e --- /dev/null +++ b/testsuites/sptests/sp07/init.c @@ -0,0 +1,131 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_extensions_table Extensions = { + Task_create_extension, /* task create user extension */ + Task_start_extension, /* task start user extension */ + Task_restart_extension, /* task restart user extension */ + Task_delete_extension, /* task delete user extension */ + NULL, /* task switch user extension */ + NULL, /* begin user extension */ + Task_exit_extension, /* task exitted user extension */ + NULL /* fatal error extension */ +}; + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 7 ***" ); + + Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', ' ' ); + + status = rtems_extension_create( + Extension_name[ 1 ], + &Extensions, + &Extension_id[ 1 ] + ); + directive_failed( status, "rtems_extension_create" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 250, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_create( + Task_name[ 4 ], + 254, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 4 ] + ); + directive_failed( status, "rtems_task_create of TA4" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_start( Task_id[ 4 ], Task_4, 0 ); + directive_failed( status, "rtems_task_start of TA4" ); + + status = rtems_task_restart( Task_id[ 3 ], 0 ); + directive_failed( status, "rtems_task_restart of TA3" ); + + status = rtems_task_set_note( Task_id[ 1 ], RTEMS_NOTEPAD_8, 4 ); + directive_failed( status, "task_set_node of TA1" ); + printf( "INIT - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8 " ); + puts ( "to TA1's priority: 04" ); + + status = rtems_task_set_note( Task_id[ 2 ], RTEMS_NOTEPAD_8, 4 ); + directive_failed( status, "task_set_node of TA2" ); + printf( "INIT - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8 " ); + puts ( "to TA2's priority: 04"); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp07/sp07.doc b/testsuites/sptests/sp07/sp07.doc new file mode 100644 index 0000000000..47411194c6 --- /dev/null +++ b/testsuites/sptests/sp07/sp07.doc @@ -0,0 +1,37 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test7 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, + t_delete, t_setreg, t_getreg, t_setpri, t_suspend + +concepts: + + a. Verifies that tasks can communicate with each other via the + t_setreg and t_getreg directives. + + b. Verifies that the highest priority task is dispatched to execute. + + c. Verifies setting the priority of both a ready and a blocked task. + + d. Verifies the deletion of ready and blocked tasks. + + e. Verifies the tcreate user extension. + + f. Verifies the tstart user extension. + + g. Verifies the tdelete user extension. diff --git a/testsuites/sptests/sp07/sp07.scn b/testsuites/sptests/sp07/sp07.scn new file mode 100644 index 0000000000..1f6de2d93d --- /dev/null +++ b/testsuites/sptests/sp07/sp07.scn @@ -0,0 +1,33 @@ +*** TEST 7 *** +TASK_CREATE - TA1 - created. +TASK_CREATE - TA2 - created. +TASK_CREATE - TA3 - created. +TASK_CREATE - TA4 - created. +TASK_START - TA1 - started. +TASK_START - TA2 - started. +TASK_START - TA3 - started. +TASK_START - TA4 - started. +TASK_RESTART - TA3 - restarted. +INIT - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8 to TA1's priority: 04 +INIT - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8 to TA2's priority: 04 + +TA1 - rtems_task_set_priority - get initial priority of self: 04 +TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 04 +TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: 03 +TA1 - rtems_task_set_priority - set TA2's priority: 03 +TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 03 +TA2 - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8: 02 +TA2 - rtems_task_set_priority - set TA1's priority: 02 +TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 02 +TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: 01 +TA1 - rtems_task_set_priority - set TA2's priority: 01 +TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 01 +TA2 - rtems_task_suspend - suspend TA1 +TA2 - rtems_task_set_priority - set priority of TA1 ( blocked ) +TASK_DELETE - TA2 deleting TA1 +TASK_DELETE - TA2 deleting TA3 +TASK_DELETE - TA2 deleting TA2 +TA4 - exitting task +RTEMS_TASK_EXITTED - extension invoked for TA4 +*** END OF TEST 7 *** +TASK_DELETE - TA4 deleting TA4 <---- may not appear diff --git a/testsuites/sptests/sp07/system.h b/testsuites/sptests/sp07/system.h new file mode 100644 index 0000000000..01a3e7f765 --- /dev/null +++ b/testsuites/sptests/sp07/system.h @@ -0,0 +1,35 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* constants */ + +#define SI_NAME 0x53595349 /* name - "SYSI" */ +#define I_NAME 0x49444c45 /* name - "IDLE" */ + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp07/task1.c b/testsuites/sptests/sp07/task1.c new file mode 100644 index 0000000000..62fa35cee9 --- /dev/null +++ b/testsuites/sptests/sp07/task1.c @@ -0,0 +1,85 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_task_priority the_priority; + rtems_task_priority previous_priority; + + pause(); + + status = rtems_task_set_priority( + RTEMS_SELF, + RTEMS_CURRENT_PRIORITY, + &the_priority + ); + directive_failed( status, "rtems_task_set_priority" ); + printf( + "TA1 - rtems_task_set_priority - get initial priority of self: %02d\n", + the_priority + ); + + while( FOREVER ) { + status = rtems_task_get_note( RTEMS_SELF, RTEMS_NOTEPAD_8, &the_priority ); + directive_failed( status, "rtems_task_get_note" ); + printf( +"TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: %02d\n", + the_priority + ); + + if ( --the_priority == 0 ) { + puts( "TA1 - rtems_task_suspend - suspend TA2" ); + status = rtems_task_suspend( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_suspend" ); + + puts( "TA1 - rtems_task_set_priority - set priority of TA2 ( blocked )" ); + status = rtems_task_set_priority( Task_id[ 2 ], 5, &previous_priority ); + directive_failed( status, "rtems_task_set_priority" ); + + status = rtems_task_delete( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_delete of TA2" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); + } + + printf( "TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: %02d\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: %02d\n", + the_priority + ); + status = rtems_task_set_priority( + Task_id[ 2 ], + the_priority, + &previous_priority + ); + directive_failed( status, "rtems_task_set_priority" ); + } +} diff --git a/testsuites/sptests/sp07/task2.c b/testsuites/sptests/sp07/task2.c new file mode 100644 index 0000000000..622bdd8e3d --- /dev/null +++ b/testsuites/sptests/sp07/task2.c @@ -0,0 +1,78 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_task_priority the_priority; + rtems_task_priority previous_priority; + + while( FOREVER ) { + + 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: %02d\n", + the_priority + ); + + if ( --the_priority == 0 ) { + puts( "TA2 - rtems_task_suspend - suspend TA1" ); + status = rtems_task_suspend( Task_id[ 1 ] ); + directive_failed( status, "rtems_task_suspend" ); + + puts( "TA2 - rtems_task_set_priority - set priority of TA1 ( blocked )" ); + status = rtems_task_set_priority( Task_id[ 1 ], 5, &previous_priority ); + directive_failed( status, "rtems_task_set_priority" ); + + status = rtems_task_delete( Task_id[ 1 ] ); /* TA1 is blocked */ + directive_failed( status, "rtems_task_delete of TA1" ); + + status = rtems_task_delete( Task_id[ 3 ] ); /* TA3 is ready */ + directive_failed( status, "rtems_task_delete of TA3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of SELD" ); + + } else { + + printf( "TA2 - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8: %02d\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: %02d\n", + the_priority + ); + status = rtems_task_set_priority( + Task_id[ 1 ], + the_priority, + &previous_priority + ); + directive_failed( status, "rtems_task_set_priority" ); + } + } +} diff --git a/testsuites/sptests/sp07/task3.c b/testsuites/sptests/sp07/task3.c new file mode 100644 index 0000000000..dce44b283b --- /dev/null +++ b/testsuites/sptests/sp07/task3.c @@ -0,0 +1,34 @@ +/* Task_3 + * + * This routine serves as a low priority test task that should never + * execute. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + rtems_status_code status; + + while( FOREVER ) { + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + } +} diff --git a/testsuites/sptests/sp07/task4.c b/testsuites/sptests/sp07/task4.c new file mode 100644 index 0000000000..cc9de6d4c3 --- /dev/null +++ b/testsuites/sptests/sp07/task4.c @@ -0,0 +1,30 @@ +/* Task_4 + * + * This routine serves as a low priority test task that should exit + * a soon as it runs to test the taskexitted user extension. + * execute. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_4( + rtems_task_argument argument +) +{ + puts( "TA4 - exitting task" ); +} diff --git a/testsuites/sptests/sp07/taskexit.c b/testsuites/sptests/sp07/taskexit.c new file mode 100644 index 0000000000..ad52d1f3a7 --- /dev/null +++ b/testsuites/sptests/sp07/taskexit.c @@ -0,0 +1,33 @@ +/* Task_exit_extension + * + * This routine is the task exitted user extension. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_extension Task_exit_extension( + rtems_tcb *running_task +) +{ + if ( task_number( running_task->Object.id ) > 0 ) { + puts_nocr( "RTEMS_TASK_EXITTED - extension invoked for " ); + put_name( Task_name[ task_number( running_task->Object.id ) ], TRUE ); + } + + puts("*** END OF TEST 7 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp07/tcreate.c b/testsuites/sptests/sp07/tcreate.c new file mode 100644 index 0000000000..7b066630f0 --- /dev/null +++ b/testsuites/sptests/sp07/tcreate.c @@ -0,0 +1,34 @@ +/* Task_create_extension + * + * This routine is the tcreate user extension. + * + * Input parameters: + * unused - pointer to currently running TCB + * created_task - pointer to new TCB being created + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_extension Task_create_extension( + rtems_tcb *unused, + rtems_tcb *created_task +) +{ + if ( task_number( created_task->Object.id ) > 0 ) { + puts_nocr( "TASK_CREATE - " ); + put_name( Task_name[ task_number( created_task->Object.id ) ], FALSE ); + puts( " - created." ); + } +} diff --git a/testsuites/sptests/sp07/tdelete.c b/testsuites/sptests/sp07/tdelete.c new file mode 100644 index 0000000000..9d7c5749c1 --- /dev/null +++ b/testsuites/sptests/sp07/tdelete.c @@ -0,0 +1,37 @@ +/* Task_delete_extension + * + * This routine is the delete user extension. + * + * Input parameters: + * running_task - pointer to running TCB + * deleted_task - pointer to TCB deleted + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_extension Task_delete_extension( + rtems_tcb *running_task, + rtems_tcb *deleted_task +) +{ + if ( task_number( running_task->Object.id ) > 0 ) { + puts_nocr( "TASK_DELETE - " ); + put_name( Task_name[ task_number( running_task->Object.id ) ], FALSE ); + } + if ( task_number( deleted_task->Object.id ) > 0 ) { + puts_nocr( " deleting " ); + put_name( Task_name[ task_number( deleted_task->Object.id ) ], TRUE ); + } +} diff --git a/testsuites/sptests/sp07/trestart.c b/testsuites/sptests/sp07/trestart.c new file mode 100644 index 0000000000..6cefb485a6 --- /dev/null +++ b/testsuites/sptests/sp07/trestart.c @@ -0,0 +1,34 @@ +/* Task_restart_extension + * + * This routine is the trestart user extension. + * + * Input parameters: + * unused - pointer to currently running TCB + * restarted_task - pointer to new TCB being started + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Task_restart_extension( + rtems_tcb *unused, + rtems_tcb *restarted_task +) +{ + if ( task_number( restarted_task->Object.id ) > 0 ) { + puts_nocr( "TASK_RESTART - " ); + put_name( Task_name[ task_number( restarted_task->Object.id ) ], FALSE ); + puts( " - restarted." ); + } +} diff --git a/testsuites/sptests/sp07/tstart.c b/testsuites/sptests/sp07/tstart.c new file mode 100644 index 0000000000..1b1fc795b7 --- /dev/null +++ b/testsuites/sptests/sp07/tstart.c @@ -0,0 +1,34 @@ +/* Task_start_extension + * + * This routine is the tstart user extension. + * + * Input parameters: + * unused - pointer to currently running TCB + * started_task - pointer to new TCB being started + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_extension Task_start_extension( + rtems_tcb *unused, + rtems_tcb *started_task +) +{ + if ( task_number( started_task->Object.id ) > 0 ) { + puts_nocr( "TASK_START - " ); + put_name( Task_name[ task_number( started_task->Object.id ) ], FALSE ); + puts( " - started." ); + } +} diff --git a/testsuites/sptests/sp08/init.c b/testsuites/sptests/sp08/init.c new file mode 100644 index 0000000000..e3020035ce --- /dev/null +++ b/testsuites/sptests/sp08/init.c @@ -0,0 +1,56 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 8 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp08/sp08.doc b/testsuites/sptests/sp08/sp08.doc new file mode 100644 index 0000000000..2b152779d7 --- /dev/null +++ b/testsuites/sptests/sp08/sp08.doc @@ -0,0 +1,26 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test8 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, + t_mode + +concepts: + + a. Verifies every mode change possible. + + b. Verifies the fatal error handler. diff --git a/testsuites/sptests/sp08/sp08.scn b/testsuites/sptests/sp08/sp08.scn new file mode 100644 index 0000000000..d85ccc384f --- /dev/null +++ b/testsuites/sptests/sp08/sp08.scn @@ -0,0 +1,22 @@ +*** TEST 8 *** +TA1 - rtems_task_mode - RTEMS_ASR - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: 00000400 +TA1 - rtems_task_mode - RTEMS_ASR - previous mode: 00000400 +TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: 00000200 +TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: 00000200 +TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: 00000100 +TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: 00000100 +TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 3 ) - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 5 ) - previous mode: 00000003 +TA1 - rtems_task_mode - set all modes - previous mode: 00000005 +TA1 - rtems_task_mode - set all modes - previous mode: 00000703 +TA1 - rtems_task_mode - clear all modes - previous mode: 00000703 +TA1 - rtems_task_mode - get current mode - previous mode: 00000000 +*** END OF TEST 8 *** + +NOTE: The interrupt level lines will be different on CPUs with few levels. diff --git a/testsuites/sptests/sp08/system.h b/testsuites/sptests/sp08/system.h new file mode 100644 index 0000000000..dec5151b46 --- /dev/null +++ b/testsuites/sptests/sp08/system.h @@ -0,0 +1,33 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +#define put_mode( _comment, _output_mode ) \ + printf( "%s %08x\n", _comment, _output_mode ); + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp08/task1.c b/testsuites/sptests/sp08/task1.c new file mode 100644 index 0000000000..eddcb11191 --- /dev/null +++ b/testsuites/sptests/sp08/task1.c @@ -0,0 +1,256 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies all combinations of + * task mode changes. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_mode previous_mode; + rtems_status_code status; + +/* BEGINNING OF RTEMS_ASR */ + + status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_ASR - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_ASR, + RTEMS_ASR_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_ASR, + RTEMS_ASR_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_ASR, + RTEMS_ASR_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_ASR - previous mode: ", + previous_mode + ); + +/* END OF RTEMS_ASR */ + +/* BEGINNING OF RTEMS_TIMESLICE */ + + status = rtems_task_mode( + RTEMS_NO_TIMESLICE, + RTEMS_TIMESLICE_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_TIMESLICE, + RTEMS_TIMESLICE_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_TIMESLICE, + RTEMS_TIMESLICE_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_TIMESLICE, + RTEMS_TIMESLICE_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: ", + previous_mode + ); + +/* END OF RTEMS_TIMESLICE */ + +/* BEGINNING OF RTEMS_PREEMPT */ + + status = rtems_task_mode( + RTEMS_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: ", + previous_mode + ); + +/* END OF RTEMS_PREEMPT */ + +/* BEGINNING OF RTEMS_INTERRUPT_LEVEL */ + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(3), + RTEMS_INTERRUPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 3 ) - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(5), + RTEMS_INTERRUPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 5 ) - previous mode: ", + previous_mode + ); + +/* END OF RTEMS_INTERRUPT_LEVEL */ + +/* BEGINNING OF COMBINATIONS */ + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR | + RTEMS_TIMESLICE | RTEMS_NO_PREEMPT, + RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | + RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - set all modes - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR | + RTEMS_TIMESLICE | RTEMS_NO_PREEMPT, + RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | + RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - set all modes - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(0) | RTEMS_ASR | RTEMS_NO_TIMESLICE | RTEMS_PREEMPT, + RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | + RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - clear all modes - previous mode: ", + previous_mode + ); + +/* END OF COMBINATIONS */ + +/* BEGINNING OF CURRENT MODE */ + + status = rtems_task_mode( + RTEMS_CURRENT_MODE, + RTEMS_CURRENT_MODE, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - get current mode - previous mode: ", + previous_mode + ); + +/* END OF CURRENT MODE */ + + puts( "*** END OF TEST 8 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp09/delay.c b/testsuites/sptests/sp09/delay.c new file mode 100644 index 0000000000..dd78610be8 --- /dev/null +++ b/testsuites/sptests/sp09/delay.c @@ -0,0 +1,28 @@ +/* Delayed_routine + * + * This routine is used as the timer routine for Timer Manager tests. + * + * Input parameters: + * ignored - this parameter is ignored + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_timer_service_routine Delayed_routine( + rtems_id ignored_id, + void *ignored_address +) +{ +} diff --git a/testsuites/sptests/sp09/init.c b/testsuites/sptests/sp09/init.c new file mode 100644 index 0000000000..3ca4b62404 --- /dev/null +++ b/testsuites/sptests/sp09/init.c @@ -0,0 +1,123 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 9 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' ); + Task_name[ 7 ] = rtems_build_name( 'T', 'A', '7', ' ' ); + Task_name[ 8 ] = rtems_build_name( 'T', 'A', '8', ' ' ); + Task_name[ 9 ] = rtems_build_name( 'T', 'A', '9', ' ' ); + Task_name[ 10 ] = rtems_build_name( 'T', 'A', 'A', ' ' ); + + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + + Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' ); + Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' ); + Semaphore_name[ 3 ] = rtems_build_name( 'S', 'M', '3', ' ' ); + + Queue_name[ 1 ] = rtems_build_name( 'M', 'Q', '1', ' ' ); + Queue_name[ 2 ] = rtems_build_name( 'M', 'Q', '2', ' ' ); + + Partition_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' ); + + Region_name[ 1 ] = rtems_build_name( 'R', 'N', '1', ' ' ); + + Port_name[ 1 ] = rtems_build_name( 'D', 'P', '1', ' ' ); + + Period_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + +#if 0 + status = rtems_task_create( + Task_name[1], + 4, + 10, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_task_create with illegal stack size" + ); + puts( "INIT - rtems_task_create - RTEMS_INVALID_SIZE" ); +#endif + puts( "INIT - rtems_task_create - RTEMS_INVALID_SIZE -- NOT CHECKED" ); + + status = rtems_task_create( + Task_name[1], + 0, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + fatal_directive_status( + status, + RTEMS_INVALID_PRIORITY, + "rtems_task_create with illegal priority" + ); + puts( "INIT - rtems_task_create - RTEMS_INVALID_PRIORITY" ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_restart( Task_id[ 1 ], 0 ); + fatal_directive_status( + status, + RTEMS_INCORRECT_STATE, + "rtems_task_restart of DORMANT task" + ); + puts( "INIT - rtems_task_restart - RTEMS_INCORRECT_STATE" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp09/isr.c b/testsuites/sptests/sp09/isr.c new file mode 100644 index 0000000000..292e9c0225 --- /dev/null +++ b/testsuites/sptests/sp09/isr.c @@ -0,0 +1,27 @@ +/* Service_routine + * + * This routine is used as the timer routine for Interrupt Manager tests. + * + * Input parameters: + * ignored - this parameter is ignored + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_isr Service_routine( + rtems_vector_number ignored +) +{ +} diff --git a/testsuites/sptests/sp09/screen01.c b/testsuites/sptests/sp09/screen01.c new file mode 100644 index 0000000000..39012f5051 --- /dev/null +++ b/testsuites/sptests/sp09/screen01.c @@ -0,0 +1,168 @@ +/* Screen1 + * + * This routine generates error screen 1 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen1() +{ + rtems_unsigned32 notepad_value; + rtems_id self_id; + rtems_task_priority previous_priority; + rtems_status_code status; + + status = rtems_task_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_delete with illegal id" + ); + puts( "TA1 - rtems_task_delete - RTEMS_INVALID_ID" ); + + status = rtems_task_get_note( RTEMS_SELF, 100, ¬epad_value ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_task_get_note with illegal notepad" + ); + puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_NUMBER" ); + + status = rtems_task_get_note( 100, RTEMS_NOTEPAD_LAST, ¬epad_value ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_get_note with illegal id" + ); + puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ID" ); + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &self_id ); + directive_failed( status, "rtems_task_ident of self" ); + + if ( self_id != Task_id[ 1 ] ) { + puts( "ERROR - rtems_task_ident - incorrect ID returned!" ); + } + puts( "TA1 - rtems_task_ident - current task RTEMS_SUCCESSFUL" ); + + status = rtems_task_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_task_ident with illegal name (local)" + ); + puts( "TA1 - rtems_task_ident - global RTEMS_INVALID_NAME" ); + + status = rtems_task_ident( 100, 1, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_task_ident with illegal name (global)" + ); + puts( "TA1 - rtems_task_ident - local RTEMS_INVALID_NAME" ); + + status = rtems_task_ident( 100, 2, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NODE, + "rtems_task_ident with illegal node" + ); + puts( "TA1 - rtems_task_ident - RTEMS_INVALID_NODE" ); + + status = rtems_task_restart( 100, 0 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_restart with illegal id" + ); + puts( "TA1 - rtems_task_restart - RTEMS_INVALID_ID" ); + + status = rtems_task_resume( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_resume with illegal id" + ); + puts( "TA1 - rtems_task_resume - RTEMS_INVALID_ID" ); + + status = rtems_task_resume( RTEMS_SELF ); + fatal_directive_status( + status, + RTEMS_INCORRECT_STATE, + "rtems_task_resume of ready task" + ); + puts( "TA1 - rtems_task_resume - RTEMS_INCORRECT_STATE" ); + + status = rtems_task_set_priority( RTEMS_SELF, 512, &previous_priority ); + fatal_directive_status( + status, + RTEMS_INVALID_PRIORITY, + "rtems_task_set_priority with illegal priority" + ); + puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_PRIORITY" ); + + status = rtems_task_set_priority( 100, 8, &previous_priority ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_set_priority with illegal id" + ); + puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_ID" ); + + status = rtems_task_set_note( + RTEMS_SELF, + RTEMS_NOTEPAD_LAST+10, + notepad_value + ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_task_set_note with illegal notepad" + ); + puts( "TA1 - rtems_task_set_note - RTEMS_INVALID_NUMBER" ); + + status = rtems_task_set_note( 100, RTEMS_NOTEPAD_LAST, notepad_value ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_set_note with illegal id" + ); + puts( "TA1 - rtems_task_set_note - RTEMS_INVALID_ID" ); + + status = rtems_task_start( 100, Task_1, 0 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_start with illegal id" + ); + puts( "TA1 - rtems_task_start - RTEMS_INVALID_ID" ); + + status = rtems_task_start( 0, Task_1, 0 ); + fatal_directive_status( + status, + RTEMS_INCORRECT_STATE, + "rtems_task_start of ready task" + ); + puts( "TA1 - rtems_task_start - RTEMS_INCORRECT_STATE" ); + + status = rtems_task_suspend( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_suspend with illegal id" + ); + puts( "TA1 - rtems_task_suspend - RTEMS_INVALID_ID" ); +} diff --git a/testsuites/sptests/sp09/screen02.c b/testsuites/sptests/sp09/screen02.c new file mode 100644 index 0000000000..02eb5e4498 --- /dev/null +++ b/testsuites/sptests/sp09/screen02.c @@ -0,0 +1,192 @@ +/* Screen2 + * + * This routine generates error screen 2 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen2() +{ + rtems_time_of_day time; + rtems_status_code status; + +/* errors before clock is set */ + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + if ( status == RTEMS_SUCCESSFUL ) { + puts( + "TA1 - rtems_clock_get - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?" + ); + } else { + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_clock_get before clock is set" + ); + puts( "TA1 - rtems_clock_get - RTEMS_NOT_DEFINED" ); + } + + status = rtems_task_wake_when( &time ); + if ( status == RTEMS_SUCCESSFUL ) { + puts( +"TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?" + ); + } else { + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_task_wake_when before clock is set" + ); + puts( "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED" ); + } + + status = rtems_timer_fire_when( 0, &time, Delayed_routine, NULL ); + if ( status == RTEMS_SUCCESSFUL ) { + puts( + "TA1 - timer_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?" + ); + } else { + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "task_fire_when before clock is set" + ); + puts( "TA1 - rtems_timer_fire_when - RTEMS_NOT_DEFINED" ); + } + + build_time( &time, 2, 5, 1987, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid year" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 15, 5, 1988, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid month" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 32, 1988, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid day" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 25, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid hour" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 8, 61, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid minute" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 8, 30, 61, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid second" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 8, 30, 45, TICKS_PER_SECOND + 1 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid ticks per second" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set successful" ); + puts( " - RTEMS_SUCCESSFUL" ); + +/* rtems_task_wake_when */ + + build_time( &time, 2, 5, 1988, 8, 30, 48, TICKS_PER_SECOND + 1 ); + time.second += 3; + puts( "TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds" ); + + status = rtems_task_wake_when( &time ); + directive_failed( + status, + "rtems_task_wake_when with invalid ticks per second" + ); + puts( "TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL" ); + + build_time( &time, 2, 5, 1961, 8, 30, 48, 0 ); + print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); + status = rtems_task_wake_when( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_task_wake_when with invalid year" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 25, 30, 48, 0 ); + print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); + status = rtems_task_wake_when( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_task_wake_when with invalid hour" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + print_time( "TA1 - current time - ", &time, "\n" ); + + time.month = 1; + print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); + status = rtems_task_wake_when( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_task_wake_when before current time" + ); + puts( " - RTEMS_INVALID_CLOCK" ); +} diff --git a/testsuites/sptests/sp09/screen03.c b/testsuites/sptests/sp09/screen03.c new file mode 100644 index 0000000000..7f431c45df --- /dev/null +++ b/testsuites/sptests/sp09/screen03.c @@ -0,0 +1,204 @@ +/* Screen3 + * + * This routine generates error screen 3 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +extern rtems_configuration_table BSP_Configuration; + +void Screen3() +{ + rtems_name task_name; + rtems_status_code status; + + task_name = 1; + status = rtems_task_create( + 0, + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_task_create with illegal name" + ); + puts( "TA1 - rtems_task_create - RTEMS_INVALID_NAME" ); + + status = rtems_task_create( + task_name, + 1, + BSP_Configuration.work_space_size, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_task_create with a stack size larger than the workspace" + ); + puts( "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED" ); + + status = rtems_task_create( + Task_name[ 2 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + puts( "TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_suspend( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_suspend of TA2" ); + puts( "TA1 - rtems_task_suspend - suspend TA2 - RTEMS_SUCCESSFUL" ); + + status = rtems_task_suspend( Task_id[ 2 ] ); + fatal_directive_status( + status, + RTEMS_ALREADY_SUSPENDED, + "rtems_task_suspend of suspended TA2" + ); + puts( "TA1 - rtems_task_suspend - suspend TA2 - RTEMS_ALREADY_SUSPENDED" ); + + status = rtems_task_resume( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_resume of TA2" ); + puts( "TA1 - rtems_task_resume - TA2 resumed - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 3 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + puts( "TA1 - rtems_task_create - TA3 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 4 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 4 ] + ); + directive_failed( status, "rtems_task_create of TA4" ); + puts( "TA1 - rtems_task_create - 4 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 5 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 5 ] + ); + directive_failed( status, "rtems_task_create of TA5" ); + puts( "TA1 - rtems_task_create - 5 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 6 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 6 ] + ); + directive_failed( status, "rtems_task_create of TA6" ); + puts( "TA1 - rtems_task_create - 6 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 7 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 7 ] + ); + directive_failed( status, "rtems_task_create of TA7" ); + puts( "TA1 - rtems_task_create - 7 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 8 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 8 ] + ); + directive_failed( status, "rtems_task_create of TA8" ); + puts( "TA1 - rtems_task_create - 8 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 9 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 9 ] + ); + directive_failed( status, "rtems_task_create of TA9" ); + puts( "TA1 - rtems_task_create - 9 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 10 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 10 ] + ); + directive_failed( status, "rtems_task_create of TA10" ); + puts( "TA1 - rtems_task_create - 10 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + task_name, + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_task_create for too many tasks" + ); + puts( "TA1 - rtems_task_create - 11 - RTEMS_TOO_MANY" ); + + status = rtems_task_create( + task_name, + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_GLOBAL, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_MP_NOT_CONFIGURED, + "rtems_task_create of global task in a single cpu system" + ); + puts( "TA1 - rtems_task_create - RTEMS_MP_NOT_CONFIGURED" ); +} diff --git a/testsuites/sptests/sp09/screen04.c b/testsuites/sptests/sp09/screen04.c new file mode 100644 index 0000000000..6e3866cb05 --- /dev/null +++ b/testsuites/sptests/sp09/screen04.c @@ -0,0 +1,85 @@ +/* Screen4 + * + * This routine generates error screen 4 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen4() +{ + rtems_event_set event_out; + rtems_time_of_day time; + rtems_status_code status; + + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &event_out + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_event_receive unsatisfied (ALL)" + ); + puts( "TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( all conditions )" ); + + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_EVENT_ANY | RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &event_out + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_event_receive unsatisfied (ANY)" + ); + puts( "TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( any condition )" ); + + puts( "TA1 - rtems_event_receive - timeout in 3 seconds" ); + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_DEFAULT_OPTIONS, + 3 * TICKS_PER_SECOND, + &event_out + ); + fatal_directive_status( + status, + RTEMS_TIMEOUT, + "rtems_event_receive" + ); + puts( "TA1 - rtems_event_receive - woke up with RTEMS_TIMEOUT" ); + + status = rtems_event_send( 100, RTEMS_EVENT_16 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_event_send with illegal id" + ); + puts( "TA1 - rtems_event_send - RTEMS_INVALID_ID" ); + + puts( "TA1 - rtems_task_wake_after - sleep 1 second - RTEMS_SUCCESSFUL" ); + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + build_time( &time, 2, 5, 1988, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + puts( " - RTEMS_SUCCESSFUL" ); +} diff --git a/testsuites/sptests/sp09/screen05.c b/testsuites/sptests/sp09/screen05.c new file mode 100644 index 0000000000..9b091a407a --- /dev/null +++ b/testsuites/sptests/sp09/screen05.c @@ -0,0 +1,148 @@ +/* Screen5 + * + * This routine generates error screen 5 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen5() +{ + rtems_status_code status; + + status = rtems_semaphore_create( 0, 1, RTEMS_DEFAULT_ATTRIBUTES, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_semaphore_create with illegal name" + ); + puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_NAME" ); + + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 1, + RTEMS_DEFAULT_ATTRIBUTES, + &Semaphore_id[ 1 ] + ); + directive_failed( status, "rtems_semaphore_create" ); + puts( "TA1 - rtems_semaphore_create - 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_semaphore_create( + Semaphore_name[ 2 ], + 1, + RTEMS_BINARY_SEMAPHORE, + &Semaphore_id[ 2 ] + ); + directive_failed( status, "rtems_semaphore_create" ); + puts( "TA1 - rtems_semaphore_create - 2 - RTEMS_SUCCESSFUL" ); + + status = rtems_semaphore_create( + Semaphore_name[ 3 ], + 1, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_semaphore_create of too many" + ); + puts( "TA1 - rtems_semaphore_create - 3 - RTEMS_TOO_MANY" ); + + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 1, + RTEMS_INHERIT_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_FIFO, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_semaphore_create of RTEMS_FIFO RTEMS_INHERIT_PRIORITY" + ); + puts( "TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED" ); + + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 1, + RTEMS_INHERIT_PRIORITY | RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_semaphore_create of RTEMS_COUNTING_SEMAPHORE RTEMS_INHERIT_PRIORITY" + ); + puts( "TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED" ); + + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 2, + RTEMS_BINARY_SEMAPHORE, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_semaphore_create of binary semaphore with count > 1" + ); + puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_NUMBER" ); + + status = rtems_semaphore_create( + Semaphore_name[ 3 ], + 1, + RTEMS_GLOBAL, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_MP_NOT_CONFIGURED, + "rtems_semaphore_create of mp not configured" + ); + puts( "TA1 - rtems_semaphore_create - RTEMS_MP_NOT_CONFIGURED" ); + + status = rtems_semaphore_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_semaphore_delete with illegal id" + ); + puts( "TA1 - rtems_semaphore_delete - unknown RTEMS_INVALID_ID" ); + + status = rtems_semaphore_delete( 0x010100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_semaphore_delete with local illegal id" + ); + puts( "TA1 - rtems_semaphore_delete - local RTEMS_INVALID_ID" ); + + status = rtems_semaphore_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_semaphore_ident will illegal name (local)" + ); + puts( "TA1 - rtems_semaphore_ident - global RTEMS_INVALID_NAME" ); + + status = rtems_semaphore_ident( 100, 1, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_semaphore_ident will illegal name (global)" + ); + puts( "TA1 - rtems_semaphore_ident - local RTEMS_INVALID_NAME" ); +} diff --git a/testsuites/sptests/sp09/screen06.c b/testsuites/sptests/sp09/screen06.c new file mode 100644 index 0000000000..40ad75d606 --- /dev/null +++ b/testsuites/sptests/sp09/screen06.c @@ -0,0 +1,125 @@ +/* Screen6 + * + * This routine generates error screen 6 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen6() +{ + rtems_status_code status; + + status = rtems_semaphore_obtain( + 100, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_semaphore_obtain with illegal id" + ); + puts( "TA1 - rtems_semaphore_obtain - RTEMS_INVALID_ID" ); + + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain successful" ); + puts( "TA1 - rtems_semaphore_obtain - got sem 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_semaphore_obtain not available" + ); + puts( "TA1 - rtems_semaphore_obtain - RTEMS_UNSATISFIED" ); + + puts( "TA1 - rtems_semaphore_obtain - timeout in 3 seconds" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + 3 * TICKS_PER_SECOND + ); + fatal_directive_status( + status, + RTEMS_TIMEOUT, + "rtems_semaphore_obtain timeout" + ); + puts( "TA1 - rtems_semaphore_obtain - woke up with RTEMS_TIMEOUT" ); + + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + fatal_directive_status( + status, + RTEMS_NOT_OWNER_OF_RESOURCE, + "rtems_semaphore_release and not owner" + ); + puts( "TA1 - rtems_semaphore_release - RTEMS_NOT_OWNER_OF_RESOURCE" ); + + status = rtems_semaphore_release( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_semaphore_release with illegal id" + ); + puts( "TA1 - rtems_semaphore_release - RTEMS_INVALID_ID" ); + + puts( "TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL" ); + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after (yield)" ); + + puts( "TA1 - rtems_semaphore_delete - delete sem 1 - RTEMS_SUCCESSFUL" ); + status = rtems_semaphore_delete( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_delete of SM1" ); + + puts( "TA1 - rtems_semaphore_obtain - binary semaphore" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 2 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain"); + + puts( "TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE" ); + status = rtems_semaphore_delete( Semaphore_id[ 2 ] ); + fatal_directive_status( + status, + RTEMS_RESOURCE_IN_USE, + "rtems_semaphore_delete of SM2" + ); + + puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after (yield)" ); + + status = rtems_task_delete( Task_id[ 2 ] ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_delete after the task has been deleted" + ); +} diff --git a/testsuites/sptests/sp09/screen07.c b/testsuites/sptests/sp09/screen07.c new file mode 100644 index 0000000000..fd808f833d --- /dev/null +++ b/testsuites/sptests/sp09/screen07.c @@ -0,0 +1,184 @@ +/* Screen7 + * + * This routine generates error screen 7 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen7() +{ + long buffer[ 4 ]; + rtems_unsigned32 count; + rtems_status_code status; + + status = rtems_message_queue_broadcast( 100, (long (*)[4]) buffer, &count ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_message_queue_broadcast with illegal id" + ); + puts( "TA1 - rtems_message_queue_broadcast - RTEMS_INVALID_ID" ); + + status = rtems_message_queue_create( + 0, + 3, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_message_queue_create with illegal name" + ); + + puts( "TA1 - rtems_message_queue_create - Q 1 - RTEMS_INVALID_NAME" ); + status = rtems_message_queue_create( + Queue_name[ 1 ], + 1, + RTEMS_GLOBAL, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_MP_NOT_CONFIGURED, + "rtems_message_queue_create of mp not configured" + ); + puts( "TA1 - rtems_message_queue_create - Q 1 - RTEMS_MP_NOT_CONFIGURED" ); + + status = rtems_message_queue_create( + Queue_name[ 1 ], + 2, + RTEMS_LIMIT, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create successful" ); + puts( + "TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL" + ); + + status = rtems_message_queue_create( + Queue_name[ 2 ], + 1, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_message_queue_create of too many" + ); + puts( "TA1 - rtems_message_queue_create - Q 2 - RTEMS_TOO_MANY" ); + + status = rtems_message_queue_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_message_queue_create with illegal id" + ); + puts( "TA1 - rtems_message_queue_delete - unknown RTEMS_INVALID_ID" ); + + status = rtems_message_queue_delete( 0x10100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_message_queue_delete with local illegal id" + ); + puts( "TA1 - rtems_message_queue_delete - local RTEMS_INVALID_ID" ); + + status = rtems_message_queue_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_message_queue_ident with illegal name" + ); + puts( "TA1 - rtems_message_queue_ident - RTEMS_INVALID_NAME" ); + + status = rtems_message_queue_flush( 100, &count ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_message_queue_flush with illegal id" + ); + puts( "TA1 - rtems_message_queue_flush - RTEMS_INVALID_ID" ); + + status = rtems_message_queue_receive( + 100, + (long (*)[4]) buffer, + RTEMS_DEFAULT_OPTIONS, + 0 + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_message_queue_receive wit illegal id" + ); + puts( "TA1 - rtems_message_queue_receive - RTEMS_INVALID_ID" ); + + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4]) buffer, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_message_queue_receive unsatisfied" + ); + puts( "TA1 - rtems_message_queue_receive - Q 1 - RTEMS_UNSATISFIED" ); + + puts( "TA1 - rtems_message_queue_receive - Q 1 - timeout in 3 seconds" ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4]) buffer, + RTEMS_DEFAULT_OPTIONS, + 3 * TICKS_PER_SECOND + ); + fatal_directive_status( + status, + RTEMS_TIMEOUT, + "rtems_message_queue_receive 3 second timeout" + ); + + puts( + "TA1 - rtems_message_queue_receive - Q 1 - woke up with RTEMS_TIMEOUT" + ); + + status = rtems_message_queue_send( 100, (long (*)[4]) buffer ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_message_queue_send with illegal id" + ); + puts( "TA1 - rtems_message_queue_send - RTEMS_INVALID_ID" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4]) buffer ); + directive_failed( status, "rtems_message_queue_send" ); + puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4]) buffer ); + directive_failed( status, "rtems_message_queue_send" ); + puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4]) buffer ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_message_queue_send too many to a limited queue" + ); + puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY" ); +} diff --git a/testsuites/sptests/sp09/screen08.c b/testsuites/sptests/sp09/screen08.c new file mode 100644 index 0000000000..18c9b8d2d8 --- /dev/null +++ b/testsuites/sptests/sp09/screen08.c @@ -0,0 +1,121 @@ +/* Screen8 + * + * This routine generates error screen 8 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen8() +{ + long buffer[ 4 ]; + rtems_status_code status; + + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete successful" ); + puts( "TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_create( + Queue_name[ 1 ], + 2, + RTEMS_LIMIT, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create successful" ); + puts( + "TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL" + ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send successful" ); + puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send successful" ); + puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_message_queue_send too many to limited queue" + ); + puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY" ); + + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete successful" ); + puts( "TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_create( + Queue_name[ 1 ], + 3, + RTEMS_LIMIT, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create successful" ); + puts( + "TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL" + ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send successful" ); + puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send successful" ); + puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_message_queue_send too many to limited queue" + ); + puts( + "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_UNSATISFIED" + ); + + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete successful" ); + puts( "TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_create( + Queue_name[ 1 ], + 3, + RTEMS_LIMIT, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create successful" ); + puts( + "TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL" + ); + + puts( "TA1 - rtems_task_start - start TA3 - RTEMS_SUCCESSFUL" ); + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after (yield)" ); + + puts( "TA1 - rtems_message_queue_delete - delete Q 1 - RTEMS_SUCCESSFUL" ); + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete successful" ); + + puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after (yield)" ); +} diff --git a/testsuites/sptests/sp09/screen09.c b/testsuites/sptests/sp09/screen09.c new file mode 100644 index 0000000000..5c6eece679 --- /dev/null +++ b/testsuites/sptests/sp09/screen09.c @@ -0,0 +1,140 @@ +/* Screen9 + * + * This routine generates error screen 9 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen9() +{ + void *converted; + rtems_status_code status; + rtems_isr_entry old_service_routine; + + status = rtems_interrupt_catch( Service_routine, 500, &old_service_routine ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_interrupt_catch with invalid vector" + ); + puts( "TA1 - rtems_interrupt_catch - RTEMS_INVALID_NUMBER" ); + + status = rtems_interrupt_catch( NULL, 3, &old_service_routine ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_interrupt_catch with invalid handler" + ); + puts( "TA1 - rtems_interrupt_catch - RTEMS_INVALID_ADDRESS" ); + + status = rtems_signal_send( 100, RTEMS_SIGNAL_1 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_signal_send with illegal id" + ); + puts( "TA1 - rtems_signal_send - RTEMS_INVALID_ID" ); + + status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_16 ); + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_signal_send with no handler" + ); + puts( "TA1 - rtems_signal_send - RTEMS_NOT_DEFINED" ); + + status = rtems_port_create( + 0, + Internal_port_area, + External_port_area, + sizeof( Internal_port_area ), + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_port_create with illegal name" + ); + puts( "TA1 - rtems_port_create - RTEMS_INVALID_NAME" ); + + status = rtems_port_create( + Port_name[ 1 ], + &((char *)Internal_port_area)[ 1 ], + External_port_area, + sizeof( Internal_port_area ), + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_port_create with illegal address" + ); + puts( "TA1 - rtems_port_create - RTEMS_INVALID_ADDRESS" ); + + status = rtems_port_create( + Port_name[ 1 ], + Internal_port_area, + External_port_area, + sizeof( Internal_port_area ), + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_port_create of too many" + ); + puts( "TA1 - rtems_port_create - RTEMS_TOO_MANY" ); + + status = rtems_port_delete( 0 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_port_delete with illegal id" + ); + puts( "TA1 - rtems_port_delete - RTEMS_INVALID_ID" ); + + status = rtems_port_ident( 0, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_port_ident with illegal name" + ); + puts( "TA1 - rtems_port_ident - RTEMS_INVALID_NAME" ); + + status = rtems_port_external_to_internal( + 100, + Internal_port_area, + &converted + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_port_external_to_internal with illegal id" + ); + puts( "TA1 - rtems_port_external_to_internal - RTEMS_INVALID_ID" ); + status = rtems_port_internal_to_external( + 100, + Internal_port_area, + &converted + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_port_internal_to_external with illegal id" + ); + puts( "TA1 - rtems_port_internal_to_external - RTEMS_INVALID_ID" ); +} diff --git a/testsuites/sptests/sp09/screen10.c b/testsuites/sptests/sp09/screen10.c new file mode 100644 index 0000000000..53a5a8d6dc --- /dev/null +++ b/testsuites/sptests/sp09/screen10.c @@ -0,0 +1,164 @@ +/* Screen10 + * + * This routine generates error screen 10 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen10() +{ + rtems_status_code status; + + status = rtems_rate_monotonic_create( 0, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_rate_monotonic_create with illegal name" + ); + puts( "TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_NAME" ); + + status = rtems_rate_monotonic_create( Period_name[ 1 ], &Period_id[ 1 ] ); + directive_failed( status, "rtems_rate_monotonic_create successful" ); + puts( "TA1 - rtems_rate_monotonic_create - RTEMS_SUCCESSFUL" ); + + status = rtems_rate_monotonic_create( Period_name[ 1 ], &Junk_id ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_rate_monotonic_create of too many" + ); + puts( "TA1 - rtems_rate_monotonic_create - RTEMS_TOO_MANY" ); + + status = rtems_rate_monotonic_ident( 0, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_rate_monotonic_ident with illegal name" + ); + puts( "TA1 - rtems_rate_monotonic_ident - RTEMS_INVALID_NAME" ); + + status = rtems_rate_monotonic_period( 100, 5 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_period with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_period - unknown RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_period( 0x10100, 5 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_period with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_period - local RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], RTEMS_PERIOD_STATUS ); + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_rate_monotonic_period status not defined" + ); + puts( + "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_NOT_DEFINED" + ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], 100 ); + directive_failed( status, "rtems_rate_monotonic_period successful" ); + puts( "TA1 - rtems_rate_monotonic_period - 100 ticks - RTEMS_SUCCESSFUL" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], RTEMS_PERIOD_STATUS ); + directive_failed( status, "rtems_rate_monotonic_period status" ); + puts( + "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_SUCCESSFUL" + ); + + while ( FOREVER ) { + + status = rtems_rate_monotonic_period(Period_id[ 1 ], RTEMS_PERIOD_STATUS); + + if ( status == RTEMS_TIMEOUT ) break; + + directive_failed( + status, + "rtems_rate_monotonic_period waiting for timeout" + ); + } + puts( + "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_TIMEOUT" + ); + + status = rtems_rate_monotonic_cancel( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_cancel with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_cancel - unknown RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_cancel( 0x10100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_cancel will illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_cancel - local RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_cancel( Period_id[ 1 ] ); + directive_failed( status, "rtems_rate_monotonic_cancel" ); + puts( "TA1 - rtems_rate_monotonic_cancel - RTEMS_SUCCESSFUL" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 ); + directive_failed( status, "rtems_rate_monotonic_period restart" ); + + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 ); + fatal_directive_status( + status, + RTEMS_TIMEOUT, + "rtems_rate_monotonic_period" + ); + puts( "TA1 - rtems_rate_monotonic_period - 5 ticks - RTEMS_TIMEOUT" ); + + status = rtems_task_start( Task_id[ 4 ], Task_4, 0 ); + directive_failed( status, "rtems_task_start of TA4" ); + + puts( "TA1 - yielding to TA4" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + + status = rtems_rate_monotonic_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_delete with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_delete - unknown RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_delete( 0x10100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_delete with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_delete - local RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_delete( Period_id[ 1 ] ); + directive_failed( status, "rtems_rate_monotonic_delete" ); + puts( "TA1 - rtems_rate_monotonic_delete - RTEMS_SUCCESSFUL" ); +} diff --git a/testsuites/sptests/sp09/screen11.c b/testsuites/sptests/sp09/screen11.c new file mode 100644 index 0000000000..8c13cd2490 --- /dev/null +++ b/testsuites/sptests/sp09/screen11.c @@ -0,0 +1,250 @@ +/* Screen11 + * + * This routine generates error screen 11 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen11() +{ + void *buffer_address_1; + void *buffer_address_2; + void *buffer_address_3; + rtems_status_code status; + + status = rtems_partition_create( + 0, + Partition_good_area, + 128, + 40, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_partition_create with illegal name" + ); + puts( "TA1 - rtems_partition_create - RTEMS_INVALID_NAME" ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_good_area, + 0, + 80, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_partition_create with illegal length" + ); + puts( "TA1 - rtems_partition_create - length - RTEMS_INVALID_SIZE" ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_good_area, + 128, + 0, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_partition_create with illegal buffer size" + ); + puts( "TA1 - rtems_partition_create - buffer size - RTEMS_INVALID_SIZE" ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_good_area, + 128, + 256, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_partition_create with buffer_size > length" + ); + puts( + "TA1 - rtems_partition_create - length < buffer size - RTEMS_INVALID_SIZE" + ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_good_area, + 128, + 64, + RTEMS_GLOBAL, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_MP_NOT_CONFIGURED, + "rtems_partition_create of global" + ); + puts( "TA1 - rtems_partition_create - RTEMS_MP_NOT_CONFIGURED" ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_bad_area, + 128, + 64, + RTEMS_GLOBAL, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_partition_create with bad address" + ); + puts( "TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS" ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_good_area, + 128, + 34, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_partition_create with unaligned buffer_size" + ); + puts( "TA1 - rtems_partition_create - RTEMS_INVALID_SIZE" ); + + status = rtems_partition_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_partition_delete with illegal id" + ); + puts( "TA1 - rtems_partition_delete - unknown RTEMS_INVALID_ID" ); + + status = rtems_partition_delete( 0x10100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_partition_delete with illegal id" + ); + puts( "TA1 - rtems_partition_delete - local RTEMS_INVALID_ID" ); + + status = rtems_partition_get_buffer( 100, &buffer_address_1 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_partition_get_buffer with illegal id" + ); + puts( "TA1 - rtems_partition_get_buffer - RTEMS_INVALID_ID" ); + + status = rtems_partition_ident( 0, RTEMS_SEARCH_ALL_NODES, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_partition_ident with illegal name" + ); + puts( "TA1 - rtems_partition_ident - RTEMS_INVALID_NAME" ); + + status = rtems_partition_return_buffer( 100, buffer_address_1 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_partition_return_buffer with illegal id" + ); + puts( "TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ID" ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_good_area, + 128, + 64, + RTEMS_DEFAULT_ATTRIBUTES, + &Partition_id[ 1 ] + ); + directive_failed( status, "rtems_partition_create" ); + puts( "TA1 - rtems_partition_create - RTEMS_SUCCESSFUL" ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_good_area, + 128, + 32, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_partition_create of too many" + ); + puts( "TA1 - rtems_partition_create - RTEMS_TOO_MANY" ); + + status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_1 ); + directive_failed( status, "rtems_partition_get_buffer"); + puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" ); + + status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_2 ); + directive_failed( status, "rtems_partition_get_buffer" ); + puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" ); + + status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_3 ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_partition_get_buffer unsatisfied" + ); + puts( "TA1 - rtems_partition_get_buffer - RTEMS_UNSATISFIED" ); + + status = rtems_partition_delete( Partition_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_RESOURCE_IN_USE, + "rtems_partition_delete with buffers in use" + ); + puts( "TA1 - rtems_partition_delete - RTEMS_RESOURCE_IN_USE" ); + + status = rtems_partition_return_buffer( + Partition_id[ 1 ], + Region_good_area /* NOTE: Region Memory */ + ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_partition_return_buffer with buffer address out of partition" + ); + puts( + "TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - out of range" + ); + + status = rtems_partition_return_buffer( + Partition_id[ 1 ], + &Partition_good_area[ 7 ] + ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_partition_return_buffer with buffer address not on boundary" + ); + puts_nocr( "TA1 - rtems_partition_return_buffer - " ); + puts ( "RTEMS_INVALID_ADDRESS - not on boundary"); +} diff --git a/testsuites/sptests/sp09/screen12.c b/testsuites/sptests/sp09/screen12.c new file mode 100644 index 0000000000..300d54043a --- /dev/null +++ b/testsuites/sptests/sp09/screen12.c @@ -0,0 +1,327 @@ +/* Screen12 + * + * This routine generates error screen 12 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen12() +{ + void *segment_address_1; + void *segment_address_2; + void *segment_address_3; + rtems_unsigned32 offset; + rtems_unsigned32 good_front_flag; + rtems_unsigned32 good_back_flag; + rtems_status_code status; + + status = rtems_region_create( + 0, + Region_good_area, + 128, + 32, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_region_create with illegal name" + ); + puts( "TA1 - rtems_region_create - RTEMS_INVALID_NAME" ); + + status = rtems_region_create( + Region_name[ 1 ], + Region_bad_area, + 128, + 32, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_region_create with illegal address" + ); + puts( "TA1 - rtems_region_create - RTEMS_INVALID_ADDRESS" ); + + status = rtems_region_create( + Region_name[ 1 ], + Region_good_area, + 128, + 34, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_region_create with illegal size" + ); + puts( "TA1 - rtems_region_create - RTEMS_INVALID_SIZE" ); + + status = rtems_region_create( + Region_name[ 1 ], + &Region_good_area[ REGION_START_OFFSET ], + REGION_LENGTH, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &Region_id[ 1 ] + ); + directive_failed( status, "rtems_region_create" ); + puts( "TA1 - rtems_region_create - RTEMS_SUCCESSFUL" ); + + status = rtems_region_create( + Region_name[ 1 ], + Region_good_area, + 512, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_region_create of too many" + ); + puts( "TA1 - rtems_region_create - RTEMS_TOO_MANY" ); + + status = rtems_region_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_region_delete with illegal id" + ); + puts( "TA1 - rtems_region_delete - unknown RTEMS_INVALID_ID" ); + + status = rtems_region_delete( 0x10100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_region_delete with illegal id" + ); + puts( "TA1 - rtems_region_delete - local RTEMS_INVALID_ID" ); + + status = rtems_region_ident( 0, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_region_ident with illegal name" + ); + puts( "TA1 - rtems_region_ident - RTEMS_INVALID_NAME" ); + + status = rtems_region_get_segment( + 100, + 128, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_region_get_segment with illegal id" + ); + puts( "TA1 - rtems_region_get_segment - RTEMS_INVALID_ID" ); + + status = rtems_region_get_segment( + Region_id[ 1 ], + sizeof( Region_good_area ) * 2, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_region_get_segment with illegal size" + ); + puts( "TA1 - rtems_region_get_segment - RTEMS_INVALID_SIZE" ); + + status = rtems_region_get_segment( + Region_id[ 1 ], + 384, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts( "TA1 - rtems_region_get_segment - RTEMS_SUCCESSFUL" ); + + status = rtems_region_get_segment( + Region_id[ 1 ], + 384, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &segment_address_2 + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_region_get_segment unsatisfied" + ); + puts( "TA1 - rtems_region_get_segment - RTEMS_UNSATISFIED" ); + + puts( "TA1 - rtems_region_get_segment - timeout in 3 seconds" ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 128, + RTEMS_DEFAULT_OPTIONS, + 3 * TICKS_PER_SECOND, + &segment_address_3 + ); + fatal_directive_status( + status, + RTEMS_TIMEOUT, + "rtems_region_get_segment timeout" + ); + puts( "TA1 - rtems_region_get_segment - woke up with RTEMS_TIMEOUT" ); + + status = rtems_region_delete( Region_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_RESOURCE_IN_USE, + "rtems_region_delete with buffers in use" + ); + puts( "TA1 - rtems_region_delete - RTEMS_RESOURCE_IN_USE" ); + + status = rtems_region_return_segment( 100, segment_address_1 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_region_return_segment with illegal id" + ); + puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ID" ); + + status = rtems_region_return_segment( Region_id[ 1 ], Region_good_area ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_region_return_segment with illegal segment" + ); + puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" ); + +/* + * The following generate internal heap errors. Thus this code + * is subject to change if the heap code changes. + */ + + puts( "TA1 - rtems_debug_disable - RTEMS_DEBUG_REGION" ); + rtems_debug_disable( RTEMS_DEBUG_REGION ); + + offset = (segment_address_1 - (void *)Region_good_area) / 4; + +/* bad FRONT_FLAG error */ + + good_front_flag = Region_good_area[ offset - 1 ]; + Region_good_area[ offset - 1 ] = good_front_flag + 2; + + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_region_return_segment with back_flag != front_flag" + ); + puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" ); + + Region_good_area[ offset - 1 ] = good_front_flag; + +/* bad FRONT_FLAG error */ + + good_back_flag = Region_good_area[ offset - 2 ]; + Region_good_area[ offset - 2 ] = 1024; + + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_region_return_segment with back_flag != front_flag" + ); + puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" ); + + Region_good_area[ offset - 2 ] = good_back_flag; + + puts( "TA1 - rtems_debug_enable - RTEMS_DEBUG_REGION" ); + rtems_debug_enable( RTEMS_DEBUG_REGION ); + + status = rtems_region_extend( + 100, + Region_good_area, + 128 + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_region_extend with illegal id" + ); + puts( "TA1 - rtems_region_extend - RTEMS_INVALID_ID" ); + + status = rtems_region_extend( + Region_id[ 1 ], + &Region_good_area[ REGION_START_OFFSET + 16 ], + 128 + ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_region_extend with illegal starting address" + ); + puts( "TA1 - rtems_region_extend - within heap - RTEMS_INVALID_ADDRESS" ); + + status = rtems_region_extend( + Region_id[ 1 ], + Region_bad_area, + 128 + ); + fatal_directive_status( + status, + RTEMS_NOT_IMPLEMENTED, + "rtems_region_extend with unsupported starting address" + ); + puts( + "TA1 - rtems_region_extend - non-contiguous lower - RTEMS_NOT_IMPLEMENTED" + ); + + status = rtems_region_extend( + Region_id[ 1 ], + &Region_good_area[ REGION_START_OFFSET - REGION_LENGTH ], + 128 + ); + fatal_directive_status( + status, + RTEMS_NOT_IMPLEMENTED, + "rtems_region_extend with unsupported starting address" + ); + puts( + "TA1 - rtems_region_extend - contiguous lower - RTEMS_NOT_IMPLEMENTED" + ); + + status = rtems_region_extend( + Region_id[ 1 ], + &Region_good_area[ REGION_START_OFFSET + REGION_LENGTH + 16 ], + 128 + ); + fatal_directive_status( + status, + RTEMS_NOT_IMPLEMENTED, + "rtems_region_extend with unsupported starting address" + ); + puts( + "TA1 - rtems_region_extend - non-contiguous higher - RTEMS_NOT_IMPLEMENTED" + ); + +} diff --git a/testsuites/sptests/sp09/screen13.c b/testsuites/sptests/sp09/screen13.c new file mode 100644 index 0000000000..c96adeec40 --- /dev/null +++ b/testsuites/sptests/sp09/screen13.c @@ -0,0 +1,115 @@ +/* Screen13 + * + * This routine generates error screen 13 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen13() +{ + rtems_unsigned32 result; + rtems_time_of_day time; + rtems_status_code status; + + status = rtems_io_close( 0xffff, 0x0000, NULL, &result ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_close with bad major number" + ); + puts( "TA1 - rtems_io_close - RTEMS_INVALID_NUMBER" ); + status = rtems_io_control( 0xffff, 0x00000, NULL, &result ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_close with bad major number" + ); + puts( "TA1 - rtems_io_control - RTEMS_INVALID_NUMBER" ); + status = rtems_io_initialize( 0xffff, 0x00000, NULL, &result ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_initialize with bad major number" + ); + puts( "TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER" ); + status = rtems_io_open( 0xffff, 0x00000, NULL, &result ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_open with bad major number" + ); + puts( "TA1 - rtems_io_open - RTEMS_INVALID_NUMBER" ); + status = rtems_io_read( 0xffff, 0x00000, NULL, &result ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_read with bad major number" + ); + puts( "TA1 - rtems_io_read - RTEMS_INVALID_NUMBER" ); + status = rtems_io_write( 0xffff, 0x0ffff, NULL, &result ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_write with bad major number" + ); + puts( "TA1 - rtems_io_write - RTEMS_INVALID_NUMBER" ); + + build_time( &time, 12, 31, 2000, 23, 59, 59, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" ); + + build_time( &time, 12, 31, 1999, 23, 59, 59, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" ); + + build_time( &time, 12, 31, 2100, 23, 59, 59, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" ); + + build_time( &time, 12, 31, 2099, 23, 59, 59, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" ); + + build_time( &time, 12, 31, 1991, 23, 59, 59, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" ); +} diff --git a/testsuites/sptests/sp09/screen14.c b/testsuites/sptests/sp09/screen14.c new file mode 100644 index 0000000000..bf80f04c3c --- /dev/null +++ b/testsuites/sptests/sp09/screen14.c @@ -0,0 +1,162 @@ +/* Screen14 + * + * This routine generates error screen 14 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen14() +{ + rtems_status_code status; + rtems_time_of_day time; + + status = rtems_timer_create( 0, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_timer_create with illegal name" + ); + puts( "TA1 - rtems_timer_create - RTEMS_INVALID_NAME" ); + + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create" ); + puts( "TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_timer_create( 2, &Junk_id ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_timer_create for too many" + ); + puts( "TA1 - rtems_timer_create - 2 - RTEMS_TOO_MANY" ); + + status = rtems_timer_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_timer_delete with illegal id" + ); + puts( "TA1 - rtems_timer_delete - local RTEMS_INVALID_ID" ); + + status = rtems_timer_delete( 0x010100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_timer_delete with illegal id" + ); + puts( "TA1 - rtems_timer_delete - global RTEMS_INVALID_ID" ); + + status = rtems_timer_ident( 0, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_timer_ident with illegal name" + ); + puts( "TA1 - rtems_timer_ident - RTEMS_INVALID_NAME" ); + + status = rtems_timer_cancel( 0x010100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_timer_cancel with illegal id" + ); + puts( "TA1 - rtems_timer_cancel - RTEMS_INVALID_ID" ); + + status = rtems_timer_cancel( Timer_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_INCORRECT_STATE, + "rtems_timer_cancel before initiated" + ); + puts( "TA1 - rtems_timer_cancel - RTEMS_INCORRECT_STATE" ); + + status = rtems_timer_reset( 0x010100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_timer_reset with illegal id" + ); + puts( "TA1 - rtems_timer_reset - RTEMS_INVALID_ID" ); + + status = rtems_timer_reset( Timer_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_timer_reset before initiated" + ); + puts( "TA1 - rtems_timer_reset - RTEMS_NOT_DEFINED" ); + + status = rtems_timer_fire_after( + 0x010100, + 5 * TICKS_PER_SECOND, + Delayed_routine, + NULL + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_timer_fire_after illegal id" + ); + puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_ID" ); + + build_time( &time, 12, 31, 1994, 9, 0, 0, 0 ); + status = rtems_timer_fire_when( 0x010100, &time, Delayed_routine, NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_timer_fire_when with illegal id" + ); + puts( "TA1 - rtems_timer_fire_when - RTEMS_INVALID_ID" ); + + status = rtems_timer_fire_after( Timer_id[ 1 ], 0, Delayed_routine, NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_timer_fire_after with 0 ticks" + ); + puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER" ); + + build_time( &time, 2, 5, 1987, 8, 30, 45, 0 ); + status = rtems_timer_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_timer_fire_when with illegal time" + ); + print_time( + "TA1 - rtems_timer_fire_when - ", + &time, + " - RTEMS_INVALID_CLOCK\n" + ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_get - ", &time, "\n" ); + + build_time( &time, 2, 5, 1990, 8, 30, 45, 0 ); + status = rtems_timer_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_timer_fire_when before current time" + ); + print_time( + "TA1 - rtems_timer_fire_when - ", + &time, + " - before RTEMS_INVALID_CLOCK\n" + ); +} diff --git a/testsuites/sptests/sp09/sp09.doc b/testsuites/sptests/sp09/sp09.doc new file mode 100644 index 0000000000..f4e8391c47 --- /dev/null +++ b/testsuites/sptests/sp09/sp09.doc @@ -0,0 +1,36 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test9 + +directives: + ex_init, ex_start, tm_tick, i_return, + t_create,t_delete, t_getreg, t_ident, t_restart, t_resume, t_setpri, + t_setreg, t_start, t_suspend, tm_delete, tm_get, + tm_set, tm_wkafter, tm_wkwhen, ev_receive, ev_send, sm_create, sm_delete, + sm_ident, sm_p, sm_v, q_broadcast, q_create, q_delete, q_ident, q_receive, + q_send, q_urgent, as_catch, as_send, as_return, rn_create, rn_delete, + rn_getseg, rn_ident, rn_retseg, pt_create, pt_delete, pt_getbug, pt_ident, + pt_retbuf, de_close, de_cntrl, de_init, de_open, de_read, de_write + +concepts: + + a. Verifies all error codes returned by the executive in single + processor configurations. + + b. Verifies error conditions in the following kernel routines or macros: + _Ck_date_time, _Expired, _Q_submit, _Get_mnodes, _Get_node, + _Free_mem, _Get_mem, _Valid_block, _Set_tcb, _Set_resource, + _In_range, _On_boundary diff --git a/testsuites/sptests/sp09/sp09.scn b/testsuites/sptests/sp09/sp09.scn new file mode 100644 index 0000000000..534fc47e09 --- /dev/null +++ b/testsuites/sptests/sp09/sp09.scn @@ -0,0 +1,249 @@ +*** TEST 9 *** +INIT - rtems_task_create - RTEMS_INVALID_SIZE -- NOT CHECKED +INIT - rtems_task_create - RTEMS_INVALID_PRIORITY +INIT - rtems_task_restart - RTEMS_INCORRECT_STATE +TA1 - rtems_task_delete - RTEMS_INVALID_ID +TA1 - rtems_task_get_note - RTEMS_INVALID_NUMBER +TA1 - rtems_task_get_note - RTEMS_INVALID_ID +TA1 - rtems_task_ident - current task RTEMS_SUCCESSFUL +TA1 - rtems_task_ident - global RTEMS_INVALID_NAME +TA1 - rtems_task_ident - local RTEMS_INVALID_NAME +TA1 - rtems_task_ident - RTEMS_INVALID_NODE +TA1 - rtems_task_restart - RTEMS_INVALID_ID +TA1 - rtems_task_resume - RTEMS_INVALID_ID +TA1 - rtems_task_resume - RTEMS_INCORRECT_STATE +TA1 - rtems_task_set_priority - RTEMS_INVALID_PRIORITY +TA1 - rtems_task_set_priority - RTEMS_INVALID_ID +TA1 - rtems_task_set_note - RTEMS_INVALID_NUMBER +TA1 - rtems_task_set_note - RTEMS_INVALID_ID +TA1 - rtems_task_start - RTEMS_INVALID_ID +TA1 - rtems_task_start - RTEMS_INCORRECT_STATE +TA1 - rtems_task_suspend - RTEMS_INVALID_ID + +TA1 - rtems_clock_get - RTEMS_NOT_DEFINED +TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED +TA1 - rtems_timer_fire_when - RTEMS_NOT_DEFINED +TA1 - rtems_clock_set - 08:30:45 02/05/1987 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:45 15/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:45 02/32/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 25:30:45 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:61:45 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:61 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_SUCCESSFUL +TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds +TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL +TA1 - rtems_task_wake_when - 08:30:48 02/05/1961 - RTEMS_INVALID_CLOCK +TA1 - rtems_task_wake_when - 25:30:48 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - current time - 08:30:51 02/05/1988 +TA1 - rtems_task_wake_when - 08:30:51 01/05/1988 - RTEMS_INVALID_CLOCK + +TA1 - rtems_task_create - RTEMS_INVALID_NAME +TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED +TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_suspend - suspend TA2 - RTEMS_SUCCESSFUL +TA1 - rtems_task_suspend - suspend TA2 - RTEMS_ALREADY_SUSPENDED +TA1 - rtems_task_resume - TA2 resumed - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - TA3 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 4 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 5 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 6 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 7 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 8 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 9 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 10 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 11 - RTEMS_TOO_MANY +TA1 - rtems_task_create - RTEMS_MP_NOT_CONFIGURED + +TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( all conditions ) +TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( any condition ) +TA1 - rtems_event_receive - timeout in 3 seconds +TA1 - rtems_event_receive - woke up with RTEMS_TIMEOUT +TA1 - rtems_event_send - RTEMS_INVALID_ID +TA1 - rtems_task_wake_after - sleep 1 second - RTEMS_SUCCESSFUL +TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_SUCCESSFUL + +TA1 - rtems_semaphore_create - RTEMS_INVALID_NAME +TA1 - rtems_semaphore_create - 1 - RTEMS_SUCCESSFUL +TA1 - rtems_semaphore_create - 2 - RTEMS_SUCCESSFUL +TA1 - rtems_semaphore_create - 3 - RTEMS_TOO_MANY +TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED +TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED +TA1 - rtems_semaphore_create - RTEMS_INVALID_NUMBER +TA1 - rtems_semaphore_create - RTEMS_MP_NOT_CONFIGURED +TA1 - rtems_semaphore_delete - unknown RTEMS_INVALID_ID +TA1 - rtems_semaphore_delete - local RTEMS_INVALID_ID +TA1 - rtems_semaphore_ident - global RTEMS_INVALID_NAME +TA1 - rtems_semaphore_ident - local RTEMS_INVALID_NAME + +TA1 - rtems_semaphore_obtain - RTEMS_INVALID_ID +TA1 - rtems_semaphore_obtain - got sem 1 - RTEMS_SUCCESSFUL +TA1 - rtems_semaphore_obtain - RTEMS_UNSATISFIED +TA1 - rtems_semaphore_obtain - timeout in 3 seconds +TA1 - rtems_semaphore_obtain - woke up with RTEMS_TIMEOUT +TA1 - rtems_semaphore_release - RTEMS_NOT_OWNER_OF_RESOURCE +TA1 - rtems_semaphore_release - RTEMS_INVALID_ID +TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL +TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL +TA2 - rtems_semaphore_obtain - sem 1 - RTEMS_WAIT FOREVER +TA1 - rtems_semaphore_delete - delete sem 1 - RTEMS_SUCCESSFUL +TA1 - rtems_semaphore_obtain - binary semaphore +TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE +TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL +TA2 - rtems_semaphore_obtain - woke up with RTEMS_OBJECT_WAS_DELETED +TA2 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL + +TA1 - rtems_message_queue_broadcast - RTEMS_INVALID_ID +TA1 - rtems_message_queue_create - Q 1 - RTEMS_INVALID_NAME +TA1 - rtems_message_queue_create - Q 1 - RTEMS_MP_NOT_CONFIGURED +TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_create - Q 2 - RTEMS_TOO_MANY +TA1 - rtems_message_queue_delete - unknown RTEMS_INVALID_ID +TA1 - rtems_message_queue_delete - local RTEMS_INVALID_ID +TA1 - rtems_message_queue_ident - RTEMS_INVALID_NAME +TA1 - rtems_message_queue_flush - RTEMS_INVALID_ID +TA1 - rtems_message_queue_receive - RTEMS_INVALID_ID +TA1 - rtems_message_queue_receive - Q 1 - RTEMS_UNSATISFIED +TA1 - rtems_message_queue_receive - Q 1 - timeout in 3 seconds +TA1 - rtems_message_queue_receive - Q 1 - woke up with RTEMS_TIMEOUT +TA1 - rtems_message_queue_send - RTEMS_INVALID_ID +TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY + +TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY +TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_UNSATISFIED +TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL +TA1 - rtems_task_start - start TA3 - RTEMS_SUCCESSFUL +TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL +TA3 - rtems_message_queue_receive - Q 1 - RTEMS_WAIT FOREVER +TA1 - rtems_message_queue_delete - delete Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL +TA3 - rtems_message_queue_receive - woke up with RTEMS_OBJECT_WAS_DELETED +TA3 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL + +TA1 - rtems_interrupt_catch - RTEMS_INVALID_NUMBER +TA1 - rtems_interrupt_catch - RTEMS_INVALID_ADDRESS +TA1 - rtems_signal_send - RTEMS_INVALID_ID +TA1 - rtems_signal_send - RTEMS_NOT_DEFINED +TA1 - rtems_port_create - RTEMS_INVALID_NAME +TA1 - rtems_port_create - RTEMS_INVALID_ADDRESS +TA1 - rtems_port_create - RTEMS_TOO_MANY +TA1 - rtems_port_delete - RTEMS_INVALID_ID +TA1 - rtems_port_ident - RTEMS_INVALID_NAME +TA1 - rtems_port_external_to_internal - RTEMS_INVALID_ID +TA1 - rtems_port_internal_to_external - RTEMS_INVALID_ID + +TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_NAME +TA1 - rtems_rate_monotonic_create - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_create - RTEMS_TOO_MANY +TA1 - rtems_rate_monotonic_ident - RTEMS_INVALID_NAME +TA1 - rtems_rate_monotonic_period - unknown RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_period - local RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_NOT_DEFINED +TA1 - rtems_rate_monotonic_period - 100 ticks - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_TIMEOUT +TA1 - rtems_rate_monotonic_cancel - unknown RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_cancel - local RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_cancel - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_period - 5 ticks - RTEMS_TIMEOUT +TA1 - yielding to TA4 +TA4 - rtems_rate_monotonic_cancel - RTEMS_NOT_OWNER_OF_RESOURCE +TA4 - rtems_rate_monotonic_period - RTEMS_NOT_OWNER_OF_RESOURCE +TA4 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_delete - unknown RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_delete - local RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_delete - RTEMS_SUCCESSFUL + +TA1 - rtems_partition_create - RTEMS_INVALID_NAME +TA1 - rtems_partition_create - length - RTEMS_INVALID_SIZE +TA1 - rtems_partition_create - buffer size - RTEMS_INVALID_SIZE +TA1 - rtems_partition_create - length < buffer size - RTEMS_INVALID_SIZE +TA1 - rtems_partition_create - RTEMS_MP_NOT_CONFIGURED +TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS +TA1 - rtems_partition_create - RTEMS_INVALID_SIZE +TA1 - rtems_partition_delete - unknown RTEMS_INVALID_ID +TA1 - rtems_partition_delete - local RTEMS_INVALID_ID +TA1 - rtems_partition_get_buffer - RTEMS_INVALID_ID +TA1 - rtems_partition_ident - RTEMS_INVALID_NAME +TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ID +TA1 - rtems_partition_create - RTEMS_SUCCESSFUL +TA1 - rtems_partition_create - RTEMS_TOO_MANY +TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL +TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL +TA1 - rtems_partition_get_buffer - RTEMS_UNSATISFIED +TA1 - rtems_partition_delete - RTEMS_RESOURCE_IN_USE +TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - out of range +TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - not on boundary + +TA1 - rtems_region_create - RTEMS_INVALID_NAME +TA1 - rtems_region_create - RTEMS_INVALID_ADDRESS +TA1 - rtems_region_create - RTEMS_INVALID_SIZE +TA1 - rtems_region_create - RTEMS_SUCCESSFUL +TA1 - rtems_region_create - RTEMS_TOO_MANY +TA1 - rtems_region_delete - unknown RTEMS_INVALID_ID +TA1 - rtems_region_delete - local RTEMS_INVALID_ID +TA1 - rtems_region_ident - RTEMS_INVALID_NAME +TA1 - rtems_region_get_segment - RTEMS_INVALID_ID +TA1 - rtems_region_get_segment - RTEMS_INVALID_SIZE +TA1 - rtems_region_get_segment - RTEMS_SUCCESSFUL +TA1 - rtems_region_get_segment - RTEMS_UNSATISFIED +TA1 - rtems_region_get_segment - timeout in 3 seconds +TA1 - rtems_region_get_segment - woke up with RTEMS_TIMEOUT +TA1 - rtems_region_delete - RTEMS_RESOURCE_IN_USE +TA1 - rtems_region_return_segment - RTEMS_INVALID_ID +TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS +TA1 - rtems_debug_disable - RTEMS_DEBUG_REGION +TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS +TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS +TA1 - rtems_debug_enable - RTEMS_DEBUG_REGION +TA1 - rtems_region_extend - RTEMS_INVALID_ID +TA1 - rtems_region_extend - within heap - RTEMS_INVALID_ADDRESS +TA1 - rtems_region_extend - non-contiguous lower - RTEMS_NOT_IMPLEMENTED +TA1 - rtems_region_extend - contiguous lower - RTEMS_NOT_IMPLEMENTED +TA1 - rtems_region_extend - non-contiguous higher - RTEMS_NOT_IMPLEMENTED + +TA1 - rtems_io_close - RTEMS_INVALID_NUMBER +TA1 - rtems_io_control - RTEMS_INVALID_NUMBER +TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER +TA1 - rtems_io_open - RTEMS_INVALID_NUMBER +TA1 - rtems_io_read - RTEMS_INVALID_NUMBER +TA1 - rtems_io_write - RTEMS_INVALID_NUMBER +TA1 - rtems_clock_set - 23:59:59 12/31/2000 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_get - 00:00:00 01/01/2001 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_set - 23:59:59 12/31/1999 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_get - 00:00:00 01/01/2000 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_set - 23:59:59 12/31/2100 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_get - 00:00:00 01/01/2101 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_set - 23:59:59 12/31/2099 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_get - 00:00:00 01/01/2100 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_set - 23:59:59 12/31/1991 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_get - 00:00:00 01/01/1992 - RTEMS_SUCCESSFUL + +TA1 - rtems_timer_create - RTEMS_INVALID_NAME +TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL +TA1 - rtems_timer_create - 2 - RTEMS_TOO_MANY +TA1 - rtems_timer_delete - local RTEMS_INVALID_ID +TA1 - rtems_timer_delete - global RTEMS_INVALID_ID +TA1 - rtems_timer_ident - RTEMS_INVALID_NAME +TA1 - rtems_timer_cancel - RTEMS_INVALID_ID +TA1 - rtems_timer_cancel - RTEMS_INCORRECT_STATE +TA1 - rtems_timer_reset - RTEMS_INVALID_ID +TA1 - rtems_timer_reset - RTEMS_NOT_DEFINED +TA1 - rtems_timer_fire_after - RTEMS_INVALID_ID +TA1 - rtems_timer_fire_when - RTEMS_INVALID_ID +TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER +TA1 - rtems_timer_fire_when - 08:30:45 02/05/1987 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_get - 00:00:00 01/01/1992 +TA1 - rtems_timer_fire_when - 08:30:45 02/05/1990 - before RTEMS_INVALID_CLOCK +*** END OF TEST 9 *** diff --git a/testsuites/sptests/sp09/system.h b/testsuites/sptests/sp09/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp09/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp09/task1.c b/testsuites/sptests/sp09/task1.c new file mode 100644 index 0000000000..dbf28f57a8 --- /dev/null +++ b/testsuites/sptests/sp09/task1.c @@ -0,0 +1,74 @@ +/* Task_1 + * + * This task generates all possible errors for the RTEMS executive. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +#ifdef pause +#undef pause +#endif + +rtems_task Task_1( + rtems_task_argument argument +) +{ + Screen1(); + pause_and_screen_number( 2 ); + + Screen2(); + pause_and_screen_number( 3 ); + + Screen3(); + pause_and_screen_number( 4 ); + + Screen4(); + pause_and_screen_number( 5 ); + + Screen5(); + pause_and_screen_number( 6 ); + + Screen6(); + pause_and_screen_number( 7 ); + + Screen7(); + pause_and_screen_number( 8 ); + + Screen8(); + pause_and_screen_number( 9 ); + + Screen9(); + pause_and_screen_number( 10 ); + + Screen10(); + pause_and_screen_number( 11 ); + + Screen11(); + pause_and_screen_number( 12 ); + + Screen12(); + pause_and_screen_number( 13 ); + + Screen13(); + pause_and_screen_number( 14 ); + + Screen14(); + + puts( "*** END OF TEST 9 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp09/task2.c b/testsuites/sptests/sp09/task2.c new file mode 100644 index 0000000000..e9bda81fa3 --- /dev/null +++ b/testsuites/sptests/sp09/task2.c @@ -0,0 +1,48 @@ +/* Task_2 + * + * This routine serves as a test task. Its only purpose is to generate the + * error where a semaphore is deleted while a task is waiting for it. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA2 - rtems_semaphore_obtain - sem 1 - RTEMS_WAIT FOREVER" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + fatal_directive_status( + status, + RTEMS_OBJECT_WAS_DELETED, + "rtems_semaphore_obtain waiting to be deleted" + ); + puts( + "TA2 - rtems_semaphore_obtain - woke up with RTEMS_OBJECT_WAS_DELETED" + ); + + puts( "TA2 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA2" ); +} diff --git a/testsuites/sptests/sp09/task3.c b/testsuites/sptests/sp09/task3.c new file mode 100644 index 0000000000..8420c51f4d --- /dev/null +++ b/testsuites/sptests/sp09/task3.c @@ -0,0 +1,51 @@ +/* Task_3 + * + * This routine serves as a test task. Its only purpose in life is to + * generate the error where a message queue is deleted while a task + * is waiting there for a message. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + rtems_status_code status; + long buffer[ 4 ]; + + puts( "TA3 - rtems_message_queue_receive - Q 1 - RTEMS_WAIT FOREVER" ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + fatal_directive_status( + status, + RTEMS_OBJECT_WAS_DELETED, + "rtems_message_queue_receive waiting to be deleted" + ); + puts( + "TA3 - rtems_message_queue_receive - woke up with RTEMS_OBJECT_WAS_DELETED" + ); + + puts( "TA3 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA3" ); +} diff --git a/testsuites/sptests/sp09/task4.c b/testsuites/sptests/sp09/task4.c new file mode 100644 index 0000000000..73cd63373c --- /dev/null +++ b/testsuites/sptests/sp09/task4.c @@ -0,0 +1,50 @@ +/* Task_4 + * + * This routine serves as a test task. Its only purpose in life is to + * generate the error where a rate monotonic period is accessed by a + * task other than its creator. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_4( + rtems_task_argument argument +) +{ + rtems_status_code status; + + status = rtems_rate_monotonic_cancel( Period_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_NOT_OWNER_OF_RESOURCE, + "rtems_rate_monotonic_cancel not the owner" + ); + puts( "TA4 - rtems_rate_monotonic_cancel - RTEMS_NOT_OWNER_OF_RESOURCE" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 ); + fatal_directive_status( + status, + RTEMS_NOT_OWNER_OF_RESOURCE, + "rtems_rate_monotonic_period not the owner" + ); + puts( "TA4 - rtems_rate_monotonic_period - RTEMS_NOT_OWNER_OF_RESOURCE" ); + + puts( "TA4 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA4" ); +} diff --git a/testsuites/sptests/sp11/init.c b/testsuites/sptests/sp11/init.c new file mode 100644 index 0000000000..99ef1d55a0 --- /dev/null +++ b/testsuites/sptests/sp11/init.c @@ -0,0 +1,95 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 11 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' ); + Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' ); + Timer_name[ 4 ] = rtems_build_name( 'T', 'M', '4', ' ' ); + Timer_name[ 5 ] = rtems_build_name( 'T', 'M', '5', ' ' ); + Timer_name[ 6 ] = rtems_build_name( 'T', 'M', '6', ' ' ); + + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create of TM1" ); + + status = rtems_timer_create( Timer_name[ 2 ], &Timer_id[ 2 ] ); + directive_failed( status, "rtems_timer_create of TM2" ); + + status = rtems_timer_create( Timer_name[ 3 ], &Timer_id[ 3 ] ); + directive_failed( status, "rtems_timer_create of TM3" ); + + status = rtems_timer_create( Timer_name[ 4 ], &Timer_id[ 4 ] ); + directive_failed( status, "rtems_timer_create of TM4" ); + + status = rtems_timer_create( Timer_name[ 5 ], &Timer_id[ 5 ] ); + directive_failed( status, "rtems_timer_create of TM5" ); + + status = rtems_timer_create( Timer_name[ 6 ], &Timer_id[ 6 ] ); + directive_failed( status, "rtems_timer_create of TM6" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp11/sp11.doc b/testsuites/sptests/sp11/sp11.doc new file mode 100644 index 0000000000..d88f5eb86d --- /dev/null +++ b/testsuites/sptests/sp11/sp11.doc @@ -0,0 +1,26 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test11 + +directives: + ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return, + ev_send, ev_receive + tm_wkafter, tm_set, tm_get + +concepts: + + a. This test checks out the event manager along with the associated + event directives contained in the time manager. diff --git a/testsuites/sptests/sp11/sp11.scn b/testsuites/sptests/sp11/sp11.scn new file mode 100644 index 0000000000..7abb8afe45 --- /dev/null +++ b/testsuites/sptests/sp11/sp11.scn @@ -0,0 +1,74 @@ +*** TEST 11 *** +TA1 - rtems_event_send - send RTEMS_EVENT_16 to TA2 +TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_14 and RTEMS_EVENT_15 +TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_16 +TA2 - RTEMS_EVENT_16 received - eventout => 00010000 +TA2 - rtems_event_send - send RTEMS_EVENT_14 and RTEMS_EVENT_15 to TA1 +TA2 - rtems_event_receive - RTEMS_EVENT_17 or RTEMS_EVENT_18 - forever and ANY +TA1 - RTEMS_EVENT_14 and RTEMS_EVENT_15 received - eventout => 0000c000 +TA1 - rtems_event_send - send RTEMS_EVENT_18 to TA2 +TA1 - rtems_event_receive - waiting with 10 second timeout on RTEMS_EVENT_14 +TA2 - RTEMS_EVENT_17 or RTEMS_EVENT_18 received - eventout => 00040000 +TA2 - rtems_event_send - send RTEMS_EVENT_14 to TA1 +TA2 - rtems_clock_set - 08:15:00 02/12/1988 +TA2 - rtems_event_send - sending RTEMS_EVENT_10 to self after 5 seconds +TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_10 +TA1 - RTEMS_EVENT_14 received - eventout => 00004000 +TA1 - rtems_event_send - send RTEMS_EVENT_19 to TA2 +TA1 - rtems_clock_get - 08:15:00 02/12/1988 + +TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds +TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_18 +TA2 - RTEMS_EVENT_10 received - eventout => 00000400 +TA2 - rtems_clock_get - 08:15:05 02/12/1988 +TA2 - rtems_event_receive - RTEMS_PENDING_EVENTS +TA2 - eventout => 00080000 +TA2 - rtems_event_receive - RTEMS_EVENT_19 - RTEMS_NO_WAIT +TA2 - RTEMS_EVENT_19 received - eventout => 00080000 +TA2 - rtems_task_delete - deletes self +TA1 - RTEMS_EVENT_18 received - eventout => 00040000 +TA1 - rtems_clock_get - 08:15:05 02/12/1988 +TA1 - rtems_event_send - send RTEMS_EVENT_3 to self +TA1 - rtems_event_receive - RTEMS_EVENT_3 or RTEMS_EVENT_22 - NO_WAIT and ANY +TA1 - RTEMS_EVENT_3 received - eventout => 00000008 +TA1 - rtems_event_send - send RTEMS_EVENT_4 to self +TA1 - rtems_event_receive - RTEMS_EVENT_4 or RTEMS_EVENT_5 - forever and ANY +TA1 - RTEMS_EVENT_4 received - eventout => 00000010 + +TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds +TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_18 +TA1 - rtems_event_send - send RTEMS_EVENT_8 to self after 60 seconds +TA1 - rtems_event_send - send RTEMS_EVENT_9 to self after 60 seconds +TA1 - rtems_event_send - send RTEMS_EVENT_10 to self after 60 seconds +TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_8 +TA1 - rtems_clock_set - 08:15:00 02/12/1988 +TA1 - rtems_event_send - send RTEMS_EVENT_1 every second +TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:01 02/12/1988 +TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:02 02/12/1988 +TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:03 02/12/1988 +TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_1 + +TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day +TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day +TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days +TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 1 day +TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 2 days +TA1 - rtems_event_send - resending RTEMS_EVENT_11 to self in 2 days +TA1 - rtems_clock_set - 08:15:03 02/15/1988 +TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_11 +TA1 - RTEMS_EVENT_11 received - eventout => 00000800 + +TA1 - rtems_event_send/rtems_event_receive combination +TA1 - rtems_clock_set - 08:15:00 02/12/1988 +TA1 - rtems_event_receive all outstanding events +TA1 - rtems_event_send - sending RTEMS_EVENT_10 to self in 1 day +TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days +TA1 - rtems_clock_set - 07:15:00 02/12/1988 +TA1 - set time backwards +TA1 - no events received +TA1 - rtems_clock_set - 07:15:00 02/14/1988 +TA1 - set time forwards (leave a timer) +TA1 - RTEMS_EVENT_10 received +TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 100 ticks +TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 200 ticks +*** END OF TEST 11 *** diff --git a/testsuites/sptests/sp11/system.h b/testsuites/sptests/sp11/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp11/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp11/task1.c b/testsuites/sptests/sp11/task1.c new file mode 100644 index 0000000000..1b2fc86040 --- /dev/null +++ b/testsuites/sptests/sp11/task1.c @@ -0,0 +1,410 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_event_set eventout; + rtems_time_of_day time; + rtems_status_code status; + rtems_unsigned32 index; + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_16 to TA2" ); + status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_16 ); + directive_failed( status, "rtems_event_send" ); + + puts( + "TA1 - rtems_event_receive - waiting forever on " + "RTEMS_EVENT_14 and RTEMS_EVENT_15" + ); + status = rtems_event_receive( + RTEMS_EVENT_14 | RTEMS_EVENT_15, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( + "TA1 - RTEMS_EVENT_14 and RTEMS_EVENT_15 received - eventout => %08x\n", + eventout + ); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to TA2" ); + status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_18 ); + directive_failed( status, "rtems_event_send" ); + + puts( + "TA1 - rtems_event_receive - waiting with 10 second timeout on RTEMS_EVENT_14" + ); + status = rtems_event_receive( + RTEMS_EVENT_14, + RTEMS_DEFAULT_OPTIONS, + 10 * TICKS_PER_SECOND, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( "TA1 - RTEMS_EVENT_14 received - eventout => %08x\n", eventout ); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_19 to TA2" ); + status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_19 ); + directive_failed( status, "rtems_event_send" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + print_time( "TA1 - rtems_clock_get - ", &time, "\n" ); + +pause(); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds"); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 5 * TICKS_PER_SECOND, + TA1_send_18_to_self_5_seconds, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 5 seconds" ); + + puts( "TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_18" ); + status = rtems_event_receive( + RTEMS_EVENT_18, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive of 18" ); + printf( "TA1 - RTEMS_EVENT_18 received - eventout => %08x\n", eventout ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "TA1 rtems_clock_get" ); + print_time( "TA1 - rtems_clock_get - ", &time, "\n" ); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_3 to self" ); + status = rtems_event_send( RTEMS_SELF, RTEMS_EVENT_3 ); + directive_failed( status, "rtems_event_send" ); + + puts( + "TA1 - rtems_event_receive - RTEMS_EVENT_3 or " + "RTEMS_EVENT_22 - NO_WAIT and ANY" + ); + status = rtems_event_receive( + RTEMS_EVENT_3 | RTEMS_EVENT_22, + RTEMS_NO_WAIT | RTEMS_EVENT_ANY, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive of 3 and 22" ); + printf( "TA1 - RTEMS_EVENT_3 received - eventout => %08x\n", eventout ); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_4 to self" ); + status = rtems_event_send( RTEMS_SELF, RTEMS_EVENT_4 ); + directive_failed( status, "rtems_event_send" ); + + puts ( + "TA1 - rtems_event_receive - RTEMS_EVENT_4 or " + "RTEMS_EVENT_5 - forever and ANY" + ); + status = rtems_event_receive( + RTEMS_EVENT_4 | RTEMS_EVENT_5, + RTEMS_EVENT_ANY, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( "TA1 - RTEMS_EVENT_4 received - eventout => %08x\n", eventout ); + +pause(); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds"); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 5 * TICKS_PER_SECOND, + TA1_send_18_to_self_5_seconds, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 5 seconds" ); + + puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_18"); + status = rtems_timer_cancel( Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_cancel" ); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_8 to self after 60 seconds"); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 60 * TICKS_PER_SECOND, + TA1_send_8_to_self_60_seconds, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 60 seconds" ); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_9 to self after 60 seconds"); + status = rtems_timer_fire_after( + Timer_id[ 2 ], + 60 * TICKS_PER_SECOND, + TA1_send_9_to_self_60_seconds, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 60 seconds" ); + + puts( + "TA1 - rtems_event_send - send RTEMS_EVENT_10 to self after 60 seconds" + ); + status = rtems_timer_fire_after( + Timer_id[ 3 ], + 60 * TICKS_PER_SECOND, + TA1_send_10_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 60 seconds" ); + + puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_8" ); + status = rtems_timer_cancel( Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_cancel" ); + + build_time( &time, 2, 12, 1988, 8, 15, 0, 0 ); + + print_time( "TA1 - rtems_clock_set - ", &time, "\n" ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_1 every second" ); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + TICKS_PER_SECOND, + TA1_send_1_to_self_every_second, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 1 second" ); + + for ( index = 0; index < 3; index++ ) { + + status = rtems_event_receive( + RTEMS_EVENT_1, + RTEMS_EVENT_ANY, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + printf( "TA1 - RTEMS_EVENT_1 received - eventout => %08x - ", eventout ); + print_time( "at ", &time, "\n" ); + + if ( index < 2 ) { + status = rtems_timer_reset( Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_reset" ); + }; + + } + + puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_1" ); + status = rtems_timer_cancel( Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_cancel" ); + +pause(); + + time.day = 13; + puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day" ); + status = rtems_timer_fire_when( + Timer_id[ 1 ], + &time, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_when 1 day" ); + + time.hour = 7; + puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day" ); + status = rtems_timer_fire_when( + Timer_id[ 2 ], + &time, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_when 1 day" ); + + time.hour = 8; /* so code below has correct time/date */ + time.day = 14; + puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days" ); + status = rtems_timer_fire_when( + Timer_id[ 3 ], + &time, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_when 2 days" ); + + puts("TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 1 day"); + status = rtems_timer_cancel( Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_cancel" ); + + puts( + "TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 2 days" + ); + status = rtems_timer_cancel( Timer_id[ 3 ] ); + directive_failed( status, "rtems_timer_cancel" ); + + puts( + "TA1 - rtems_event_send - resending RTEMS_EVENT_11 to self in 2 days" + ); + status = rtems_timer_fire_when( + Timer_id[ 3 ], + &time, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_when 2 days" ); + + time.day = 15; + print_time( "TA1 - rtems_clock_set - ", &time, "\n" ); + status = rtems_clock_set( &time ); + directive_failed( status, "TA1 rtems_clock_set" ); + + puts( "TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_11" ); + status = rtems_event_receive( + RTEMS_EVENT_11, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( "TA1 - RTEMS_EVENT_11 received - eventout => %08x\n", eventout ); + +pause(); + + puts( "TA1 - rtems_event_send/rtems_event_receive combination" ); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 10, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 10 ticks" ); + + status = rtems_event_receive( + RTEMS_EVENT_11, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + + build_time( &time, 2, 12, 1988, 8, 15, 0, 0 ); + + print_time( "TA1 - rtems_clock_set - ", &time, "\n" ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + time.day = 13; + puts( "TA1 - rtems_event_receive all outstanding events" ); + status = rtems_event_receive( + RTEMS_ALL_EVENTS, + RTEMS_NO_WAIT | RTEMS_EVENT_ANY, + 0, + &eventout + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_event_receive all events" + ); + + puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_10 to self in 1 day" ); + status = rtems_timer_fire_when( + Timer_id[ 1 ], + &time, + TA1_send_10_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_when 1 day" ); + + time.day = 14; + puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days" ); + status = rtems_timer_fire_when( + Timer_id[ 2 ], + &time, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_when 2 days" ); + + build_time( &time, 2, 12, 1988, 7, 15, 0, 0 ); + + print_time( "TA1 - rtems_clock_set - ", &time, "\n" ); + puts( "TA1 - set time backwards" ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + status = rtems_event_receive( + RTEMS_ALL_EVENTS, + RTEMS_NO_WAIT | RTEMS_EVENT_ANY, + RTEMS_NO_TIMEOUT, + &eventout + ); + if ( eventout ) printf( "ERROR -0x%08x events received\n", eventout ); + else puts( "TA1 - no events received" ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_event_receive all events" + ); + + build_time( &time, 2, 14, 1988, 7, 15, 0, 0 ); + + print_time( "TA1 - rtems_clock_set - ", &time, "\n" ); + puts( "TA1 - set time forwards (leave a timer)" ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + status = rtems_event_receive( + RTEMS_ALL_EVENTS, + RTEMS_NO_WAIT | RTEMS_EVENT_ANY, + RTEMS_NO_TIMEOUT, + &eventout + ); + if ( eventout == RTEMS_EVENT_10 ) puts( "TA1 - RTEMS_EVENT_10 received" ); + else printf( "ERROR -0x%08x 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"); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 100, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 100 ticks" ); + + puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 200 ticks"); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 200, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 200 ticks" ); + + puts( "*** END OF TEST 11 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp11/task2.c b/testsuites/sptests/sp11/task2.c new file mode 100644 index 0000000000..176582bc36 --- /dev/null +++ b/testsuites/sptests/sp11/task2.c @@ -0,0 +1,126 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_event_set eventout; + rtems_time_of_day time; + rtems_status_code status; + + status = rtems_task_wake_after( 1*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_16" ); + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( "TA2 - RTEMS_EVENT_16 received - eventout => %08x\n", eventout ); + + puts( + "TA2 - rtems_event_send - send RTEMS_EVENT_14 and RTEMS_EVENT_15 to TA1" + ); + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_14 | RTEMS_EVENT_15 ); + directive_failed( status, "rtems_event_send" ); + + puts( + "TA2 - rtems_event_receive - RTEMS_EVENT_17 or " + "RTEMS_EVENT_18 - forever and ANY" + ); + status = rtems_event_receive( + RTEMS_EVENT_17 | RTEMS_EVENT_18, + RTEMS_EVENT_ANY, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( + "TA2 - RTEMS_EVENT_17 or RTEMS_EVENT_18 received - eventout => %08x\n", + eventout + ); + + puts( "TA2 - rtems_event_send - send RTEMS_EVENT_14 to TA1" ); + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_14 ); + directive_failed( status, "rtems_event_send" ); + + build_time( &time, 2, 12, 1988, 8, 15, 0, 0 ); + print_time( "TA2 - rtems_clock_set - ", &time, "\n" ); + status = rtems_clock_set( &time ); + directive_failed( status, "TA2 rtems_clock_set" ); + + time.second += 5; + puts( + "TA2 - rtems_event_send - sending RTEMS_EVENT_10 to self after 5 seconds" + ); + status = rtems_timer_fire_when( + Timer_id[ 5 ], + &time, + TA2_send_10_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_when after 5 seconds" ); + + puts( "TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_10" ); + status = rtems_event_receive( + RTEMS_EVENT_10, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + printf( "TA2 - RTEMS_EVENT_10 received - eventout => %08x\n", eventout ); + print_time( "TA2 - rtems_clock_get - ", &time, "\n" ); + + puts( "TA2 - rtems_event_receive - RTEMS_PENDING_EVENTS" ); + status = rtems_event_receive( + RTEMS_PENDING_EVENTS, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( "TA2 - eventout => %08x\n", eventout ); + + puts( "TA2 - rtems_event_receive - RTEMS_EVENT_19 - RTEMS_NO_WAIT" ); + status = rtems_event_receive( + RTEMS_EVENT_19, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( "TA2 - RTEMS_EVENT_19 received - eventout => %08x\n", eventout ); + + puts( "TA2 - rtems_task_delete - deletes self" ); + status = rtems_task_delete( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_delete of TA2" ); +} diff --git a/testsuites/sptests/sp11/timer.c b/testsuites/sptests/sp11/timer.c new file mode 100644 index 0000000000..3ec11b7345 --- /dev/null +++ b/testsuites/sptests/sp11/timer.c @@ -0,0 +1,97 @@ +/* Timer_functions + * + * These routines are the timer service routines used by this test. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_timer_service_routine TA1_send_18_to_self_5_seconds( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_18 ); + directive_failed( status, "rtems_event_send of 18" ); +} + +rtems_timer_service_routine TA1_send_8_to_self_60_seconds( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_8 ); + directive_failed( status, "rtems_event_send of 8" ); +} + +rtems_timer_service_routine TA1_send_9_to_self_60_seconds( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_9 ); + directive_failed( status, "rtems_event_send of 9" ); +} + +rtems_timer_service_routine TA1_send_10_to_self( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_10 ); + directive_failed( status, "rtems_event_send of 10" ); +} + +rtems_timer_service_routine TA1_send_1_to_self_every_second( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_1 ); + directive_failed( status, "rtems_event_send of 1" ); +} + +rtems_timer_service_routine TA1_send_11_to_self( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_11 ); + directive_failed( status, "rtems_event_send of 11" ); +} + +rtems_timer_service_routine TA2_send_10_to_self( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_10 ); + directive_failed( status, "rtems_event_send of 10" ); +} diff --git a/testsuites/sptests/sp12/init.c b/testsuites/sptests/sp12/init.c new file mode 100644 index 0000000000..dd702ca75e --- /dev/null +++ b/testsuites/sptests/sp12/init.c @@ -0,0 +1,176 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 12 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + + Priority_task_name[ 1 ] = rtems_build_name( 'P', 'R', 'I', '1' ); + Priority_task_name[ 2 ] = rtems_build_name( 'P', 'R', 'I', '2' ); + Priority_task_name[ 3 ] = rtems_build_name( 'P', 'R', 'I', '3' ); + Priority_task_name[ 4 ] = rtems_build_name( 'P', 'R', 'I', '4' ); + Priority_task_name[ 5 ] = rtems_build_name( 'P', 'R', 'I', '5' ); + + Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' ); + Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' ); + Semaphore_name[ 3 ] = rtems_build_name( 'S', 'M', '3', ' ' ); + + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 1, + RTEMS_DEFAULT_ATTRIBUTES, + &Semaphore_id[ 1 ] + ); + directive_failed( status, "rtems_semaphore_create of SM1" ); + + status = rtems_semaphore_create( + Semaphore_name[ 2 ], + 0, + RTEMS_PRIORITY, + &Semaphore_id[ 2 ] + ); + directive_failed( status, "rtems_semaphore_create of SM2" ); + + status = rtems_semaphore_create( + Semaphore_name[ 3 ], + 1, + RTEMS_DEFAULT_ATTRIBUTES, + &Semaphore_id[ 3 ] + ); + directive_failed( status, "rtems_semaphore_create of SM3" ); + + puts( "INIT - Forward priority queue test" ); + Priority_test_driver( 0 ); + + puts( "INIT - Backward priority queue test" ); + Priority_test_driver( 32 ); + +pause(); + + puts( "INIT - Binary Semaphore and Priority Inheritance Test" ); + + status = rtems_semaphore_delete( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_delete of SM2" ); + + puts( "INIT - rtems_semaphore_create - allocated binary semaphore" ); + status = rtems_semaphore_create( + Semaphore_name[ 2 ], + 0, + RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, + &Semaphore_id[ 2 ] + ); + directive_failed( status, "rtems_semaphore_create of priority inherit SM2" ); + + puts( "INIT - rtems_semaphore_release - allocated binary semaphore" ); + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release of SM2" ); + + puts( "INIT - rtems_semaphore_delete - allocated binary semaphore" ); + status = rtems_semaphore_delete( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_delete of SM2" ); + + status = rtems_semaphore_create( + Semaphore_name[ 2 ], + 1, + RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, + &Semaphore_id[ 2 ] + ); + directive_failed( status, "rtems_semaphore_create of priority inherit SM2" ); + + Priority_test_driver( 64 ); + +pause(); + + status = rtems_semaphore_delete( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_delete of SM2" ); + + status = rtems_semaphore_create( + Semaphore_name[ 2 ], + 0, + RTEMS_PRIORITY, + &Semaphore_id[ 2 ] + ); + directive_failed( status, "rtems_semaphore_create of priority SM2" ); + + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release of SM2" ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp12/pridrv.c b/testsuites/sptests/sp12/pridrv.c new file mode 100644 index 0000000000..7174faf784 --- /dev/null +++ b/testsuites/sptests/sp12/pridrv.c @@ -0,0 +1,131 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Priority_test_driver( + rtems_unsigned32 priority_base +) +{ + rtems_task_priority previous_priority; + rtems_unsigned32 index; + rtems_status_code status; + + for ( index = 1 ; index <= 5 ; index++ ) { + switch ( index ) { + case 1: + case 2: + case 3: + Task_priority[ index ] = priority_base + index; + break; + default: + Task_priority[ index ] = priority_base + 3; + break; + } + + status = rtems_task_create( + Priority_task_name[ index ], + Task_priority[ index ], + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Priority_task_id[ index ] + ); + directive_failed( status, "rtems_task_create loop" ); + + } + + if ( priority_base == 0 ) { + for ( index = 1 ; index <= 5 ; index++ ) { + status = rtems_task_start( + Priority_task_id[ index ], + Priority_task, + index + ); + directive_failed( status, "rtems_task_start loop" ); + } + } else { + for ( index = 5 ; index >= 1 ; index-- ) { + status = rtems_task_start( + Priority_task_id[ index ], + Priority_task, + index + ); + directive_failed( status, "rtems_task_start loop" ); + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after loop" ); + + if ( priority_base == 64 ) { + if ( index == 4 ) { + status = rtems_task_set_priority( + Priority_task_id[ 5 ], + priority_base + 4, + &previous_priority + ); + printf( "PDRV - change priority of PRI5 from %d to %d\n", + previous_priority, + priority_base + 4 + ); + directive_failed( status, "PDRV rtems_task_set_priority" ); + } + status = rtems_task_set_priority( + Priority_task_id[ 5 ], + RTEMS_CURRENT_PRIORITY, + &previous_priority + ); + directive_failed( status, "PDRV rtems_task_set_priority CURRENT" ); + printf( "PDRV - priority of PRI5 is %d\n", previous_priority ); + } + } + } + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after after loop" ); + + if ( priority_base == 0 ) { + for ( index = 1 ; index <= 5 ; index++ ) { + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release loop" ); + } + } + + if ( priority_base == 64 ) { + puts( "PDRV - rtems_task_resume - PRI5" ); + status = rtems_task_resume( Priority_task_id[ 5 ] ); + directive_failed( status, "rtems_task_resume" ); + + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after so PRI5 can run" ); + + status = rtems_task_delete( Priority_task_id[ 5 ] ); + directive_failed( status, "rtems_task_delete of PRI5" ); + } + else { + for ( index = 1 ; index <= 5 ; index++ ) { + status = rtems_task_delete( Priority_task_id[ index ] ); + directive_failed( status, "rtems_task_delete loop" ); + } + } +} diff --git a/testsuites/sptests/sp12/pritask.c b/testsuites/sptests/sp12/pritask.c new file mode 100644 index 0000000000..155ef345cd --- /dev/null +++ b/testsuites/sptests/sp12/pritask.c @@ -0,0 +1,91 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Priority_task( + rtems_task_argument its_index +) +{ + rtems_interval timeout; + rtems_task_priority its_priority; + rtems_task_priority current_priority; + rtems_status_code status; + rtems_unsigned32 index; + + its_priority = Task_priority[ its_index ]; + + if ( its_priority < 3 ) + timeout = 5 * TICKS_PER_SECOND; + else + timeout = RTEMS_NO_TIMEOUT; + + put_name( Priority_task_name[ its_index ], FALSE ); + puts( " - rtems_semaphore_obtain - wait forever on SM2" ); + + status = rtems_semaphore_obtain( + Semaphore_id[ 2 ], + RTEMS_DEFAULT_OPTIONS, + timeout + ); + directive_failed( status, "rtems_semaphore_obtain of SM2" ); + + if ( its_priority < 64 ) { + printf( "PRI%d - WHY AM I HERE? (pri=%d)", its_index, its_priority ); + exit( 0 ); + } + + if ( its_index == 5 ) + puts( "PRI5 - rtems_task_suspend - until all priority tasks blocked" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend" ); + + puts( "PRI5 - rtems_task_delete - all tasks waiting on SM2" ); + for ( index = 1 ; index < 5 ; index++ ) { + status = rtems_task_delete( Priority_task_id[ index ] ); + directive_failed( status, "rtems_task_delete loop" ); + } + + puts( "PRI5 - rtems_semaphore_obtain - nested" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 2 ], + RTEMS_DEFAULT_OPTIONS, + timeout + ); + directive_failed( status, "rtems_semaphore_obtain nested" ); + + puts( "PRI5 - rtems_semaphore_release - nested" ); + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release nested " ); + + puts( "PRI5 - rtems_semaphore_release - restore priority" ); + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release" ); + + status = rtems_task_set_priority( + RTEMS_SELF, + RTEMS_CURRENT_PRIORITY, + ¤t_priority + ); + directive_failed( status, "PRI5 rtems_task_set_priority CURRENT" ); + printf( "PRI5 - priority of PRI5 is %d\n", current_priority ); + + (void) rtems_task_suspend( RTEMS_SELF ); +} diff --git a/testsuites/sptests/sp12/sp12.doc b/testsuites/sptests/sp12/sp12.doc new file mode 100644 index 0000000000..fc19d92ed7 --- /dev/null +++ b/testsuites/sptests/sp12/sp12.doc @@ -0,0 +1,27 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test12 + +directives: + ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return, + sm_create, sm_ident, sm_delete, sm_p, sm_v, tm_wkafter, t_setpri + +concepts: + + a. This test checks out the semaphore manager. + + b. This test forces _Flush_taskq() to unblock a task waiting + on a deleted object. diff --git a/testsuites/sptests/sp12/sp12.scn b/testsuites/sptests/sp12/sp12.scn new file mode 100644 index 0000000000..82ceca3c6e --- /dev/null +++ b/testsuites/sptests/sp12/sp12.scn @@ -0,0 +1,78 @@ +*** TEST 12 *** +INIT - Forward priority queue test +PRI1 - rtems_semaphore_obtain - wait forever on SM2 +PRI2 - rtems_semaphore_obtain - wait forever on SM2 +PRI3 - rtems_semaphore_obtain - wait forever on SM2 +PRI4 - rtems_semaphore_obtain - wait forever on SM2 +PRI5 - rtems_semaphore_obtain - wait forever on SM2 +INIT - Backward priority queue test +PRI5 - rtems_semaphore_obtain - wait forever on SM2 +PRI4 - rtems_semaphore_obtain - wait forever on SM2 +PRI3 - rtems_semaphore_obtain - wait forever on SM2 +PRI2 - rtems_semaphore_obtain - wait forever on SM2 +PRI1 - rtems_semaphore_obtain - wait forever on SM2 + +INIT - Binary Semaphore and Priority Inheritance Test +INIT - rtems_semaphore_create - allocated binary semaphore +INIT - rtems_semaphore_release - allocated binary semaphore +INIT - rtems_semaphore_delete - allocated binary semaphore +PRI5 - rtems_semaphore_obtain - wait forever on SM2 +PRI5 - rtems_task_suspend - until all priority tasks blocked +PDRV - priority of PRI5 is 67 +PRI4 - rtems_semaphore_obtain - wait forever on SM2 +PDRV - change priority of PRI5 from 67 to 68 +PDRV - priority of PRI5 is 67 +PRI3 - rtems_semaphore_obtain - wait forever on SM2 +PDRV - priority of PRI5 is 67 +PRI2 - rtems_semaphore_obtain - wait forever on SM2 +PDRV - priority of PRI5 is 66 +PRI1 - rtems_semaphore_obtain - wait forever on SM2 +PDRV - priority of PRI5 is 65 +PDRV - rtems_task_resume - PRI5 +PRI5 - rtems_task_delete - all tasks waiting on SM2 +PRI5 - rtems_semaphore_obtain - nested +PRI5 - rtems_semaphore_release - nested +PRI5 - rtems_semaphore_release - restore priority +PRI5 - priority of PRI5 is 68 + +TA1 - rtems_semaphore_ident - smid => 00010001 +TA1 - rtems_semaphore_obtain - wait forever on SM2 +TA1 - got SM2 +TA1 - rtems_semaphore_obtain - wait forever on SM3 +TA1 - got SM3 +TA1 - rtems_semaphore_obtain - get SM1 - RTEMS_NO_WAIT +TA1 - got SM1 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA2 - rtems_semaphore_obtain - wait forever on SM1 +TA3 - rtems_semaphore_obtain - wait forever on SM2 + +TA1 - rtems_semaphore_release - release SM1 +TA1 - rtems_semaphore_obtain - waiting for SM1 with 10 second timeout +TA2 - got SM1 +TA2 - rtems_semaphore_release - release SM1 +TA2 - rtems_task_set_priority - make self highest priority task +TA2 - rtems_semaphore_obtain - wait forever on SM2 +TA1 - got SM1 +TA1 - rtems_semaphore_release - release SM2 +TA2 - got SM2 +TA2 - rtems_semaphore_release - release SM2 +TA2 - rtems_task_delete - delete self +TA1 - rtems_task_wake_after - sleep 5 seconds +TA3 - got SM2 +TA3 - rtems_semaphore_release - release SM2 +TA3 - rtems_semaphore_obtain - wait forever on SM3 + +TA1 - rtems_task_delete - delete TA3 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA4 - rtems_semaphore_obtain - wait forever on SM1 +TA5 - rtems_semaphore_obtain - wait forever on SM1 +TA1 - rtems_task_delete - delete TA4 +TA1 - rtems_semaphore_release - release SM1 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA5 - got SM1 +TA5 - rtems_semaphore_obtain - wait forever on SM1 +TA1 - rtems_semaphore_delete - delete SM1 +TA1 - rtems_semaphore_delete - delete SM3 +TA1 - rtems_task_delete - delete self +TA5 - SM1 deleted by TA1 +*** END OF TEST 12 *** diff --git a/testsuites/sptests/sp12/system.h b/testsuites/sptests/sp12/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp12/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp12/task1.c b/testsuites/sptests/sp12/task1.c new file mode 100644 index 0000000000..d3d7f3ed15 --- /dev/null +++ b/testsuites/sptests/sp12/task1.c @@ -0,0 +1,153 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies the semaphore manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id smid; + rtems_status_code status; + + status = rtems_semaphore_ident( + Semaphore_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &smid + ); + printf( "TA1 - rtems_semaphore_ident - smid => %08x\n", smid ); + directive_failed( status, "rtems_semaphore_ident of SM1" ); + + puts( "TA1 - rtems_semaphore_obtain - wait forever on SM2" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 2 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain of SM2" ); + puts( "TA1 - got SM2" ); + + puts( "TA1 - rtems_semaphore_obtain - wait forever on SM3" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 3 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain of SM3" ); + puts( "TA1 - got SM3" ); + + puts( "TA1 - rtems_semaphore_obtain - get SM1 - RTEMS_NO_WAIT" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain of SM1" ); + puts( "TA1 - got SM1" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + +pause(); + + puts( "TA1 - rtems_semaphore_release - release SM1" ); + status = rtems_semaphore_release( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_release of SM1" ); + + puts( + "TA1 - rtems_semaphore_obtain - waiting for SM1 with 10 second timeout" + ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + 10 * TICKS_PER_SECOND + ); + directive_failed( status, "rtems_semaphore_obtain of SM1" ); + puts( "TA1 - got SM1" ); + + puts( "TA1 - rtems_semaphore_release - release SM2" ); + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release of SM2" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + +pause(); + + puts( "TA1 - rtems_task_delete - delete TA3" ); + status = rtems_task_delete( Task_id[ 3 ] ); + directive_failed( status, "rtems_task_delete of TA3" ); + + status = rtems_task_create( + Task_name[ 4 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 4 ] + ); + directive_failed( status, "rtems_task_create of TA4" ); + + status = rtems_task_create( + Task_name[ 5 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 5 ] + ); + directive_failed( status, "rtems_task_create of TA5" ); + + status = rtems_task_start( Task_id[ 4 ], Task_4, 0 ); + directive_failed( status, "rtems_task_start of TA4" ); + + status = rtems_task_start( Task_id[ 5 ], Task5, 0 ); + directive_failed( status, "rtems_task_start of TA5" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_task_delete - delete TA4" ); + status = rtems_task_delete( Task_id[ 4 ] ); + directive_failed( status, "rtems_task_delete of TA4" ); + + puts( "TA1 - rtems_semaphore_release - release SM1" ); + status = rtems_semaphore_release( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_release on SM1" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_semaphore_delete - delete SM1" ); + status = rtems_semaphore_delete( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_delete of SM1" ); + + puts( "TA1 - rtems_semaphore_delete - delete SM3" ); + status = rtems_semaphore_delete( Semaphore_id[ 3 ] ); + directive_failed( status, "rtems_semaphore_delete of SM3" ); + + puts( "TA1 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA1" ); +} diff --git a/testsuites/sptests/sp12/task2.c b/testsuites/sptests/sp12/task2.c new file mode 100644 index 0000000000..41d6735162 --- /dev/null +++ b/testsuites/sptests/sp12/task2.c @@ -0,0 +1,65 @@ +/* Task_2 + * + * This routine serves as a test task. It simply obtains semaphores + * 1 and 2, the later when it is a high priority task. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_task_priority previous_priority; + + puts( "TA2 - rtems_semaphore_obtain - wait forever on SM1" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + puts( "TA2 - got SM1" ); + directive_failed( status, "rtems_semaphore_obtain on SM1" ); + + puts( "TA2 - rtems_semaphore_release - release SM1" ); + status = rtems_semaphore_release( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_release on SM1" ); + + puts( "TA2 - rtems_task_set_priority - make self highest priority task" ); + status = rtems_task_set_priority( RTEMS_SELF, 3, &previous_priority ); + directive_failed( status, "rtems_task_set_priority on TA2" ); + + puts( "TA2 - rtems_semaphore_obtain - wait forever on SM2" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 2 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + puts( "TA2 - got SM2" ); + directive_failed( status, "rtems_semaphore_obtain on SM2" ); + + puts( "TA2 - rtems_semaphore_release - release SM2" ); + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release on SM2" ); + + puts( "TA2 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA2" ); +} diff --git a/testsuites/sptests/sp12/task3.c b/testsuites/sptests/sp12/task3.c new file mode 100644 index 0000000000..7340b84ce6 --- /dev/null +++ b/testsuites/sptests/sp12/task3.c @@ -0,0 +1,50 @@ +/* Task_3 + * + * This routine serves as a test task. It simply obtains semaphore + * 2 and waits forever attempting to obtain semaphore 3. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA3 - rtems_semaphore_obtain - wait forever on SM2" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 2 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain on SM2" ); + puts( "TA3 - got SM2" ); + + puts( "TA3 - rtems_semaphore_release - release SM2" ); + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release on SM2" ); + + puts( "TA3 - rtems_semaphore_obtain - wait forever on SM3" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 3 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain on SM3" ); +} diff --git a/testsuites/sptests/sp12/task4.c b/testsuites/sptests/sp12/task4.c new file mode 100644 index 0000000000..9a0e952613 --- /dev/null +++ b/testsuites/sptests/sp12/task4.c @@ -0,0 +1,37 @@ +/* Task_4 + * + * This routine serves as a test task. It waits forever attempting + * to obtain semaphore 1. However, it should never get the semaphore! + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_4( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA4 - rtems_semaphore_obtain - wait forever on SM1" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain on SM1" ); +} diff --git a/testsuites/sptests/sp12/task5.c b/testsuites/sptests/sp12/task5.c new file mode 100644 index 0000000000..ccf10cd11a --- /dev/null +++ b/testsuites/sptests/sp12/task5.c @@ -0,0 +1,55 @@ +/* Task5 + * + * This routine serves as a test task. It obtains semaphore 1 correctly + * once, then waits for semaphore 1 again. Task 1 should delete the + * semaphore, thus waking this task up. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task5( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA5 - rtems_semaphore_obtain - wait forever on SM1" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain on SM1" ); + puts( "TA5 - got SM1" ); + + puts( "TA5 - rtems_semaphore_obtain - wait forever on SM1" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + fatal_directive_status( + status, + RTEMS_OBJECT_WAS_DELETED, + "rtems_semaphore_obtain on SM1" + ); + puts( "TA5 - SM1 deleted by TA1" ); + + puts( "*** END OF TEST 12 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp13/fillbuff.c b/testsuites/sptests/sp13/fillbuff.c new file mode 100644 index 0000000000..43ccd86803 --- /dev/null +++ b/testsuites/sptests/sp13/fillbuff.c @@ -0,0 +1,31 @@ +/* Fill_buffer + * + * This test routine copies a given source string to a given destination + * buffer. + * + * Input parameters: + * source - pointer to string to be copied + * buffer - pointer to message buffer to be filled + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Fill_buffer( + char *source, + long *buffer +) +{ + memcpy( buffer, source, 16 ); +} diff --git a/testsuites/sptests/sp13/init.c b/testsuites/sptests/sp13/init.c new file mode 100644 index 0000000000..0629cdff21 --- /dev/null +++ b/testsuites/sptests/sp13/init.c @@ -0,0 +1,112 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 13 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + Queue_name[ 1 ] = rtems_build_name( 'Q', '1', ' ', ' ' ); + Queue_name[ 2 ] = rtems_build_name( 'Q', '2', ' ', ' ' ); + Queue_name[ 3 ] = rtems_build_name( 'Q', '3', ' ', ' ' ); + + status = rtems_message_queue_create( + Queue_name[ 1 ], + 0, + RTEMS_DEFAULT_ATTRIBUTES, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create of Q1" ); + + status = rtems_message_queue_create( + Queue_name[ 2 ], + 10, + RTEMS_PRIORITY | RTEMS_LIMIT, + &Queue_id[ 2 ] + ); + directive_failed( status, "rtems_message_queue_create of Q2" ); + + status = rtems_message_queue_create( + Queue_name[ 3 ], + 0, + RTEMS_DEFAULT_ATTRIBUTES, + &Queue_id[ 3 ] + ); + directive_failed( status, "rtems_message_queue_create of Q3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp13/putbuff.c b/testsuites/sptests/sp13/putbuff.c new file mode 100644 index 0000000000..e0bbfa4d7f --- /dev/null +++ b/testsuites/sptests/sp13/putbuff.c @@ -0,0 +1,31 @@ +/* Put_buffer + * + * This test routine prints the given buffer. + * buffer. + * + * Input parameters: + * buffer - pointer to message buffer to be printer + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +#define BUFFER_LENGTH 16 + +void Put_buffer( + long *buffer +) +{ + printf( "%16s", (char *)buffer ); +} diff --git a/testsuites/sptests/sp13/sp13.doc b/testsuites/sptests/sp13/sp13.doc new file mode 100644 index 0000000000..4a0c9d24a0 --- /dev/null +++ b/testsuites/sptests/sp13/sp13.doc @@ -0,0 +1,25 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test13 + +directives: + ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return, + q_create, q_ident, q_delete, q_send, q_urgent, q_broadcast, q_receive, + tm_wkafter, t_setpri + +concepts: + + a. This test checks out the message manager. diff --git a/testsuites/sptests/sp13/sp13.scn b/testsuites/sptests/sp13/sp13.scn new file mode 100644 index 0000000000..bd3af7da48 --- /dev/null +++ b/testsuites/sptests/sp13/sp13.scn @@ -0,0 +1,66 @@ +*** TEST 13 *** +TA1 - rtems_message_queue_ident - qid => 00010001 +TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 +TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_NO_WAIT +TA2 - buffer received: BUFFER 1 TO Q 1 +TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_WAIT FOREVER +TA2 - buffer received: BUFFER 2 TO Q 1 +TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_WAIT FOREVER +TA3 - rtems_message_queue_receive - receive from queue 2 - RTEMS_WAIT FOREVER +TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA2 - buffer received: BUFFER 3 TO Q 1 +TA2 - rtems_task_set_priority - make self highest priority task +TA2 - rtems_message_queue_receive - receive from queue 2 - RTEMS_WAIT FOREVER + +TA1 - rtems_message_queue_send - BUFFER 1 TO Q 2 +TA2 - buffer received: BUFFER 1 TO Q 2 +TA2 - rtems_message_queue_send - BUFFER 2 TO Q 2 +TA2 - rtems_message_queue_receive - receive from queue 1 - 10 second timeout +TA1 - rtems_message_queue_receive - receive from queue 1 - 10 second timeout +TA3 - buffer received: BUFFER 2 TO Q 2 +TA3 - rtems_message_queue_broadcast - BUFFER 3 TO Q 1 +TA2 - buffer received: BUFFER 3 TO Q 1 +TA2 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER +TA3 - number of tasks awakened = 02 +TA3 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER +TA1 - buffer received: BUFFER 3 TO Q 1 +TA1 - rtems_task_delete - delete TA2 +TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA3 - buffer received: BUFFER 1 TO Q 3 +TA3 - rtems_task_delete - delete self + +TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3 +TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3 +TA1 - rtems_message_queue_send - BUFFER 4 TO Q 3 +TA1 - rtems_message_queue_urgent - BUFFER 5 TO Q 3 +TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER +TA1 - buffer received: BUFFER 5 TO Q 3 +TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER +TA1 - buffer received: BUFFER 2 TO Q 3 +TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER +TA1 - buffer received: BUFFER 3 TO Q 3 +TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER +TA1 - buffer received: BUFFER 4 TO Q 3 +TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2 +TA1 - rtems_message_queue_receive - receive from queue 2 - RTEMS_WAIT FOREVER +TA1 - buffer received: BUFFER 3 TO Q 2 + +TA1 - rtems_message_queue_delete - delete queue 1 +TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2 +TA1 - rtems_message_queue_delete - delete queue 2 +TA1 - rtems_message_queue_flush - empty Q 3 +TA1 - 0 messages were flushed from Q 3 +TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3 +TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3 +TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3 +TA1 - rtems_message_queue_flush - Q 3 +TA1 - 3 messages were flushed from Q 3 +TA1 - rtems_message_queue_send until all message buffers consumed +TA1 - all message buffers consumed +TA1 - rtems_message_queue_flush - Q 3 +TA1 - 100 messages were flushed from Q 3 +*** END OF TEST 13 *** diff --git a/testsuites/sptests/sp13/system.h b/testsuites/sptests/sp13/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp13/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp13/task1.c b/testsuites/sptests/sp13/task1.c new file mode 100644 index 0000000000..89c0619025 --- /dev/null +++ b/testsuites/sptests/sp13/task1.c @@ -0,0 +1,213 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +extern rtems_configuration_table BSP_Configuration; + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id qid; + long buffer[ 4 ]; + rtems_unsigned32 index; + rtems_unsigned32 count; + rtems_status_code status; + + status = rtems_message_queue_ident( + Queue_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &qid + ); + printf( "TA1 - rtems_message_queue_ident - qid => %08x\n", qid ); + directive_failed( status, "rtems_message_queue_ident" ); + + Fill_buffer( "BUFFER 1 TO Q 1", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1" ); + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + Fill_buffer( "BUFFER 2 TO Q 1", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1" ); + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + Fill_buffer( "BUFFER 3 TO Q 1", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1" ); + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + +pause(); + + Fill_buffer( "BUFFER 1 TO Q 2", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 2" ); + status = rtems_message_queue_send( Queue_id[ 2 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + puts_nocr( "TA1 - rtems_message_queue_receive - receive from queue 1 - " ); + puts ( "10 second timeout" ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + 10 * TICKS_PER_SECOND + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA1 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + puts( "TA1 - rtems_task_delete - delete TA2" ); + status = rtems_task_delete( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_delete" ); + + Fill_buffer( "BUFFER 1 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3" ); + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + +pause(); + + Fill_buffer( "BUFFER 2 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3" ); + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + Fill_buffer( "BUFFER 3 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3" ); + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + Fill_buffer( "BUFFER 4 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 4 TO Q 3" ); + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + Fill_buffer( "BUFFER 5 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_urgent - BUFFER 5 TO Q 3" ); + status = rtems_message_queue_urgent( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_urgent" ); + + for ( index = 1 ; index <= 4 ; index++ ) { + puts( + "TA1 - rtems_message_queue_receive - receive from queue 3 - " + "RTEMS_WAIT FOREVER" + ); + status = rtems_message_queue_receive( + Queue_id[ 3 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA1 - buffer received: " ); + Put_buffer( buffer ); + new_line; + } + + Fill_buffer( "BUFFER 3 TO Q 2", buffer ); + puts( "TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2" ); + status = rtems_message_queue_urgent( Queue_id[ 2 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_urgent" ); + + puts( + "TA1 - rtems_message_queue_receive - receive from queue 2 - " + "RTEMS_WAIT FOREVER" + ); + status = rtems_message_queue_receive( + Queue_id[ 2 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA1 - buffer received: " ); + Put_buffer( buffer ); + new_line; + +pause(); + + puts( "TA1 - rtems_message_queue_delete - delete queue 1" ); + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete" ); + + Fill_buffer( "BUFFER 3 TO Q 2", buffer ); + puts( "TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2" ); + status = rtems_message_queue_urgent( Queue_id[ 2 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_urgent" ); + + puts( "TA1 - rtems_message_queue_delete - delete queue 2" ); + status = rtems_message_queue_delete( Queue_id[ 2 ] ); + directive_failed( status, "rtems_message_queue_delete" ); + + puts( "TA1 - rtems_message_queue_flush - empty Q 3" ); + status = rtems_message_queue_flush( Queue_id[ 3 ], &count ); + printf( "TA1 - %d messages were flushed from Q 3\n", count ); + + Fill_buffer( "BUFFER 1 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3" ); + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + Fill_buffer( "BUFFER 2 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3" ); + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + Fill_buffer( "BUFFER 3 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3" ); + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + puts( "TA1 - rtems_message_queue_flush - Q 3" ); + status = rtems_message_queue_flush( Queue_id[ 3 ], &count ); + printf( "TA1 - %d messages were flushed from Q 3\n", count ); + + puts( "TA1 - rtems_message_queue_send until all message buffers consumed" ); + while ( FOREVER ) { + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + if ( status == RTEMS_UNSATISFIED ) break; + directive_failed( status, "rtems_message_queue_send loop" ); + } + + puts( "TA1 - all message buffers consumed" ); + puts( "TA1 - rtems_message_queue_flush - Q 3" ); + status = rtems_message_queue_flush( Queue_id[ 3 ], &count ); + printf( "TA1 - %d messages were flushed from Q 3\n", count ); + + if ( count != BSP_Configuration.maximum_messages ) + printf( "TA1 - ERROR - %d messages flushed!!!", count ); + + puts( "*** END OF TEST 13 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp13/task2.c b/testsuites/sptests/sp13/task2.c new file mode 100644 index 0000000000..7d6438312c --- /dev/null +++ b/testsuites/sptests/sp13/task2.c @@ -0,0 +1,132 @@ +/* Task_2 + * + * This routine serves as a test task. Multiple tasks are required to + * verify all message manager capabilities. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + long buffer[ 4 ]; + rtems_task_priority previous_priority; + rtems_status_code status; + + puts( + "TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_NO_WAIT" + ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])buffer, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA2 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + puts( + "TA2 - rtems_message_queue_receive - receive from queue 1 - " + "RTEMS_WAIT FOREVER" + ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA2 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + puts( + "TA2 - rtems_message_queue_receive - receive from queue 1 - " + "RTEMS_WAIT FOREVER" + ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA2 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + puts( "TA2 - rtems_task_set_priority - make self highest priority task" ); + status = rtems_task_set_priority( RTEMS_SELF, 3, &previous_priority ); + directive_failed( status, "rtems_task_set_priority" ); + + puts( + "TA2 - rtems_message_queue_receive - receive from queue 2 - " + "RTEMS_WAIT FOREVER" + ); + status = rtems_message_queue_receive( + Queue_id[ 2 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA2 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + Fill_buffer( "BUFFER 2 TO Q 2", (long *)buffer ); + puts( "TA2 - rtems_message_queue_send - BUFFER 2 TO Q 2" ); + directive_failed( status, "rtems_message_queue_send" ); + + status = rtems_message_queue_send( Queue_id[ 2 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + puts( + "TA2 - rtems_message_queue_receive - receive from queue 1 - " + "10 second timeout" + ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + 10 * TICKS_PER_SECOND + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA2 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + puts( + "TA2 - rtems_message_queue_receive - receive from queue 3 - " + "RTEMS_WAIT FOREVER" + ); + status = rtems_message_queue_receive( + Queue_id[ 3 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA2 - buffer received: " ); + Put_buffer( buffer ); + new_line; + +} diff --git a/testsuites/sptests/sp13/task3.c b/testsuites/sptests/sp13/task3.c new file mode 100644 index 0000000000..3ba7b61728 --- /dev/null +++ b/testsuites/sptests/sp13/task3.c @@ -0,0 +1,74 @@ +/* Task_3 + * + * This routine serves as a test task. Its major function is to + * broadcast a messge to all the other tasks. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + long buffer[ 4 ]; + rtems_unsigned32 count; + rtems_status_code status; + + puts( + "TA3 - rtems_message_queue_receive - receive from queue 2 - " + "RTEMS_WAIT FOREVER" + ); + status = rtems_message_queue_receive( + Queue_id[ 2 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA3 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + Fill_buffer( "BUFFER 3 TO Q 1", (long *)buffer ); + puts( "TA3 - rtems_message_queue_broadcast - BUFFER 3 TO Q 1" ); + status = rtems_message_queue_broadcast( + Queue_id[ 1 ], + (long (*)[4])buffer, + &count + ); + printf( "TA3 - number of tasks awakened = %02d\n", count ); + puts( + "TA3 - rtems_message_queue_receive - receive from queue 3 - " + "RTEMS_WAIT FOREVER" + ); + + status = rtems_message_queue_receive( + Queue_id[ 3 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA3 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + puts( "TA3 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp14/asr.c b/testsuites/sptests/sp14/asr.c new file mode 100644 index 0000000000..af7e212877 --- /dev/null +++ b/testsuites/sptests/sp14/asr.c @@ -0,0 +1,47 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_asr Process_asr( + rtems_signal_set the_signal_set +) +{ + rtems_status_code status; + + printf( "ASR - ENTRY - signal => %08x\n", the_signal_set ); + switch( the_signal_set ) { + case RTEMS_SIGNAL_16: + case RTEMS_SIGNAL_17: + case RTEMS_SIGNAL_18 | RTEMS_SIGNAL_19: + break; + case RTEMS_SIGNAL_0: + case RTEMS_SIGNAL_1: + puts( "ASR - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after yield" ); + break; + case RTEMS_SIGNAL_3: + Asr_fired = TRUE; + break; + } + printf( "ASR - EXIT - signal => %08x\n", the_signal_set ); +} diff --git a/testsuites/sptests/sp14/init.c b/testsuites/sptests/sp14/init.c new file mode 100644 index 0000000000..627295c03e --- /dev/null +++ b/testsuites/sptests/sp14/init.c @@ -0,0 +1,75 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 14 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create of TM1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp14/sp14.doc b/testsuites/sptests/sp14/sp14.doc new file mode 100644 index 0000000000..16aa420183 --- /dev/null +++ b/testsuites/sptests/sp14/sp14.doc @@ -0,0 +1,24 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test14 + +directives: + ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return, + as_catch, as_return, as_send, tm_wkafter + +concepts: + + a. This test checks out the signal manager. diff --git a/testsuites/sptests/sp14/sp14.scn b/testsuites/sptests/sp14/sp14.scn new file mode 100644 index 0000000000..31e6d067d2 --- /dev/null +++ b/testsuites/sptests/sp14/sp14.scn @@ -0,0 +1,33 @@ +*** TEST 14 *** +TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 ) +TA1 - rtems_signal_send - RTEMS_SIGNAL_16 to self +ASR - ENTRY - signal => 00010000 +ASR - EXIT - signal => 00010000 +TA1 - rtems_signal_send - RTEMS_SIGNAL_0 to self +ASR - ENTRY - signal => 00000001 +ASR - rtems_task_wake_after - yield processor +TA2 - rtems_signal_send - RTEMS_SIGNAL_17 to TA1 +TA2 - rtems_task_wake_after - yield processor +ASR - ENTRY - signal => 00020000 +ASR - EXIT - signal => 00020000 +ASR - EXIT - signal => 00000001 +TA1 - rtems_signal_catch - RTEMS_NO_ASR + +TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self +ASR - ENTRY - signal => 00000002 +ASR - rtems_task_wake_after - yield processor +TA2 - rtems_signal_send - RTEMS_SIGNAL_18 and RTEMS_SIGNAL_19 to TA1 +TA2 - rtems_task_wake_after - yield processor +ASR - EXIT - signal => 00000002 +ASR - ENTRY - signal => 000c0000 +ASR - EXIT - signal => 000c0000 +TA1 - rtems_task_mode - disable ASRs +TA1 - sending signal to RTEMS_SELF from timer +TA1 - waiting for signal to arrive +TA1 - timer routine got the correct arguments +TA1 - rtems_task_mode - enable ASRs +ASR - ENTRY - signal => 00000008 +ASR - EXIT - signal => 00000008 +TA1 - rtems_signal_catch - asraddr of NULL +TA1 - rtems_task_delete - delete self +*** END OF TEST 14 *** diff --git a/testsuites/sptests/sp14/system.h b/testsuites/sptests/sp14/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp14/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp14/task1.c b/testsuites/sptests/sp14/task1.c new file mode 100644 index 0000000000..ac8feed71f --- /dev/null +++ b/testsuites/sptests/sp14/task1.c @@ -0,0 +1,116 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_timer_service_routine Signal_3_to_task_1( + rtems_id id, + void *pointer +) +{ + rtems_status_code status; + + status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_3 ); + directive_failed( status, "rtems_signal_send of 3" ); + + Timer_got_this_id = id; + Timer_got_this_pointer = pointer; + + Signals_sent = TRUE; +} + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_mode previous_mode; + rtems_status_code status; + + puts( "TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 )" ); + status = rtems_signal_catch( Process_asr, RTEMS_INTERRUPT_LEVEL(3) ); + directive_failed( status, "rtems_signal_catch" ); + + puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_16 to self" ); + status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_16 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_0 to self" ); + status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_0 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA1 - rtems_signal_catch - RTEMS_NO_ASR" ); + status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR ); + directive_failed( status, "rtems_signal_catch" ); + +pause(); + + puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self" ); + status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA1 - rtems_task_mode - disable ASRs" ); + status = rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &previous_mode ); + directive_failed( status, "rtems_task_mode" ); + + Timer_got_this_id = 0; + Timer_got_this_pointer = NULL; + + puts( "TA1 - sending signal to RTEMS_SELF from timer" ); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + TICKS_PER_SECOND / 2, + Signal_3_to_task_1, + Task_1 + ); + directive_failed( status, "rtems_timer_fire_after" ); + + puts( "TA1 - waiting for signal to arrive" ); + + Signals_sent = FALSE; + Asr_fired = FALSE; + + while ( Signals_sent == FALSE ) + ; + + if ( Timer_got_this_id == Timer_id[ 1 ] && + Timer_got_this_pointer == Task_1 ) + puts( "TA1 - timer routine got the correct arguments" ); + else + printf( + "TA1 - timer got (0x%x, %p) instead of (0x%x, %p)!!!!\n", + Timer_got_this_id, + Timer_got_this_pointer, + Timer_id[ 1 ], + Task_1 + ); + + puts( "TA1 - rtems_task_mode - enable ASRs" ); + status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode ); + directive_failed( status, "rtems_task_mode" ); + + puts( "TA1 - rtems_signal_catch - asraddr of NULL" ); + status = rtems_signal_catch( NULL, RTEMS_DEFAULT_MODES ); + directive_failed( status, "rtems_signal_catch" ); + + puts( "TA1 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp14/task2.c b/testsuites/sptests/sp14/task2.c new file mode 100644 index 0000000000..bf1e7cc224 --- /dev/null +++ b/testsuites/sptests/sp14/task2.c @@ -0,0 +1,48 @@ +/* Task_2 + * + * This routine serves as a test task. It verifies that one task can + * send signals to another task ( invoking the other task's RTEMS_ASR ). + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA2 - rtems_signal_send - RTEMS_SIGNAL_17 to TA1" ); + status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_17 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA2 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + puts("TA2 - rtems_signal_send - RTEMS_SIGNAL_18 and RTEMS_SIGNAL_19 to TA1"); + status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_18 | RTEMS_SIGNAL_19 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA2 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "*** END OF TEST 14 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp15/init.c b/testsuites/sptests/sp15/init.c new file mode 100644 index 0000000000..4bee311714 --- /dev/null +++ b/testsuites/sptests/sp15/init.c @@ -0,0 +1,81 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 15 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + Partition_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' ); + Partition_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + puts("INIT - rtems_partition_create - partition 1"); + status = rtems_partition_create( + Partition_name[ 1 ], + Area_1, + 4096, + 512, + RTEMS_DEFAULT_ATTRIBUTES, + &Partition_id[ 1 ] + ); + directive_failed( status, "rtems_partition_create of PT1" ); + + puts("INIT - rtems_partition_create - partition 2"); + status = rtems_partition_create( + Partition_name[ 2 ], + Area_2, + 274, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &Partition_id[ 2 ] + ); + directive_failed( status, "rtems_partition_create of PT2" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp15/sp15.doc b/testsuites/sptests/sp15/sp15.doc new file mode 100644 index 0000000000..3ec20ae92b --- /dev/null +++ b/testsuites/sptests/sp15/sp15.doc @@ -0,0 +1,24 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test15 + +directives: + ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return, + pt_create, pt_ident, pt_getbuf, pt_retbuf, pt_delete + +concepts: + + a. This test checks out the partition manager. diff --git a/testsuites/sptests/sp15/sp15.scn b/testsuites/sptests/sp15/sp15.scn new file mode 100644 index 0000000000..acddd5b5e9 --- /dev/null +++ b/testsuites/sptests/sp15/sp15.scn @@ -0,0 +1,16 @@ +*** TEST 15 *** +INIT - rtems_partition_create - partition 1 +INIT - rtems_partition_create - partition 2 +TA1 - rtems_partition_ident - partition 1 id = 00010001 +TA1 - rtems_partition_ident - partition 2 id = 00010002 +TA1 - rtems_partition_get_buffer - buffer 1 from partition 1 - 0x00000000 +TA1 - rtems_partition_get_buffer - buffer 2 from partition 1 - 0x00000200 +TA1 - rtems_partition_get_buffer - buffer 1 from partition 2 - 0x00000000 +TA1 - rtems_partition_get_buffer - buffer 2 from partition 2 - 0x00000080 +TA1 - rtems_partition_return_buffer - buffer 1 to partition 1 - 0x00000000 +TA1 - rtems_partition_return_buffer - buffer 2 to partition 1 - 0x00000200 +TA1 - rtems_partition_return_buffer - buffer 1 to partition 2 - 0x00000000 +TA1 - rtems_partition_return_buffer - buffer 2 to partition 2 - 0x00000080 +TA1 - rtems_partition_delete - delete partition 1 +TA1 - rtems_partition_delete - delete partition 2 +*** END OF TEST 15 *** diff --git a/testsuites/sptests/sp15/system.h b/testsuites/sptests/sp15/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp15/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp15/task1.c b/testsuites/sptests/sp15/task1.c new file mode 100644 index 0000000000..f22d27efe3 --- /dev/null +++ b/testsuites/sptests/sp15/task1.c @@ -0,0 +1,129 @@ +/* Task_1 + * + * This routine serves as a test task. It tests the partition manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id ptid_1; + rtems_id ptid_2; + void *buffer_address_1; + void *buffer_address_2; + void *buffer_address_3; + void *buffer_address_4; + rtems_status_code status; + + puts_nocr( "TA1 - rtems_partition_ident - partition 1 id = " ); + status = rtems_partition_ident( + Partition_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &ptid_1 + ); + directive_failed( status, "rtems_partition_ident of PT1" ); + printf( "%08x\n", ptid_1 ); + + puts_nocr( "TA1 - rtems_partition_ident - partition 2 id = " ); + status = rtems_partition_ident( + Partition_name[ 2 ], + RTEMS_SEARCH_ALL_NODES, + &ptid_2 + ); + directive_failed( status, "rtems_partition_ident of PT2" ); + printf( "%08x\n", ptid_2 ); + + puts_nocr( + "TA1 - rtems_partition_get_buffer - buffer 1 from partition 1 - " + ); + status = rtems_partition_get_buffer( ptid_1, &buffer_address_1 ); + directive_failed( status, "rtems_partition_get_buffer" ); + Put_address_from_area_1( buffer_address_1 ); + new_line; + + puts_nocr( + "TA1 - rtems_partition_get_buffer - buffer 2 from partition 1 - " + ); + status = rtems_partition_get_buffer( ptid_1, &buffer_address_2 ); + directive_failed( status, "rtems_partition_get_buffer" ); + Put_address_from_area_1( buffer_address_2 ); + new_line; + + puts_nocr( + "TA1 - rtems_partition_get_buffer - buffer 1 from partition 2 - " + ); + status = rtems_partition_get_buffer( ptid_2, &buffer_address_3 ); + directive_failed( status, "rtems_partition_get_buffer" ); + Put_address_from_area_2( buffer_address_3 ); + new_line; + + puts_nocr( + "TA1 - rtems_partition_get_buffer - buffer 2 from partition 2 - " + ); + status = rtems_partition_get_buffer( ptid_2, &buffer_address_4 ); + directive_failed( status, "rtems_partition_get_buffer" ); + Put_address_from_area_2( buffer_address_4 ); + new_line; + + puts_nocr( + "TA1 - rtems_partition_return_buffer - buffer 1 to partition 1 - " + ); + Put_address_from_area_1( buffer_address_1 ); + new_line; + status = rtems_partition_return_buffer( ptid_1, buffer_address_1 ); + directive_failed( status, "rtems_partition_return_buffer" ); + + puts_nocr( + "TA1 - rtems_partition_return_buffer - buffer 2 to partition 1 - " + ); + Put_address_from_area_1( buffer_address_2 ); + new_line; + status = rtems_partition_return_buffer( ptid_1, buffer_address_2 ); + directive_failed( status, "rtems_partition_return_buffer" ); + + puts_nocr( + "TA1 - rtems_partition_return_buffer - buffer 1 to partition 2 - " + ); + Put_address_from_area_2( buffer_address_3 ); + new_line; + status = rtems_partition_return_buffer( ptid_2, buffer_address_3 ); + directive_failed( status, "rtems_partition_return_buffer" ); + + puts_nocr( + "TA1 - rtems_partition_return_buffer - buffer 2 to partition 2 - " + ); + Put_address_from_area_2( buffer_address_4 ); + new_line; + status = rtems_partition_return_buffer( ptid_2, buffer_address_4 ); + directive_failed( status, "rtems_partition_return_buffer" ); + + puts( "TA1 - rtems_partition_delete - delete partition 1" + ); + status = rtems_partition_delete( ptid_1 ); + directive_failed( status, "rtems_partition_delete" ); + + puts( "TA1 - rtems_partition_delete - delete partition 2" + ); + status = rtems_partition_delete( ptid_2 ); + directive_failed( status, "rtems_partition_delete" ); + + puts( "*** END OF TEST 15 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp16/init.c b/testsuites/sptests/sp16/init.c new file mode 100644 index 0000000000..a5b1163b13 --- /dev/null +++ b/testsuites/sptests/sp16/init.c @@ -0,0 +1,131 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 16 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + BASE_PRIORITY, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + BASE_PRIORITY, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + BASE_PRIORITY, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + Region_name[ 1 ] = rtems_build_name( 'R', 'N', '1', ' ' ); + Region_name[ 2 ] = rtems_build_name( 'R', 'N', '2', ' ' ); + Region_name[ 3 ] = rtems_build_name( 'R', 'N', '3', ' ' ); + Region_name[ 4 ] = rtems_build_name( 'R', 'N', '4', ' ' ); + + status = rtems_region_create( + Region_name[ 1 ], + Area_1, + 4096, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &Region_id[ 1 ] + ); + directive_failed( status, "rtems_region_create of RN1" ); + + status = rtems_region_create( + Region_name[ 2 ], + Area_2, + 4096, + 128, + RTEMS_PRIORITY, + &Region_id[ 2 ] + ); + directive_failed( status, "rtems_region_create of RN2" ); + + status = rtems_region_create( + Region_name[ 3 ], + Area_3, + 4096, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &Region_id[ 3 ] + ); + directive_failed( status, "rtems_region_create of RN3" ); + + status = rtems_region_create( + Region_name[ 4 ], + Area_4, + 4096, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &Region_id[ 4 ] + ); + directive_failed( status, "rtems_region_create of RN4" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp16/sp16.doc b/testsuites/sptests/sp16/sp16.doc new file mode 100644 index 0000000000..c5512af051 --- /dev/null +++ b/testsuites/sptests/sp16/sp16.doc @@ -0,0 +1,24 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test16 + +directives: + ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return, + rn_create, rn_ident, rn_getbuf, rn_retbuf, rn_delete + +concepts: + + a. This test checks out the region manager. diff --git a/testsuites/sptests/sp16/sp16.scn b/testsuites/sptests/sp16/sp16.scn new file mode 100644 index 0000000000..a1a27cb9ad --- /dev/null +++ b/testsuites/sptests/sp16/sp16.scn @@ -0,0 +1,58 @@ +*** TEST 16 *** +TA1 - rtems_region_ident - rnid => 00010002 +TA1 - rtems_region_get_segment - wait on 100 byte segment from region 2 +TA1 - got segment from region 2 - 0x00000f78 +TA1 - rtems_region_get_segment - wait on 3K segment from region 3 +TA1 - got segment from region 3 - 0x000003f8 +TA1 - rtems_region_get_segment - get 3080 byte segment from region 1 - NO_WAIT +TA1 - got segment from region 1 - 0x00000378 +TA1 - rtems_task_wake_after - yield processor +TA2 - rtems_region_get_segment - wait on 2K segment from region 1 +TA3 - rtems_region_get_segment - wait on 3968 byte segment from region 2 + +TA1 - rtems_region_return_segment - return segment to region 1 - 0x00000378 +TA1 - rtems_region_get_segment - wait 10 seconds for 3K segment from region 1 +TA2 - got segment from region 1 - 0x000007f8 +TA2 - rtems_region_return_segment - return segment to region 1 - 0x000007f8 +TA2 - rtems_task_set_priority - make self highest priority task +TA2 - rtems_region_get_segment - wait on 3968 byte segment +TA1 - got segment from region 1 - 0x000003f8 +TA1 - rtems_region_return_segment - return segment to region 2 - 0x00000f78 +TA2 - got segment from region 2 - 0x00000008 +TA2 - rtems_region_return_segment - return segment to region 2 - 0x00000008 +TA2 - rtems_task_delete - delete self +TA1 - rtems_task_wake_after - yield processor +TA3 - got segment from region 2 - 0x00000008 +TA3 - rtems_region_get_segment - wait on 2K segment from region 3 +TA1 - rtems_task_delete - delete TA3 + +TA1 - rtems_task_wake_after - yield processor +TA4 - rtems_region_get_segment - wait on 1.5K segment from region 1 +TA5 - rtems_region_get_segment - wait on 1.5K segment from region 1 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x000003f8 +TA1 - rtems_task_wake_after - yield processor +TA4 - got and returned 0x000009f8 +TA5 - got and returned 0x000003f0 +TA1 - rtems_region_get_segment - wait 10 seconds for 3K segment from region 1 +TA1 - got segment from region 1 - 0x000003f8 +TA1 - rtems_task_wake_after - yield processor +TA4 - rtems_region_get_segment - wait on 3K segment from region 1 +TA5 - rtems_region_get_segment - wait on 3K segment from region 1 +TA1 - rtems_task_delete - delete TA4 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x000003f8 +TA1 - rtems_task_wake_after - yield processor +TA5 - got segment from region 1 - 0x000003f8 +TA5 - rtems_region_return_segment - return segment to region 1 - 0x000003f8 +TA5 - rtems_task_delete - delete self +TA1 - rtems_region_delete - delete region 1 +TA1 - rtems_region_get_segment - get 3K segment from region 4 +TA1 - got segment from region 4 - 0x000003f8 +TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4 +TA1 - rtems_task_get_note - RTEMS_UNSATISFIED +TA1 - rtems_region_extend - extend region 4 by 4K +TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4 +TA1 - got 3K segment from region 4 - 0x00001400 +TA1 - rtems_region_return_segment - return segment to region 4 - 0x000003f8 +TA1 - rtems_region_return_segment - return segment to region 4 - 0x00001400 +TA1 - rtems_region_delete - delete region 4 +*** END OF TEST 16 *** diff --git a/testsuites/sptests/sp16/system.h b/testsuites/sptests/sp16/system.h new file mode 100644 index 0000000000..9e2b748a85 --- /dev/null +++ b/testsuites/sptests/sp16/system.h @@ -0,0 +1,32 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +#define BASE_PRIORITY 140 /* all tasks priority */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp16/task1.c b/testsuites/sptests/sp16/task1.c new file mode 100644 index 0000000000..25f90aca00 --- /dev/null +++ b/testsuites/sptests/sp16/task1.c @@ -0,0 +1,282 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id rnid; + void *segment_address_1; + void *segment_address_2; + void *segment_address_3; + void *segment_address_4; + rtems_status_code status; + + status = rtems_region_ident( Region_name[ 1 ], &rnid ); + printf( "TA1 - rtems_region_ident - rnid => %08x\n", rnid ); + directive_failed( status, "rtems_region_ident of RN1" ); + + puts( + "TA1 - rtems_region_get_segment - wait on 100 byte segment from region 2" + ); + status = rtems_region_get_segment( + Region_id[ 2 ], + 100, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 2 - " ); + Put_address_from_area_2( segment_address_1 ); + new_line; + + puts( "TA1 - rtems_region_get_segment - wait on 3K segment from region 3" ); + status = rtems_region_get_segment( + Region_id[ 3 ], + 3072, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_2 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 3 - " ); + Put_address_from_area_3( segment_address_2 ); + new_line; + + puts_nocr( "TA1 - rtems_region_get_segment - get 3080 byte segment " ); + puts ( "from region 1 - NO_WAIT" ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 3080, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &segment_address_3 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( segment_address_3 ); + new_line; + + puts( "TA1 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + +pause(); + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( segment_address_3 ); + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_3 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait 10 seconds for 3K " + "segment from region 1" + ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 3072, + RTEMS_DEFAULT_OPTIONS, + 10 * TICKS_PER_SECOND, + &segment_address_4 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( segment_address_4 ); + new_line; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 2 - " + ); + Put_address_from_area_2( segment_address_1 ); + new_line; + status = rtems_region_return_segment( Region_id[ 2 ], segment_address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + + puts( "TA1 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_task_delete - delete TA3" ); + status = rtems_task_delete( Task_id[ 3 ] ); + directive_failed( status, "rtems_task_delete of TA3" ); + +pause(); + + status = rtems_task_create( + Task_name[ 4 ], + BASE_PRIORITY, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 4 ] + ); + directive_failed( status, "rtems_task_create of TA4" ); + + status = rtems_task_create( + Task_name[ 5 ], + BASE_PRIORITY, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 5 ] + ); + directive_failed( status, "rtems_task_create of TA5" ); + + status = rtems_task_start( Task_id[ 4 ], Task_4, 0 ); + directive_failed( status, "rtems_task_start of TA4" ); + + status = rtems_task_start( Task_id[ 5 ], Task5, 0 ); + directive_failed( status, "rtems_task_start of TA5" ); + + puts( "TA1 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( segment_address_4 ); + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_4 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + + puts( "TA1 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts_nocr( "TA1 - rtems_region_get_segment - wait 10 seconds for 3K " ); + puts ( "segment from region 1"); + status = rtems_region_get_segment( + Region_id[ 1 ], + 3072, + RTEMS_DEFAULT_OPTIONS, + 10 * TICKS_PER_SECOND, + &segment_address_4 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( segment_address_4 ); + new_line; + + puts( "TA1 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_task_delete - delete TA4" ); + status = rtems_task_delete( Task_id[ 4 ] ); + directive_failed( status, "rtems_task_delete of TA4" ); + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( segment_address_4 ); + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_4 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + + puts( "TA1 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + + puts( "TA1 - rtems_region_delete - delete region 1" ); + status = rtems_region_delete( Region_id[ 1 ] ); + directive_failed( status, "rtems_region_delete" ); + + puts( "TA1 - rtems_region_get_segment - get 3K segment from region 4" ); + status = rtems_region_get_segment( + Region_id[ 4 ], + 3072, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 4 - " ); + Put_address_from_area_4( segment_address_1 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4" + ); + status = rtems_region_get_segment( + Region_id[ 4 ], + 3072, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &segment_address_2 + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_task_get_segment with no memory left" + ); + puts( "TA1 - rtems_task_get_note - RTEMS_UNSATISFIED" ); + + puts( "TA1 - rtems_region_extend - extend region 4 by 4K" ); + status = rtems_region_extend( + Region_id[ 4 ], + &Area_4[4096], + 4096 + ); + directive_failed( status, "rtems_region_extend" ); + + puts( + "TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4" + ); + status = rtems_region_get_segment( + Region_id[ 4 ], + 3072, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &segment_address_3 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got 3K segment from region 4 - " ); + Put_address_from_area_4( segment_address_3 ); + new_line; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 4 - " + ); + Put_address_from_area_4( segment_address_1 ); + status = rtems_region_return_segment( Region_id[ 4 ], segment_address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 4 - " + ); + Put_address_from_area_4( segment_address_3 ); + status = rtems_region_return_segment( Region_id[ 4 ], segment_address_3 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + + puts( "TA1 - rtems_region_delete - delete region 4" ); + status = rtems_region_delete( Region_id[ 4 ] ); + directive_failed( status, "rtems_region_delete" ); + + puts( "*** END OF TEST 16 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp16/task2.c b/testsuites/sptests/sp16/task2.c new file mode 100644 index 0000000000..d5bc312b27 --- /dev/null +++ b/testsuites/sptests/sp16/task2.c @@ -0,0 +1,86 @@ +/* Task_2 + * + * This routine serves as a test task. It competes with the other tasks + * for region resources. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_task_priority previous_priority; + void *segment_address_1; + void *segment_address_2; + + puts( "TA2 - rtems_region_get_segment - wait on 2K segment from region 1" ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 2048, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA2 - got segment from region 1 - " ); + Put_address_from_area_1( segment_address_1 ); + new_line; + + puts_nocr( + "TA2 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( segment_address_1 ); + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + + puts( "TA2 - rtems_task_set_priority - make self highest priority task" ); + status = rtems_task_set_priority( + RTEMS_SELF, + BASE_PRIORITY-1, + &previous_priority + ); + directive_failed( status, "rtems_task_set_priority" ); + + puts("TA2 - rtems_region_get_segment - wait on 3968 byte segment"); + status = rtems_region_get_segment( + Region_id[ 2 ], + 3968, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_2 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA2 - got segment from region 2 - "); + Put_address_from_area_2( segment_address_2 ); + new_line; + + puts_nocr( + "TA2 - rtems_region_return_segment - return segment to region 2 - " + ); + Put_address_from_area_2( segment_address_2 ); + status = rtems_region_return_segment( Region_id[ 2 ], segment_address_2 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + + puts( "TA2 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp16/task3.c b/testsuites/sptests/sp16/task3.c new file mode 100644 index 0000000000..292e5824f6 --- /dev/null +++ b/testsuites/sptests/sp16/task3.c @@ -0,0 +1,57 @@ +/* Task_3 + * + * This routine serves as a test task. It competes with the other tasks + * for region resources. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + rtems_status_code status; + void *segment_address_1; + void *segment_address_2; + + puts( + "TA3 - rtems_region_get_segment - wait on 3968 byte segment from region 2" + ); + status = rtems_region_get_segment( + Region_id[ 2 ], + 3968, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA3 - got segment from region 2 - " ); + Put_address_from_area_2( segment_address_1 ); + new_line; + directive_failed( status, "rtems_region_return_segment" ); + + puts( "TA3 - rtems_region_get_segment - wait on 2K segment from region 3" ); + status = rtems_region_get_segment( + Region_id[ 3 ], + 2048, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_2 + ); + directive_failed( status, "rtems_region_get_segment" ); +} diff --git a/testsuites/sptests/sp16/task4.c b/testsuites/sptests/sp16/task4.c new file mode 100644 index 0000000000..f3da89b72e --- /dev/null +++ b/testsuites/sptests/sp16/task4.c @@ -0,0 +1,60 @@ +/* Task_4 + * + * This routine serves as a test task. It competes with the other tasks + * for region resources. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_4( + rtems_task_argument argument +) +{ + rtems_status_code status; + void *segment_address_1; + void *segment_address_2; + + puts( "TA4 - rtems_region_get_segment - wait on 1.5K segment from region 1" ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 1536, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + puts_nocr( "TA4 - got and returned " ); + Put_address_from_area_1( segment_address_1 ); + new_line; + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA4 - rtems_region_get_segment - wait on 3K segment from region 1" ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 3072, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_2 + ); + directive_failed( status, "rtems_region_get_segment" ); +} diff --git a/testsuites/sptests/sp16/task5.c b/testsuites/sptests/sp16/task5.c new file mode 100644 index 0000000000..5defa75f9c --- /dev/null +++ b/testsuites/sptests/sp16/task5.c @@ -0,0 +1,73 @@ +/* Task5 + * + * This routine serves as a test task. It competes with the other tasks + * for region resources. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task5( + rtems_task_argument argument +) +{ + void *segment_address_1; + void *segment_address_2; + rtems_status_code status; + + puts( "TA5 - rtems_region_get_segment - wait on 1.5K segment from region 1" ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 1536, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + puts_nocr( "TA5 - got and returned " ); + Put_address_from_area_1( segment_address_1 ); + new_line; + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA5 - rtems_region_get_segment - wait on 3K segment from region 1" ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 3072, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_2 + ); + puts_nocr( "TA5 - got segment from region 1 - " ); + Put_address_from_area_1( segment_address_2 ); + new_line; + + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_2 ); + puts_nocr( + "TA5 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( segment_address_2 ); + new_line; + + puts( "TA5 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp17/asr.c b/testsuites/sptests/sp17/asr.c new file mode 100644 index 0000000000..1795bbd522 --- /dev/null +++ b/testsuites/sptests/sp17/asr.c @@ -0,0 +1,32 @@ +/* Process_asr + * + * This routine performs the processing for task 1's RTEMS_ASR. It is called + * by an assembly routine which saves the necessary registers. + * + * Input parameters: + * signal - signal set + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_asr Process_asr( + rtems_signal_set signal_set +) +{ + rtems_status_code status; + + status = rtems_task_resume( Task_id[ 2 ] ); + directive_failed( status, "RTEMS_ASR - rtems_task_resume of TA2" ); +} diff --git a/testsuites/sptests/sp17/init.c b/testsuites/sptests/sp17/init.c new file mode 100644 index 0000000000..5527e80c9c --- /dev/null +++ b/testsuites/sptests/sp17/init.c @@ -0,0 +1,72 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 17 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + + Task_2_preempted = FALSE; + + status = rtems_task_create( + Task_name[ 1 ], + 2, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp17/sp17.doc b/testsuites/sptests/sp17/sp17.doc new file mode 100644 index 0000000000..b4258461cf --- /dev/null +++ b/testsuites/sptests/sp17/sp17.doc @@ -0,0 +1,35 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test17 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + as_catch, as_return + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + c. Verifies executive initialization performed correctly. + + d. Verifies that a task can get the task identification number + of another task. + + e. Verifies that a signal can be sent to a remote task. diff --git a/testsuites/sptests/sp17/sp17.scn b/testsuites/sptests/sp17/sp17.scn new file mode 100644 index 0000000000..47fd140e2a --- /dev/null +++ b/testsuites/sptests/sp17/sp17.scn @@ -0,0 +1,8 @@ +*** TEST 17 *** +TA2 - Suspending self +TA1 - rtems_signal_catch: initializing signal catcher +TA1 - Sending signal to self +TA2 - signal_return preempted correctly +TA1 - TA2 correctly preempted me +TA1 - Got Back!!! +*** END OF TEST 17 *** diff --git a/testsuites/sptests/sp17/system.h b/testsuites/sptests/sp17/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp17/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp17/task1.c b/testsuites/sptests/sp17/task1.c new file mode 100644 index 0000000000..282c161a39 --- /dev/null +++ b/testsuites/sptests/sp17/task1.c @@ -0,0 +1,48 @@ +/* Task_1 + * + * This task initializes the signal catcher, sends the first signal + * if running on the first node, and loops while waiting for signals. + * + * NOTE: The signal catcher is not reentrant and hence RTEMS_NO_ASR must + * be a part of its execution mode. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA1 - rtems_signal_catch: initializing signal catcher" ); + status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR | RTEMS_NO_PREEMPT ); + directive_failed( status, "rtems_signal_catch" ); + + puts( "TA1 - Sending signal to self" ); + status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_16 ); + directive_failed( status, "rtems_signal_send" ); + + if ( Task_2_preempted == TRUE ) + puts( "TA1 - TA2 correctly preempted me" ); + + puts("TA1 - Got Back!!!"); + + puts( "*** END OF TEST 17 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp17/task2.c b/testsuites/sptests/sp17/task2.c new file mode 100644 index 0000000000..cd3e16c7c0 --- /dev/null +++ b/testsuites/sptests/sp17/task2.c @@ -0,0 +1,45 @@ +/* Task_2 + * + * This task initializes the signal catcher, sends the first signal + * if running on the first node, and loops while waiting for signals. + * + * NOTE: The signal catcher is not reentrant and hence RTEMS_NO_ASR must + * be a part of its execution mode. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + Task_2_preempted = FALSE; + + puts( "TA2 - Suspending self" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend of TA2" ); + + puts( "TA2 - signal_return preempted correctly" ); + + Task_2_preempted = TRUE; + + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend of TA2" ); +} diff --git a/testsuites/sptests/sp19/first.c b/testsuites/sptests/sp19/first.c new file mode 100644 index 0000000000..94bdedd5ad --- /dev/null +++ b/testsuites/sptests/sp19/first.c @@ -0,0 +1,66 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#include "fptest.h" +#include "inttest.h" + +rtems_task First_FP_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_id tid; + rtems_time_of_day time; + rtems_unsigned32 task_index; + INTEGER_DECLARE; + FP_DECLARE; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident" ); + + task_index = task_number( tid ); + + INTEGER_LOAD( INTEGER_factors[ task_index ] ); + FP_LOAD( FP_factors[ task_index ] ); + + put_name( Task_name[ task_index ], FALSE ); + printf( " - integer base = (0x%x)\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 ( argument == 0 ) { + status = rtems_task_restart( RTEMS_SELF, 1 ); + directive_failed( status, "rtems_task_restart of RTEMS_SELF" ); + } else { + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); + } +} diff --git a/testsuites/sptests/sp19/fptask.c b/testsuites/sptests/sp19/fptask.c new file mode 100644 index 0000000000..b8e881e6cd --- /dev/null +++ b/testsuites/sptests/sp19/fptask.c @@ -0,0 +1,98 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#include "fptest.h" +#include "inttest.h" + +rtems_task FP_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_id tid; + rtems_time_of_day time; + rtems_unsigned32 task_index; + rtems_unsigned32 previous_seconds; + INTEGER_DECLARE; + FP_DECLARE; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident of self" ); + + task_index = task_number( tid ); + + INTEGER_LOAD( INTEGER_factors[ task_index ] ); + FP_LOAD( FP_factors[ task_index ] ); + + put_name( Task_name[ task_index ], FALSE ); + printf( " - integer base = (0x%x)\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 + + previous_seconds = -1; + + while( FOREVER ) { + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + if ( time.second >= 16 ) { + + if ( task_number( tid ) == 4 ) { + puts( "TA4 - rtems_task_delete - self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA4" ); + } + puts( "TA5 - rtems_task_delete - TA3" ); + status = rtems_task_delete( Task_id[ 3 ] ); + directive_failed( status, "rtems_task_delete of TA3" ); + + puts( "*** END OF TEST 19 *** " ); + exit( 0 ); + } + + if (previous_seconds != time.second) + { + put_name( Task_name[ task_index ], FALSE ); + print_time( " - rtems_clock_get - ", &time, "\n" ); + previous_seconds = time.second; + } + + INTEGER_CHECK( INTEGER_factors[ task_index ] ); + FP_CHECK( FP_factors[ task_index ] ); + + /* for the first 4 seconds we spin as fast as possible + * so that we likely are interrupted + * After that, we go to sleep for a second at a time + */ + if (time.second >= 4) + { + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + } + } +} diff --git a/testsuites/sptests/sp19/fptest.h b/testsuites/sptests/sp19/fptest.h new file mode 100644 index 0000000000..a8f3a925cb --- /dev/null +++ b/testsuites/sptests/sp19/fptest.h @@ -0,0 +1,165 @@ +/* fptest.h + * + * This include file contains the CPU dependent implementation + * of the following routines needed to test RTEMS floating + * point support: + * FP_load( &context ) + * FP_check( &context ) + * + * FP_load - loads the specified floating point context + * FP_check - checks the specified floating point context + * + * NOTE: These routines are VERY CPU dependent and are thus + * located in in the CPU dependent include file + * fptest.h. These routines form the core of the + * floating point context switch test. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#ifndef __FPTEST_h +#define __FPTEST_h + +#include + +#ifndef RTEMS_HAS_HARDWARE_FP +#error "This CPU does not have RTEMS_HAS_HARDWARE_FP defined" +#endif + +#if ( RTEMS_HAS_HARDWARE_FP == FALSE ) + +#define FP_DECLARE ; +#define FP_LOAD( _factor ) +#define FP_CHECK( _factor ) 0 + +#else + +#define FP_DECLARE \ + double fp01 = 1.0; \ + double fp02 = 2.0; \ + double fp03 = 3.0; \ + double fp04 = 4.0; \ + double fp05 = 5.0; \ + double fp06 = 6.0; \ + double fp07 = 7.0; \ + double fp08 = 8.0; \ + double fp09 = 9.0; \ + double fp10 = 10.0; \ + double fp11 = 11.0; \ + double fp12 = 12.0; \ + double fp13 = 13.0; \ + double fp14 = 14.0; \ + double fp15 = 15.0; \ + double fp16 = 16.0; \ + double fp17 = 17.0; \ + double fp18 = 18.0; \ + double fp19 = 19.0; \ + double fp20 = 20.0; \ + double fp21 = 21.0; \ + double fp22 = 22.0; \ + double fp23 = 23.0; \ + double fp24 = 24.0; \ + double fp25 = 25.0; \ + double fp26 = 26.0; \ + double fp27 = 27.0; \ + double fp28 = 28.0; \ + double fp29 = 29.0; \ + double fp30 = 30.0; \ + double fp31 = 31.0; \ + double fp32 = 32.0 + +#define FP_LOAD( _factor ) \ + do { \ + fp01 += _factor; \ + fp02 += _factor; \ + fp03 += _factor; \ + fp04 += _factor; \ + fp05 += _factor; \ + fp06 += _factor; \ + fp07 += _factor; \ + fp08 += _factor; \ + fp09 += _factor; \ + fp10 += _factor; \ + fp11 += _factor; \ + fp12 += _factor; \ + fp13 += _factor; \ + fp14 += _factor; \ + fp15 += _factor; \ + fp16 += _factor; \ + fp17 += _factor; \ + fp18 += _factor; \ + fp19 += _factor; \ + fp20 += _factor; \ + fp21 += _factor; \ + fp22 += _factor; \ + fp23 += _factor; \ + fp24 += _factor; \ + fp25 += _factor; \ + fp26 += _factor; \ + fp27 += _factor; \ + fp28 += _factor; \ + fp29 += _factor; \ + fp30 += _factor; \ + fp31 += _factor; \ + fp32 += _factor; \ + } while (0) + +#define EPSILON (0.0005) +#define FPABS(d) (((d) < 0.0) ? -(d) : (d)) +#define FPNEQ(a,b) (FPABS((a)-(b)) > EPSILON) + +#define FP_CHECK_ONE( _v, _base, _factor ) \ + if ( FPNEQ( (_v), ((_base) + (_factor)) ) ) { \ + printf("%d: " #_v " wrong -- (%g not %g)\n", \ + task_index, (_v), (_base + _factor)); \ + } + + +#define FP_CHECK( _factor ) \ + do { \ + FP_CHECK_ONE( fp01, 1.0, (_factor) ); \ + FP_CHECK_ONE( fp02, 2.0, (_factor) ); \ + FP_CHECK_ONE( fp03, 3.0, (_factor) ); \ + FP_CHECK_ONE( fp04, 4.0, (_factor) ); \ + FP_CHECK_ONE( fp05, 5.0, (_factor) ); \ + FP_CHECK_ONE( fp06, 6.0, (_factor) ); \ + FP_CHECK_ONE( fp07, 7.0, (_factor) ); \ + FP_CHECK_ONE( fp08, 8.0, (_factor) ); \ + FP_CHECK_ONE( fp09, 9.0, (_factor) ); \ + FP_CHECK_ONE( fp10, 10.0, (_factor) ); \ + FP_CHECK_ONE( fp11, 11.0, (_factor) ); \ + FP_CHECK_ONE( fp12, 12.0, (_factor) ); \ + FP_CHECK_ONE( fp13, 13.0, (_factor) ); \ + FP_CHECK_ONE( fp14, 14.0, (_factor) ); \ + FP_CHECK_ONE( fp15, 15.0, (_factor) ); \ + FP_CHECK_ONE( fp16, 16.0, (_factor) ); \ + FP_CHECK_ONE( fp17, 17.0, (_factor) ); \ + FP_CHECK_ONE( fp18, 18.0, (_factor) ); \ + FP_CHECK_ONE( fp19, 19.0, (_factor) ); \ + FP_CHECK_ONE( fp20, 20.0, (_factor) ); \ + FP_CHECK_ONE( fp21, 21.0, (_factor) ); \ + FP_CHECK_ONE( fp22, 22.0, (_factor) ); \ + FP_CHECK_ONE( fp23, 23.0, (_factor) ); \ + FP_CHECK_ONE( fp24, 24.0, (_factor) ); \ + FP_CHECK_ONE( fp25, 25.0, (_factor) ); \ + FP_CHECK_ONE( fp26, 26.0, (_factor) ); \ + FP_CHECK_ONE( fp27, 27.0, (_factor) ); \ + FP_CHECK_ONE( fp28, 28.0, (_factor) ); \ + FP_CHECK_ONE( fp29, 29.0, (_factor) ); \ + FP_CHECK_ONE( fp30, 30.0, (_factor) ); \ + FP_CHECK_ONE( fp31, 31.0, (_factor) ); \ + FP_CHECK_ONE( fp32, 32.0, (_factor) ); \ + } while (0) + +#endif + +#endif diff --git a/testsuites/sptests/sp19/init.c b/testsuites/sptests/sp19/init.c new file mode 100644 index 0000000000..477ec4ef43 --- /dev/null +++ b/testsuites/sptests/sp19/init.c @@ -0,0 +1,153 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 19 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + Task_name[ 6 ] = rtems_build_name( 'F', 'P', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 2, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_FLOATING_POINT, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 2, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 2, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_create( + Task_name[ 4 ], + 2, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_FLOATING_POINT, + &Task_id[ 4 ] + ); + directive_failed( status, "rtems_task_create of TA4" ); + + status = rtems_task_create( + Task_name[ 5 ], + 2, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_FLOATING_POINT, + &Task_id[ 5 ] + ); + directive_failed( status, "rtems_task_create of TA5" ); + + status = rtems_task_create( + Task_name[ 6 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_FLOATING_POINT, + &Task_id[ 6 ] + ); + directive_failed( status, "rtems_task_create of FP1" ); + + status = rtems_task_start( Task_id[ 6 ], First_FP_task, 0 ); + directive_failed( status, "rtems_task_start of FP1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_start( Task_id[ 4 ], FP_task, 0 ); + directive_failed( status, "rtems_task_start of TA4" ); + + status = rtems_task_start( Task_id[ 5 ], FP_task, 0 ); + directive_failed( status, "rtems_task_create of TA5" ); + + /* + * Load "task dependent factors" in the context areas + */ + + + FP_factors[0] = 0.0; + FP_factors[1] = 1000.1; + FP_factors[2] = 2000.2; + FP_factors[3] = 3000.3; + FP_factors[4] = 4000.4; + FP_factors[5] = 5000.5; + FP_factors[6] = 6000.6; + FP_factors[7] = 7000.7; + FP_factors[8] = 8000.8; + FP_factors[9] = 9000.9; + + INTEGER_factors[0] = 0x0000; + INTEGER_factors[1] = 0x1000; + INTEGER_factors[2] = 0x2000; + INTEGER_factors[3] = 0x3000; + INTEGER_factors[4] = 0x4000; + INTEGER_factors[5] = 0x5000; + INTEGER_factors[6] = 0x6000; + INTEGER_factors[7] = 0x7000; + INTEGER_factors[8] = 0x8000; + INTEGER_factors[9] = 0x9000; + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA1" ); +} diff --git a/testsuites/sptests/sp19/inttest.h b/testsuites/sptests/sp19/inttest.h new file mode 100644 index 0000000000..5dfb0af636 --- /dev/null +++ b/testsuites/sptests/sp19/inttest.h @@ -0,0 +1,149 @@ +/* inttest.h + * + * XXX: ??? + * This include file contains the CPU dependent implementation + * of the following routines needed to test RTEMS floating + * point support: + * INTEGER_load( &context ) + * INTEGER_check( &context ) + * + * INTEGER_load - loads the specified floating point context + * INTEGER_check - checks the specified floating point context + * + * NOTE: These routines are VERY CPU dependent and are thus + * located in in the CPU dependent include file + * inttest.h. These routines form the core of the + * floating point context switch test. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#ifndef __INTEGER_TEST_h +#define __INTEGER_TEST_h + +#include +#define REG_VARIABLE rtems_unsigned32 + +#define INTEGER_DECLARE \ + REG_VARIABLE int01 = 1; \ + REG_VARIABLE int02 = 2; \ + REG_VARIABLE int03 = 3; \ + REG_VARIABLE int04 = 4; \ + REG_VARIABLE int05 = 5; \ + REG_VARIABLE int06 = 6; \ + REG_VARIABLE int07 = 7; \ + REG_VARIABLE int08 = 8; \ + REG_VARIABLE int09 = 9; \ + REG_VARIABLE int10 = 10; \ + REG_VARIABLE int11 = 11; \ + REG_VARIABLE int12 = 12; \ + REG_VARIABLE int13 = 13; \ + REG_VARIABLE int14 = 14; \ + REG_VARIABLE int15 = 15; \ + REG_VARIABLE int16 = 16; \ + REG_VARIABLE int17 = 17; \ + REG_VARIABLE int18 = 18; \ + REG_VARIABLE int19 = 19; \ + REG_VARIABLE int20 = 20; \ + REG_VARIABLE int21 = 21; \ + REG_VARIABLE int22 = 22; \ + REG_VARIABLE int23 = 23; \ + REG_VARIABLE int24 = 24; \ + REG_VARIABLE int25 = 25; \ + REG_VARIABLE int26 = 26; \ + REG_VARIABLE int27 = 27; \ + REG_VARIABLE int28 = 28; \ + REG_VARIABLE int29 = 29; \ + REG_VARIABLE int30 = 30; \ + REG_VARIABLE int31 = 31; \ + REG_VARIABLE int32 = 32 + +#define INTEGER_LOAD( _factor ) \ + do { \ + int01 += _factor; \ + int02 += _factor; \ + int03 += _factor; \ + int04 += _factor; \ + int05 += _factor; \ + int06 += _factor; \ + int07 += _factor; \ + int08 += _factor; \ + int09 += _factor; \ + int10 += _factor; \ + int11 += _factor; \ + int12 += _factor; \ + int13 += _factor; \ + int14 += _factor; \ + int15 += _factor; \ + int16 += _factor; \ + int17 += _factor; \ + int18 += _factor; \ + int19 += _factor; \ + int20 += _factor; \ + int21 += _factor; \ + int22 += _factor; \ + int23 += _factor; \ + int24 += _factor; \ + int25 += _factor; \ + int26 += _factor; \ + int27 += _factor; \ + int28 += _factor; \ + int29 += _factor; \ + int30 += _factor; \ + int31 += _factor; \ + int32 += _factor; \ + } while (0) + +#define INTEGER_CHECK_ONE( _v, _base, _factor ) \ + if ( (_v) != ((_base) + (_factor)) ) { \ + printf("%d: " #_v " wrong -- (0x%x not 0x%x)\n", \ + task_index, (_v), (_base + _factor)); \ + } + + +#define INTEGER_CHECK( _factor ) \ + do { \ + INTEGER_CHECK_ONE( int01, 1, (_factor) ); \ + INTEGER_CHECK_ONE( int02, 2, (_factor) ); \ + INTEGER_CHECK_ONE( int03, 3, (_factor) ); \ + INTEGER_CHECK_ONE( int04, 4, (_factor) ); \ + INTEGER_CHECK_ONE( int05, 5, (_factor) ); \ + INTEGER_CHECK_ONE( int06, 6, (_factor) ); \ + INTEGER_CHECK_ONE( int07, 7, (_factor) ); \ + INTEGER_CHECK_ONE( int08, 8, (_factor) ); \ + INTEGER_CHECK_ONE( int09, 9, (_factor) ); \ + INTEGER_CHECK_ONE( int10, 10, (_factor) ); \ + INTEGER_CHECK_ONE( int11, 11, (_factor) ); \ + INTEGER_CHECK_ONE( int12, 12, (_factor) ); \ + INTEGER_CHECK_ONE( int13, 13, (_factor) ); \ + INTEGER_CHECK_ONE( int14, 14, (_factor) ); \ + INTEGER_CHECK_ONE( int15, 15, (_factor) ); \ + INTEGER_CHECK_ONE( int16, 16, (_factor) ); \ + INTEGER_CHECK_ONE( int17, 17, (_factor) ); \ + INTEGER_CHECK_ONE( int18, 18, (_factor) ); \ + INTEGER_CHECK_ONE( int19, 19, (_factor) ); \ + INTEGER_CHECK_ONE( int20, 20, (_factor) ); \ + INTEGER_CHECK_ONE( int21, 21, (_factor) ); \ + INTEGER_CHECK_ONE( int22, 22, (_factor) ); \ + INTEGER_CHECK_ONE( int23, 23, (_factor) ); \ + INTEGER_CHECK_ONE( int24, 24, (_factor) ); \ + INTEGER_CHECK_ONE( int25, 25, (_factor) ); \ + INTEGER_CHECK_ONE( int26, 26, (_factor) ); \ + INTEGER_CHECK_ONE( int27, 27, (_factor) ); \ + INTEGER_CHECK_ONE( int28, 28, (_factor) ); \ + INTEGER_CHECK_ONE( int29, 29, (_factor) ); \ + INTEGER_CHECK_ONE( int30, 30, (_factor) ); \ + INTEGER_CHECK_ONE( int31, 31, (_factor) ); \ + INTEGER_CHECK_ONE( int32, 32, (_factor) ); \ + } while (0) + +#endif diff --git a/testsuites/sptests/sp19/sp19.doc b/testsuites/sptests/sp19/sp19.doc new file mode 100644 index 0000000000..78ac463c9f --- /dev/null +++ b/testsuites/sptests/sp19/sp19.doc @@ -0,0 +1,23 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test19 + +directives: + +concepts: + + a. Verifies system can dispatch a mixture of floating point and + non-floating point tasks. diff --git a/testsuites/sptests/sp19/sp19.scn b/testsuites/sptests/sp19/sp19.scn new file mode 100644 index 0000000000..76ded9f7d0 --- /dev/null +++ b/testsuites/sptests/sp19/sp19.scn @@ -0,0 +1,55 @@ +*** TEST 19 *** +FP1 - integer base = (0x6000) +FP1 - float base = (6000.6) +FP1 - integer base = (0x6000) +FP1 - float base = (6000.6) +TA1 - integer base = (0x1000) +TA1 - rtems_clock_get - 09:00:00 12/31/1988 +TA2 - integer base = (0x2000) +TA2 - rtems_clock_get - 09:00:00 12/31/1988 +TA3 - integer base = (0x3000) +TA3 - rtems_clock_get - 09:00:00 12/31/1988 +TA4 - integer base = (0x4000) +TA4 - float base = (4000.4) +TA4 - rtems_clock_get - 09:00:00 12/31/1988 +TA5 - integer base = (0x5000) +TA5 - float base = (5000.5) +TA5 - rtems_clock_get - 09:00:00 12/31/1988 +TA4 - rtems_clock_get - 09:00:01 12/31/1988 +TA5 - rtems_clock_get - 09:00:01 12/31/1988 +TA4 - rtems_clock_get - 09:00:02 12/31/1988 +TA5 - rtems_clock_get - 09:00:02 12/31/1988 +TA4 - rtems_clock_get - 09:00:03 12/31/1988 +TA5 - rtems_clock_get - 09:00:03 12/31/1988 +TA4 - rtems_clock_get - 09:00:04 12/31/1988 +TA5 - rtems_clock_get - 09:00:04 12/31/1988 +TA1 - rtems_clock_get - 09:00:05 12/31/1988 +TA4 - rtems_clock_get - 09:00:05 12/31/1988 +TA5 - rtems_clock_get - 09:00:05 12/31/1988 +TA4 - rtems_clock_get - 09:00:06 12/31/1988 +TA5 - rtems_clock_get - 09:00:06 12/31/1988 +TA4 - rtems_clock_get - 09:00:07 12/31/1988 +TA5 - rtems_clock_get - 09:00:07 12/31/1988 +TA4 - rtems_clock_get - 09:00:08 12/31/1988 +TA5 - rtems_clock_get - 09:00:08 12/31/1988 +TA4 - rtems_clock_get - 09:00:09 12/31/1988 +TA5 - rtems_clock_get - 09:00:09 12/31/1988 +TA1 - rtems_clock_get - 09:00:10 12/31/1988 +TA2 - rtems_clock_get - 09:00:10 12/31/1988 +TA4 - rtems_clock_get - 09:00:10 12/31/1988 +TA5 - rtems_clock_get - 09:00:10 12/31/1988 +TA4 - rtems_clock_get - 09:00:11 12/31/1988 +TA5 - rtems_clock_get - 09:00:11 12/31/1988 +TA4 - rtems_clock_get - 09:00:12 12/31/1988 +TA5 - rtems_clock_get - 09:00:12 12/31/1988 +TA4 - rtems_clock_get - 09:00:13 12/31/1988 +TA5 - rtems_clock_get - 09:00:13 12/31/1988 +TA4 - rtems_clock_get - 09:00:14 12/31/1988 +TA5 - rtems_clock_get - 09:00:14 12/31/1988 +TA1 - rtems_clock_get - 09:00:15 12/31/1988 +TA3 - rtems_clock_get - 09:00:15 12/31/1988 +TA4 - rtems_clock_get - 09:00:15 12/31/1988 +TA5 - rtems_clock_get - 09:00:15 12/31/1988 +TA4 - rtems_task_delete - self +TA5 - rtems_task_delete - TA3 +*** END OF TEST 19 *** diff --git a/testsuites/sptests/sp19/system.h b/testsuites/sptests/sp19/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp19/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp19/task1.c b/testsuites/sptests/sp19/task1.c new file mode 100644 index 0000000000..874fbcc614 --- /dev/null +++ b/testsuites/sptests/sp19/task1.c @@ -0,0 +1,59 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#include "inttest.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_id tid; + rtems_time_of_day time; + rtems_unsigned32 task_index; + INTEGER_DECLARE; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident" ); + + task_index = task_number( tid ); + + INTEGER_LOAD( INTEGER_factors[ task_index ] ); + + put_name( Task_name[ task_index ], FALSE ); + printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] ); + + while( FOREVER ) { + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + put_name( Task_name[ task_number( tid ) ], FALSE ); + print_time( " - rtems_clock_get - ", &time, "\n" ); + + INTEGER_CHECK( INTEGER_factors[ task_index ] ); + + status = rtems_task_wake_after( + ( task_number( tid ) ) * 5 * TICKS_PER_SECOND + ); + directive_failed( status, "rtems_task_wake_after" ); + } +} diff --git a/testsuites/sptests/sp20/getall.c b/testsuites/sptests/sp20/getall.c new file mode 100644 index 0000000000..cff3841dff --- /dev/null +++ b/testsuites/sptests/sp20/getall.c @@ -0,0 +1,43 @@ +/* Get_all_counters + * + * This routine allows TA5 to atomically obtain the iteration counters. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Get_all_counters() +{ + rtems_mode previous_mode; + rtems_status_code status; + + status = rtems_task_mode( + RTEMS_NO_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode to RTEMS_NO_PREEMPT" ); + + Temporary_count = Count; + Count.count[ 1 ] = 0; + Count.count[ 2 ] = 0; + Count.count[ 3 ] = 0; + Count.count[ 4 ] = 0; + Count.count[ 5 ] = 0; + + status = rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode ); + directive_failed( status, "rtems_task_mode to RTEMS_PREEMPT" ); +} diff --git a/testsuites/sptests/sp20/init.c b/testsuites/sptests/sp20/init.c new file mode 100644 index 0000000000..95bdc3e728 --- /dev/null +++ b/testsuites/sptests/sp20/init.c @@ -0,0 +1,71 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + rtems_status_code status; + + puts( "\n\n*** TEST 20 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + + for ( index = 1 ; index <= 5 ; index++ ) { + status = rtems_task_create( + Task_name[ index ], + Priorities[ index ], + 4096, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] + ); + directive_failed( status, "rtems_task_create loop" ); + } + + for ( index = 1 ; index <= 5 ; index++ ) { + status = rtems_task_start( Task_id[ index ], Task_1_through_5, index ); + directive_failed( status, "rtems_task_start loop" ); + } + + Count.count[ 1 ] = 0; + Count.count[ 2 ] = 0; + Count.count[ 3 ] = 0; + Count.count[ 4 ] = 0; + Count.count[ 5 ] = 0; + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp20/sp20.doc b/testsuites/sptests/sp20/sp20.doc new file mode 100644 index 0000000000..4a029a4b89 --- /dev/null +++ b/testsuites/sptests/sp20/sp20.doc @@ -0,0 +1,24 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test20 + +directives: + + rm_create, rm_period + +concepts: + + a. Verifies Rate Monotonic Manager behavior. diff --git a/testsuites/sptests/sp20/sp20.scn b/testsuites/sptests/sp20/sp20.scn new file mode 100644 index 0000000000..1de3c18db8 --- /dev/null +++ b/testsuites/sptests/sp20/sp20.scn @@ -0,0 +1,27 @@ +*** TEST 20 *** +TA1 - rtems_rate_monotonic_create id = 0x00010001 +TA1 - rtems_rate_monotonic_ident id = 0x00010001 +TA1 - (0x00010001) period 2 +TA2 - rtems_rate_monotonic_create id = 0x00010002 +TA2 - rtems_rate_monotonic_ident id = 0x00010002 +TA2 - (0x00010002) period 2 +TA3 - rtems_rate_monotonic_create id = 0x00010003 +TA3 - rtems_rate_monotonic_ident id = 0x00010003 +TA3 - (0x00010003) period 2 +TA4 - rtems_rate_monotonic_create id = 0x00010004 +TA4 - rtems_rate_monotonic_ident id = 0x00010004 +TA4 - (0x00010004) period 2 +TA5 - rtems_rate_monotonic_create id = 0x00010005 +TA5 - rtems_rate_monotonic_ident id = 0x00010005 +TA5 - (0x00010005) period 50 +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) +TA5 - PERIODS CHECK OK (6) +TA5 - PERIODS CHECK OK (7) +TA5 - PERIODS CHECK OK (8) +TA5 - PERIODS CHECK OK (9) +TA5 - PERIODS CHECK OK (10) +*** END OF TEST 20 *** diff --git a/testsuites/sptests/sp20/system.h b/testsuites/sptests/sp20/system.h new file mode 100644 index 0000000000..98d52a20cc --- /dev/null +++ b/testsuites/sptests/sp20/system.h @@ -0,0 +1,34 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +struct counters { + rtems_unsigned32 count[6]; +}; + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp20/task1.c b/testsuites/sptests/sp20/task1.c new file mode 100644 index 0000000000..c5eda1a9ae --- /dev/null +++ b/testsuites/sptests/sp20/task1.c @@ -0,0 +1,116 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_unsigned32 Periods[6] = { 0, 2, 2, 2, 2, 100 }; +rtems_unsigned32 Iterations[6] = { 0, 50, 50, 50, 50, 1 }; +rtems_task_priority Priorities[6] = { 0, 1, 1, 3, 4, 5 }; + +rtems_task Task_1_through_5( + rtems_unsigned32 argument +) +{ + rtems_id rmid; + rtems_id test_rmid; + rtems_unsigned32 index; + rtems_unsigned32 pass; + rtems_unsigned32 failed; + rtems_status_code status; + + status = rtems_rate_monotonic_create( argument, &rmid ); + directive_failed( status, "rtems_rate_monotonic_create" ); + put_name( Task_name[ argument ], FALSE ); + printf( "- rtems_rate_monotonic_create id = 0x%08x\n", rmid ); + + 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%08x\n", test_rmid ); + + if ( rmid != test_rmid ) { + printf( "RMID's DO NOT MATCH (0x%x and 0x%x)\n", rmid, test_rmid ); + exit( 0 ); + } + + put_name( Task_name[ argument ], FALSE ); + printf( "- (0x%08x) period %d\n", rmid, Periods[ argument ] ); + + status = rtems_task_wake_after( 2 ); + directive_failed( status, "rtems_task_wake_after" ); + + switch ( argument ) { + case 1: + case 2: + case 3: + case 4: + while ( FOREVER ) { + status = rtems_rate_monotonic_period( rmid, Periods[ argument ] ); + directive_failed( status, "rtems_rate_monotonic_period" ); + Count.count[ argument ]++; + } + break; + case 5: + pass = 0; + failed = 0; + + status = rtems_rate_monotonic_period( rmid, Periods[ argument ] ); + directive_failed( status, "rtems_rate_monotonic_period 1 of TA5" ); + + Get_all_counters(); + + while ( FOREVER ) { + + status = rtems_rate_monotonic_period( rmid, Periods[ argument ] ); + directive_failed( status, "rtems_rate_monotonic_period 2 of TA5" ); + + Get_all_counters(); + + for( index = 1 ; index <= 4 ; index++ ) { + if ( Temporary_count.count[ index ] != Iterations[ index ] ) { + puts_nocr( "FAIL -- " ); + put_name ( Task_name[ index ], FALSE ); + printf ( " Actual=%d, Expected=%d\n", + Temporary_count.count[ index ], + Iterations[ index ] + ); + failed += 1; + } + } + + if ( failed == 5 ) + exit( 0 ); + + pass += 1; + + printf( "TA5 - PERIODS CHECK OK (%d)\n", pass ); + + fflush( stdout ); + + if ( pass == 10 ) { + puts( "*** END OF TEST 20 ***" ); + exit( 0 ); + } + + } + break; + } +} diff --git a/testsuites/sptests/sp21/init.c b/testsuites/sptests/sp21/init.c new file mode 100644 index 0000000000..bee9b931fc --- /dev/null +++ b/testsuites/sptests/sp21/init.c @@ -0,0 +1,56 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 21 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp21/sp21.doc b/testsuites/sptests/sp21/sp21.doc new file mode 100644 index 0000000000..55ed6282bc --- /dev/null +++ b/testsuites/sptests/sp21/sp21.doc @@ -0,0 +1,28 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test21 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_delete + de_init, de_open, de_close, de_read, de_write, de_cntrl + +concepts: + + a. Verifies all I/O manager directives always return successful for + null drivers. + + b. Verifies all I/O manager directives call and return from the driver + entry points in the driver address table. diff --git a/testsuites/sptests/sp21/sp21.scn b/testsuites/sptests/sp21/sp21.scn new file mode 100644 index 0000000000..c6392e3ea3 --- /dev/null +++ b/testsuites/sptests/sp21/sp21.scn @@ -0,0 +1,19 @@ +*** TEST 21 *** +----- TESTING THE NULL DRIVER CHECKS ----- +TA1 - rtems_io_initialize - NULL DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_open - NULL DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_close - NULL DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_read - NULL DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_write - NULL DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_control - NULL DRIVER RTEMS_SUCCESSFUL +----- TESTING THE I/O MANAGER DIRECTIVES ----- +TA1 - rtems_io_initialize - STUB DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_open - STUB DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_close - STUB DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_read - STUB DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_write - STUB DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_control - STUB DRIVER RTEMS_SUCCESSFUL +----- RETURNING INVALID MAJOR NUMBER ----- +TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER +TA1 - rtems_io_open - RTEMS_INVALID_NUMBER +*** END OF TEST 21 *** diff --git a/testsuites/sptests/sp21/system.h b/testsuites/sptests/sp21/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp21/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp21/task1.c b/testsuites/sptests/sp21/task1.c new file mode 100644 index 0000000000..3c4b284a97 --- /dev/null +++ b/testsuites/sptests/sp21/task1.c @@ -0,0 +1,106 @@ +/* Task_1 + * + * This routine serves as a test task. It tests the I/O manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +#define STUB_DRIVER_MAJOR 0x2 +#define NO_DRIVER_MAJOR 0x1 +#define INVALID_DRIVER_MAJOR 0x5 + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_status_code return_value; + + puts( "----- TESTING THE NULL DRIVER CHECKS -----" ); + + status = rtems_io_initialize( NO_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_initialize" ); + puts( "TA1 - rtems_io_initialize - NULL DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_open( NO_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_open" ); + puts( "TA1 - rtems_io_open - NULL DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_close( NO_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_close" ); + puts( "TA1 - rtems_io_close - NULL DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_read( NO_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_read" ); + puts( "TA1 - rtems_io_read - NULL DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_write( NO_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_write" ); + puts( "TA1 - rtems_io_write - NULL DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_control( NO_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_control" ); + puts( "TA1 - rtems_io_control - NULL DRIVER RTEMS_SUCCESSFUL" ); + + puts( "----- TESTING THE I/O MANAGER DIRECTIVES -----" ); + + status = rtems_io_initialize( STUB_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_initialize" ); + puts( "TA1 - rtems_io_initialize - STUB DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_open( STUB_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_open" ); + puts( "TA1 - rtems_io_open - STUB DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_close( STUB_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_close" ); + puts( "TA1 - rtems_io_close - STUB DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_read( STUB_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_read" ); + puts( "TA1 - rtems_io_read - STUB DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_write( STUB_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_write" ); + puts( "TA1 - rtems_io_write - STUB DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_control( STUB_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_control" ); + puts( "TA1 - rtems_io_control - STUB DRIVER RTEMS_SUCCESSFUL" ); + + puts( "----- RETURNING INVALID MAJOR NUMBER -----" ); + + status = rtems_io_initialize( INVALID_DRIVER_MAJOR, 0, NULL, &return_value ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_initialize" + ); + puts( "TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER" ); + + status = rtems_io_open( INVALID_DRIVER_MAJOR, 0, NULL, &return_value ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_open" + ); + puts( "TA1 - rtems_io_open - RTEMS_INVALID_NUMBER" ); + + puts( "*** END OF TEST 21 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp22/delay.c b/testsuites/sptests/sp22/delay.c new file mode 100644 index 0000000000..bcf9e014a7 --- /dev/null +++ b/testsuites/sptests/sp22/delay.c @@ -0,0 +1,32 @@ +/* Delayed_resume + * + * This routine is scheduled to be fired as a timer service routine. + * When fired this subprogram resumes Task_1. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_timer_service_routine Delayed_resume( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_task_resume( Task_id[ 1 ] ); + directive_failed( status, "rtems_task_resume of self" ); +} diff --git a/testsuites/sptests/sp22/init.c b/testsuites/sptests/sp22/init.c new file mode 100644 index 0000000000..820fac81e3 --- /dev/null +++ b/testsuites/sptests/sp22/init.c @@ -0,0 +1,69 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_time_of_day time; + rtems_status_code status; + + puts( "\n\n*** TEST 22 ***" ); + + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + puts( "INIT - rtems_timer_create - creating timer 1" ); + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create" ); + + printf( "INIT - timer 1 has id (0x%x)\n", Timer_id[ 1 ] ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp22/prtime.c b/testsuites/sptests/sp22/prtime.c new file mode 100644 index 0000000000..f3871eb9fd --- /dev/null +++ b/testsuites/sptests/sp22/prtime.c @@ -0,0 +1,32 @@ +/* Print_time + * + * This routine prints the name of Task_1 and the current time of day. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Print_time( void ) +{ + rtems_time_of_day time; + rtems_status_code status; + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + put_name( Task_name[ 1 ], FALSE ); + print_time( "- rtems_clock_get - ", &time, "\n" ); +} diff --git a/testsuites/sptests/sp22/sp22.doc b/testsuites/sptests/sp22/sp22.doc new file mode 100644 index 0000000000..9208d7a695 --- /dev/null +++ b/testsuites/sptests/sp22/sp22.doc @@ -0,0 +1,20 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test22 + +directives: + +concepts: diff --git a/testsuites/sptests/sp22/sp22.scn b/testsuites/sptests/sp22/sp22.scn new file mode 100644 index 0000000000..6402ab4482 --- /dev/null +++ b/testsuites/sptests/sp22/sp22.scn @@ -0,0 +1,29 @@ +*** TEST 22 *** +INIT - rtems_timer_create - creating timer 1 +INIT - timer 1 has id (0x10001) +TA1 - rtems_timer_ident - identing timer 1 +TA1 - timer 1 has id (0x10001) +TA1 - rtems_clock_get - 09:00:00 12/31/1988 +TA1 - rtems_timer_fire_after - timer 1 in 3 seconds +TA1 - rtems_task_suspend( RTEMS_SELF ) +TA1 - rtems_clock_get - 09:00:03 12/31/1988 +TA1 - rtems_timer_fire_after - timer 1 in 3 seconds +TA1 - rtems_task_wake_after - 1 second +TA1 - rtems_clock_get - 09:00:04 12/31/1988 +TA1 - rtems_timer_reset - timer 1 +TA1 - rtems_task_suspend( RTEMS_SELF ) +TA1 - rtems_clock_get - 09:00:07 12/31/1988 + +TA1 - rtems_timer_fire_after - timer 1 in 3 seconds +TA1 - rtems_timer_cancel - timer 1 +TA1 - rtems_clock_get - 09:00:07 12/31/1988 +TA1 - rtems_timer_fire_when - timer 1 in 3 seconds +TA1 - rtems_task_suspend( RTEMS_SELF ) +TA1 - rtems_clock_get - 09:00:10 12/31/1988 +TA1 - rtems_timer_fire_when - timer 1 in 3 seconds +TA1 - rtems_task_wake_after - 1 second +TA1 - rtems_clock_get - 09:00:11 12/31/1988 +TA1 - rtems_timer_cancel - timer 1 +TA1 - rtems_task_wake_after - YIELD (only task at priority) +TA1 - timer_deleting - timer 1 +*** END OF TEST 22 *** diff --git a/testsuites/sptests/sp22/system.h b/testsuites/sptests/sp22/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp22/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp22/task1.c b/testsuites/sptests/sp22/task1.c new file mode 100644 index 0000000000..240a1972cc --- /dev/null +++ b/testsuites/sptests/sp22/task1.c @@ -0,0 +1,164 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id tmid; + rtems_time_of_day time; + rtems_status_code status; + +/* Get id */ + + puts( "TA1 - rtems_timer_ident - identing timer 1" ); + status = rtems_timer_ident( Timer_name[ 1 ], &tmid ); + directive_failed( status, "rtems_timer_ident" ); + printf( "TA1 - timer 1 has id (0x%x)\n", tmid ); + +/* after which is allowed to fire */ + + Print_time(); + + puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" ); + status = rtems_timer_fire_after( + tmid, + 3 * TICKS_PER_SECOND, + Delayed_resume, + NULL + ); + directive_failed( status, "rtems_timer_fire_after" ); + + puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend" ); + + Print_time(); + +/* after which is reset and allowed to fire */ + + puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" ); + status = rtems_timer_fire_after( + tmid, + 3 * TICKS_PER_SECOND, + Delayed_resume, + NULL + ); + directive_failed( status, "rtems_timer_fire_after" ); + + puts( "TA1 - rtems_task_wake_after - 1 second" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + Print_time(); + + puts( "TA1 - rtems_timer_reset - timer 1" ); + status = rtems_timer_reset( tmid ); + directive_failed( status, "rtems_timer_reset" ); + + puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend" ); + + Print_time(); + + pause(); + + /* + * Reset the time since we do not know how long the user waited + * before pressing at the pause. This insures that the + * actual output matches the screen. + */ + + build_time( &time, 12, 31, 1988, 9, 0, 7, 0 ); + + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + +/* after which is canceled */ + + puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" ); + status = rtems_timer_fire_after( + tmid, + 3 * TICKS_PER_SECOND, + Delayed_resume, + NULL + ); + directive_failed( status, "rtems_timer_fire_after" ); + + puts( "TA1 - rtems_timer_cancel - timer 1" ); + status = rtems_timer_cancel( tmid ); + directive_failed( status, "rtems_timer_cancel" ); + +/* when which is allowed to fire */ + + Print_time(); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + time.second += 3; + + puts( "TA1 - rtems_timer_fire_when - timer 1 in 3 seconds" ); + status = rtems_timer_fire_when( tmid, &time, Delayed_resume, NULL ); + directive_failed( status, "rtems_timer_fire_when" ); + + puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend" ); + + Print_time(); + +/* when which is canceled */ + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + time.second += 3; + + puts( "TA1 - rtems_timer_fire_when - timer 1 in 3 seconds" ); + status = rtems_timer_fire_when( tmid, &time, Delayed_resume, NULL ); + directive_failed( status, "rtems_timer_fire_when" ); + + puts( "TA1 - rtems_task_wake_after - 1 second" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + Print_time(); + + puts( "TA1 - rtems_timer_cancel - timer 1" ); + status = rtems_timer_cancel( tmid ); + directive_failed( status, "rtems_timer_cancel" ); + +/* delete */ + puts( "TA1 - rtems_task_wake_after - YIELD (only task at priority)" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - timer_deleting - timer 1" ); + status = rtems_timer_delete( tmid ); + directive_failed( status, "rtems_timer_delete" ); + + puts( "*** END OF TEST 22 *** " ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp23/init.c b/testsuites/sptests/sp23/init.c new file mode 100644 index 0000000000..5acaf67e42 --- /dev/null +++ b/testsuites/sptests/sp23/init.c @@ -0,0 +1,72 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 23 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + Port_name[ 1 ] = rtems_build_name( 'D', 'P', '1', ' ' ); + + status = rtems_port_create( + Port_name[ 1 ], + Internal_port_area, + External_port_area, + 0xff, + &Port_id[ 1 ] + ); + directive_failed( status, "rtems_port_create of DP1" ); + + printf( "INIT - rtems_port_create - DP1 - int = %p ext = %p\n", + Internal_port_area, + External_port_area + ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp23/sp23.doc b/testsuites/sptests/sp23/sp23.doc new file mode 100644 index 0000000000..485a4ec466 --- /dev/null +++ b/testsuites/sptests/sp23/sp23.doc @@ -0,0 +1,26 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test23 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_delete, + m_ext2int, m_int2ext + +concepts: + + a. Verifies the dual ported RAM directives work correctly. + +output: diff --git a/testsuites/sptests/sp23/sp23.scn b/testsuites/sptests/sp23/sp23.scn new file mode 100644 index 0000000000..7529abd4c4 --- /dev/null +++ b/testsuites/sptests/sp23/sp23.scn @@ -0,0 +1,9 @@ +*** TEST 23 *** +INIT - rtems_port_create - DP1 - int = 0x00001000 ext = 0x00002000 +TA1 - rtems_port_ident - 00010001 +TA1 - rtems_port_external_to_internal - 0x0000200e => 0x0000100e +TA1 - rtems_port_internal_to_external - 0x0000100e => 0x0000200e +TA1 - rtems_port_external_to_internal - 0x0000300e => 0x0000300e +TA1 - rtems_port_internal_to_external - 0x0000050e => 0x0000050e +TA1 - rtems_port_delete - DP1 +*** END OF TEST 23 *** diff --git a/testsuites/sptests/sp23/system.h b/testsuites/sptests/sp23/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp23/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp23/task1.c b/testsuites/sptests/sp23/task1.c new file mode 100644 index 0000000000..5012616131 --- /dev/null +++ b/testsuites/sptests/sp23/task1.c @@ -0,0 +1,96 @@ +/* Task_1 + * + * This task verifies that the dual ported RAM directives work + * correctly by converting external addresses to internal addresses and + * internal addresses to external addresses. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id dpid; + void *to_be_converted; + void *converted; + rtems_status_code status; + + status = rtems_port_ident( Port_name[ 1 ], &dpid ); + directive_failed( status, "rtems_port_ident" ); + printf( "TA1 - rtems_port_ident - %08x\n", dpid ); + + to_be_converted = &External_port_area[ 0xe ]; + status = rtems_port_external_to_internal( + Port_id[ 1 ], + to_be_converted, + &converted + ); + directive_failed( status, "rtems_port_external_to_internal" ); + printf( + "TA1 - rtems_port_external_to_internal - %p => %p\n", + to_be_converted, + converted + ); + + to_be_converted = &Internal_port_area[ 0xe ]; + status = rtems_port_internal_to_external( + Port_id[ 1 ], + to_be_converted, + &converted + ); + directive_failed( status, "rtems_port_internal_to_external" ); + printf( + "TA1 - rtems_port_internal_to_external - %p => %p\n", + to_be_converted, + converted + ); + + to_be_converted = &Above_port_area[ 0xe ]; + status = rtems_port_external_to_internal( + Port_id[ 1 ], + to_be_converted, + &converted + ); + directive_failed( status, "rtems_port_external_to_internal" ); + printf( + "TA1 - rtems_port_external_to_internal - %p => %p\n", + to_be_converted, + converted + ); + + to_be_converted = &Below_port_area[ 0xe ]; + status = rtems_port_internal_to_external( + Port_id[ 1 ], + to_be_converted, + &converted + ); + directive_failed( status, "rtems_port_internal_to_external" ); + printf( + "TA1 - rtems_port_internal_to_external - %p => %p\n", + to_be_converted, + converted + ); + + status = rtems_port_delete( Port_id[ 1 ] ); + directive_failed( status, "rtems_port_delete" ); + puts( "TA1 - rtems_port_delete - DP1" ); + + puts( "*** END OF TEST 23 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/sp24/init.c b/testsuites/sptests/sp24/init.c new file mode 100644 index 0000000000..c73830a6df --- /dev/null +++ b/testsuites/sptests/sp24/init.c @@ -0,0 +1,79 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_time_of_day time; + rtems_unsigned32 index; + rtems_status_code status; + + puts( "\n\n*** TEST 24 ***" ); + + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' ); + Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' ); + + for ( index = 1 ; index <= 3 ; index++ ) { + status = rtems_task_create( + Task_name[ index ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] + ); + directive_failed( status, "rtems_task_create loop" ); + + status = rtems_timer_create( + Timer_name[ index ], + &Timer_id[ index ] + ); + directive_failed( status, "rtems_timer_create loop" ); + } + + for ( index = 1 ; index <= 3 ; index++ ) { + status = rtems_task_start( Task_id[ index ], Task_1_through_3, index ); + directive_failed( status, "rtems_task_start loop" ); + } + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp24/resume.c b/testsuites/sptests/sp24/resume.c new file mode 100644 index 0000000000..c73696c109 --- /dev/null +++ b/testsuites/sptests/sp24/resume.c @@ -0,0 +1,34 @@ +/* Resume_task + * + * This subprogram is scheduled as a timer service routine. When + * it fires it resumes the task which is mapped to this timer. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_timer_service_routine Resume_task( + rtems_id timer_id, + void *ignored_address +) +{ + rtems_id task_to_resume; + rtems_status_code status; + + task_to_resume = Task_id[ rtems_get_index( timer_id ) ]; + status = rtems_task_resume( task_to_resume ); + directive_failed( status, "rtems_task_resume" ); +} diff --git a/testsuites/sptests/sp24/sp24.doc b/testsuites/sptests/sp24/sp24.doc new file mode 100644 index 0000000000..14b743d588 --- /dev/null +++ b/testsuites/sptests/sp24/sp24.doc @@ -0,0 +1,51 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test24 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + ev_receive + +concepts: + + a. This test is a cyclic version of test1. The times printed by + each test should not skew as in test1 (see output section). + + b. Verifies system can create and start both the executive's system + initialization and idle task. + + c. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + d. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + e. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + f. Verifies executive initialization performed correctly. + + g. Verifies the executive trap handler except for the halt function. + + h. Verifies that a task can get the task identification number of itself. + +output: + "TA1" is printed once every 5 seconds. "TA2" is printed once + every 10 seconds. "TA3" is printed once every 15 seconds. + + The times printed should be multiples of 5 seconds for TA1, 10 seconds + for TA2, and 15 seconds for TA3. If this does not happen, the calendar + time does not correspond correctly to the number of ticks. diff --git a/testsuites/sptests/sp24/sp24.scn b/testsuites/sptests/sp24/sp24.scn new file mode 100644 index 0000000000..577dc4f7b2 --- /dev/null +++ b/testsuites/sptests/sp24/sp24.scn @@ -0,0 +1,16 @@ +*** TEST 24 *** +TA1 - rtems_clock_get - 09:00:00 12/31/1988 +TA2 - rtems_clock_get - 09:00:00 12/31/1988 +TA3 - rtems_clock_get - 09:00:00 12/31/1988 +TA1 - rtems_clock_get - 09:00:05 12/31/1988 +TA1 - rtems_clock_get - 09:00:10 12/31/1988 +TA2 - rtems_clock_get - 09:00:10 12/31/1988 +TA1 - rtems_clock_get - 09:00:15 12/31/1988 +TA3 - rtems_clock_get - 09:00:15 12/31/1988 +TA1 - rtems_clock_get - 09:00:20 12/31/1988 +TA2 - rtems_clock_get - 09:00:20 12/31/1988 +TA1 - rtems_clock_get - 09:00:25 12/31/1988 +TA1 - rtems_clock_get - 09:00:30 12/31/1988 +TA2 - rtems_clock_get - 09:00:30 12/31/1988 +TA3 - rtems_clock_get - 09:00:30 12/31/1988 +*** END OF TEST 24 *** diff --git a/testsuites/sptests/sp24/system.h b/testsuites/sptests/sp24/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/sp24/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp24/task1.c b/testsuites/sptests/sp24/task1.c new file mode 100644 index 0000000000..bb3540acee --- /dev/null +++ b/testsuites/sptests/sp24/task1.c @@ -0,0 +1,58 @@ +/* Task_1_through_3 + * + * This task is a cyclic version of test1 to asssure that the times + * displayed are not skewed as in test1. "TA1" is printed once every + * 5 seconds, "TA2" is printed once every 10 seconds, and "TA3" is + * printed once every 15 seconds. The times displayed should be + * in multiples of 5, 10, and 15 for TA1, TA2, and TA3 respectively. + * If the times are skewed from these values, then the calendar time + * does not correspond correctly with the number of ticks. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1_through_3( + rtems_task_argument argument +) +{ + rtems_id tid; + rtems_time_of_day time; + rtems_status_code status; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident of self" ); + + while ( FOREVER ) { + status = rtems_timer_fire_after( + Timer_id[ argument ], + task_number( tid ) * 5 * TICKS_PER_SECOND, + Resume_task, + NULL + ); + directive_failed( status, "tm_fire_after failed" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get failed" ); + + if ( time.second >= 35 ) { + puts( "*** END OF TEST 24 ***" ); + exit( 0 ); + } + + put_name( Task_name[ task_number( tid ) ], FALSE ); + print_time( " - rtems_clock_get - ", &time, "\n" ); + + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend" ); + } +} diff --git a/testsuites/sptests/sp25/init.c b/testsuites/sptests/sp25/init.c new file mode 100644 index 0000000000..fcd5b3dfd6 --- /dev/null +++ b/testsuites/sptests/sp25/init.c @@ -0,0 +1,69 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 25 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + BASE_PRIORITY, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + Region_name[ 1 ] = rtems_build_name('R', 'N', '0', '1'); + + + status = rtems_region_create( + Region_name[ 1 ], + Area_1, + sizeof( Area_1 ), + 64, + RTEMS_DEFAULT_ATTRIBUTES, + &Region_id[ 1 ] + ); + directive_failed( status, "rtems_region_create of RN1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/sp25/sp25.doc b/testsuites/sptests/sp25/sp25.doc new file mode 100644 index 0000000000..98684f53b3 --- /dev/null +++ b/testsuites/sptests/sp25/sp25.doc @@ -0,0 +1,32 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test25 + +directives: + task_create + task_start + task_delete + region_create + region_ident + region_get_segment + region_return_segment + region_delete + +concepts: + + a. Verifies that the heap maintains it's integrity trhough a series + on region_get_segments and region_return_segments. + diff --git a/testsuites/sptests/sp25/sp25.scn b/testsuites/sptests/sp25/sp25.scn new file mode 100644 index 0000000000..1944f18f4b --- /dev/null +++ b/testsuites/sptests/sp25/sp25.scn @@ -0,0 +1,29 @@ +*** TEST 25 *** +TA1 - rtems_region_ident - 00010002 +TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f9b8 +TA1 - rtems_region_get_segment - wait on 128 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f930 +TA1 - rtems_region_get_segment - wait on 256 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f828 +TA1 - rtems_region_get_segment - wait on 512 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f620 +TA1 - rtems_region_get_segment - wait on 1024 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f218 +TA1 - rtems_region_get_segment - wait on 2048 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000ea10 +TA1 - rtems_region_get_segment - wait on 4096 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000da08 +TA1 - rtems_region_get_segment - wait on 8192 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000ba00 + +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f828 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f620 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f9b8 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f930 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000da08 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000ea10 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000ba00 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f218 +TA1 - rtems_region_delete - walks heap if debug enabled +*** END OF TEST 25 *** diff --git a/testsuites/sptests/sp25/system.h b/testsuites/sptests/sp25/system.h new file mode 100644 index 0000000000..9e2b748a85 --- /dev/null +++ b/testsuites/sptests/sp25/system.h @@ -0,0 +1,32 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +#define BASE_PRIORITY 140 /* all tasks priority */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/sp25/task1.c b/testsuites/sptests/sp25/task1.c new file mode 100644 index 0000000000..6222c4e734 --- /dev/null +++ b/testsuites/sptests/sp25/task1.c @@ -0,0 +1,241 @@ +/* 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, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + void *address_1; + void *address_2; + void *address_3; + void *address_4; + void *address_5; + void *address_6; + void *address_7; + void *address_8; + rtems_status_code status; + rtems_id region_id; + + status = rtems_region_ident(Region_name[ 1 ], ®ion_id); + printf( "TA1 - rtems_region_ident - %08x\n", region_id ); + directive_failed(status, "rtems_region_ident of RN01"); + + puts( + "TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 64, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_1 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 128 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 128, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_2 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_2 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 256 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 256, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_3 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_3 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 512 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 512, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_4 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_4 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 1024 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 1024, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_5 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_5 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 2048 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 2048, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_6 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_6 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 4096 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 4096, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_7 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_7 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 8192 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 8192, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_8 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_8 ); + new_line; + +pause(); + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_3 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_3 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_3 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_4 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_4 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_4 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_1 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_1 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_2 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_2 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_2 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_7 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_7 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_7 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_6 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_6 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_6 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_8 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_8 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_8 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_5 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_5 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_5 = 0; + + puts( "TA1 - rtems_region_delete - walks heap if debug enabled" ); + rtems_region_delete(Region_id[ 1 ]); + + puts( "*** END OF TEST 25 ***" ); + exit( 0 ); +} diff --git a/testsuites/sptests/spfatal/fatal.c b/testsuites/sptests/spfatal/fatal.c new file mode 100644 index 0000000000..3b2228bffd --- /dev/null +++ b/testsuites/sptests/spfatal/fatal.c @@ -0,0 +1,134 @@ +/* Fatal Error Test + * + * NOTE: + * + * This test actually modifies the Configuration table and restarts + * the executive. It is very carefully constructed to do this and + * uses the Configuration very carefully. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +#include + +char Workspace[ 64 * 1024 ] CPU_STRUCTURE_ALIGNMENT; + +typedef enum { + FATAL_WORKSPACE_OF_ZERO, + FATAL_NULL_WORKSPACE, + FATAL_WORKSPACE_TOO_SMALL, + FATAL_TASK_CREATE, + FATAL_TASK_START +} Fatal_errors_t; + +#define FATAL_LAST FATAL_TASK_START + +volatile Fatal_errors_t Case_in_switch; + +rtems_status_code Expected_Errors[] = { + RTEMS_UNSATISFIED, + RTEMS_INVALID_ADDRESS, + RTEMS_UNSATISFIED, + RTEMS_INVALID_PRIORITY, + RTEMS_TASK_EXITTED +}; + +rtems_status_code Error_Happened[ FATAL_LAST + 1]; + +jmp_buf Restart_Context; + +/* + * We depend on this being zeroed during initialization. This + * occurs automatically because this is part of the BSS. + */ + +rtems_unsigned32 First_Time_Through; + +void Process_case(); + +rtems_extension Fatal_extension( + rtems_unsigned32 error +) +{ + int index; + + Error_Happened[ Case_in_switch ] = error; + + if ( First_Time_Through == 0 ) { + Case_in_switch = FATAL_WORKSPACE_OF_ZERO; + First_Time_Through = 1; + setjmp( Restart_Context ); + } else if ( Case_in_switch == FATAL_LAST ) { + + /* + * Depending on the C library we use, we cannot get the + * task exitted error so do not check for it. + */ + + puts( "*** TEST FATAL ***" ); + for ( index=0 ; index< FATAL_LAST ; index++ ) + put_error( Error_Happened[ index ], Expected_Errors[ index ] ); + puts( "NOT TESTING FATAL ERROR WHEN TASK EXITS -- C LIBRARY CATCHES THIS" ); + puts( "*** END OF TEST FATAL ***" ); + + /* + * returns to the default fatal error handler instead of + * calling rtems_shutdown_executive + */ + return; + + } else { + + longjmp( Restart_Context, 1 ); + } + + Process_case(); +} + + + +void Process_case() +{ + switch ( Case_in_switch ) { + case FATAL_WORKSPACE_OF_ZERO: + New_Configuration = BSP_Configuration; + New_Configuration.work_space_start = NULL; + Case_in_switch = FATAL_NULL_WORKSPACE; + break; + + case FATAL_NULL_WORKSPACE: + New_Configuration.work_space_start = Workspace; + New_Configuration.work_space_size = 256; + Case_in_switch = FATAL_WORKSPACE_TOO_SMALL; + break; + + case FATAL_WORKSPACE_TOO_SMALL: + Initialization_tasks[ 0 ].initial_priority = RTEMS_CURRENT_PRIORITY; + New_Configuration.work_space_size = sizeof( Workspace ); + Case_in_switch = FATAL_TASK_CREATE; + break; + + case FATAL_TASK_CREATE: + Initialization_tasks[ 0 ].initial_priority = 1; + Initialization_tasks[ 0 ].entry_point = NULL; + Case_in_switch = FATAL_TASK_START; + break; + + case FATAL_TASK_START: + /* this extension exits the test */ + Initialization_tasks[ 0 ].entry_point = Init; + break; + } + rtems_initialize_executive( &New_Configuration, &Cpu_table ); +} + diff --git a/testsuites/sptests/spfatal/init.c b/testsuites/sptests/spfatal/init.c new file mode 100644 index 0000000000..a50c6101f5 --- /dev/null +++ b/testsuites/sptests/spfatal/init.c @@ -0,0 +1,54 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/sptests/spfatal/puterr.c b/testsuites/sptests/spfatal/puterr.c new file mode 100644 index 0000000000..f7d79e5f34 --- /dev/null +++ b/testsuites/sptests/spfatal/puterr.c @@ -0,0 +1,68 @@ +/* put_error + * + * This routine verifies that the given error is the expected error. + * + * Input parameters: + * error - actual error code + * expected - expected error code + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +char *Errors[] = { + "RTEMS_SUCCESSFUL", /* successful completion */ + "RTEMS_TASK_EXITTED", /* returned from a task */ + "RTEMS_MP_NOT_CONFIGURED", /* multiprocessing not configured */ + "RTEMS_INVALID_NAME", /* invalid object name */ + "RTEMS_INVALID_ID", /* invalid object id */ + "RTEMS_TOO_MANY", /* too many */ + "RTEMS_TIMEOUT", /* timed out waiting */ + "RTEMS_OBJECT_WAS_DELETED", /* object was deleted while waiting */ + "RTEMS_INVALID_SIZE", /* specified size was invalid */ + "RTEMS_INVALID_ADDRESS", /* address specified is invalid */ + "RTEMS_INVALID_NUMBER", /* number was invalid */ + "RTEMS_NOT_DEFINED", /* item has not been initialized */ + "RTEMS_RESOURCE_IN_USE", /* resources still outstanding */ + "RTEMS_UNSATISFIED", /* request not satisfied */ + "RTEMS_INCORRECT_STATE", /* task is in wrong state */ + "RTEMS_ALREADY_SUSPENDED", /* task already in state */ + "RTEMS_ILLEGAL_ON_SELF", /* illegal operation on calling task */ + "RTEMS_ILLEGAL_ON_REMOTE_OBJECT", /* illegal operation for remote object */ + "RTEMS_CALLED_FROM_ISR", /* called from ISR */ + "RTEMS_INVALID_PRIORITY", /* invalid task priority */ + "RTEMS_INVALID_CLOCK", /* invalid date/time */ + "RTEMS_INVALID_NODE", /* invalid node id */ + "RTEMS_NOT_OWNER_OF_RESOURCE", /* not owner of resource */ + "RTEMS_NOT_CONFIGURED", /* directive not configured */ + "RTEMS_NOT_IMPLEMENTED" /* directive not implemented */ +}; + +/* Task states */ + +void put_error( + rtems_unsigned32 error, + rtems_status_code expected +) +{ + + if ( error <= RTEMS_NOT_IMPLEMENTED ) + printf( "EXPECTED FATAL - error code is correctly %s\n", Errors[ error ] ); + else + printf( "ERROR - out of range error code is %d\n", error ); + + if ( error != expected ) { + printf( "ERROR - did not get expected code of %d\n", expected ); + } +} diff --git a/testsuites/sptests/spfatal/spfatal.doc b/testsuites/sptests/spfatal/spfatal.doc new file mode 100644 index 0000000000..501f278670 --- /dev/null +++ b/testsuites/sptests/spfatal/spfatal.doc @@ -0,0 +1,28 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: testfatal + +directives: none + +concepts: + + a. Verifies that the proper error is reported by k_fatal when a task + exits. + + b. Verifies that the task exitted extension works correctly. + + c. Verifies that the fatal error extension works corectly. + diff --git a/testsuites/sptests/spfatal/spfatal.scn b/testsuites/sptests/spfatal/spfatal.scn new file mode 100644 index 0000000000..ecb9f63597 --- /dev/null +++ b/testsuites/sptests/spfatal/spfatal.scn @@ -0,0 +1,8 @@ +*** TEST FATAL *** +EXPECTED FATAL - error code is correctly RTEMS_UNSATISFIED +EXPECTED FATAL - error code is correctly RTEMS_INVALID_ADDRESS +EXPECTED FATAL - error code is correctly RTEMS_UNSATISFIED +EXPECTED FATAL - error code is correctly RTEMS_INVALID_PRIORITY +EXPECTED FATAL - error code is correctly RTEMS_TASK_EXITTED +NOT TESTING FATAL ERROR WHEN TASK EXITS -- C LIBRARY CATCHES THIS +*** END OF TEST FATAL *** diff --git a/testsuites/sptests/spfatal/system.h b/testsuites/sptests/spfatal/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/testsuites/sptests/spfatal/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/testsuites/sptests/spfatal/task1.c b/testsuites/sptests/spfatal/task1.c new file mode 100644 index 0000000000..d06d25e690 --- /dev/null +++ b/testsuites/sptests/spfatal/task1.c @@ -0,0 +1,29 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies the task manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + puts( "\n\n*** TEST FATAL ***" ); + puts( "TA1 - exitting task" ); +} diff --git a/testsuites/sptests/spsize/getint.c b/testsuites/sptests/spsize/getint.c new file mode 100644 index 0000000000..43d1f695c9 --- /dev/null +++ b/testsuites/sptests/spsize/getint.c @@ -0,0 +1,32 @@ +/* getint + * + * This routine reads and returns an integer. + * It assumes decimal. + * + * Input parameters: NONE + * + * Output parameters: + * returns - number read + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include +#include + +int getint( void ) +{ + char buff[16]; + + gets(buff); + return atoi(buff); +} diff --git a/testsuites/sptests/spsize/init.c b/testsuites/sptests/spsize/init.c new file mode 100644 index 0000000000..e15e7b40fb --- /dev/null +++ b/testsuites/sptests/spsize/init.c @@ -0,0 +1,58 @@ +/* Init + * + * 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: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "apps.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Test_task(); +void size_rtems( int mode ); + +rtems_task Init( + rtems_task_argument argument +) +{ + int choice; + + setvbuf(stdout, 0, _IONBF, 0); + + do { + puts( "\n*** RTEMS SIZE PROGRAM ***" ); + printf( "\n\nPlease select program mode:\n" ); + printf( " 1) Print Formulas\n" ); + printf( " 2) Determine Workspace Size\n" ); + printf( " 3) Exit\n" ); + printf( "Enter number of choice (1,2,3) : " ); + + choice = getint(); + switch( choice ) { + case 1: size_rtems( 1 ); break; + case 2: size_rtems( 0 ); break; + case 3: exit( 0 ); + default: continue; + } + } while ( FOREVER ); +} diff --git a/testsuites/sptests/spsize/size.c b/testsuites/sptests/spsize/size.c new file mode 100644 index 0000000000..52404272fd --- /dev/null +++ b/testsuites/sptests/spsize/size.c @@ -0,0 +1,601 @@ +/* main + * + * This program is run to determine the data space and work space + * requirements of the current version of RTEMS. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* These are always defined by the executive. + * + * #include + * #include + * #include + */ +#define HEAP_OVHD 16 /* wasted heap space per task stack */ +#define NAME_PTR_SIZE 8 /* size of name and pointer table entries */ +#define READYCHAINS_SIZE \ + ((RTEMS_MAXIMUM_PRIORITY + 1) * sizeof(Chain_Control )) + +#define PER_TASK \ + (sizeof (Thread_Control) + NAME_PTR_SIZE + HEAP_OVHD) +#define PER_SEMAPHORE \ + (sizeof (Semaphore_Control) + NAME_PTR_SIZE) +#define PER_TIMER \ + (sizeof (Timer_Control) + NAME_PTR_SIZE) +#define PER_MSGQ \ + (sizeof (Message_queue_Control) + NAME_PTR_SIZE) +#define PER_MSG \ + (sizeof (Message_queue_Buffer_control)) +#define PER_REGN \ + (sizeof (Region_Control) + NAME_PTR_SIZE) +#define PER_PART \ + (sizeof (Partition_Control) + NAME_PTR_SIZE) +#define PER_PERIOD \ + (sizeof (Rate_monotonic_Control) + NAME_PTR_SIZE) +#define PER_PORT \ + (sizeof (Dual_ported_memory_Control) + NAME_PTR_SIZE) +#define PER_EXTENSION \ + (sizeof (Extension_Control) + NAME_PTR_SIZE) + +#define PER_DRV (0) +#define PER_FPTASK (CONTEXT_FP_SIZE) +#define PER_GOBTBL (sizeof (Chain_Control)*4) +#define PER_NODE PER_GOBTBL +#define PER_GOBJECT (sizeof (Objects_MP_Control)) +#define PER_PROXY (sizeof (Thread_Proxy_control)) + +#if (CPU_ALL_TASKS_ARE_FP == TRUE) +#define SYSTEM_INITIALIZATION_FP (sizeof( Context_Control_fp )) +#else +#define SYSTEM_INITIALIZATION_FP 0 +#endif + +#if (CPU_IDLE_TASK_IS_FP == TRUE) +#define SYSTEM_IDLE_FP (sizeof( Context_Control_fp )) +#else +#define SYSTEM_IDLE_FP 0 +#endif + +#define SYSTEM_TASKS \ + (INTERNAL_THREADS_IDLE_THREAD_STACK_SIZE + \ + INTERNAL_THREADS_SYSTEM_INITIALIZATION_THREAD_STACK_SIZE + \ + (2*sizeof(Thread_Control))) + \ + SYSTEM_INITIALIZATION_FP + \ + SYSTEM_IDLE_FP + +#define rtems_unsigned32 unsigned32 + +rtems_unsigned32 sys_req; + +/* to avoid warnings */ +int puts(); +int printf(); +int getint(); +#undef getchar +int getchar(); +void help_size(); +void print_formula(); + +void size_rtems( + int mode +) +{ +int uninitialized = 0; +int initialized = 0; + +/* + * The following data is allocated for each Manager: + * + * + Per Manager Object Information + * - local pointer table + * - local name table + * - the object's control blocks + * - global name chains + * + * The following is the data allocate from the RTEMS Workspace Area. + * The order indicates the order in which RTEMS allocates it. + * + * + Object MP + * - Global Object CB's + * + Thread + * - Ready Chain + * + Thread MP + * - Proxies Chain + * + Interrupt Manager + * - Interrupt Stack + * + Timer Manager + * - per Manager Object Data + * + Extension Manager + * - per Manager Object Data + * + Message Queue Manager + * - per Manager Object Data + * - Message Buffers + * + Semaphore Manager + * - per Manager Object Data + * + Partition Manager + * - per Manager Object Data + * + Region Manager + * - per Manager Object Data + * + Dual Ported Memory Manager + * - per Manager Object Data + * + Rate Monotonic Manager + * - per Manager Object Data + * + Internal Threads Handler + * - SYSI Thread TCB + * - IDLE Thread TCB + * - SYSI Thread stack + * - SYSI Thread FP area (if CPU requires this) + * - IDLE Thread stack + * - IDLE Thread FP area (if CPU requires this) + * + * This does not take into account any CPU dependent alignment requirements. + * + * The following calculates the overhead needed by RTEMS from the + * Workspace Area. + */ +sys_req = SYSTEM_TASKS + /* SYSI and IDLE */ + NAME_PTR_SIZE + /* Task Overhead */ + READYCHAINS_SIZE + /* Ready Chains */ + NAME_PTR_SIZE + /* Timer Overhead */ + NAME_PTR_SIZE + /* Semaphore Overhead */ + NAME_PTR_SIZE + /* Message Queue Overhead */ + NAME_PTR_SIZE + /* Region Overhead */ + NAME_PTR_SIZE + /* Partition Overhead */ + NAME_PTR_SIZE + /* Dual-Ported Memory Overhead */ + NAME_PTR_SIZE + /* Rate Monotonic Overhead */ + NAME_PTR_SIZE + /* Extension Overhead */ + PER_NODE; /* Extra Gobject Table */ + +uninitialized = +/*address.h*/ 0 + + +/*asr.h*/ 0 + + +/*attr.h*/ 0 + + +/*bitfield.h*/ 0 + + +/*chain.h*/ 0 + + +/*clock.h*/ 0 + + +/*config.h*/ (sizeof _Configuration_Table) + + (sizeof _Configuration_MP_table) + + (sizeof _Configuration_MPCI_table) + + +/*context.h*/ (sizeof _Context_Switch_necessary) + + +/*copyrt.h*/ 0 + + +/*dpmem.h*/ (sizeof _Dual_ported_memory_Information) + + +/*event.h*/ (sizeof _Event_Sync) + + +/*eventmp.h*/ 0 + + +/*eventset.h*/ 0 + + +/*extension.h*/ (sizeof _Extension_Information) + + +/*fatal.h*/ 0 + + +/*heap.h*/ 0 + + +/*init.h*/ 0 + + +/*inthrdmp.h*/ 0 + + +/*intr.h*/ 0 + + +/*intthrd.h*/ (sizeof _Internal_threads_System_initialization_thread) + + (sizeof _Internal_threads_Idle_thread) + + (sizeof _Internal_threads_MP_Receive_server_entry) + + +/*io.h*/ (sizeof _IO_Number_of_drivers) + + (sizeof _IO_Driver_address_table) + + +/*isr.h*/ (sizeof _ISR_Nest_level) + + (sizeof _ISR_Vector_table) + + (sizeof _ISR_Signals_to_thread_executing) + + +/*message.h*/ (sizeof _Message_queue_Inactive_messages) + + (sizeof _Message_queue_Information) + + +/*modes.h*/ 0 + + +/*mp.h*/ 0 + + +/*mpci.h*/ (sizeof _MPCI_Remote_blocked_threads) + + +/*mppkt.h*/ 0 + + +/*mptables.h*/ 0 + + +/*msgmp.h*/ 0 + + +/*object.h*/ (sizeof _Objects_Local_node) + + +/*objectmp.h*/ (sizeof _Objects_MP_Inactive_global_objects) + + +/*options.h*/ 0 + + +/*part.h*/ (sizeof _Partition_Information) + + +/*partmp.h*/ 0 + + +/*priority.h*/ (sizeof _Priority_Major_bit_map) + + (sizeof _Priority_Bit_map) + + +/*ratemon.h*/ (sizeof _Rate_monotonic_Information) + + +/*region.h*/ (sizeof _Region_Information) + + +/*regionmp.h*/ 0 + + +/*rtems.h*/ /* Not applicable */ + +/*sem.h*/ (sizeof _Semaphore_Information) + + +/*semmp.h*/ 0 + + +/*signal.h*/ 0 + + +/*signalmp.h*/ 0 + + +/*stack.h*/ 0 + + +/*states.h*/ 0 + + +/*status.h*/ 0 + + +/*system.h*/ (sizeof _CPU_Table) + + +/*sysstate.h*/ (sizeof _System_state_Current) + + +/*taskmp.h*/ 0 + + +/*tasks.h*/ 0 + + +/*thread.h*/ (sizeof _Thread_Dispatch_disable_level) + + (sizeof _Thread_Ticks_remaining_in_timeslice) + + (sizeof _Thread_Ticks_per_timeslice) + + (sizeof _Thread_Ready_chain) + + (sizeof _Thread_Executing) + + (sizeof _Thread_Heir) + + (sizeof _Thread_Allocated_fp) + + (sizeof _Thread_Information) + + (sizeof _Thread_BSP_context) + + +/*threadmp.h*/ (sizeof _Thread_MP_Receive) + + (sizeof _Thread_MP_Active_proxies) + + (sizeof _Thread_MP_Inactive_proxies) + + +/*threadq.h*/ 0 + + +/*timer.h*/ (sizeof _Timer_Information) + + +/*tod.h*/ (sizeof _TOD_Current) + + (sizeof _TOD_Seconds_since_epoch) + + (sizeof _TOD_Ticks_since_boot) + + (sizeof _TOD_Microseconds_per_tick) + + (sizeof _TOD_Ticks_per_second) + + (sizeof _TOD_Seconds_watchdog) + + +/*tqdata.h*/ 0 + + +/*types.h*/ 0 + + +/*userext.h*/ (sizeof _User_extensions_Initial) + + (sizeof _User_extensions_List) + + +/*watchdog.h*/ (sizeof _Watchdog_Ticks_chain) + + (sizeof _Watchdog_Seconds_chain) + + (sizeof _Watchdog_Sync) + + +/*wkspace.h*/ (sizeof _Workspace_Area); + +uninitialized = 0; + +#ifdef i386 + +/* cpu.h */ +uninitialized += (sizeof _CPU_Null_fp_context) + + (sizeof _CPU_Interrupt_stack_low) + + (sizeof _CPU_Interrupt_stack_high); + +#endif + +#ifdef i960 + +/* cpu.h */ +uninitialized += (sizeof _CPU_Interrupt_stack_low) + + (sizeof _CPU_Interrupt_stack_high); + +#endif + +#ifdef hppa1_1 + +/* cpu.h */ +uninitialized += (sizeof _CPU_Null_fp_context) + + (sizeof _CPU_Default_gr27) + + (sizeof _CPU_Interrupt_stack_low) + + (sizeof _CPU_Interrupt_stack_high); +#endif + +#ifdef m68k + +/* cpu.h */ +uninitialized += (sizeof _CPU_Interrupt_stack_low) + + (sizeof _CPU_Interrupt_stack_high); + +#endif + +#ifdef no_cpu + +/* cpu.h */ +uninitialized += (sizeof _CPU_Null_fp_context) + + (sizeof _CPU_Interrupt_stack_low) + + (sizeof _CPU_Interrupt_stack_high) + + (sizeof _CPU_Thread_dispatch_pointer); + +#endif + +initialized += +/*copyrt.h*/ (strlen(_Copyright_Notice)+1) + + +/*sptables.h*/ (sizeof _Configuration_Default_multiprocessing_table) + + (strlen(_RTEMS_version)+1) + + (sizeof _Entry_points) + + + +/*tod.h*/ (sizeof _TOD_Days_per_month) + + (sizeof _TOD_Days_to_date) + + (sizeof _TOD_Days_since_last_leap_year); + +puts( "" ); +#ifdef i960CA + print_formula(); +#else + if ( mode == 0 ) help_size(); + else print_formula(); +#endif + +printf( "\n" ); +printf( "RTEMS uninitialized data consumes %d bytes\n", uninitialized ); +printf( "RTEMS intialized data consumes %d bytes\n", initialized ); + +} + +void help_size() +{ +int c = '\0'; +int break_loop; +int total_size; +int task_stacks; +int interrupt_stack; +int maximum_tasks, size_tasks; +int maximum_sems, size_sems; +int maximum_timers, size_timers; +int maximum_msgqs, size_msgqs; +int maximum_msgs, size_msgs; +int maximum_regns, size_regns; +int maximum_parts, size_parts; +int maximum_ports, size_ports; +int maximum_periods, size_periods; +int maximum_extensions, size_extensions; +int maximum_drvs, size_drvs; +int maximum_fps, size_fps; +int maximum_nodes, size_nodes; +int maximum_gobjs, size_gobjs; +int maximum_proxies, size_proxies; + +total_size = sys_req; /* Fixed Overhead */ +printf( "What is maximum_tasks? " ); +maximum_tasks = getint(); +size_tasks = PER_TASK * maximum_tasks; +total_size += size_tasks; + +printf( "What is maximum_semaphores? " ); +maximum_sems = getint(); +size_sems = PER_SEMAPHORE * maximum_sems; +total_size += size_sems; + +printf( "What is maximum_timers? " ); +maximum_timers = getint(); +size_timers = PER_TIMER * maximum_timers; +total_size += size_timers; + +printf( "What is maximum_message_queues? " ); +maximum_msgqs = getint(); +size_msgqs = PER_MSGQ * maximum_msgqs; +total_size += size_msgqs; + +printf( "What is maximum_messages? " ); +maximum_msgs = getint(); +size_msgs = PER_MSG * maximum_msgs; +total_size += size_msgs; + +printf( "What is maximum_regions? " ); +maximum_regns = getint(); +size_regns = PER_REGN * maximum_regns; +total_size += size_regns; + +printf( "What is maximum_partitions? " ); +maximum_parts = getint(); +size_parts = PER_PART * maximum_parts; +total_size += size_parts; + +printf( "What is maximum_ports? " ); +maximum_ports = getint(); +size_ports = PER_PORT * maximum_ports; +total_size += size_ports; + +printf( "What is maximum_periods? " ); +maximum_periods = getint(); +size_periods = PER_PORT * maximum_periods; +total_size += size_periods; + +printf( "What is maximum_extensions? " ); +maximum_extensions = getint(); +size_extensions = PER_EXTENSION * maximum_extensions; +total_size += size_extensions; + +printf( "What is number_of_device_drivers? " ); +maximum_drvs = getint(); +size_drvs = PER_DRV * maximum_drvs; +total_size += size_drvs; + +printf( "What will be total stack requirement for all tasks? " ); +task_stacks = getint(); +total_size += task_stacks; + +printf( "What is the size of the interrupt stack? " ); +interrupt_stack = getint(); +total_size += interrupt_stack; + +printf( "How many tasks will be created with the FP flag? " ); +maximum_fps = getint(); +size_fps = PER_FPTASK * maximum_fps; +total_size += size_fps; + +printf( "Is this a single processor system? " ); +for ( break_loop=0 ; !break_loop; c = getchar() ) { + switch ( c ) { + case 'Y': case 'y': + case 'N': case 'n': + break_loop = 1; + break; + } +} +printf( "%c\n", c ); +if ( c == 'n' || c == 'N' ) { + printf( "What is maximum_nodes? " ); + maximum_nodes = getint(); + size_nodes = PER_NODE * maximum_nodes; + total_size += size_nodes; + printf( "What is maximum_global_objects? " ); + maximum_gobjs = getint(); + size_gobjs = PER_GOBJECT * maximum_gobjs; + total_size += size_gobjs; + printf( "What is maximum_proxies? " ); + maximum_proxies = getint(); + size_proxies = PER_PROXY * maximum_proxies; + total_size += size_proxies; +} else { + maximum_nodes = 0; + size_nodes = PER_NODE * 0; + maximum_gobjs = 0; + size_gobjs = PER_GOBJECT * 0; + maximum_proxies = 0; + size_proxies = PER_PROXY * 0; +} + +printf( "\n\n" ); +printf( " ************** EXECUTIVE WORK SPACE REQUIRED **************\n" ); +printf( " Tasks - %03d * %03d = %d\n", + maximum_tasks, PER_TASK, size_tasks ); +printf( " Semaphores - %03d * %03d = %d\n", + maximum_sems, PER_SEMAPHORE, size_sems ); +printf( " Timers - %03d * %03d = %d\n", + maximum_timers, PER_TIMER, size_timers ); +printf( " Msg Queues - %03d * %03d = %d\n", + maximum_msgqs, PER_MSGQ, size_msgqs ); +printf( " Messages - %03d * %03d = %d\n", + maximum_msgs, PER_MSG, size_msgs ); +printf( " Regions - %03d * %03d = %d\n", + maximum_regns, PER_REGN, size_regns); +printf( " Partitions - %03d * %03d = %d\n", + maximum_parts, PER_PART, size_parts ); +printf( " Periods - %03d * %03d = %d\n", + maximum_periods, PER_PERIOD, size_periods ); +printf( " Extensions - %03d * %03d = %d\n", + maximum_extensions, PER_EXTENSION, size_extensions ); +printf( " Device Drivers - %03d * %03d = %d\n", + maximum_drvs, PER_DRV, size_drvs ); + +printf( " System Requirements - %04d = %d\n", + sys_req, sys_req ); + +printf( " Floating Point Tasks - %03d * %03d = %d\n", + maximum_fps, PER_FPTASK, size_fps ); +printf( " Application Task Stacks - = %d\n", + task_stacks ); +printf( " Interrupt Stacks - = %d\n", + task_stacks ); +printf( " \n" ); +printf( " Global object tables - %03d * %03d = %d\n", + maximum_nodes, PER_NODE, size_nodes ); +printf( " Global objects - %03d * %03d = %d\n", + maximum_gobjs, PER_GOBJECT, size_gobjs ); +printf( " Proxies - %03d * %03d = %d\n", + maximum_proxies, PER_PROXY, size_proxies ); +printf( "\n\n" ); +printf( " TOTAL = %d bytes\n", + total_size ); +} + +void print_formula() +{ +printf( " ************** EXECUTIVE WORK SPACE FORMULA **************\n" ); +printf( " Tasks - maximum_tasks * %d\n", PER_TASK ); +printf( " Timers - maximum_timers * %d\n", PER_TIMER ); +printf( " Semaphores - maximum_semaphores * %d\n", PER_SEMAPHORE); +printf( " Message Queues - maximum_message_queues * %d\n", PER_MSGQ ); +printf( " Messages - maximum_messages * %d\n", PER_MSG ); +printf( " Regions - maximum_regions * %d\n", PER_REGN ); +printf( " Partitions - maximum_partitions * %d\n", PER_PART ); +printf( " Ports - maximum_ports * %d\n", PER_PORT ); +printf( " Periods - maximum_periods * %d\n", PER_PORT ); +printf( " Extensions - maximum_extensions * %d\n", PER_EXTENSION ); +printf( " Device Drivers - number_of_device_drivers * %d\n", PER_DRV); +printf( " System Requirements - %d\n", sys_req ); +printf( " Floating Point Tasks - FPMASK Tasks * %d\n", CONTEXT_FP_SIZE ); +printf( " User's Tasks' Stacks -\n" ); +printf( " Interrupt Stack -\n" ); +printf( " \n" ); +printf( " Global object tables - maximum_nodes * %d\n", PER_NODE ); +printf( " Global objects - maximum_global_objects * %d\n", PER_GOBJECT ); +printf( " Proxies - maximum_proxies * %d\n", PER_PROXY ); +} diff --git a/testsuites/support/include/tmacros.h b/testsuites/support/include/tmacros.h new file mode 100644 index 0000000000..8a5fad37c8 --- /dev/null +++ b/testsuites/support/include/tmacros.h @@ -0,0 +1,116 @@ +/* tmacros.h + * + * This include file contains macros which are useful in the RTEMS + * test suites. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __TMACROS_h +#define __TMACROS_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include "bsp.h" +#include "stdio.h" +#include "stdlib.h" +#include "libcsupport.h" + +#define FOREVER 1 /* infinite loop */ + +#define directive_failed( dirstat, failmsg ) \ + fatal_directive_status( dirstat, RTEMS_SUCCESSFUL, failmsg ) + +#define fatal_directive_status( stat, desired, msg ) \ + { \ + if ( (stat) != (desired) ) { \ + printf( "\n%s FAILED -- expected (%d) got (%d)\n", \ + (msg), (desired), (stat) ); \ + exit( stat ); \ + } \ + } + +#define sprint_time(str,s1,tb,s2) \ + sprintf( (str), "%s%02d:%02d:%02d %02d/%02d/%04d%s", \ + s1, (tb)->hour, (tb)->minute, (tb)->second, \ + (tb)->month, (tb)->day, (tb)->year, s2 ); + +#define print_time(s1,tb,s2) \ + printf( "%s%02d:%02d:%02d %02d/%02d/%04d%s", \ + s1, (tb)->hour, (tb)->minute, (tb)->second, \ + (tb)->month, (tb)->day, (tb)->year, s2 ); + +#define put_dot( c ) putchar( c ); fflush( stdout ) + +#define new_line puts( "" ) + +#define puts_nocr printf + +#define pause() \ + do { \ + char buffer[ 80 ]; \ + printf( " " ); fflush( stdout ); \ + gets( buffer ); \ + puts( "" ); \ + } while ( 0 ) + +#define pause_and_screen_number( _screen ) \ + do { \ + char buffer[ 80 ]; \ + printf( " ", (_screen) ); fflush( stdout ); \ + gets( buffer ); \ + puts( "" ); \ + } while ( 0 ) + +#define put_name( name, crlf ) \ +{ rtems_unsigned32 c0, c1, c2, c3; \ + c0 = (name >> 24) & 0xff; \ + c1 = (name >> 16) & 0xff; \ + c2 = (name >> 8) & 0xff; \ + c3 = name & 0xff; \ + putchar( (char)c0 ); \ + if ( c1 ) putchar( (char)c1 ); \ + if ( c2 ) putchar( (char)c2 ); \ + if ( c3 ) putchar( (char)c3 ); \ + if ( crlf ) \ + putchar( '\n' ); \ +} + +#define put_buffer( _buffer ) XYZ( _buffer ) + +#define build_time( TB, MON, DAY, YR, HR, MIN, SEC, TK ) \ + { (TB)->year = YR; \ + (TB)->month = MON; \ + (TB)->day = DAY; \ + (TB)->hour = HR; \ + (TB)->minute = MIN; \ + (TB)->second = SEC; \ + (TB)->ticks = TK; } + +#define task_number( tid ) \ + ( rtems_get_index( tid ) - BSP_Configuration.number_of_initialization_tasks ) + +static inline rtems_unsigned32 get_ticks_per_second( void ) +{ + rtems_interval ticks_per_second; + (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second ); + return ticks_per_second; +} + +#define TICKS_PER_SECOND get_ticks_per_second() + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/testsuites/tmtests/README b/testsuites/tmtests/README new file mode 100644 index 0000000000..c27617d5a3 --- /dev/null +++ b/testsuites/tmtests/README @@ -0,0 +1,21 @@ +# +# $Id$ +# + +This directory contains the RTEMS Timing Test Suite. +The tests in this directory are used to measure the execution +time of RTEMS directive and some critical internal functions. +The results of these test are reported in the Fact Sheets +and Supplental Manuals. + +These tests attempt to benchmark RTEMS as the user would. They measure +the execution time for a directive (under various circumstances) +from the time RTEMS is entered until it is executed. Where possible, +the time is the average of at least 100 invocations of the directive. + +The accuracy of the times reported by these benchmarks is very dependent +on the resolution of the timer being used. It is also important to +insure that all sources of hardware interrupts are disabled during +execution of the tests. This insures that the directive time reported +does not include any interrupt time. + diff --git a/testsuites/tmtests/include/timesys.h b/testsuites/tmtests/include/timesys.h new file mode 100644 index 0000000000..3b61d7b42d --- /dev/null +++ b/testsuites/tmtests/include/timesys.h @@ -0,0 +1,30 @@ +/* timesystem.h + * + * This include file contains information that is included in every + * function in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +/* constants */ + +#define OPERATION_COUNT 100 +#define IT_COUNT 100 + +/* Miscellaneous */ + +#define FOREVER 1 /* infinite loop */ +#define EXTERN extern /* external definition */ + +/* structures */ + +/* end of include file */ diff --git a/testsuites/tmtests/tm01/system.h b/testsuites/tmtests/tm01/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm01/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm01/task1.c b/testsuites/tmtests/tm01/task1.c new file mode 100644 index 0000000000..2463722320 --- /dev/null +++ b/testsuites/tmtests/tm01/task1.c @@ -0,0 +1,187 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Test_task( + rtems_task_argument argument +); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 1 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 128, + 4096, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); + +} + +rtems_task Test_task( + rtems_task_argument argument +) +{ + rtems_unsigned32 semaphore_obtain_time; + rtems_unsigned32 semaphore_release_time; + rtems_unsigned32 semaphore_obtain_no_wait_time; + rtems_unsigned32 semaphore_obtain_loop_time; + rtems_unsigned32 semaphore_release_loop_time; + rtems_unsigned32 index; + rtems_unsigned32 iterations; + rtems_name name; + rtems_id smid; + rtems_status_code status; + + name = rtems_build_name( 'S', 'M', '1', ' ' ); + + semaphore_obtain_time = 0; + semaphore_release_time = 0; + semaphore_obtain_no_wait_time = 0; + semaphore_obtain_loop_time = 0; + semaphore_release_loop_time = 0; + + + /* Time one invocation of rtems_semaphore_create */ + + Timer_initialize(); + (void) rtems_semaphore_create( + name, + OPERATION_COUNT, + RTEMS_DEFAULT_MODES, + &smid + ); + end_time = Read_timer(); + put_time( + "rtems_semaphore_create", + end_time, + 1, + 0, + CALLING_OVERHEAD_SEMAPHORE_CREATE + ); + + /* Time one invocation of rtems_semaphore_delete */ + + Timer_initialize(); + (void) rtems_semaphore_delete( smid ); + end_time = Read_timer(); + put_time( + "rtems_semaphore_delete", + end_time, + 1, + 0, + CALLING_OVERHEAD_SEMAPHORE_CREATE + ); + + status = rtems_semaphore_create( + name, + OPERATION_COUNT, + RTEMS_DEFAULT_ATTRIBUTES, + &smid + ); + + for ( iterations=OPERATION_COUNT ; iterations ; iterations-- ) { + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) Empty_function(); + end_time = Read_timer(); + + semaphore_obtain_loop_time += end_time; + semaphore_release_loop_time += end_time; + + /* rtems_semaphore_obtain (available) */ + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) rtems_semaphore_obtain( + smid, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + end_time = Read_timer(); + + semaphore_obtain_time += end_time; + + /* rtems_semaphore_release */ + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) rtems_semaphore_release( smid ); + end_time = Read_timer(); + + semaphore_release_time += end_time; + + /* semaphore obtain (RTEMS_NO_WAIT) */ + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + rtems_semaphore_obtain( smid, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT ); + semaphore_obtain_no_wait_time += Read_timer(); + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + rtems_semaphore_release( smid ); + end_time = Read_timer(); + + semaphore_release_time += end_time; + } + + put_time( + "rtems_semaphore_obtain", + semaphore_obtain_time, + OPERATION_COUNT * OPERATION_COUNT, + semaphore_obtain_loop_time, + CALLING_OVERHEAD_SEMAPHORE_OBTAIN + ); + + put_time( + "rtems_semaphore_obtain (RTEMS_NO_WAIT)", + semaphore_obtain_no_wait_time, + OPERATION_COUNT * OPERATION_COUNT, + semaphore_obtain_loop_time, + CALLING_OVERHEAD_SEMAPHORE_OBTAIN + ); + + put_time( + "rtems_semaphore_release", + semaphore_release_time, + OPERATION_COUNT * OPERATION_COUNT * 2, + semaphore_release_loop_time * 2, + CALLING_OVERHEAD_SEMAPHORE_RELEASE + ); + + exit( 0 ); +} diff --git a/testsuites/tmtests/tm01/tm01.doc b/testsuites/tmtests/tm01/tm01.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm01/tm01.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm02/system.h b/testsuites/tmtests/tm02/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm02/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm02/task1.c b/testsuites/tmtests/tm02/task1.c new file mode 100644 index 0000000000..e86ed6af65 --- /dev/null +++ b/testsuites/tmtests/tm02/task1.c @@ -0,0 +1,156 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id High_id; +rtems_id Low_id; +rtems_id Semaphore_id; + +rtems_task High_task( + rtems_task_argument argument +); + +rtems_task Middle_tasks( + rtems_task_argument argument +); + +rtems_task Low_task( + rtems_task_argument argument +); + + +void test_init(); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 2 ***" ); + + test_init(); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete" ); +} + +void test_init() +{ + rtems_status_code status; + rtems_unsigned32 index; + rtems_task_priority priority; + + priority = 5; + + status = rtems_task_create( + rtems_build_name( 'H', 'I', 'G', 'H' ), + priority, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &High_id + ); + directive_failed( status, "rtems_task_create of high task" ); + + priority++; + + status = rtems_task_start( High_id, High_task, 0 ); + directive_failed( status, "rtems_task_start of high task" ); + + for ( index=2 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'M', 'I', 'D', ' ' ), + priority, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Low_id + ); + directive_failed( status, "rtems_task_create middle" ); + + priority++; + + status = rtems_task_start( Low_id, Middle_tasks, 0 ); + directive_failed( status, "rtems_task_start middle" ); + } + + status = rtems_task_create( + rtems_build_name( 'L', 'O', 'W', ' ' ), + priority, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Low_id + ); + directive_failed( status, "rtems_task_create low" ); + + status = rtems_task_start( Low_id, Low_task, 0 ); + directive_failed( status, "rtems_task_start low" ); + + status = rtems_semaphore_create( + rtems_build_name( 'S', 'M', '1', ' '), + 0, + RTEMS_DEFAULT_ATTRIBUTES, + &Semaphore_id + ); + directive_failed( status, "rtems_semaphore_create of SM1" ); +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + + Timer_initialize(); /* start blocking rtems_semaphore_obtain time */ + status = rtems_semaphore_obtain( + Semaphore_id, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); +} + +rtems_task Middle_tasks( + rtems_task_argument argument +) +{ + rtems_status_code status; + + status = rtems_semaphore_obtain( + Semaphore_id, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); +} + +rtems_task Low_task( + rtems_task_argument argument +) +{ + end_time = Read_timer(); + + put_time( + "rtems_semaphore_obtain (blocking)", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_SEMAPHORE_OBTAIN + ); + exit( 0 ); +} diff --git a/testsuites/tmtests/tm02/tm02.doc b/testsuites/tmtests/tm02/tm02.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm02/tm02.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm03/system.h b/testsuites/tmtests/tm03/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm03/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm03/task1.c b/testsuites/tmtests/tm03/task1.c new file mode 100644 index 0000000000..0ee82005d7 --- /dev/null +++ b/testsuites/tmtests/tm03/task1.c @@ -0,0 +1,149 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Semaphore_id; +rtems_task test_init( + rtems_task_argument argument +); + +rtems_task Middle_tasks( + rtems_task_argument argument +); + +rtems_task High_task( + rtems_task_argument argument +); + + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_id task_id; + + puts( "\n\n*** TIME TEST 3 ***" ); + status = rtems_task_create( + rtems_build_name( 'T', 'A', '1', ' ' ), + 252, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create of test_init" ); + + status = rtems_task_start( task_id, test_init, 0 ); + directive_failed( status, "rtems_task_start of test_init" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task test_init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_unsigned32 index; + rtems_id task_id; + rtems_task_priority priority; + + priority = 250; + + status = rtems_semaphore_create( + rtems_build_name( 'S', 'M', '1', '\0'), + 0, + RTEMS_DEFAULT_ATTRIBUTES, + &Semaphore_id + ); + directive_failed( status, "rtems_semaphore_create of SM1" ); + + for ( index = 2 ; index <= OPERATION_COUNT ; index ++ ) { + rtems_task_create( + rtems_build_name( 'M', 'I', 'D', ' ' ), + priority, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create middle" ); + + priority--; + + rtems_task_start( task_id, Middle_tasks, 0 ); + directive_failed( status, "rtems_task_start middle" ); + } + + status = rtems_task_create( + rtems_build_name( 'H', 'I', 'G', 'H' ), + priority, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create of high task" ); + + status = rtems_task_start( task_id, High_task, 0 ); + directive_failed( status, "rtems_task_start of high task" ); + + Timer_initialize(); /* start the timer */ + status = rtems_semaphore_release( Semaphore_id ); +} + +rtems_task Middle_tasks( + rtems_task_argument argument +) +{ + rtems_status_code status; + + status = rtems_semaphore_obtain( + Semaphore_id, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + + status = rtems_semaphore_release( Semaphore_id ); +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + + status = rtems_semaphore_obtain( + Semaphore_id, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + + end_time = Read_timer(); + + put_time( + "rtems_semaphore_release (preemptive)", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_SEMAPHORE_RELEASE + ); + exit( 0 ); +} diff --git a/testsuites/tmtests/tm03/tm03.doc b/testsuites/tmtests/tm03/tm03.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm03/tm03.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm04/system.h b/testsuites/tmtests/tm04/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm04/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm04/task1.c b/testsuites/tmtests/tm04/task1.c new file mode 100644 index 0000000000..0014d02dd3 --- /dev/null +++ b/testsuites/tmtests/tm04/task1.c @@ -0,0 +1,387 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Semaphore_id; +rtems_id Task_id[OPERATION_COUNT+1]; +rtems_unsigned32 task_count; +rtems_id Highest_id; + +rtems_task Low_tasks( + rtems_task_argument argument +); + +rtems_task High_task( + rtems_task_argument argument +); + +rtems_task Restart_task( + rtems_task_argument argument +); + +void test_init(); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 4 ***" ); + + test_init(); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +void test_init() +{ + rtems_status_code status; + rtems_unsigned32 index; + + task_count = OPERATION_COUNT; + + for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) { + + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + 10, + 1024, + RTEMS_NO_PREEMPT, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] + ); + directive_failed( status, "rtems_task_create loop" ); + + status = rtems_task_start( Task_id[ index ], Low_tasks, 0 ); + directive_failed( status, "rtems_task_start loop" ); + } + + status = rtems_semaphore_create( + rtems_build_name( 'S', 'M', '1', ' ' ), + 0, + RTEMS_DEFAULT_ATTRIBUTES, + &Semaphore_id + ); + directive_failed( status, "rtems_semaphore_create of SM1" ); +} + +rtems_task Highest_task( + rtems_task_argument argument +) +{ + rtems_task_priority old_priority; + rtems_status_code status; + + if ( argument == 1 ) { + + end_time = Read_timer(); + + put_time( + "rtems_task_restart (blocked, preempt)", + end_time, + 1, + 0, + CALLING_OVERHEAD_TASK_RESTART + ); + + status = rtems_task_set_priority( + RTEMS_CURRENT_PRIORITY, + 254, + &old_priority + ); + directive_failed( status, "rtems_task_set_priority" ); + + } else if ( argument == 2 ) { + + end_time = Read_timer(); + + put_time( + "rtems_task_restart (ready, preempt)", + end_time, + 1, + 0, + CALLING_OVERHEAD_TASK_RESTART + ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); + + } else + (void) rtems_semaphore_obtain( + Semaphore_id, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_unsigned32 index; + rtems_name name; + rtems_task_priority old_priority; + + Timer_initialize(); + (void) rtems_task_restart( Highest_id, 1 ); + /* preempted by Higher_task */ + + Timer_initialize(); + (void) rtems_task_restart( Highest_id, 2 ); + /* preempted by Higher_task */ + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + rtems_semaphore_release( Semaphore_id ); + end_time = Read_timer(); + + put_time( + "rtems_semaphore_release (readying)", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_SEMAPHORE_RELEASE + ); + + name = rtems_build_name( 'T', 'I', 'M', 'E' ); + + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_delete( Task_id[index] ); + directive_failed( status, "rtems_task_delete" ); + } + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + rtems_task_create( + name, + 10, + 1024, + RTEMS_NO_PREEMPT, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] + ); + end_time = Read_timer(); + + put_time( + "rtems_task_create", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_CREATE + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + rtems_task_start( Task_id[ index ], Low_tasks, 0 ); + + end_time = Read_timer(); + + put_time( + "rtems_task_start", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_START + ); + + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_delete( Task_id[ index ] ); + directive_failed( status, "rtems_task_delete" ); + } + + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + name, + 250, + 1024, + RTEMS_NO_PREEMPT, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] + ); + directive_failed( status, "rtems_task_create LOOP" ); + + status = rtems_task_start( Task_id[ index ], Restart_task, 0 ); + directive_failed( status, "rtems_task_start LOOP" ); + + status = rtems_task_suspend( Task_id[ index ] ); + directive_failed( status, "rtems_task_suspend LOOP" ); + } + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_restart( Task_id[ index ], 0 ); + end_time = Read_timer(); + + put_time( + "rtems_task_restart (suspended)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_RESTART + ); + + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_suspend( Task_id[ index ] ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_delete( Task_id[ index ] ); + end_time = Read_timer(); + + put_time( + "rtems_task_delete (suspended)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_DELETE + ); + + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + name, + 250, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] + ); + directive_failed( status, "rtems_task_create LOOP" ); + + status = rtems_task_start( Task_id[ index ], Restart_task, 0 ); + directive_failed( status, "rtems_task_start LOOP" ); + } + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_restart( Task_id[ index ], 1 ); + end_time = Read_timer(); + + put_time( + "rtems_task_restart (ready)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_RESTART + ); + + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_set_priority( Task_id[ index ], 5, &old_priority ); + directive_failed( status, "rtems_task_set_priority loop" ); + } + + /* yield processor -- tasks block */ + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_restart( Task_id[ index ], 1 ); + end_time = Read_timer(); + + put_time( + "rtems_task_restart (blocked, no preempt)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_RESTART + ); + + /* yield processor -- tasks block */ + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_delete( Task_id[ index ] ); + end_time = Read_timer(); + + put_time( + "rtems_task_delete (blocked)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_DELETE + ); + + exit( 0 ); +} + +rtems_task Low_tasks( + rtems_task_argument argument +) +{ + rtems_id id; + rtems_status_code status; + + task_count--; + + if ( task_count == 0 ) { + status = rtems_task_create( + rtems_build_name( 'H', 'I', ' ', ' ' ), + 5, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create HI" ); + + status = rtems_task_start( id, High_task, 0 ); + directive_failed( status, "rtems_task_start HI" ); + + status = rtems_task_create( + rtems_build_name( 'H', 'I', 'G', 'H' ), + 3, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Highest_id + ); + directive_failed( status, "rtems_task_create HIGH" ); + + status = rtems_task_start( Highest_id, Highest_task, 0 ); + directive_failed( status, "rtems_task_start HIGH" ); + + } + (void) rtems_semaphore_obtain( + Semaphore_id, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); +} + +rtems_task Restart_task( + rtems_task_argument argument +) +{ + if ( argument == 1 ) + (void) rtems_semaphore_obtain( + Semaphore_id, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); +} diff --git a/testsuites/tmtests/tm04/tm04.doc b/testsuites/tmtests/tm04/tm04.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm04/tm04.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm05/system.h b/testsuites/tmtests/tm05/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm05/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm05/task1.c b/testsuites/tmtests/tm05/task1.c new file mode 100644 index 0000000000..624a87114a --- /dev/null +++ b/testsuites/tmtests/tm05/task1.c @@ -0,0 +1,132 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Task_id[OPERATION_COUNT+1]; +rtems_unsigned32 Task_index; + +rtems_task High_task( + rtems_task_argument argument +); + +rtems_task Middle_tasks( + rtems_task_argument argument +); + +rtems_task Low_task( + rtems_task_argument argument +); + +void test_init(); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 5 ***" ); + + test_init(); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +void test_init() +{ + rtems_status_code status; + rtems_task_entry task_entry; + rtems_task_priority priority; + rtems_unsigned32 index; + + priority = 250; + + for( index = 0; index <= OPERATION_COUNT ; index++ ) { + + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + priority, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] + ); + directive_failed( status, "rtems_task_create loop" ); + + priority--; + + if ( index==0 ) task_entry = Low_task; + else if ( index==OPERATION_COUNT ) task_entry = High_task; + else task_entry = Middle_tasks; + + status = rtems_task_start( Task_id[ index ], task_entry, 0 ); + directive_failed( status, "rtems_task_start loop" ); + } +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + Timer_initialize(); + + (void) rtems_task_suspend( RTEMS_SELF ); + + end_time = Read_timer(); + + put_time( + "rtems_task_resume (causing preempt)", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_TASK_RESUME + ); + + exit( 0 ); +} + +rtems_task Middle_tasks( + rtems_task_argument argument +) +{ + (void) rtems_task_suspend( RTEMS_SELF ); + + Task_index++; + (void) rtems_task_resume( Task_id[ Task_index ] ); +} + +rtems_task Low_task( + rtems_task_argument argument +) +{ + + end_time = Read_timer(); + + put_time( + "rtems_task_resume self", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_TASK_SUSPEND + ); + + Task_index = 1; + Timer_initialize(); + (void) rtems_task_resume( Task_id[ Task_index ] ); +} diff --git a/testsuites/tmtests/tm05/tm05.doc b/testsuites/tmtests/tm05/tm05.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm05/tm05.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm06/system.h b/testsuites/tmtests/tm06/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm06/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm06/task1.c b/testsuites/tmtests/tm06/task1.c new file mode 100644 index 0000000000..c6a6af6c63 --- /dev/null +++ b/testsuites/tmtests/tm06/task1.c @@ -0,0 +1,162 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Task_id[ OPERATION_COUNT + 1 ]; + +rtems_unsigned32 Task_restarted; + +rtems_task null_task( + rtems_task_argument argument +); + +rtems_task Task_1( + rtems_task_argument argument +); + +void test_init( void ); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 6 ***" ); + + test_init(); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +void test_init( void ) +{ + rtems_status_code status; + rtems_id id; + + Task_restarted = OPERATION_COUNT; + + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + 128, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create" ); + + status = rtems_task_start( id, Task_1, 0 ); + directive_failed( status, "rtems_task_start" ); +} + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_unsigned32 index; + + if ( Task_restarted == OPERATION_COUNT ) + Timer_initialize(); + + Task_restarted--; + + if ( Task_restarted != 0 ) + (void) rtems_task_restart( RTEMS_SELF, 0 ); + + end_time = Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + put_time( + "rtems_task_restart self", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_RESTART + ); + + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + 254, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] + ); + directive_failed( status, "rtems_task_create loop" ); + + status = rtems_task_start( Task_id[ index ], null_task, 0 ); + directive_failed( status, "rtems_task_start loop" ); + } + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_suspend( Task_id[ index ] ); + end_time = Read_timer(); + + put_time( + "rtems_task_suspend (no preempt)", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_TASK_SUSPEND + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_resume( Task_id[ index ] ); + end_time = Read_timer(); + + put_time( + "rtems_task_resume (no preempt)", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_TASK_RESUME + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_delete( Task_id[ index ] ); + end_time = Read_timer(); + + put_time( + "rtems_task_delete (others)", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_TASK_RESUME + ); + + exit( 0 ); +} + +rtems_task null_task( + rtems_task_argument argument +) +{ + while ( FOREVER ) + ; +} diff --git a/testsuites/tmtests/tm06/tm06.doc b/testsuites/tmtests/tm06/tm06.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm06/tm06.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm07/system.h b/testsuites/tmtests/tm07/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm07/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm07/task1.c b/testsuites/tmtests/tm07/task1.c new file mode 100644 index 0000000000..fcd545bbc4 --- /dev/null +++ b/testsuites/tmtests/tm07/task1.c @@ -0,0 +1,120 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Task_id[OPERATION_COUNT+1], task_index; + +rtems_task High_task( + rtems_task_argument argument +); + +rtems_task Middle_tasks( + rtems_task_argument argument +); + +rtems_task Low_task( + rtems_task_argument argument +); + +void test_init(); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 7 ***" ); + + test_init(); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +void test_init() +{ + rtems_status_code status; + rtems_task_priority priority; + rtems_task_entry task_entry; + rtems_unsigned32 index; + + priority = 250; + + for( index=0 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + priority, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[index] + ); + directive_failed( status, "rtems_task_create" ); + priority--; + + if ( index == 0 ) task_entry = Low_task; + else if ( index == OPERATION_COUNT ) task_entry = High_task; + else task_entry = Middle_tasks; + + status = rtems_task_start( Task_id[index], task_entry, 0 ); + directive_failed( status, "rtems_task_start" ); + } +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + if ( argument != 0 ) { + end_time = Read_timer(); + + put_time( + "rtems_task_restart suspended/preempt", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_TASK_RESTART + ); + } else + (void) rtems_task_suspend( RTEMS_SELF ); + + exit( 0 ); +} + +rtems_task Middle_tasks( + rtems_task_argument argument +) +{ + task_index++; + + if ( argument != 0 ) + (void) rtems_task_restart( Task_id[ task_index ], 0xffffffff ); + else + (void) rtems_task_suspend( RTEMS_SELF ); +} + +rtems_task Low_task( + rtems_task_argument argument +) +{ + task_index = 1; + + Timer_initialize(); + (void) rtems_task_restart( Task_id[ task_index ], 0xffffffff ); +} diff --git a/testsuites/tmtests/tm07/tm07.doc b/testsuites/tmtests/tm07/tm07.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm07/tm07.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm08/system.h b/testsuites/tmtests/tm08/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm08/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm08/task1.c b/testsuites/tmtests/tm08/task1.c new file mode 100644 index 0000000000..36312ff4b7 --- /dev/null +++ b/testsuites/tmtests/tm08/task1.c @@ -0,0 +1,255 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Test_task_id; + +rtems_task test_task( + rtems_task_argument argument +); +rtems_task test_task1( + rtems_task_argument argument +); +void test_init(); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 8 ***" ); + + test_init(); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +void test_init() +{ + rtems_status_code status; + + status = rtems_task_create( + 1, + 128, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Test_task_id + ); + directive_failed( status, "rtems_task_create" ); + + status = rtems_task_start( Test_task_id, test_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + status = rtems_task_create( + 1, + 254, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Test_task_id + ); + directive_failed( status, "rtems_task_create" ); + + status = rtems_task_start( Test_task_id, test_task1, 0 ); + directive_failed( status, "rtems_task_start" ); +} + +rtems_task test_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_unsigned32 index; + rtems_task_priority old_priority; + rtems_time_of_day time; + rtems_unsigned32 old_note; + rtems_unsigned32 old_mode; + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_set_priority( + Test_task_id, + RTEMS_CURRENT_PRIORITY, + &old_priority + ); + end_time = Read_timer(); + + put_time( + "rtems_task_set_priority current priority", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_SET_PRIORITY + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_set_priority( Test_task_id, 253, &old_priority ); + end_time = Read_timer(); + + put_time( + "rtems_task_set_priority no preempt", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_SET_PRIORITY + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_mode( + RTEMS_CURRENT_MODE, + RTEMS_CURRENT_MODE, + &old_mode + ); + end_time = Read_timer(); + + put_time( + "rtems_task_mode (current)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_MODE + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { + (void) rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(1), + RTEMS_INTERRUPT_MASK, + &old_mode + ); + (void) rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(0), + RTEMS_INTERRUPT_MASK, + &old_mode + ); + } + end_time = Read_timer(); + + put_time( + "rtems_task_mode (no reschedule)", + end_time, + OPERATION_COUNT * 2, + overhead, + CALLING_OVERHEAD_TASK_MODE + ); + + Timer_initialize(); /* must be one host */ + (void) rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &old_mode ); + end_time = Read_timer(); + + put_time( + "rtems_task_mode (reschedule)", + end_time, + 1, + 0, + CALLING_OVERHEAD_TASK_MODE + ); + + status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode ); + directive_failed( status, "rtems_task_mode" ); + + status = rtems_task_set_priority( Test_task_id, 1, &old_priority ); + directive_failed( status, "rtems_task_set_priority" ); + + /* preempted by test_task1 */ + Timer_initialize(); + (void) rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_set_note( Test_task_id, 8, 10 ); + end_time = Read_timer(); + + put_time( + "rtems_task_set_note", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_SET_NOTE + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_get_note( Test_task_id, 8, &old_note ); + end_time = Read_timer(); + + put_time( + "rtems_task_set_note", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_GET_NOTE + ); + + build_time( &time, 1, 1, 1988, 0, 0, 0, 0 ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_clock_set( &time ); + end_time = Read_timer(); + + put_time( + "rtems_clock_set", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_CLOCK_SET + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + end_time = Read_timer(); + + put_time( + "rtems_clock_get", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_CLOCK_GET + ); + + exit( 0 ); +} + +rtems_task test_task1( + rtems_task_argument argument +) +{ + end_time = Read_timer(); + + put_time( + "rtems_task_mode (preemptive)", + end_time, + 1, + 0, + CALLING_OVERHEAD_TASK_MODE + ); + + (void) rtems_task_suspend( RTEMS_SELF ); +} diff --git a/testsuites/tmtests/tm08/tm08.doc b/testsuites/tmtests/tm08/tm08.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm08/tm08.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm09/system.h b/testsuites/tmtests/tm09/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm09/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm09/task1.c b/testsuites/tmtests/tm09/task1.c new file mode 100644 index 0000000000..9126ee8a1d --- /dev/null +++ b/testsuites/tmtests/tm09/task1.c @@ -0,0 +1,221 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Queue_id; + +rtems_task Test_task( + rtems_task_argument argument +); +void queue_test(); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 9 ***" ); + + status = rtems_task_create( + 1, + 128, + 4096, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task Test_task ( + rtems_task_argument argument +) +{ + Timer_initialize(); + rtems_message_queue_create( + 1, + OPERATION_COUNT, + RTEMS_DEFAULT_ATTRIBUTES, + &Queue_id + ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_create", + end_time, + 1, + 0, + CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE + ); + + queue_test(); + + Timer_initialize(); + rtems_message_queue_delete( Queue_id ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_delete", + end_time, + 1, + 0, + CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE + ); + + exit( 0 ); +} + +void queue_test() +{ + rtems_unsigned32 send_loop_time; + rtems_unsigned32 urgent_loop_time; + rtems_unsigned32 receive_loop_time; + rtems_unsigned32 send_time; + rtems_unsigned32 urgent_time; + rtems_unsigned32 receive_time; + rtems_unsigned32 empty_flush_time; + rtems_unsigned32 flush_time; + rtems_unsigned32 empty_flush_count; + rtems_unsigned32 flush_count; + rtems_unsigned32 index; + rtems_unsigned32 iterations; + long buffer[4]; + rtems_status_code status; + + send_loop_time = 0; + urgent_loop_time = 0; + receive_loop_time = 0; + send_time = 0; + urgent_time = 0; + receive_time = 0; + empty_flush_time = 0; + flush_time = 0; + flush_count = 0; + empty_flush_count = 0; + + for ( iterations = 1 ; iterations <= OPERATION_COUNT ; iterations++ ) { + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + send_loop_time += Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + urgent_loop_time += Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + receive_loop_time += Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_message_queue_send( Queue_id, (long (*)[4])buffer ); + send_time += Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_message_queue_receive( + Queue_id, + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + receive_time += Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_message_queue_urgent( Queue_id, (long (*)[4])buffer ); + urgent_time += Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_message_queue_receive( + Queue_id, + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + receive_time += Read_timer(); + + Timer_initialize(); + rtems_message_queue_flush( Queue_id, &empty_flush_count ); + empty_flush_time += Read_timer(); + + /* send one message to flush */ + status = rtems_message_queue_send( + Queue_id, + (long (*)[4])buffer + ); + directive_failed( status, "rtems_message_queue_send" ); + + Timer_initialize(); + rtems_message_queue_flush( Queue_id, &flush_count ); + flush_time += Read_timer(); + } + + put_time( + "rtems_message_queue_send (no tasks waiting)", + send_time, + OPERATION_COUNT * OPERATION_COUNT, + send_loop_time, + CALLING_OVERHEAD_MESSAGE_QUEUE_SEND + ); + + put_time( + "rtems_message_queue_urgent (no tasks waiting)", + urgent_time, + OPERATION_COUNT * OPERATION_COUNT, + urgent_loop_time, + CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT + ); + + put_time( + "rtems_message_queue_receive (messages available)", + receive_time, + OPERATION_COUNT * OPERATION_COUNT * 2, + receive_loop_time * 2, + CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE + ); + + put_time( + "rtems_message_queue_flush (empty queue)", + empty_flush_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH + ); + + put_time( + "rtems_message_queue_flush (messages flushed)", + flush_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH + ); + +} diff --git a/testsuites/tmtests/tm09/tm09.doc b/testsuites/tmtests/tm09/tm09.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm09/tm09.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm10/system.h b/testsuites/tmtests/tm10/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm10/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm10/task1.c b/testsuites/tmtests/tm10/task1.c new file mode 100644 index 0000000000..788c2cd1f7 --- /dev/null +++ b/testsuites/tmtests/tm10/task1.c @@ -0,0 +1,156 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Queue_id; +long Buffer[4]; + +rtems_task High_task( + rtems_task_argument argument +); + +rtems_task Middle_tasks( + rtems_task_argument argument +); + +rtems_task Low_task( + rtems_task_argument argument +); + +void test_init(); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 10 ***" ); + + test_init(); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +void test_init() +{ + rtems_unsigned32 index; + rtems_task_entry task_entry; + rtems_status_code status; + rtems_task_priority priority; + rtems_id task_id; + + priority = 5; + + for( index = 0; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + priority, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create LOOP" ); + + priority++; + + if ( index==0 ) task_entry = High_task; + else if ( index==OPERATION_COUNT ) task_entry = Low_task; + else task_entry = Middle_tasks; + + status = rtems_task_start( task_id, task_entry, 0 ); + directive_failed( status, "rtems_task_start LOOP" ); + } + + status = rtems_message_queue_create( + 1, + OPERATION_COUNT, + RTEMS_DEFAULT_ATTRIBUTES, + &Queue_id + ); + directive_failed( status, "rtems_message_queue_create" ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_message_queue_receive( + Queue_id, + (long (*)[4]) Buffer, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT + ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_receive (RTEMS_NO_WAIT)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE + ); + +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + Timer_initialize(); + (void) rtems_message_queue_receive( + Queue_id, + (long (*)[4]) Buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); +} + +rtems_task Middle_tasks( + rtems_task_argument argument +) +{ + (void) rtems_message_queue_receive( + Queue_id, + (long (*)[4]) Buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); +} + + +rtems_task Low_task( + rtems_task_argument argument +) +{ + end_time = Read_timer(); + + put_time( + "rtems_message_queue_receive (blocking)", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE + ); + + exit( 0 ); +} diff --git a/testsuites/tmtests/tm10/tm10.doc b/testsuites/tmtests/tm10/tm10.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm10/tm10.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm11/system.h b/testsuites/tmtests/tm11/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm11/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm11/task1.c b/testsuites/tmtests/tm11/task1.c new file mode 100644 index 0000000000..9bf45442dc --- /dev/null +++ b/testsuites/tmtests/tm11/task1.c @@ -0,0 +1,148 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Queue_id; + +long Buffer[4]; + +rtems_task test_init( + rtems_task_argument argument +); + +rtems_task Middle_tasks( + rtems_task_argument argument +); + +rtems_task High_task( + rtems_task_argument argument +); + + +void Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_id id; + + puts( "\n\n*** TIME TEST 11 ***" ); + + status = rtems_task_create( + 1, + 251, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create" ); + + status = rtems_task_start( id, test_init, 0 ); + directive_failed( status, "rtems_task_start" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task test_init( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + rtems_task_entry task_entry; + rtems_task_priority priority; + rtems_id task_id; + rtems_status_code status; + +/* As each task is started, it preempts this task and + * performs a blocking rtems_message_queue_receive. Upon completion of + * this loop all created tasks are blocked. + */ + + status = rtems_message_queue_create( + rtems_build_name( 'M', 'Q', '1', ' ' ), + OPERATION_COUNT, + RTEMS_DEFAULT_ATTRIBUTES, + &Queue_id + ); + directive_failed( status, "rtems_message_queue_create" ); + + priority = 250; + + for( index = 0; index < OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + priority, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create LOOP" ); + + priority--; + + if ( index==OPERATION_COUNT-1 ) task_entry = High_task; + else task_entry = Middle_tasks; + + status = rtems_task_start( task_id, task_entry, 0 ); + directive_failed( status, "rtems_task_start LOOP" ); + } + + Timer_initialize(); + (void) rtems_message_queue_send( Queue_id, (long (*)[4]) Buffer ); +} + +rtems_task Middle_tasks( + rtems_task_argument argument +) +{ + (void) rtems_message_queue_receive( + Queue_id, + (long (*)[4]) Buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + + (void) rtems_message_queue_send( Queue_id, (long (*)[4]) Buffer ); +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + (void) rtems_message_queue_receive( + Queue_id, + (long (*)[4]) Buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + + end_time = Read_timer(); + + put_time( + "rtems_message_queue_send (preemptive)", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_MESSAGE_QUEUE_SEND + ); + + exit( 0 ); +} diff --git a/testsuites/tmtests/tm11/tm11.doc b/testsuites/tmtests/tm11/tm11.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm11/tm11.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm12/system.h b/testsuites/tmtests/tm12/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm12/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm12/task1.c b/testsuites/tmtests/tm12/task1.c new file mode 100644 index 0000000000..8735cc601f --- /dev/null +++ b/testsuites/tmtests/tm12/task1.c @@ -0,0 +1,142 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Queue_id; + +long Buffer[4]; + +rtems_task test_init( + rtems_task_argument argument +); + +rtems_task High_task( + rtems_task_argument argument +); + +rtems_task Low_tasks( + rtems_task_argument argument +); + + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_id task_id; + rtems_status_code status; + + puts( "\n\n*** TIME TEST 12 ***" ); + + status = rtems_task_create( + 1, + 251, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create" ); + + status = rtems_task_start( task_id, test_init, 0 ); + directive_failed( status, "rtems_task_start" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task test_init( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + rtems_task_entry task_entry; + rtems_task_priority priority; + rtems_id task_id; + rtems_status_code status; + + + status = rtems_message_queue_create( + rtems_build_name( 'M', 'Q', '1', ' ' ), + OPERATION_COUNT, + RTEMS_DEFAULT_ATTRIBUTES, + &Queue_id + ); + directive_failed( status, "rtems_message_queue_create" ); + + priority = 250; + + for( index = 0; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + priority, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create LOOP" ); + + priority--; + + if ( index==OPERATION_COUNT ) task_entry = High_task; + else task_entry = Low_tasks; + + status = rtems_task_start( task_id, task_entry, 0 ); + directive_failed( status, "rtems_task_start LOOP" ); + } +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_message_queue_send( Queue_id, (long (*)[4]) Buffer ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_send (readying)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_MESSAGE_QUEUE_SEND + ); + + exit( 0 ); +} + +rtems_task Low_tasks( + rtems_task_argument argument +) +{ + (void) rtems_message_queue_receive( + Queue_id, + (long (*)[4]) Buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); +} diff --git a/testsuites/tmtests/tm12/tm12.doc b/testsuites/tmtests/tm12/tm12.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm12/tm12.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm13/system.h b/testsuites/tmtests/tm13/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm13/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm13/task1.c b/testsuites/tmtests/tm13/task1.c new file mode 100644 index 0000000000..28ff2bf149 --- /dev/null +++ b/testsuites/tmtests/tm13/task1.c @@ -0,0 +1,147 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Queue_id; + +long Buffer[4]; + +rtems_task test_init( + rtems_task_argument argument +); + +rtems_task Middle_tasks( + rtems_task_argument argument +); + +rtems_task High_task( + rtems_task_argument argument +); + +void Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_id id; + + puts( "\n\n*** TIME TEST 13 ***" ); + + status = rtems_task_create( + 1, + 251, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create" ); + + status = rtems_task_start( id, test_init, 0 ); + directive_failed( status, "rtems_task_start" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task test_init( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + rtems_task_entry task_entry; + rtems_task_priority priority; + rtems_id task_id; + rtems_status_code status; + +/* As each task is started, it preempts this task and + * performs a blocking rtems_message_queue_receive. Upon completion of + * this loop all created tasks are blocked. + */ + + status = rtems_message_queue_create( + rtems_build_name( 'M', 'Q', '1', ' ' ), + OPERATION_COUNT, + RTEMS_DEFAULT_ATTRIBUTES, + &Queue_id + ); + directive_failed( status, "rtems_message_queue_create" ); + + priority = 250; + + for( index = 0; index < OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + priority, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create LOOP" ); + + priority--; + + if ( index==OPERATION_COUNT-1 ) task_entry = High_task; + else task_entry = Middle_tasks; + + status = rtems_task_start( task_id, task_entry, 0 ); + directive_failed( status, "rtems_task_start LOOP" ); + } + + Timer_initialize(); + (void) rtems_message_queue_urgent( Queue_id, (long (*)[4]) Buffer ); +} + +rtems_task Middle_tasks( + rtems_task_argument argument +) +{ + (void) rtems_message_queue_receive( + Queue_id, + (long (*)[4]) Buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + + (void) rtems_message_queue_urgent( Queue_id, (long (*)[4]) Buffer ); +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + (void) rtems_message_queue_receive( + Queue_id, + (long (*)[4]) Buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + + end_time = Read_timer(); + + put_time( + "rtems_message_queue_urgent (preemptive)", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT + ); + + exit( 0 ); +} diff --git a/testsuites/tmtests/tm13/tm13.doc b/testsuites/tmtests/tm13/tm13.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm13/tm13.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm14/system.h b/testsuites/tmtests/tm14/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm14/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm14/task1.c b/testsuites/tmtests/tm14/task1.c new file mode 100644 index 0000000000..3020fa66e9 --- /dev/null +++ b/testsuites/tmtests/tm14/task1.c @@ -0,0 +1,142 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Queue_id; + +long Buffer[4]; + +rtems_task test_init( + rtems_task_argument argument +); + +rtems_task High_task( + rtems_task_argument argument +); + +rtems_task Low_tasks( + rtems_task_argument argument +); + + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_id task_id; + rtems_status_code status; + + puts( "\n\n*** TIME TEST 14 ***" ); + + status = rtems_task_create( + 1, + 251, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create" ); + + status = rtems_task_start( task_id, test_init, 0 ); + directive_failed( status, "rtems_task_start" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task test_init( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + rtems_task_entry task_entry; + rtems_task_priority priority; + rtems_id task_id; + rtems_status_code status; + + + status = rtems_message_queue_create( + rtems_build_name( 'M', 'Q', '1', ' ' ), + OPERATION_COUNT, + RTEMS_DEFAULT_ATTRIBUTES, + &Queue_id + ); + directive_failed( status, "rtems_message_queue_create" ); + + priority = 250; + + for( index = 0; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + priority, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create LOOP" ); + + priority--; + + if ( index==OPERATION_COUNT ) task_entry = High_task; + else task_entry = Low_tasks; + + status = rtems_task_start( task_id, task_entry, 0 ); + directive_failed( status, "rtems_task_start LOOP" ); + } +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_message_queue_urgent( Queue_id, (long (*)[4]) Buffer ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_urgent (readying)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT + ); + + exit( 0 ); +} + +rtems_task Low_tasks( + rtems_task_argument argument +) +{ + (void) rtems_message_queue_receive( + Queue_id, + (long (*)[4]) Buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); +} diff --git a/testsuites/tmtests/tm14/tm14.doc b/testsuites/tmtests/tm14/tm14.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm14/tm14.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm15/system.h b/testsuites/tmtests/tm15/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm15/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm15/task1.c b/testsuites/tmtests/tm15/task1.c new file mode 100644 index 0000000000..05fb29461b --- /dev/null +++ b/testsuites/tmtests/tm15/task1.c @@ -0,0 +1,222 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_unsigned32 time_set, eventout; + +rtems_task High_tasks( + rtems_task_argument argument +); + +rtems_task Low_task( + rtems_task_argument argument +); + +void test_init(); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 15 ***" ); + + test_init(); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +void test_init() +{ + rtems_id id; + rtems_unsigned32 index; + rtems_event_set event_out; + rtems_status_code status; + + time_set = FALSE; + + status = rtems_task_create( + rtems_build_name( 'L', 'O', 'W', ' ' ), + 10, + 1024, + RTEMS_NO_PREEMPT, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create LOW" ); + + status = rtems_task_start( id, Low_task, 0 ); + directive_failed( status, "rtems_task_start LOW" ); + + for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'H', 'I', 'G', 'H' ), + 5, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] + ); + directive_failed( status, "rtems_task_create LOOP" ); + + status = rtems_task_start( Task_id[ index ], High_tasks, 0 ); + directive_failed( status, "rtems_task_start LOOP" ); + } + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + { + (void) rtems_event_receive( + RTEMS_PENDING_EVENTS, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &event_out + ); + } + + end_time = Read_timer(); + + put_time( + "rtems_event_receive (current)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_EVENT_RECEIVE + ); + + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + { + (void) rtems_event_receive( + RTEMS_ALL_EVENTS, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &event_out + ); + } + end_time = Read_timer(); + + put_time( + "rtems_event_receive (RTEMS_NO_WAIT)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_EVENT_RECEIVE + ); +} + +rtems_task Low_task( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + rtems_event_set event_out; + + end_time = Read_timer(); + + put_time( + "rtems_event_receive (blocking)", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_EVENT_RECEIVE + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_event_send( RTEMS_SELF, RTEMS_EVENT_16 ); + end_time = Read_timer(); + + put_time( + "rtems_event_send (non-blocking)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_EVENT_SEND + ); + + Timer_initialize(); + (void) rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &event_out + ); + end_time = Read_timer(); + + put_time( + "rtems_event_receive (available)", + end_time, + 1, + 0, + CALLING_OVERHEAD_EVENT_RECEIVE + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_event_send( Task_id[ index ], RTEMS_EVENT_16 ); + end_time = Read_timer(); + + put_time( + "rtems_event_send (readying)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_EVENT_SEND + ); + + exit( 0 ); +} + +rtems_task High_tasks( + rtems_task_argument argument +) +{ + rtems_status_code status; + + if ( time_set ) + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + else { + time_set = 1; + Timer_initialize(); /* start blocking rtems_event_receive time */ + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + } +} diff --git a/testsuites/tmtests/tm15/tm15.doc b/testsuites/tmtests/tm15/tm15.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm15/tm15.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm16/system.h b/testsuites/tmtests/tm16/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm16/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm16/task1.c b/testsuites/tmtests/tm16/task1.c new file mode 100644 index 0000000000..a837c72014 --- /dev/null +++ b/testsuites/tmtests/tm16/task1.c @@ -0,0 +1,148 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_unsigned32 Task_count; + +rtems_task test_init( + rtems_task_argument argument +); + +rtems_task Middle_tasks( + rtems_task_argument argument +); + +rtems_task High_task( + rtems_task_argument argument +); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_id id; + rtems_status_code status; + + puts( "\n\n*** TIME TEST 16 ***" ); + + status = rtems_task_create( + rtems_build_name( 'T', 'E', 'S', 'T' ), + 251, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create of test_init" ); + + status = rtems_task_start( id, test_init, 0 ); + directive_failed( status, "rtems_task_start of test_init" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task test_init( + rtems_task_argument argument +) +{ + rtems_task_priority priority; + rtems_status_code status; + rtems_unsigned32 index; + rtems_task_entry task_entry; + +/* As each task is started, it preempts this task and + * performs a blocking rtems_event_receive. Upon completion of + * this loop all created tasks are blocked. + */ + + priority = 250; + + for( index = 0 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'M', 'I', 'D', ' ' ), + priority, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] + ); + directive_failed( status, "rtems_task_create LOOP" ); + + if ( index == OPERATION_COUNT ) task_entry = High_task; + else task_entry = Middle_tasks; + + status = rtems_task_start( Task_id[ index ], task_entry, 0 ); + directive_failed( status, "rtems_task_start LOOP" ); + + priority--; + } + + Task_count = 0; + + Timer_initialize(); + (void) rtems_event_send( Task_id[ Task_count ], RTEMS_EVENT_16 ); + /* preempts task */ +} + +rtems_task Middle_tasks( + rtems_task_argument argument +) +{ + rtems_event_set event_out; + + (void) rtems_event_receive( /* task blocks */ + RTEMS_EVENT_16, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &event_out + ); + + Task_count++; + + (void) rtems_event_send( /* preempts task */ + Task_id[ Task_count ], + RTEMS_EVENT_16 + ); +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + rtems_event_set event_out; + + (void) rtems_event_receive( /* task blocks */ + RTEMS_EVENT_16, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &event_out + ); + + end_time = Read_timer(); + + put_time( + "rtems_event_send (preemptive)", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_EVENT_SEND + ); + + exit( 0 ); +} diff --git a/testsuites/tmtests/tm16/tm16.doc b/testsuites/tmtests/tm16/tm16.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm16/tm16.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm17/system.h b/testsuites/tmtests/tm17/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm17/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm17/task1.c b/testsuites/tmtests/tm17/task1.c new file mode 100644 index 0000000000..fbf658799b --- /dev/null +++ b/testsuites/tmtests/tm17/task1.c @@ -0,0 +1,127 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_unsigned32 Task_count; +rtems_task_priority Task_priority; + +rtems_task First_task( + rtems_task_argument argument +); + +rtems_task Middle_tasks( + rtems_task_argument argument +); + +rtems_task Last_task( + rtems_task_argument argument +); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_task_entry task_entry; + rtems_unsigned32 index; + rtems_status_code status; + + puts( "\n\n*** TIME TEST 17 ***" ); + + Task_priority = 254; + + for( index = 0; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + Task_priority, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] + ); + directive_failed( status, "rtems_task_create loop" ); + + if ( index == OPERATION_COUNT ) task_entry = Last_task; + else if ( index == 0 ) task_entry = First_task; + else task_entry = Middle_tasks; + + status = rtems_task_start( Task_id[ index ], task_entry, 0 ); + directive_failed( status, "rtems_task_start loop" ); + } + + Task_count = 1; + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task First_task( + rtems_task_argument argument +) +{ + rtems_task_priority previous_priority; + + Timer_initialize(); + + Task_priority--; + Task_count++; + + (void) rtems_task_set_priority( + Task_id[ Task_count ], + Task_priority, + &previous_priority + ); +} + +rtems_task Middle_tasks( + rtems_task_argument argument +) +{ + rtems_task_priority previous_priority; + + Task_priority--; + Task_count++; + + (void) rtems_task_set_priority( + Task_id[ Task_count ], + Task_priority, + &previous_priority + ); +} + +rtems_task Last_task( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + + end_time = Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + put_time( + "rtems_task_set_priority (preemptive)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_SET_PRIORITY + ); + + exit( 0 ); +} diff --git a/testsuites/tmtests/tm17/tm17.doc b/testsuites/tmtests/tm17/tm17.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm17/tm17.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm18/system.h b/testsuites/tmtests/tm18/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm18/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm18/task1.c b/testsuites/tmtests/tm18/task1.c new file mode 100644 index 0000000000..c5b529f988 --- /dev/null +++ b/testsuites/tmtests/tm18/task1.c @@ -0,0 +1,112 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_unsigned32 taskcount; +rtems_task_priority taskpri; + +rtems_task First_task( + rtems_task_argument argument +); + +rtems_task Middle_tasks( + rtems_task_argument argument +); + +rtems_task Last_task( + rtems_task_argument argument +); + + +void test_init(); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 18 ***" ); + + test_init(); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +void test_init() +{ + rtems_id id; + rtems_task_entry task_entry; + rtems_unsigned32 index; + rtems_status_code status; + + for ( index = 0 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + 128, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create loop" ); + + if ( index == OPERATION_COUNT ) task_entry = Last_task; + else if ( index == 0 ) task_entry = First_task; + else task_entry = Middle_tasks; + + + status = rtems_task_start( id, task_entry, 0 ); + directive_failed( status, "rtems_task_start loop" ); + } + +} + +rtems_task First_task( + rtems_task_argument argument +) +{ + Timer_initialize(); + + (void) rtems_task_delete( RTEMS_SELF ); +} + +rtems_task Middle_tasks( + rtems_task_argument argument +) +{ + (void) rtems_task_delete( RTEMS_SELF ); +} + +rtems_task Last_task( + rtems_task_argument argument +) +{ + end_time = Read_timer(); + + put_time( + "rtems_task_delete self", + end_time, + OPERATION_COUNT, + 0, + CALLING_OVERHEAD_TASK_DELETE + ); + + exit( 0 ); +} diff --git a/testsuites/tmtests/tm18/tm18.doc b/testsuites/tmtests/tm18/tm18.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm18/tm18.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm19/system.h b/testsuites/tmtests/tm19/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm19/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm19/task1.c b/testsuites/tmtests/tm19/task1.c new file mode 100644 index 0000000000..7c491b7572 --- /dev/null +++ b/testsuites/tmtests/tm19/task1.c @@ -0,0 +1,212 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_asr Process_asr_for_pass_1( + rtems_signal_set signals +); + +rtems_asr Process_asr_for_pass_2( + rtems_signal_set signals +); + +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Task_2( + rtems_task_argument argument +); + +rtems_task Task_3( + rtems_task_argument argument +); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 19 ***" ); + + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + 128, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TASK1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TASK1" ); + + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + 127, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TASK2" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TASK2" ); + + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + 126, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TASK3" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TASK3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_asr Process_asr_for_pass_1( + rtems_signal_set signals +) +{ + end_time = Read_timer(); + + put_time( + "rtems_signal_send (self)", + end_time, + 1, + 0, + CALLING_OVERHEAD_SIGNAL_SEND + ); + + puts( "SIGNAL_ENTER (non-preemptive) na" ); + + Timer_initialize(); +} + +rtems_asr Process_asr_for_pass_2( + rtems_signal_set signals +) +{ + rtems_status_code status; + + puts( "SIGNAL_ENTER (preemptive) na" ); + + status = rtems_task_resume( Task_id[ 3 ] ); + directive_failed( status, "rtems_task_resume" ); + + Timer_initialize(); +} + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_status_code status; + + Timer_initialize(); + (void) rtems_signal_catch( Process_asr_for_pass_1, RTEMS_DEFAULT_MODES ); + end_time = Read_timer(); + + put_time( + "rtems_signal_catch", + end_time, + 1, + 0, + CALLING_OVERHEAD_SIGNAL_CATCH + ); + + Timer_initialize(); + rtems_signal_send( Task_id[ 2 ], 1 ); + end_time = Read_timer(); + + put_time( + "rtems_signal_send (non-preemptive)", + end_time, + 1, + 0, + CALLING_OVERHEAD_SIGNAL_SEND + ); + + Timer_initialize(); + (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 ); + + /* end time is done is RTEMS_ASR */ + + end_time = Read_timer(); + + put_time( + "SIGNAL_RETURN (non-preemptive)", + end_time, + 1, + 0, + 0 + ); + + status = rtems_signal_catch( Process_asr_for_pass_2, RTEMS_NO_PREEMPT ); + directive_failed( status, "rtems_signal_catch" ); + + Timer_initialize(); + (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 ); +} + +rtems_asr Process_asr_for_task_2( + rtems_signal_set signals +) +{ + ; +} + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + status = rtems_signal_catch( Process_asr_for_task_2, RTEMS_DEFAULT_MODES ); + directive_failed( status, "rtems_signal_catch" ); + + (void) rtems_task_suspend( RTEMS_SELF ); +} + +rtems_task Task_3( + rtems_task_argument argument +) +{ + (void) rtems_task_suspend( RTEMS_SELF ); + + end_time = Read_timer(); + + put_time( + "SIGNAL_RETURN (preemptive)", + end_time, + 1, + 0, + 0 + ); + + exit( 0 ); +} diff --git a/testsuites/tmtests/tm19/tm19.doc b/testsuites/tmtests/tm19/tm19.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm19/tm19.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm20/system.h b/testsuites/tmtests/tm20/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm20/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm20/task1.c b/testsuites/tmtests/tm20/task1.c new file mode 100644 index 0000000000..6cfcb3d0c1 --- /dev/null +++ b/testsuites/tmtests/tm20/task1.c @@ -0,0 +1,467 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_device_major_number _STUB_major = 0; + +rtems_id Region_id; +rtems_name Region_name; +rtems_unsigned8 Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT; + +rtems_id Partition_id; +rtems_name Partition_name; +rtems_unsigned8 Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT; + +void *Buffer_address_1; +void *Buffer_address_2; +void *Buffer_address_3; +void *Buffer_address_4; + +rtems_unsigned32 buffer_count; + +void *Buffer_addresses[ OPERATION_COUNT+1 ]; + +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Task_2( + rtems_task_argument argument +); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 20 ***" ); + + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', '1' ), + 128, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TASK1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TASK1" ); + + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', '2' ), + 129, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TASK2" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TASK2" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + rtems_mode previous_mode; + rtems_task_priority previous_priority; + rtems_unsigned32 return_value; + rtems_status_code status; + + Partition_name = rtems_build_name( 'P', 'A', 'R', 'T' ); + + Timer_initialize(); + rtems_partition_create( + Partition_name, + Partition_area, + 2048, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &Partition_id + ); + end_time = Read_timer(); + + put_time( + "rtems_partition_create", + end_time, + 1, + 0, + CALLING_OVERHEAD_PARTITION_CREATE + ); + + Region_name = rtems_build_name( 'R', 'E', 'G', 'N' ); + + Timer_initialize(); + rtems_region_create( + Region_name, + Region_area, + 2048, + 16, + RTEMS_DEFAULT_ATTRIBUTES, + &Region_id + ); + end_time = Read_timer(); + + put_time( + "rtems_region_create", + end_time, + 1, + 0, + CALLING_OVERHEAD_REGION_CREATE + ); + + Timer_initialize(); + (void) rtems_partition_get_buffer( Partition_id, &Buffer_address_1 ); + end_time = Read_timer(); + + put_time( + "rtems_partition_get_buffer (available)", + end_time, + 1, + 0, + CALLING_OVERHEAD_PARTITION_GET_BUFFER + ); + + buffer_count = 0; + while ( FOREVER ) { + + status = rtems_partition_get_buffer( + Partition_id, + &Buffer_addresses[ buffer_count ] + ); + + if ( status == RTEMS_UNSATISFIED ) break; + + buffer_count++; + } + + Timer_initialize(); + (void) rtems_partition_get_buffer( Partition_id, &Buffer_address_2 ); + end_time = Read_timer(); + + put_time( + "rtems_partition_get_buffer (not available)", + end_time, + 1, + 0, + CALLING_OVERHEAD_PARTITION_GET_BUFFER + ); + + Timer_initialize(); + (void) rtems_partition_return_buffer( Partition_id, Buffer_address_1 ); + end_time = Read_timer(); + + put_time( + "rtems_partition_return_buffer", + end_time, + 1, + 0, + CALLING_OVERHEAD_PARTITION_RETURN_BUFFER + ); + + for ( index = 0 ; index < buffer_count ; index++ ) { + + status = rtems_partition_return_buffer( + Partition_id, + Buffer_addresses[ index ] + ); + directive_failed( status, "rtems_partition_return_buffer" ); + + } + + Timer_initialize(); + (void) rtems_partition_delete( Partition_id ); + end_time = Read_timer(); + + put_time( + "rtems_partition_delete", + end_time, + 1, + 0, + CALLING_OVERHEAD_PARTITION_DELETE + ); + + status = rtems_region_get_segment( + Region_id, + 400, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &Buffer_address_2 + ); + directive_failed( status, "region_get_semgent" ); + + Timer_initialize(); + (void) rtems_region_get_segment( + Region_id, + 400, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &Buffer_address_3 + ); + end_time = Read_timer(); + + put_time( + "rtems_region_get_segment (available)", + end_time, + 1, + 0, + CALLING_OVERHEAD_REGION_GET_SEGMENT + ); + + Timer_initialize(); + (void) rtems_region_get_segment( + Region_id, + 1998, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &Buffer_address_4 + ); + end_time = Read_timer(); + + put_time( + "rtems_region_get_segment (RTEMS_NO_WAIT)", + end_time, + 1, + 0, + CALLING_OVERHEAD_REGION_GET_SEGMENT + ); + + status = rtems_region_return_segment( Region_id, Buffer_address_3 ); + directive_failed( status, "rtems_region_return_segment" ); + + Timer_initialize(); + (void) rtems_region_return_segment( Region_id, Buffer_address_2 ); + end_time = Read_timer(); + + put_time( + "rtems_region_return_segment (no tasks waiting)", + end_time, + 1, + 0, + CALLING_OVERHEAD_REGION_RETURN_SEGMENT + ); + + status = rtems_region_get_segment( + Region_id, + 400, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &Buffer_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + + Timer_initialize(); + (void) rtems_region_get_segment( + Region_id, + 1998, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &Buffer_address_2 + ); + + /* execute Task_2 */ + + end_time = Read_timer(); + + put_time( + "rtems_region_return_segment (preempt)", + end_time, + 1, + 0, + CALLING_OVERHEAD_REGION_RETURN_SEGMENT + ); + + status = rtems_region_return_segment( Region_id, Buffer_address_2 ); + directive_failed( status, "rtems_region_return_segment" ); + + status = rtems_task_mode( + RTEMS_NO_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + + status = rtems_task_set_priority( RTEMS_SELF, 254, &previous_priority ); + directive_failed( status, "rtems_task_set_priority" ); + + status = rtems_region_get_segment( + Region_id, + 400, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &Buffer_address_1 + ); + directive_failed( status, "rtems_region_return_segment" ); + + status = rtems_region_get_segment( + Region_id, + 1998, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &Buffer_address_2 + ); + directive_failed( status, "rtems_region_get_segment" ); + + /* execute Task_2 */ + + status = rtems_region_return_segment( Region_id, Buffer_address_2 ); + directive_failed( status, "rtems_region_return_segment" ); + + Timer_initialize(); + (void) rtems_region_delete( Region_id ); + end_time = Read_timer(); + + put_time( + "rtems_region_delete", + end_time, + 1, + 0, + CALLING_OVERHEAD_REGION_DELETE + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_io_initialize( 0, 0, NULL, &return_value ); + end_time = Read_timer(); + + put_time( + "rtems_io_initialize", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_IO_INITIALIZE + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_io_open( 0, 0, NULL, &return_value ); + end_time = Read_timer(); + + put_time( + "rtems_io_open", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_IO_OPEN + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_io_close( 0, 0, NULL, &return_value ); + end_time = Read_timer(); + + put_time( + "rtems_io_close", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_IO_CLOSE + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_io_read( 0, 0, NULL, &return_value ); + end_time = Read_timer(); + + put_time( + "rtems_io_read", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_IO_READ + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_io_write( 0, 0, NULL, &return_value ); + end_time = Read_timer(); + + put_time( + "rtems_io_write", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_IO_WRITE + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_io_control( 0, 0, NULL, &return_value ); + end_time = Read_timer(); + + put_time( + "rtems_io_control", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_IO_CONTROL + ); + + exit( 0 ); +} + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + end_time = Read_timer(); + + put_time( + "rtems_region_get_segment (blocking)", + end_time, + 1, + 0, + CALLING_OVERHEAD_REGION_GET_SEGMENT + ); + + Timer_initialize(); + (void) rtems_region_return_segment( Region_id, Buffer_address_1 ); + + /* preempt back to Task_1 */ + + Timer_initialize(); + (void) rtems_region_return_segment( Region_id, Buffer_address_1 ); + end_time = Read_timer(); + + put_time( + "rtems_region_return_segment (ready -- return)", + end_time, + 1, + 0, + CALLING_OVERHEAD_REGION_RETURN_SEGMENT + ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/testsuites/tmtests/tm20/tm20.doc b/testsuites/tmtests/tm20/tm20.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm20/tm20.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm21/system.h b/testsuites/tmtests/tm21/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm21/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm21/task1.c b/testsuites/tmtests/tm21/task1.c new file mode 100644 index 0000000000..0f31e08485 --- /dev/null +++ b/testsuites/tmtests/tm21/task1.c @@ -0,0 +1,234 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_unsigned8 Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT; +rtems_unsigned8 Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT; + +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_id id; + rtems_status_code status; + + puts( "\n\n*** TIME TEST 21 ***" ); + + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + 250, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create of TASK1" ); + + status = rtems_task_start( id, Task_1, 0 ); + directive_failed( status, "rtems_task_start of TASK1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + rtems_id id; + rtems_status_code status; + + for( index = 1 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create ( + index, + 254, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create" ); + + status = rtems_message_queue_create( + index, + OPERATION_COUNT, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_message_queue_create" ); + + status = rtems_semaphore_create( + index, + OPERATION_COUNT, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_semaphore_create" ); + + status = rtems_region_create( + index, + Region_area, + 2048, + 16, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_region_create" ); + + status = rtems_partition_create( + index, + Partition_area, + 2048, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_partition_create" ); + + status = rtems_port_create( + index, + Partition_area, + Region_area, + 0xff, + &id + ); + directive_failed( status, "rtems_port_create" ); + + status = rtems_timer_create( index, &id ); + directive_failed( status, "rtems_timer_create" ); + + status = rtems_rate_monotonic_create( index, &id ); + directive_failed( status, "rtems_rate_monotonic_create" ); + } + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_ident( index, RTEMS_SEARCH_ALL_NODES, &id ); + end_time = Read_timer(); + + put_time( + "rtems_task_ident", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_IDENT + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_message_queue_ident( index, RTEMS_SEARCH_ALL_NODES, &id ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_ident", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_semaphore_ident( index, RTEMS_SEARCH_ALL_NODES, &id ); + end_time = Read_timer(); + + put_time( + "rtems_semaphore_ident", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_SEMAPHORE_IDENT + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_partition_ident( index, RTEMS_SEARCH_ALL_NODES, &id ); + end_time = Read_timer(); + + put_time( + "rtems_partition_ident", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_PARTITION_IDENT + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_region_ident( index, &id ); + end_time = Read_timer(); + + put_time( + "rtems_region_ident", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_REGION_IDENT + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_port_ident( index, &id ); + end_time = Read_timer(); + + put_time( + "rtems_port_ident", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_PORT_IDENT + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_timer_ident( index, &id ); + end_time = Read_timer(); + + put_time( + "rtems_timer_ident", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TIMER_IDENT + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_rate_monotonic_ident( index, &id ); + end_time = Read_timer(); + + put_time( + "rtems_rate_monotonic_ident", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_RATE_MONOTONIC_IDENT + ); + + exit( 0 ); +} diff --git a/testsuites/tmtests/tm21/tm21.doc b/testsuites/tmtests/tm21/tm21.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm21/tm21.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm22/system.h b/testsuites/tmtests/tm22/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm22/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm22/task1.c b/testsuites/tmtests/tm22/task1.c new file mode 100644 index 0000000000..450466ea54 --- /dev/null +++ b/testsuites/tmtests/tm22/task1.c @@ -0,0 +1,193 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Queue_id; + +long Buffer[4]; + +rtems_task Low_task( + rtems_task_argument argument +); + +rtems_task High_task( + rtems_task_argument argument +); + +rtems_task Preempt_task( + rtems_task_argument argument +); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_id id; + rtems_status_code status; + + puts( "\n\n*** TIME TEST 22 ***" ); + + status = rtems_message_queue_create( + rtems_build_name( 'M', 'Q', '1', ' '), + 0, + RTEMS_DEFAULT_ATTRIBUTES, + &Queue_id + ); + directive_failed( status, "rtems_message_queue_create" ); + + status = rtems_task_create( + rtems_build_name( 'L', 'O', 'W', ' ' ), + 10, + 2048, + RTEMS_NO_PREEMPT, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create" ); + + status = rtems_task_start( id, Low_task, 0 ); + directive_failed( status, "rtems_task_start LOW" ); + + status = rtems_task_create( + 1, + 11, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create RTEMS_PREEMPT" ); + + status = rtems_task_start( id, Preempt_task, 0 ); + directive_failed( status, "rtems_task_start RTEMS_PREEMPT" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + rtems_unsigned32 count; + rtems_status_code status; + + Timer_initialize(); + (void) rtems_message_queue_broadcast( + Queue_id, + (long (*)[4]) Buffer, + &count + ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_broadcast (readying)", + end_time, + 1, + 0, + CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST + ); + + status = rtems_task_suspend(RTEMS_SELF); + directive_failed( status, "rtems_task_suspend" ); +} + +rtems_task Low_task( + rtems_task_argument argument +) +{ + rtems_id id; + rtems_unsigned32 index; + rtems_unsigned32 count; + rtems_status_code status; + + status = rtems_task_create( + rtems_build_name( 'H', 'I', 'G', 'H' ), + 5, + 2048, + RTEMS_NO_PREEMPT, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create" ); + + status = rtems_task_start( id, High_task, 0 ); + directive_failed( status, "rtems_task_start HIGH" ); + + status = rtems_message_queue_receive( + Queue_id, + (long (*)[4]) Buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "message_queu_receive" ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_message_queue_broadcast( + Queue_id, + (long (*)[4]) Buffer, + &count + ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_broadcast (no waiting tasks)", + end_time, + OPERATION_COUNT, + 1, + CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST + ); + + (void) rtems_message_queue_receive( + Queue_id, + (long (*)[4]) Buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + + /* should go to Preempt_task here */ + + end_time = Read_timer(); + + put_time( + "rtems_message_queue_broadcast (preempt)", + end_time, + 1, + 0, + CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST + ); + + exit( 0 ); +} + +rtems_task Preempt_task( + rtems_task_argument argument +) +{ + rtems_unsigned32 count; + + Timer_initialize(); + (void) rtems_message_queue_broadcast( + Queue_id, + (long (*)[4]) Buffer, + &count + ); + + /* should be preempted by low task */ +} diff --git a/testsuites/tmtests/tm22/tm22.doc b/testsuites/tmtests/tm22/tm22.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm22/tm22.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm23/system.h b/testsuites/tmtests/tm23/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm23/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm23/task1.c b/testsuites/tmtests/tm23/task1.c new file mode 100644 index 0000000000..8b3e6dbccc --- /dev/null +++ b/testsuites/tmtests/tm23/task1.c @@ -0,0 +1,302 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Timer_id[ OPERATION_COUNT+1 ]; + +rtems_time_of_day time_of_day; + +void null_delay( + rtems_id ignored_id, + void *ignored_address +); + +rtems_task Low_task( + rtems_task_argument argument +); + +rtems_task Middle_tasks( + rtems_task_argument argument +); + +rtems_task High_task( + rtems_task_argument argument +); + + +rtems_task Init( + rtems_task_argument argument +) +{ + + rtems_task_priority priority; + rtems_unsigned32 index; + rtems_id id; + rtems_task_entry task_entry; + rtems_status_code status; + + puts( "\n\n*** TIME TEST 23 ***" ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + priority = 5; + + for( index=1 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + priority, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create LOOP" ); + + if ( index == 1 ) task_entry = High_task; + else if ( index == OPERATION_COUNT ) task_entry = Low_task; + else task_entry = Middle_tasks; + + status = rtems_task_start( id, task_entry, 0 ); + directive_failed( status, "rtems_task_start LOOP" ); + + priority++; + } + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +void null_delay( + rtems_id ignored_id, + void *ignored_address +) +{ +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + rtems_status_code status; + int i; + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_timer_create( index, &Timer_id[ index ] ); + end_time = Read_timer(); + + put_time( + "rtems_timer_create", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TIMER_CREATE + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_timer_fire_after( Timer_id[ index ], 500, null_delay, NULL ); + end_time = Read_timer(); + + put_time( + "rtems_timer_fire_after (inactive)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TIMER_FIRE_AFTER + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_timer_fire_after( Timer_id[ index ], 500, null_delay, NULL ); + end_time = Read_timer(); + + put_time( + "rtems_timer_fire_after (active)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TIMER_FIRE_AFTER + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_timer_cancel( Timer_id[ index ] ); + end_time = Read_timer(); + + put_time( + "rtems_timer_cancel (active)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TIMER_CANCEL + ); + + for ( Timer_initialize(), i=0 ; i + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm24/task1.c b/testsuites/tmtests/tm24/task1.c new file mode 100644 index 0000000000..160116ca16 --- /dev/null +++ b/testsuites/tmtests/tm24/task1.c @@ -0,0 +1,124 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_unsigned32 Task_count; + +rtems_task Tasks( + rtems_task_argument argument +); + +rtems_task High_task( + rtems_task_argument argument +); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_id id; + rtems_unsigned32 index; + rtems_status_code status; + + puts( "\n\n*** TIME TEST 24 ***" ); + + status = rtems_task_create( + rtems_build_name( 'H', 'I', 'G', 'H' ), + 10, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create HIGH" ); + + status = rtems_task_start( id, High_task, 0 ); + directive_failed( status, "rtems_task_create HIGH" ); + + for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'R', 'E', 'S', 'T' ), + 128, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create LOOP" ); + + status = rtems_task_start( id, Tasks, 0 ); + directive_failed( status, "rtems_task_start LOOP" ); + } + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_unsigned32 index; + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + end_time = Read_timer(); + + put_time( + "rtems_task_wake_after (no context switch)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_WAKE_AFTER + ); + + Task_count = 0; + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task Tasks( + rtems_task_argument argument +) +{ + Task_count++; + + if ( Task_count == 1 ) + Timer_initialize(); + else if ( Task_count == OPERATION_COUNT ) { + end_time = Read_timer(); + + put_time( + "rtems_task_wake_after (context switch)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_TASK_WAKE_AFTER + ); + + exit( 0 ); + } + (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); +} diff --git a/testsuites/tmtests/tm24/tm24.doc b/testsuites/tmtests/tm24/tm24.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm24/tm24.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm25/system.h b/testsuites/tmtests/tm25/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm25/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm25/task1.c b/testsuites/tmtests/tm25/task1.c new file mode 100644 index 0000000000..1959b668e3 --- /dev/null +++ b/testsuites/tmtests/tm25/task1.c @@ -0,0 +1,108 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Semaphore_id; + +rtems_task High_tasks( + rtems_task_argument argument +); + +rtems_task Low_task( + rtems_task_argument argument +); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_id task_id; + rtems_unsigned32 index; + rtems_status_code status; + + puts( "\n\n*** TIME TEST 25 ***" ); + + status = rtems_semaphore_create( + rtems_build_name( 'S', 'M', '1', ' ') , + 0, + RTEMS_DEFAULT_ATTRIBUTES, + &Semaphore_id + ); + directive_failed( status, "rtems_semaphore_create of SM1" ); + + status = rtems_task_create( + rtems_build_name( 'L', 'O', 'W', ' ' ), + 254, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create LOW" ); + + status = rtems_task_start( task_id, Low_task, 0 ); + directive_failed( status, "rtems_task_start LOW" ); + + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + 128, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create LOOP" ); + + status = rtems_task_start( task_id, High_tasks, 0 ); + directive_failed( status, "rtems_task_start LOOP" ); + } + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task High_tasks( + rtems_task_argument argument +) +{ + (void) rtems_semaphore_obtain( + Semaphore_id, + RTEMS_DEFAULT_OPTIONS, + 0xffffffff + ); +} + +rtems_task Low_task( + rtems_task_argument argument +) +{ + Timer_initialize(); + (void) rtems_clock_tick(); + end_time = Read_timer(); + + put_time( + "rtems_clock_tick", + end_time, + 1, + 0, + CALLING_OVERHEAD_CLOCK_TICK + ); + + exit( 0 ); +} diff --git a/testsuites/tmtests/tm25/tm25.doc b/testsuites/tmtests/tm25/tm25.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm25/tm25.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm26/fptest.h b/testsuites/tmtests/tm26/fptest.h new file mode 100644 index 0000000000..39b8438ef9 --- /dev/null +++ b/testsuites/tmtests/tm26/fptest.h @@ -0,0 +1,165 @@ +/* fptest.h + * + * This include file contains the CPU dependent implementation + * of the following routines needed to test RTEMS floating + * point support: + * FP_load( &context ) + * FP_check( &context ) + * + * FP_load - loads the specified floating point context + * FP_check - checks the specified floating point context + * + * NOTE: These routines are VERY CPU dependent and are thus + * located in in the CPU dependent include file + * fptest.h. These routines form the core of the + * floating point context switch test. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#ifndef __FPTEST_h +#define __FPTEST_h + +#include + +#ifndef CPU_HARDWARE_FP +#error "This CPU does not have CPU_HARDWARE_FP defined" +#endif + +#if ( CPU_HARDWARE_FP == FALSE ) + +#define FP_DECLARE +#define FP_LOAD( _factor ) +#define FP_CHECK( _factor ) 0 + +#else + +#define FP_DECLARE \ + double fp01 = 1.0; \ + double fp02 = 2.0; \ + double fp03 = 3.0; \ + double fp04 = 4.0; \ + double fp05 = 5.0; \ + double fp06 = 6.0; \ + double fp07 = 7.0; \ + double fp08 = 8.0; \ + double fp09 = 9.0; \ + double fp10 = 10.0; \ + double fp11 = 11.0; \ + double fp12 = 12.0; \ + double fp13 = 13.0; \ + double fp14 = 14.0; \ + double fp15 = 15.0; \ + double fp16 = 16.0; \ + double fp17 = 17.0; \ + double fp18 = 18.0; \ + double fp19 = 19.0; \ + double fp20 = 20.0; \ + double fp21 = 21.0; \ + double fp22 = 22.0; \ + double fp23 = 23.0; \ + double fp24 = 24.0; \ + double fp25 = 25.0; \ + double fp26 = 26.0; \ + double fp27 = 27.0; \ + double fp28 = 28.0; \ + double fp29 = 29.0; \ + double fp30 = 30.0; \ + double fp31 = 31.0; \ + double fp32 = 32.0 + +#define FP_LOAD( _factor ) \ + do { \ + fp01 += _factor; \ + fp02 += _factor; \ + fp03 += _factor; \ + fp04 += _factor; \ + fp05 += _factor; \ + fp06 += _factor; \ + fp07 += _factor; \ + fp08 += _factor; \ + fp09 += _factor; \ + fp10 += _factor; \ + fp11 += _factor; \ + fp12 += _factor; \ + fp13 += _factor; \ + fp14 += _factor; \ + fp15 += _factor; \ + fp16 += _factor; \ + fp17 += _factor; \ + fp18 += _factor; \ + fp19 += _factor; \ + fp20 += _factor; \ + fp21 += _factor; \ + fp22 += _factor; \ + fp23 += _factor; \ + fp24 += _factor; \ + fp25 += _factor; \ + fp26 += _factor; \ + fp27 += _factor; \ + fp28 += _factor; \ + fp29 += _factor; \ + fp30 += _factor; \ + fp31 += _factor; \ + fp32 += _factor; \ + } while (0) + +#define EPSILON (0.0005) +#define FPABS(d) (((d) < 0.0) ? -(d) : (d)) +#define FPNEQ(a,b) (FPABS((a)-(b)) > EPSILON) + +#define FP_CHECK_ONE( _v, _base, _factor ) \ + if ( FPNEQ( (_v), ((_base) + (_factor)) ) ) { \ + printf("%d: " #_v " wrong -- (%g not %g)\n", \ + task_index, (_v), (_base + _factor)); \ + } + + +#define FP_CHECK( _factor ) \ + do { \ + FP_CHECK_ONE( fp01, 1.0, (_factor) ); \ + FP_CHECK_ONE( fp02, 2.0, (_factor) ); \ + FP_CHECK_ONE( fp03, 3.0, (_factor) ); \ + FP_CHECK_ONE( fp04, 4.0, (_factor) ); \ + FP_CHECK_ONE( fp05, 5.0, (_factor) ); \ + FP_CHECK_ONE( fp06, 6.0, (_factor) ); \ + FP_CHECK_ONE( fp07, 7.0, (_factor) ); \ + FP_CHECK_ONE( fp08, 8.0, (_factor) ); \ + FP_CHECK_ONE( fp09, 9.0, (_factor) ); \ + FP_CHECK_ONE( fp10, 10.0, (_factor) ); \ + FP_CHECK_ONE( fp11, 11.0, (_factor) ); \ + FP_CHECK_ONE( fp12, 12.0, (_factor) ); \ + FP_CHECK_ONE( fp13, 13.0, (_factor) ); \ + FP_CHECK_ONE( fp14, 14.0, (_factor) ); \ + FP_CHECK_ONE( fp15, 15.0, (_factor) ); \ + FP_CHECK_ONE( fp16, 16.0, (_factor) ); \ + FP_CHECK_ONE( fp17, 17.0, (_factor) ); \ + FP_CHECK_ONE( fp18, 18.0, (_factor) ); \ + FP_CHECK_ONE( fp19, 19.0, (_factor) ); \ + FP_CHECK_ONE( fp20, 20.0, (_factor) ); \ + FP_CHECK_ONE( fp21, 21.0, (_factor) ); \ + FP_CHECK_ONE( fp22, 22.0, (_factor) ); \ + FP_CHECK_ONE( fp23, 23.0, (_factor) ); \ + FP_CHECK_ONE( fp24, 24.0, (_factor) ); \ + FP_CHECK_ONE( fp25, 25.0, (_factor) ); \ + FP_CHECK_ONE( fp26, 26.0, (_factor) ); \ + FP_CHECK_ONE( fp27, 27.0, (_factor) ); \ + FP_CHECK_ONE( fp28, 28.0, (_factor) ); \ + FP_CHECK_ONE( fp29, 29.0, (_factor) ); \ + FP_CHECK_ONE( fp30, 30.0, (_factor) ); \ + FP_CHECK_ONE( fp31, 31.0, (_factor) ); \ + FP_CHECK_ONE( fp32, 32.0, (_factor) ); \ + } while (0) + +#endif + +#endif diff --git a/testsuites/tmtests/tm26/system.h b/testsuites/tmtests/tm26/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm26/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm26/task1.c b/testsuites/tmtests/tm26/task1.c new file mode 100644 index 0000000000..b3544741bc --- /dev/null +++ b/testsuites/tmtests/tm26/task1.c @@ -0,0 +1,470 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "system.h" +#include "fptest.h" +#include "coverhd.h" +#include "tmacros.h" +#include "timesys.h" + +#undef EXTERN +#define EXTERN +#include "gvar.h" +#include "conftbl.h" +#undef EXTERN +#define EXTERN extern + +/* TEST DATA */ +rtems_id Semaphore_id; + +Objects_Locations location; /* uses internal RTEMS type */ + +Thread_Control *Middle_tcb; /* uses internal RTEMS type */ + +rtems_task High_task( + rtems_task_argument argument +); + +rtems_task Middle_task( + rtems_task_argument argument +); + +rtems_task Low_task( + rtems_task_argument argument +); + +rtems_task Floating_point_task_1( + rtems_task_argument argument +); + +rtems_task Floating_point_task_2( + rtems_task_argument argument +); + +void complete_test( void ); + +rtems_task null_task( + rtems_task_argument argument +) +{ +} + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + rtems_id task_id; + rtems_status_code status; + + puts( "\n\n*** TIME TEST 26 ***" ); + + status = rtems_task_create( + rtems_build_name( 'F', 'P', '1', ' ' ), + 201, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_FLOATING_POINT, + &task_id + ); + directive_failed( status, "rtems_task_create of FP1" ); + + status = rtems_task_start( task_id, Floating_point_task_1, 0 ); + directive_failed( status, "rtems_task_start of FP1" ); + + status = rtems_task_create( + rtems_build_name( 'F', 'P', '2', ' ' ), + 202, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_FLOATING_POINT, + &task_id + ); + directive_failed( status, "rtems_task_create of FP2" ); + + status = rtems_task_start( task_id, Floating_point_task_2, 0 ); + directive_failed( status, "rtems_task_start of FP2" ); + + status = rtems_task_create( + rtems_build_name( 'L', 'O', 'W', ' ' ), + 200, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create of LOW" ); + + status = rtems_task_start( task_id, Low_task, 0 ); + directive_failed( status, "rtems_task_start of LOW" ); + + status = rtems_task_create( + rtems_build_name( 'M', 'I', 'D', ' ' ), + 128, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create of MIDDLE" ); + + status = rtems_task_start( task_id, Middle_task, 0 ); + directive_failed( status, "rtems_task_start of MIDDLE" ); + + status = rtems_task_create( + rtems_build_name( 'H', 'I', 'G', 'H' ), + 5, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create of HIGH" ); + + status = rtems_task_start( task_id, High_task, 0 ); + directive_failed( status, "rtems_task_start of HIGH" ); + + status = rtems_semaphore_create( + rtems_build_name( 'S', 'E', 'M', '1' ), + OPERATION_COUNT, + RTEMS_DEFAULT_ATTRIBUTES, + &Semaphore_id + ); + directive_failed( status, "rtems_semaphore_create" ); + + for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'N', 'U', 'L', 'L' ), + 254, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create LOOP" ); + + status = rtems_task_start( task_id, null_task, 0 ); + directive_failed( status, "rtems_task_start LOOP" ); + } + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task High_task( + rtems_task_argument argument +) +{ + Timer_initialize(); + _Thread_Disable_dispatch(); + end_time = Read_timer(); + + put_time( + "THREAD_DISABLE_DISPATCH", + end_time, + 1, + 0, + 0 + ); + + + Timer_initialize(); + _Thread_Enable_dispatch(); + end_time = Read_timer(); + + put_time( + "THREAD_ENABLE_DISPATCH", + end_time, + 1, + 0, + 0 + ); + + Timer_initialize(); + _Thread_Set_state( _Thread_Executing, STATES_SUSPENDED ); + end_time = Read_timer(); + + put_time( + "THREAD_SET_STATE", + end_time, + 1, + 0, + 0 + ); + + _Context_Switch_necessary = TRUE; + + Timer_initialize(); + _Thread_Dispatch(); /* dispatches Middle_task */ +} + +rtems_task Middle_task( + rtems_task_argument argument +) +{ + end_time = Read_timer(); + + put_time( + "THREAD_DISPATCH (NO FP)", + end_time, + 1, + 0, + 0 + ); + + _Thread_Set_state( _Thread_Executing, STATES_SUSPENDED ); + + Middle_tcb = _Thread_Executing; + + _Thread_Executing = + (Thread_Control *) _Thread_Ready_chain[200].first; + + /* do not force context switch */ + + _Context_Switch_necessary = FALSE; + + Timer_initialize(); + _Context_Switch( &Middle_tcb->Registers, &_Thread_Executing->Registers ); +} + +rtems_task Low_task( + rtems_task_argument argument +) +{ + Thread_Control *executing; + + end_time = Read_timer(); + + put_time( + "CONTEXT_SWITCH (NO FP)", + end_time, + 1, + 0, + 0 + ); + + executing = _Thread_Executing; + + _Thread_Executing = + (Thread_Control *) _Thread_Ready_chain[201].first; + + /* do not force context switch */ + + _Context_Switch_necessary = FALSE; + + Timer_initialize(); + _Context_Restore_fp( &_Thread_Executing->fp_context ); + _Context_Switch( &executing->Registers, &_Thread_Executing->Registers ); +} + +rtems_task Floating_point_task_1( + rtems_task_argument argument +) +{ + Thread_Control *executing; + FP_DECLARE; + + end_time = Read_timer(); + + put_time( + "CONTEXT_SWITCH (restore 1st FP)", + end_time, + 1, + 0, + 0 + ); + + executing = _Thread_Executing; + + _Thread_Executing = + (Thread_Control *) _Thread_Ready_chain[202].first; + + /* do not force context switch */ + + _Context_Switch_necessary = FALSE; + + Timer_initialize(); + _Context_Save_fp( &executing->fp_context ); + _Context_Restore_fp( &_Thread_Executing->fp_context ); + _Context_Switch( &executing->Registers, &_Thread_Executing->Registers ); + /* switch to Floating_point_task_2 */ + + end_time = Read_timer(); + + put_time( + "CONTEXT_SWITCH (used->init FP)", + end_time, + 1, + 0, + 0 + ); + + FP_LOAD( 1.0 ); + + executing = _Thread_Executing; + + _Thread_Executing = + (Thread_Control *) _Thread_Ready_chain[202].first; + + /* do not force context switch */ + + _Context_Switch_necessary = FALSE; + + Timer_initialize(); + _Context_Save_fp( &executing->fp_context ); + _Context_Restore_fp( &_Thread_Executing->fp_context ); + _Context_Switch( &executing->Registers, &_Thread_Executing->Registers ); + /* switch to Floating_point_task_2 */ +} + +rtems_task Floating_point_task_2( + rtems_task_argument argument +) +{ + Thread_Control *executing; + FP_DECLARE; + + end_time = Read_timer(); + + put_time( + "CONTEXT_SWITCH (init->init FP)", + end_time, + 1, + 0, + 0 + ); + + executing = _Thread_Executing; + + _Thread_Executing = + (Thread_Control *) _Thread_Ready_chain[201].first; + + FP_LOAD( 1.0 ); + + /* do not force context switch */ + + _Context_Switch_necessary = FALSE; + + Timer_initialize(); + _Context_Save_fp( &executing->fp_context ); + _Context_Restore_fp( &_Thread_Executing->fp_context ); + _Context_Switch( &executing->Registers, &_Thread_Executing->Registers ); + /* switch to Floating_point_task_1 */ + + end_time = Read_timer(); + + put_time( + "CONTEXT_SWITCH (used->used FP)", + end_time, + 1, + 0, + 0 + ); + + complete_test(); +} + +void complete_test( void ) +{ + rtems_unsigned32 index; + rtems_id task_id; + + Timer_initialize(); + _Thread_Resume( Middle_tcb ); + end_time = Read_timer(); + + put_time( + "THREAD_RESUME", + end_time, + 1, + 0, + 0 + ); + + _Thread_Set_state( Middle_tcb, STATES_WAITING_FOR_MESSAGE ); + + Timer_initialize(); + _Thread_Unblock( Middle_tcb ); + end_time = Read_timer(); + + put_time( + "THREAD_UNBLOCK", + end_time, + 1, + 0, + 0 + ); + + _Thread_Set_state( Middle_tcb, STATES_WAITING_FOR_MESSAGE ); + + Timer_initialize(); + _Thread_Ready( Middle_tcb ); + end_time = Read_timer(); + + put_time( + "THREAD_READY", + end_time, + 1, + 0, + 0 + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + task_id = Middle_tcb->Object.id; + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) _Thread_Get( task_id, &location ); + end_time = Read_timer(); + + put_time( + "THREAD_GET", + end_time, + OPERATION_COUNT, + 0, + 0 + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) _Semaphore_Get( Semaphore_id, &location ); + end_time = Read_timer(); + + put_time( + "SEMAPHORE_GET", + end_time, + OPERATION_COUNT, + 0, + 0 + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) _Thread_Get( 0x3, &location ); + end_time = Read_timer(); + + put_time( + "THREAD_GET invalid id", + end_time, + OPERATION_COUNT, + 0, + 0 + ); + exit( 0 ); +} + diff --git a/testsuites/tmtests/tm26/tm26.doc b/testsuites/tmtests/tm26/tm26.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm26/tm26.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm27/system.h b/testsuites/tmtests/tm27/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm27/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm27/task1.c b/testsuites/tmtests/tm27/task1.c new file mode 100644 index 0000000000..edd657b40c --- /dev/null +++ b/testsuites/tmtests/tm27/task1.c @@ -0,0 +1,237 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +#include + +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Task_2( + rtems_task_argument argument +); + +volatile rtems_unsigned32 Interrupt_occurred; +volatile rtems_unsigned32 Interrupt_enter_time, Interrupt_enter_nested_time; +volatile rtems_unsigned32 Interrupt_return_time, Interrupt_return_nested_time; +rtems_unsigned32 Interrupt_nest; + +rtems_isr Isr_handler( + rtems_vector_number vector +); + +/* + * INTERNAL RTEMS VARIABLES!!! + */ + +extern rtems_unsigned32 _Thread_Dispatch_disable_level; +extern rtems_unsigned32 _Context_Switch_necessary; +extern Chain_Control *_Thread_Ready_chain; +extern rtems_tcb *_Thread_Heir; + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 27 ***" ); + + status = rtems_task_create( + rtems_build_name( 'T', 'A', '1', ' ' ), + 254, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create Task_1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start Task_1" ); + + status = rtems_task_create( + rtems_build_name( 'T', 'A', '2', ' ' ), + 254, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of Task_2" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of Task_2" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task Task_1( + rtems_task_argument argument +) +{ + _Thread_Dispatch_disable_level = 1; + + Interrupt_nest = 1; + + Install_tm27_vector( Isr_handler ); + + Interrupt_occurred = 0; + Timer_initialize(); + Cause_tm27_intr(); + /* goes to Isr_handler */ + +#if (MUST_WAIT_FOR_INTERRUPT == 1) + while ( Interrupt_occurred == 0 ); +#endif + Interrupt_return_time = Read_timer(); + + put_time( + "INTERRUPT_ENTER (nested interrupt)", + Interrupt_enter_nested_time, + 1, + 0, + 0 + ); + + put_time( + "INTERRUPT_RETURN (nested interrupt)", + Interrupt_return_nested_time, + 1, + 0, + 0 + ); + + Interrupt_nest = 0; + + _Thread_Dispatch_disable_level = 0; + + Interrupt_occurred = 0; + Timer_initialize(); + Cause_tm27_intr(); + /* goes to Isr_handler */ + +#if (MUST_WAIT_FOR_INTERRUPT == 1) + while ( Interrupt_occurred == 0 ); +#endif + Interrupt_return_time = Read_timer(); + + put_time( + "INTERRUPT_ENTER (no preempt)", + Interrupt_enter_time, + 1, + 0, + 0 + ); + + put_time( + "INTERRUPT_RETURN (no preempt)", + Interrupt_return_time, + 1, + 0, + 0 + ); + + _Thread_Dispatch_disable_level = 0; + + _Thread_Heir = (rtems_tcb *) _Thread_Ready_chain[254].last; + + _Context_Switch_necessary = 1; + + Interrupt_occurred = 0; + Timer_initialize(); + Cause_tm27_intr(); + /* goes to Isr_handler */ +} + +rtems_task Task_2( + rtems_task_argument argument +) +{ +#if (MUST_WAIT_FOR_INTERRUPT == 1) + while ( Interrupt_occurred == 0 ); +#endif + end_time = Read_timer(); + + put_time( + "INTERRUPT_ENTER (preempt)", + Interrupt_enter_time, + 1, + 0, + 0 + ); + + put_time( + "INTERRUPT_RETURN (preempt)", + end_time, + 1, + 0, + 0 + ); + + exit( 0 ); +} + +/* The Isr_handler() and Isr_handler_inner() routines are structured + * so that there will be as little entry overhead as possible included + * in the interrupt entry time. + */ + +void Isr_handler_inner( void ); + +rtems_isr Isr_handler( + rtems_vector_number vector +) +{ + end_time = Read_timer(); + + Interrupt_occurred = 1; + Isr_handler_inner(); +} + +void Isr_handler_inner( void ) +{ + + /*enable_tracing();*/ + Clear_tm27_intr(); + switch ( Interrupt_nest ) { + case 0: + Interrupt_enter_time = end_time; + break; + case 1: + Interrupt_enter_time = end_time; + Interrupt_nest = 2; + Interrupt_occurred = 0; + Lower_tm27_intr(); + Timer_initialize(); + Cause_tm27_intr(); + /* goes to a nested copy of Isr_handler */ +#if (MUST_WAIT_FOR_INTERRUPT == 1) + while ( Interrupt_occurred == 0 ); +#endif + Interrupt_return_nested_time = Read_timer(); + break; + case 2: + Interrupt_enter_nested_time = end_time; + break; + } + + Timer_initialize(); +} diff --git a/testsuites/tmtests/tm27/tm27.doc b/testsuites/tmtests/tm27/tm27.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm27/tm27.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm28/system.h b/testsuites/tmtests/tm28/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm28/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm28/task1.c b/testsuites/tmtests/tm28/task1.c new file mode 100644 index 0000000000..c6af6fb03f --- /dev/null +++ b/testsuites/tmtests/tm28/task1.c @@ -0,0 +1,134 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_id Port_id; + +rtems_unsigned8 Internal_area[ 256 ]; +rtems_unsigned8 External_area[ 256 ]; + +rtems_task Test_task( + rtems_task_argument argument +); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TIME TEST 28 ***" ); + + status = rtems_task_create( + rtems_build_name( 'T', 'I', 'M', 'E' ), + 128, + 4096, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create" ); + + status = rtems_task_start( Task_id[ 1 ], Test_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task Test_task ( + rtems_task_argument argument +) +{ + rtems_name name; + rtems_unsigned32 index; + void *converted; + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + name = rtems_build_name( 'P', 'O', 'R', 'T' ), + + Timer_initialize(); + rtems_port_create( + name, + Internal_area, + External_area, + 0xff, + &Port_id + ); + end_time = Read_timer(); + + put_time( + "rtems_port_create", + end_time, + 1, + 0, + CALLING_OVERHEAD_PORT_CREATE + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_port_external_to_internal( + Port_id, + &External_area[ 0xf ], + &converted + ); + end_time = Read_timer(); + + put_time( + "rtems_port_external_to_internal", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL + ); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_port_internal_to_external( + Port_id, + &Internal_area[ 0xf ], + &converted + ); + end_time = Read_timer(); + + put_time( + "rtems_port_internal_to_external", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL + ); + + Timer_initialize(); + rtems_port_delete( Port_id ); + end_time = Read_timer(); + + put_time( + "rtems_port_delete", + end_time, + 1, + 0, + CALLING_OVERHEAD_PORT_DELETE + ); + + exit( 0 ); +} diff --git a/testsuites/tmtests/tm28/tm28.doc b/testsuites/tmtests/tm28/tm28.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm28/tm28.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tm29/system.h b/testsuites/tmtests/tm29/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tm29/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tm29/task1.c b/testsuites/tmtests/tm29/task1.c new file mode 100644 index 0000000000..a38e9567c8 --- /dev/null +++ b/testsuites/tmtests/tm29/task1.c @@ -0,0 +1,207 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_name Period_name; + +rtems_task Tasks( + rtems_task_argument argument +); + +rtems_task Low_task( + rtems_task_argument argument +); + +rtems_unsigned32 Task_count; + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_id id; + rtems_unsigned32 index; + rtems_status_code status; + + puts( "\n\n*** TIME TEST 29 ***" ); + + Period_name = rtems_build_name( 'P', 'R', 'D', ' ' ); + + Timer_initialize(); + (void) rtems_rate_monotonic_create( Period_name, &id ); + end_time = Read_timer(); + + put_time( + "rtems_rate_monotonic_create", + end_time, + 1, + 0, + CALLING_OVERHEAD_RATE_MONOTONIC_CREATE + ); + + Timer_initialize(); + (void) rtems_rate_monotonic_period( id, 10 ); + end_time = Read_timer(); + + put_time( + "rtems_rate_monotonic_period (initial)", + end_time, + 1, + 0, + CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD + ); + + Timer_initialize(); + (void) rtems_rate_monotonic_period( id, RTEMS_PERIOD_STATUS ); + end_time = Read_timer(); + + put_time( + "rtems_rate_monotonic_period (STATUS)", + end_time, + 1, + 0, + CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD + ); + + Timer_initialize(); + (void) rtems_rate_monotonic_cancel( id ); + end_time = Read_timer(); + + put_time( + "rtems_rate_monotonic_cancel", + end_time, + 1, + 0, + CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL + ); + + Timer_initialize(); + (void) rtems_rate_monotonic_delete( id ); + end_time = Read_timer(); + + put_time( + "rtems_rate_monotonic_delete (cancelled)", + end_time, + 1, + 0, + CALLING_OVERHEAD_RATE_MONOTONIC_DELETE + ); + + status = rtems_rate_monotonic_create( Period_name, &id ); + directive_failed( status, "rtems_rate_monotonic_create" ); + + status = rtems_rate_monotonic_period( id, 10 ); + directive_failed( status, "rtems_rate_monotonic_period" ); + + Timer_initialize(); + rtems_rate_monotonic_delete( id ); + end_time = Read_timer(); + + put_time( + "rtems_rate_monotonic_delete (active)", + end_time, + 1, + 0, + CALLING_OVERHEAD_RATE_MONOTONIC_DELETE + ); + + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'E', 'S', 'T' ), + 128, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create LOOP" ); + + status = rtems_task_start( id, Tasks, 0 ); + directive_failed( status, "rtems_task_start LOOP" ); + } + + status = rtems_task_create( + rtems_build_name( 'L', 'O', 'W', ' ' ), + 200, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create LOW" ); + + status = rtems_task_start( id, Low_task, 0 ); + directive_failed( status, "rtems_task_start LOW" ); + + Task_count = 0; + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task Tasks( + rtems_task_argument argument +) +{ + rtems_id id; + rtems_status_code status; + + status = rtems_rate_monotonic_create( 1, &id ); + directive_failed( status, "rtems_rate_monotonic_create" ); + + status = rtems_rate_monotonic_period( id, 100 ); + directive_failed( status, "rtems_rate_monotonic_period" ); + + /* + * Give up the processor to allow all tasks to actually + * create and start their period timer before the benchmark + * timer is initialized. + */ + + (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + + Task_count++; + + if ( Task_count == 1 ) + Timer_initialize(); + + (void) rtems_rate_monotonic_period( id, 100 ); +} + +rtems_task Low_task( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + + end_time = Read_timer(); + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) Empty_function(); + overhead = Read_timer(); + + put_time( + "rtems_rate_monotonic_period (blocking)", + end_time, + OPERATION_COUNT, + overhead, + CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD + ); + + exit( 0 ); +} diff --git a/testsuites/tmtests/tm29/tm29.doc b/testsuites/tmtests/tm29/tm29.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tm29/tm29.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + diff --git a/testsuites/tmtests/tmck/system.h b/testsuites/tmtests/tmck/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tmck/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tmck/task1.c b/testsuites/tmtests/tmck/task1.c new file mode 100644 index 0000000000..c151475505 --- /dev/null +++ b/testsuites/tmtests/tmck/task1.c @@ -0,0 +1,180 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +#define MAXIMUM_DISTRIBUTION 10000 + +#undef OPERATION_COUNT +#define OPERATION_COUNT 100000 + +int Distribution[ MAXIMUM_DISTRIBUTION + 1 ]; + +rtems_task Task_1( + rtems_task_argument argument +); + +void check_read_timer( void ); + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_id id; + rtems_status_code status; + + /* + * Tell the Timer Driver what we are doing + */ + + Set_find_average_overhead( 1 ); + + puts( "\n\n*** TIME CHECKER ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ), + + status = rtems_task_create( + 1, + 5, + 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( id, Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + + check_read_timer(); +pause(); + + Timer_initialize(); + end_time = Read_timer(); + + put_time( + "NULL timer stopped at", + end_time, + 1, + 0, + 0 + ); + + Timer_initialize(); + for ( index = 1 ; index <= 1000 ; index++ ) + (void) Empty_function(); + end_time = Read_timer(); + + put_time( + "LOOP (1000) timer stopped at", + end_time, + 1, + 0, + 0 + ); + + Timer_initialize(); + for ( index = 1 ; index <= 10000 ; index++ ) + (void) Empty_function(); + end_time = Read_timer(); + + put_time( + "LOOP (10000) timer stopped at", + end_time, + 1, + 0, + 0 + ); + + Timer_initialize(); + for ( index = 1 ; index <= 50000 ; index++ ) + (void) Empty_function(); + end_time = Read_timer(); + + put_time( + "LOOP (50000) timer stopped at", + end_time, + 1, + 0, + 0 + ); + + Timer_initialize(); + for ( index = 1 ; index <= 100000 ; index++ ) + (void) Empty_function(); + end_time = Read_timer(); + + put_time( + "LOOP (100000) timer stopped at", + end_time, + 1, + 0, + 0 + ); + + exit( 0 ); +} + +void check_read_timer() +{ + rtems_unsigned32 index; + rtems_unsigned32 time; + + for ( index = 1 ; index <= MAXIMUM_DISTRIBUTION ; index++ ) + Distribution[ index ] = 0; + + for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) { + Timer_initialize(); + end_time = Read_timer(); + if ( end_time > MAXIMUM_DISTRIBUTION ) { + /* + * Under UNIX a simple process swap takes longer than we + * consider valid for our testing purposes. + */ + printf( "TOO LONG (%d) at %d!!!\n", end_time, index ); +#if defined(unix) + index--; + continue; +#else + exit( 1 ); +#endif + } + else + Distribution[ end_time ]++; + } + + printf( "Units may not be in microseconds for this test!!!\n" ); + time = 0; + for ( index = 0 ; index <= MAXIMUM_DISTRIBUTION ; index++ ) { + time += (Distribution[ index ] * index); + if ( Distribution[ index ] != 0 ) + printf( "%d %d\n", index, Distribution[ index ] ); + } + printf( "Total time = %d\n", time ); + printf( "Average time = %d\n", time / OPERATION_COUNT ); +} diff --git a/testsuites/tmtests/tmck/tmck.doc b/testsuites/tmtests/tmck/tmck.doc new file mode 100644 index 0000000000..9ef6a57d99 --- /dev/null +++ b/testsuites/tmtests/tmck/tmck.doc @@ -0,0 +1,20 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives timed by this test. + +benchmark name: timecheck + +This becnchmark is used to calibrate the timer. It is only used to +when initial timing begins on a particular processor board. + diff --git a/testsuites/tmtests/tmoverhd/dumrtems.h b/testsuites/tmtests/tmoverhd/dumrtems.h new file mode 100644 index 0000000000..d0492c1014 --- /dev/null +++ b/testsuites/tmtests/tmoverhd/dumrtems.h @@ -0,0 +1,255 @@ +/* dumrtems.h + * + * This include file contains phony macros to map + * executive calls to Empty_directive(). + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __DUMRTEMS_h +#define __DUMRTEMS_h + +/* RTEMS call redefinition macros */ + +#undef rtems_signal_catch +#undef rtems_signal_send +#undef rtems_io_close +#undef rtems_io_control +#undef rtems_io_initialize +#undef rtems_io_open +#undef rtems_io_read +#undef rtems_io_write +#undef rtems_port_internal_to_external +#undef rtems_port_external_to_internal +#undef rtems_port_create +#undef rtems_port_delete +#undef rtems_port_ident +#undef rtems_event_receive +#undef rtems_event_send +#undef rtems_initialize_executive +#undef rtems_shutdown_executive +#undef rtems_interrupt_catch +#undef rtems_partition_create +#undef rtems_partition_delete +#undef rtems_partition_get_buffer +#undef rtems_partition_ident +#undef rtems_partition_return_buffer +#undef rtems_message_queue_broadcast +#undef rtems_message_queue_create +#undef rtems_message_queue_delete +#undef rtems_message_queue_flush +#undef rtems_message_queue_ident +#undef rtems_message_queue_receive +#undef rtems_message_queue_send +#undef rtems_message_queue_urgent +#undef rtems_region_create +#undef rtems_region_delete +#undef rtems_region_get_segment +#undef rtems_region_ident +#undef rtems_region_return_segment +#undef rtems_semaphore_create +#undef rtems_semaphore_delete +#undef rtems_semaphore_ident +#undef rtems_semaphore_obtain +#undef rtems_semaphore_release +#undef rtems_task_create +#undef rtems_task_delete +#undef rtems_task_get_note +#undef rtems_task_ident +#undef rtems_task_mode +#undef rtems_task_restart +#undef rtems_task_resume +#undef rtems_task_set_note +#undef rtems_task_set_priority +#undef rtems_task_start +#undef rtems_task_suspend +#undef rtems_clock_get +#undef rtems_clock_set +#undef rtems_clock_tick +#undef rtems_task_wake_after +#undef rtems_task_wake_when +#undef rtems_fatal_error_occurred +#undef rtems_rate_monotonic_create +#undef rtems_rate_monotonic_ident +#undef rtems_rate_monotonic_delete +#undef rtems_rate_monotonic_cancel +#undef rtems_rate_monotonic_period +#undef rtems_multiprocessing_announce +#undef rtems_timer_create +#undef rtems_timer_ident +#undef rtems_timer_delete +#undef rtems_timer_cancel +#undef rtems_timer_fire_after +#undef rtems_timer_fire_when +#undef rtems_timer_reset + +#define rtems_signal_catch( asraddr, mode ) \ + Empty_directive( asraddr, mode ) +#define rtems_signal_send( tid, signal ) \ + Empty_directive( tid, signal ) + +#define rtems_io_close( major, minor, argp, rval ) \ + Empty_directive( major, minor, argp, rval ) +#define rtems_io_control( major, minor, argp, rval ) \ + Empty_directive( major, minor, argp, rval ) +#define rtems_io_initialize( major, minor, argp, rval ) \ + Empty_directive( major, minor, argp, rval ) +#define rtems_io_open( major, minor, argp, rval ) \ + Empty_directive( major, minor, argp, rval ) +#define rtems_io_read( major, minor, argp, rval ) \ + Empty_directive( major, minor, argp, rval ) +#define rtems_io_write( major, minor, argp, rval ) \ + Empty_directive( major, minor, argp, rval ) + +#define rtems_port_internal_to_external( dpid, internal, external ) \ + Empty_directive( dpid, internal, external ) +#define rtems_port_external_to_internal( dpid, external, internal ) \ + Empty_directive( dpid, external, internal ) +#define rtems_port_create( name, intaddr, extaddr, length, dpid ) \ + Empty_directive( name, intaddr, extaddr, length, dpid ) +#define rtems_port_delete( dpid ) \ + Empty_directive( dpid ) +#define rtems_port_ident( name, dpid ) \ + Empty_directive( name, dpid ) + +#define rtems_event_receive( eventin, options, timeout, eventout ) \ + Empty_directive( eventin, options, timeout, eventout ) +#define rtems_event_send( tid, event ) \ + Empty_directive( tid, event ) + +#define rtems_initialize_executive( conftbl, cputbl ) \ + Empty_directive( conftbl, cputbl ) +#define rtems_shutdown_executive( the_error ) \ + Empty_directive( the_error ) + +#define rtems_interrupt_catch( israddr, vector, oldisr ) \ + Empty_directive( israddr, vector, oldisr ) + +#define rtems_partition_create( name, paddr, length, bsize, attr, ptid ) \ + Empty_directive( name, paddr, length, bsize, attr, ptid ) +#define rtems_partition_delete( ptid ) \ + Empty_directive( ptid ) +#define rtems_partition_get_buffer( ptid, bufaddr ) \ + Empty_directive( ptid, bufaddr ) +#define rtems_partition_ident( name, node, ptid ) \ + Empty_directive( name, node, ptid ) +#define rtems_partition_return_buffer( ptid, bufaddr ) \ + Empty_directive( ptid, bufaddr ) + +#define rtems_message_queue_broadcast( qid, buffer, count ) \ + Empty_directive( qid, buffer, count ) +#define rtems_message_queue_create( name, count, attr, qid ) \ + Empty_directive( name, count, attr, qid ) +#define rtems_message_queue_delete( qid ) \ + Empty_directive( qid ) +#define rtems_message_queue_flush( qid, count ) \ + Empty_directive( qid, count ) +#define rtems_message_queue_ident( name, node, qid ) \ + Empty_directive( name, node, qid ) +#define rtems_message_queue_receive( qid, buffer, options, timeout ) \ + Empty_directive( qid, buffer, options, timeout ) +#define rtems_message_queue_send( qid, buffer ) \ + Empty_directive( qid, buffer ) +#define rtems_message_queue_urgent( qid, buffer ) \ + Empty_directive( qid, buffer ) + +#define rtems_region_create( name, paddr, length, pagesize, attr, rnid ) \ + Empty_directive( name, paddr, length, pagesize, attr, rnid ) +#define rtems_region_delete( rnid ) \ + Empty_directive( rnid ) +#define rtems_region_get_segment( rnid, size, options, timeout, segaddr ) \ + Empty_directive( rnid, size, options, timeout, segaddr ) +#define rtems_region_ident( name, rnid ) \ + Empty_directive( name, rnid ) +#define rtems_region_return_segment( rnid, segaddr ) \ + Empty_directive( rnid, segaddr ) + +#define rtems_semaphore_create( name, count, attr, smid ) \ + Empty_directive( name, count, attr, smid ) +#define rtems_semaphore_delete( smid ) \ + Empty_directive( smid ) +#define rtems_semaphore_ident( name, node, smid ) \ + Empty_directive( name, node, smid ) +#define rtems_semaphore_obtain( smid, options, timeout ) \ + Empty_directive( smid, options, timeout ) +#define rtems_semaphore_release( smid ) \ + Empty_directive( smid ) + +#define rtems_task_create( name, priority, stack_size, mode, attr, tid ) \ + Empty_directive( name, priority, stack_size, mode, attr, tid ) +#define rtems_task_delete( tid ) \ + Empty_directive( tid ) +#define rtems_task_get_note( tid, notepad, note ) \ + Empty_directive( tid, notepad, note ) +#define rtems_task_ident( name, node, tid ) \ + Empty_directive( name, node, tid ) +#define rtems_task_mode( mode, mask, pmode ) \ + Empty_directive( mode, mask, pmode ) +#define rtems_task_restart( tid, arg ) \ + Empty_directive( tid, arg ) +#define rtems_task_resume( tid ) \ + Empty_directive( tid ) +#define rtems_task_set_note( tid, notepad, note ) \ + Empty_directive( tid, notepad, note ) +#define rtems_task_set_priority( tid, priority, ppriority ) \ + Empty_directive( tid, priority, ppriority ) +#define rtems_task_start( tid, saddr, arg ) \ + Empty_directive( tid, saddr, arg ) +#define rtems_task_suspend( tid ) \ + Empty_directive( tid ) + +#define rtems_clock_get( options, time ) \ + Empty_directive( options, time ) +#define rtems_clock_set( time ) \ + Empty_directive( time ) +#define rtems_clock_tick() \ + Empty_directive() +#define rtems_task_wake_after( ticks ) \ + Empty_directive( ticks ) +#define rtems_task_wake_when( time ) \ + Empty_directive( time ) + +#define rtems_fatal_error_occurred( errcode ) \ + Empty_directive( errcode ) + +#define rtems_rate_monotonic_create( name, id ) \ + Empty_directive( name, id ) +#define rtems_rate_monotonic_ident( name, id ) \ + Empty_directive( name, id ) +#define rtems_rate_monotonic_delete( id ) \ + Empty_directive( id ) +#define rtems_rate_monotonic_cancel( id ) \ + Empty_directive( id ) +#define rtems_rate_monotonic_period( id, period ) \ + Empty_directive( id, period ) + +#define rtems_multiprocessing_announce() \ + Empty_directive() + +#define rtems_timer_create( name, tmid ) \ + Empty_directive( name, tmid ) +#define rtems_timer_delete( tmid ) \ + Empty_directive( tmid ) +#define rtems_timer_cancel( tmid ) \ + Empty_directive( tmid ) +#define rtems_timer_ident( name, tmid ) \ + Empty_directive( name, tmid ) +#define rtems_timer_fire_after( tmid, ticks, routine, user_data ) \ + Empty_directive( tmid, ticks, routine, user_data ) +#define rtems_timer_fire_when( tmid, time, routine, user_data ) \ + Empty_directive( tmid, time, routine, user_data ) +#define rtems_timer_reset( tmid ) \ + Empty_directive( tmid ) + +rtems_status_code Empty_directive(); + +#endif +/* end of include file */ diff --git a/testsuites/tmtests/tmoverhd/empty.c b/testsuites/tmtests/tmoverhd/empty.c new file mode 100644 index 0000000000..dcfa33d1ed --- /dev/null +++ b/testsuites/tmtests/tmoverhd/empty.c @@ -0,0 +1,41 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_timer_service_routine Timer_handler( + rtems_id argument +) +{ +} + +rtems_asr Isr_handler( + rtems_signal_set signals +) +{ +} + +rtems_asr Asr_handler( + rtems_signal_set signals +) +{ +} + +rtems_task task_func() {} + +void null_func() {} + +rtems_status_code Empty_directive() +{ + return( RTEMS_SUCCESSFUL ); +} diff --git a/testsuites/tmtests/tmoverhd/system.h b/testsuites/tmtests/tmoverhd/system.h new file mode 100644 index 0000000000..9133506e7f --- /dev/null +++ b/testsuites/tmtests/tmoverhd/system.h @@ -0,0 +1,23 @@ +/* system.h + * + * This include file is used by all tests in the Time Suite. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include + +#include "coverhd.h" +#include "tmacros.h" + +#include "timesys.h" +#include "timegvar.h" diff --git a/testsuites/tmtests/tmoverhd/testtask.c b/testsuites/tmtests/tmoverhd/testtask.c new file mode 100644 index 0000000000..0586f39a35 --- /dev/null +++ b/testsuites/tmtests/tmoverhd/testtask.c @@ -0,0 +1,1279 @@ +/* + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_unsigned8 Memory_area[ 2048 ]; +rtems_unsigned8 Internal_port_area[ 256 ]; +rtems_unsigned8 External_port_area[ 256 ]; + +rtems_task Task_1( + rtems_task_argument argument +); + +rtems_task Init( + rtems_task_argument argument +) +{ rtems_id id; + rtems_status_code status; + + Set_find_average_overhead( TRUE ); + + puts( "\n\n*** TIME TEST overhead ***" ); + + status = rtems_task_create( + rtems_build_name( 'T', 'A', '1', ' ' ), + 254, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( id, Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} + +/* comment out the following include to verify type are correct */ +#include "dumrtems.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_name name; + rtems_unsigned32 index; + rtems_cpu_table cpu_table; + rtems_id id; + rtems_task_priority in_priority; + rtems_task_priority out_priority; + rtems_mode in_mode; + rtems_mode mask; + rtems_mode out_mode; + rtems_unsigned32 note; + rtems_time_of_day time; + rtems_interval timeout; + rtems_signal_set signals; + void *address_1; + rtems_event_set events; + long buffer[ 4 ]; + rtems_unsigned32 count; + rtems_device_major_number major; + rtems_device_minor_number minor; + rtems_unsigned32 io_result; + rtems_unsigned32 error; + rtems_clock_get_options options; + + name = rtems_build_name( 'N', 'A', 'M', 'E' ); + in_priority = 250; + in_mode = RTEMS_NO_PREEMPT; + mask = RTEMS_PREEMPT_MASK; + note = 8; + timeout = 100; + signals = RTEMS_SIGNAL_1 | RTEMS_SIGNAL_3; + major = 10; + minor = 0; + error = 100; + options = 0; + +/* rtems_initialize_executive */ + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_initialize_executive( &BSP_Configuration, &cpu_table ); + end_time = Read_timer(); + + put_time( + "rtems_initialize_executive", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_shutdown_executive */ + + Timer_initialize(); + for ( index=1 ; index <= OPERATION_COUNT ; index++ ) + (void) rtems_shutdown_executive( error ); + end_time = Read_timer(); + + put_time( + "rtems_shutdown_executive", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_task_create */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_task_create( + name, + in_priority, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + end_time = Read_timer(); + + put_time( + "rtems_task_create", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_task_ident */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_task_ident( name, RTEMS_SEARCH_ALL_NODES, id ); + end_time = Read_timer(); + + put_time( + "rtems_task_ident", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_task_start */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_task_start( id, Task_1, 0 ); + end_time = Read_timer(); + + put_time( + "rtems_task_start", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_task_restart */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_task_restart( id, 0 ); + end_time = Read_timer(); + + put_time( + "rtems_task_restart", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_task_delete */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_task_delete( id ); + end_time = Read_timer(); + + put_time( + "rtems_task_delete", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_task_suspend */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_task_suspend( id ); + end_time = Read_timer(); + + put_time( + "rtems_task_suspend", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_task_resume */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_task_resume( id ); + end_time = Read_timer(); + + put_time( + "rtems_task_resume", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_task_set_priority */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_task_set_priority( id, in_priority, &out_priority ); + end_time = Read_timer(); + + put_time( + "rtems_task_set_priority", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_task_mode */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_task_mode( in_mode, mask, &out_mode ); + end_time = Read_timer(); + + put_time( + "rtems_task_mode", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_task_get_note */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_task_get_note( id, 1, note ); + end_time = Read_timer(); + + put_time( + "rtems_task_get_note", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_task_set_note */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_task_set_note( id, 1, note ); + end_time = Read_timer(); + + put_time( + "rtems_task_set_note", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_task_wake_when */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_task_wake_when( time ); + end_time = Read_timer(); + + put_time( + "rtems_task_wake_when", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_task_wake_after */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_task_wake_after( timeout ); + end_time = Read_timer(); + + put_time( + "rtems_task_wake_after", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_interrupt_catch */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_interrupt_catch( Isr_handler, 5, address_1 ); + end_time = Read_timer(); + + put_time( + "rtems_interrupt_catch", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_clock_get */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_clock_get( options, time ); + end_time = Read_timer(); + + put_time( + "rtems_clock_get", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_clock_set */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_clock_set( time ); + end_time = Read_timer(); + + put_time( + "rtems_clock_set", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_clock_tick */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_clock_tick(); + end_time = Read_timer(); + + put_time( + "rtems_clock_tick", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +pause(); + +/* rtems_timer_create */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_timer_create( name, &id ); + end_time = Read_timer(); + + put_time( + "rtems_timer_create", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_timer_delete */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_timer_delete( id ); + end_time = Read_timer(); + + put_time( + "rtems_timer_delete", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_timer_ident */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_timer_ident( name, id ); + end_time = Read_timer(); + + put_time( + "rtems_timer_ident", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_timer_fire_after */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_timer_fire_after( + id, + timeout, + Timer_handler, + NULL + ); + end_time = Read_timer(); + + put_time( + "rtems_timer_fire_after", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_timer_fire_when */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_timer_fire_when( + id, + time, + Timer_handler, + NULL + ); + end_time = Read_timer(); + + put_time( + "rtems_timer_fire_when", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_timer_reset */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_timer_reset( id ); + end_time = Read_timer(); + + put_time( + "rtems_timer_reset", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_timer_cancel */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_timer_cancel( id ); + end_time = Read_timer(); + + put_time( + "rtems_timer_cancel", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_semaphore_create */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_semaphore_create( + name, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + end_time = Read_timer(); + + put_time( + "rtems_semaphore_create", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_semaphore_delete */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_semaphore_delete( id ); + end_time = Read_timer(); + + put_time( + "rtems_semaphore_delete", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_semaphore_ident */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_semaphore_ident( name, RTEMS_SEARCH_ALL_NODES, id ); + end_time = Read_timer(); + + put_time( + "rtems_semaphore_ident", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_semaphore_obtain */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_semaphore_obtain( id, RTEMS_DEFAULT_OPTIONS, timeout ); + end_time = Read_timer(); + + put_time( + "rtems_semaphore_obtain", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_semaphore_release */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_semaphore_release( id ); + end_time = Read_timer(); + + put_time( + "rtems_semaphore_release", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_message_queue_create */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_message_queue_create( + name, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_create", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_message_queue_ident */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_message_queue_ident( + name, + RTEMS_SEARCH_ALL_NODES, + id + ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_ident", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_message_queue_delete */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_message_queue_delete( id ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_delete", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_message_queue_send */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_message_queue_send( id, (long (*)[4])buffer ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_send", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_message_queue_urgent */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_message_queue_urgent( id, (long (*)[4])buffer ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_urgent", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_message_queue_broadcast */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_message_queue_broadcast( + id, + (long (*)[4])buffer, + &count + ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_broadcast", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_message_queue_receive */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_message_queue_receive( + id, + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + timeout + ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_receive", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_message_queue_flush */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_message_queue_flush( id, &count ); + end_time = Read_timer(); + + put_time( + "rtems_message_queue_flush", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +pause(); + +/* rtems_event_send */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_event_send( id, events ); + end_time = Read_timer(); + + put_time( + "rtems_event_send", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_event_receive */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_DEFAULT_OPTIONS, + timeout, + &events + ); + end_time = Read_timer(); + + put_time( + "rtems_event_receive", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_signal_catch */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_signal_catch( Asr_handler, RTEMS_DEFAULT_MODES ); + end_time = Read_timer(); + + put_time( + "rtems_signal_catch", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_signal_send */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_signal_send( id, signals ); + end_time = Read_timer(); + + put_time( + "rtems_signal_send", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_partition_create */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_partition_create( + name, + Memory_area, + 2048, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + end_time = Read_timer(); + + put_time( + "rtems_partition_create", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_partition_ident */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_partition_ident( name, RTEMS_SEARCH_ALL_NODES, id ); + end_time = Read_timer(); + + put_time( + "rtems_partition_ident", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_partition_delete */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_partition_delete( id ); + end_time = Read_timer(); + + put_time( + "rtems_partition_delete", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_partition_get_buffer */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_partition_get_buffer( id, address_1 ); + end_time = Read_timer(); + + put_time( + "rtems_partition_get_buffer", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_partition_return_buffer */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_partition_return_buffer( id, address_1 ); + end_time = Read_timer(); + + put_time( + "rtems_partition_return_buffer", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_region_create */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_region_create( + name, + Memory_area, + 2048, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + end_time = Read_timer(); + + put_time( + "rtems_region_create", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_region_ident */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_region_ident( name, id ); + end_time = Read_timer(); + + put_time( + "rtems_region_ident", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_region_delete */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_region_delete( id ); + end_time = Read_timer(); + + put_time( + "rtems_region_delete", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_region_get_segment */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_region_get_segment( + id, + 243, + RTEMS_DEFAULT_OPTIONS, + timeout, + &address_1 + ); + end_time = Read_timer(); + + put_time( + "rtems_region_get_segment", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_region_return_segment */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_region_return_segment( id, address_1 ); + end_time = Read_timer(); + + put_time( + "rtems_region_return_segment", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_port_create */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_port_create( + name, + Internal_port_area, + External_port_area, + 0xff, + &id + ); + end_time = Read_timer(); + + put_time( + "rtems_port_create", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_port_ident */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_port_ident( name, id ); + end_time = Read_timer(); + + put_time( + "rtems_port_ident", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_port_delete */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_port_delete( id ); + end_time = Read_timer(); + + put_time( + "rtems_port_delete", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_port_external_to_internal */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_port_external_to_internal( + id, + &External_port_area[ 7 ], + address_1 + ); + end_time = Read_timer(); + + put_time( + "rtems_port_external_to_internal", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_port_internal_to_external */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_port_internal_to_external( + id, + &Internal_port_area[ 7 ], + address_1 + ); + end_time = Read_timer(); + + put_time( + "rtems_port_internal_to_external", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +pause(); + +/* rtems_io_initialize */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_io_initialize( + major, + minor, + address_1, + &io_result + ); + end_time = Read_timer(); + + put_time( + "rtems_io_initialize", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_io_open */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_io_open( + major, + minor, + address_1, + &io_result + ); + end_time = Read_timer(); + + put_time( + "rtems_io_open", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_io_close */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_io_close( + major, + minor, + address_1, + &io_result + ); + end_time = Read_timer(); + + put_time( + "rtems_io_close", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_io_read */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_io_read( + major, + minor, + address_1, + &io_result + ); + end_time = Read_timer(); + + put_time( + "rtems_io_read", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_io_write */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_io_write( + major, + minor, + address_1, + &io_result + ); + end_time = Read_timer(); + + put_time( + "rtems_io_write", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_io_control */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_io_control( + major, + minor, + address_1, + &io_result + ); + end_time = Read_timer(); + + put_time( + "rtems_io_control", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_fatal_error_occurred */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_fatal_error_occurred( error ); + end_time = Read_timer(); + + put_time( + "rtems_fatal_error_occurred", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_rate_monotonic_create */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_rate_monotonic_create( name, &id ); + end_time = Read_timer(); + + put_time( + "rtems_rate_monotonic_create", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_rate_monotonic_ident */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_rate_monotonic_ident( name, id ); + end_time = Read_timer(); + + put_time( + "rtems_rate_monotonic_ident", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_rate_monotonic_delete */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_rate_monotonic_delete( id ); + end_time = Read_timer(); + + put_time( + "rtems_rate_monotonic_delete", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_rate_monotonic_cancel */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_rate_monotonic_cancel( id ); + end_time = Read_timer(); + + put_time( + "rtems_rate_monotonic_cancel", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_rate_monotonic_period */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_rate_monotonic_period( id, timeout ); + end_time = Read_timer(); + + put_time( + "rtems_rate_monotonic_period", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + +/* rtems_multiprocessing_announce */ + + Timer_initialize(); + for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) + (void) rtems_multiprocessing_announce(); + end_time = Read_timer(); + + put_time( + "rtems_multiprocessing_announce", + end_time, + OPERATION_COUNT, + overhead, + 0 + ); + + puts( "*** END OF TIME OVERHEAD ***\n" ); + + exit( 0 ); +} diff --git a/testsuites/tmtests/tmoverhd/tmoverhd.doc b/testsuites/tmtests/tmoverhd/tmoverhd.doc new file mode 100644 index 0000000000..0de40191c6 --- /dev/null +++ b/testsuites/tmtests/tmoverhd/tmoverhd.doc @@ -0,0 +1,13 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + -- cgit v1.2.3