configuration.xml 89 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <SPC5-Config version="1.0.0">
  3. <application name="NASA OSAL Test Suite" version="1.0.0" standalone="true" locked="false">
  4. <description>Test specification for the NASA OSAL ChibiOS extension.</description>
  5. <component id="org.chibios.spc5.components.portable.generic_startup">
  6. <component id="org.chibios.spc5.components.portable.chibios_unitary_tests_engine" />
  7. </component>
  8. <instances>
  9. <instance locked="false" id="org.chibios.spc5.components.portable.generic_startup" />
  10. <instance locked="false" id="org.chibios.spc5.components.portable.chibios_unitary_tests_engine">
  11. <description>
  12. <brief>
  13. <value>NASA OSAL Test Suite.</value>
  14. </brief>
  15. <copyright>
  16. <value><![CDATA[/* Copyright statement.*/]]></value>
  17. </copyright>
  18. <introduction>
  19. <value>Test suite for NASA OSAL implementation over ChibiOS/RT. The purpose of this suite is to perform unit tests on the OSAL module and to converge to 100% code coverage through successive improvements.</value>
  20. </introduction>
  21. </description>
  22. <global_data_and_code>
  23. <code_prefix>
  24. <value>nasa_osal_</value>
  25. </code_prefix>
  26. <global_definitions>
  27. <value><![CDATA[#define TEST_SUITE_NAME "NASA OSAL over ChibiOS/RT Test Suite"
  28. #define TASKS_BASE_PRIORITY 200
  29. #define TASKS_STACK_SIZE 256
  30. extern THD_WORKING_AREA(wa_test1, TASKS_STACK_SIZE);
  31. extern THD_WORKING_AREA(wa_test2, TASKS_STACK_SIZE);
  32. extern THD_WORKING_AREA(wa_test3, TASKS_STACK_SIZE);
  33. extern THD_WORKING_AREA(wa_test4, TASKS_STACK_SIZE);]]></value>
  34. </global_definitions>
  35. <global_code>
  36. <value><![CDATA[THD_WORKING_AREA(wa_test1, TASKS_STACK_SIZE);
  37. THD_WORKING_AREA(wa_test2, TASKS_STACK_SIZE);
  38. THD_WORKING_AREA(wa_test3, TASKS_STACK_SIZE);
  39. THD_WORKING_AREA(wa_test4, TASKS_STACK_SIZE);]]></value>
  40. </global_code>
  41. </global_data_and_code>
  42. <sequences>
  43. <sequence>
  44. <type index="0">
  45. <value>Internal Tests</value>
  46. </type>
  47. <brief>
  48. <value>Tasks Functionality</value>
  49. </brief>
  50. <description>
  51. <value>This sequence tests the NASA OSAL over ChibiOS/RT functionalities related to threading.</value>
  52. </description>
  53. <condition>
  54. <value />
  55. </condition>
  56. <shared_code>
  57. <value><![CDATA[#include "osapi.h"
  58. static void test_task1(void) {
  59. test_emit_token('A');
  60. }
  61. static void test_task2(void) {
  62. test_emit_token('B');
  63. }
  64. static void test_task3(void) {
  65. test_emit_token('C');
  66. }
  67. static void test_task4(void) {
  68. test_emit_token('D');
  69. }
  70. static void delete_handler(void) {
  71. test_emit_token('C');
  72. }
  73. static void test_task_delete(void) {
  74. test_emit_token('A');
  75. (void) OS_TaskInstallDeleteHandler(delete_handler);
  76. while (!OS_TaskDeleteCheck()) {
  77. (void) OS_TaskDelay(1);
  78. }
  79. test_emit_token('B');
  80. }]]></value>
  81. </shared_code>
  82. <cases>
  83. <case>
  84. <brief>
  85. <value>OS_TaskCreate() errors</value>
  86. </brief>
  87. <description>
  88. <value>Parameters checking in OS_TaskCreate() is tested.</value>
  89. </description>
  90. <condition>
  91. <value />
  92. </condition>
  93. <various_code>
  94. <setup_code>
  95. <value />
  96. </setup_code>
  97. <teardown_code>
  98. <value />
  99. </teardown_code>
  100. <local_variables>
  101. <value />
  102. </local_variables>
  103. </various_code>
  104. <steps>
  105. <step>
  106. <description>
  107. <value>OS_TaskCreate() is invoked with task_id set to NULL, an error is expected.</value>
  108. </description>
  109. <tags>
  110. <value />
  111. </tags>
  112. <code>
  113. <value><![CDATA[int32 err;
  114. err = OS_TaskCreate(NULL, /* Error.*/
  115. "failing task",
  116. test_task1,
  117. (uint32 *)wa_test1,
  118. sizeof wa_test1,
  119. TASKS_BASE_PRIORITY,
  120. 0);
  121. test_assert(err == OS_INVALID_POINTER, "NULL not detected");
  122. test_assert_sequence("", "task executed");]]></value>
  123. </code>
  124. </step>
  125. <step>
  126. <description>
  127. <value>OS_TaskCreate() is invoked with task_name set to NULL, an error is expected.</value>
  128. </description>
  129. <tags>
  130. <value />
  131. </tags>
  132. <code>
  133. <value><![CDATA[int32 err;
  134. uint32 tid;
  135. err = OS_TaskCreate(&tid,
  136. NULL, /* Error.*/
  137. test_task1,
  138. (uint32 *)wa_test1,
  139. sizeof wa_test1,
  140. TASKS_BASE_PRIORITY,
  141. 0);
  142. test_assert(err == OS_INVALID_POINTER, "NULL not detected");
  143. test_assert_sequence("", "task executed");]]></value>
  144. </code>
  145. </step>
  146. <step>
  147. <description>
  148. <value>OS_TaskCreate() is invoked with stack_pointer set to NULL, an error is expected.</value>
  149. </description>
  150. <tags>
  151. <value />
  152. </tags>
  153. <code>
  154. <value><![CDATA[int32 err;
  155. uint32 tid;
  156. err = OS_TaskCreate(&tid,
  157. "failing task",
  158. test_task1,
  159. (uint32 *)NULL, /* Error.*/
  160. sizeof wa_test1,
  161. TASKS_BASE_PRIORITY,
  162. 0);
  163. test_assert(err == OS_INVALID_POINTER, "NULL not detected");
  164. test_assert_sequence("", "task executed");]]></value>
  165. </code>
  166. </step>
  167. <step>
  168. <description>
  169. <value>OS_TaskCreate() is invoked with a very long task name, an error is expected.</value>
  170. </description>
  171. <tags>
  172. <value />
  173. </tags>
  174. <code>
  175. <value><![CDATA[int32 err;
  176. uint32 tid;
  177. err = OS_TaskCreate(&tid,
  178. "this is a very very long task name", /* Error.*/
  179. test_task1,
  180. (uint32 *)wa_test1,
  181. sizeof wa_test1,
  182. TASKS_BASE_PRIORITY,
  183. 0);
  184. test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected");
  185. test_assert_sequence("", "task executed");]]></value>
  186. </code>
  187. </step>
  188. <step>
  189. <description>
  190. <value>OS_TaskCreate() is invoked with priority below and above allowed range, an error is expected.</value>
  191. </description>
  192. <tags>
  193. <value />
  194. </tags>
  195. <code>
  196. <value><![CDATA[int32 err;
  197. uint32 tid;
  198. err = OS_TaskCreate(&tid,
  199. "failing task",
  200. test_task1,
  201. (uint32 *)wa_test1,
  202. sizeof wa_test1,
  203. 0, /* Error.*/
  204. 0);
  205. test_assert(err == OS_ERR_INVALID_PRIORITY, "priority error not detected");
  206. test_assert_sequence("", "task executed");
  207. err = OS_TaskCreate(&tid,
  208. "failing task",
  209. test_task1,
  210. (uint32 *)wa_test1,
  211. sizeof wa_test1,
  212. 256, /* Error.*/
  213. 0);
  214. test_assert(err == OS_ERR_INVALID_PRIORITY, "priority error not detected");
  215. test_assert_sequence("", "task executed");]]></value>
  216. </code>
  217. </step>
  218. <step>
  219. <description>
  220. <value>OS_TaskCreate() is invoked with a stack size below minimum, an error is expected.</value>
  221. </description>
  222. <tags>
  223. <value />
  224. </tags>
  225. <code>
  226. <value><![CDATA[int32 err;
  227. uint32 tid;
  228. err = OS_TaskCreate(&tid,
  229. "failing task",
  230. test_task1,
  231. (uint32 *)wa_test1,
  232. 16, /* Error.*/
  233. TASKS_BASE_PRIORITY,
  234. 0);
  235. test_assert(err == OS_INVALID_INT_NUM, "stack insufficient size not detected");
  236. test_assert_sequence("", "task executed");]]></value>
  237. </code>
  238. </step>
  239. <step>
  240. <description>
  241. <value>OS_TaskCreate() is invoked twice with duplicated name and then duplicated stack, an error is expected in both cases.</value>
  242. </description>
  243. <tags>
  244. <value />
  245. </tags>
  246. <code>
  247. <value><![CDATA[int32 err;
  248. uint32 tid;
  249. err = OS_TaskCreate(&tid,
  250. "running task",
  251. test_task1,
  252. (uint32 *)wa_test1,
  253. sizeof wa_test1,
  254. TASKS_BASE_PRIORITY,
  255. 0);
  256. test_assert(err == OS_SUCCESS, "task creation failed");
  257. err = OS_TaskCreate(&tid,
  258. "running task",
  259. test_task2,
  260. (uint32 *)wa_test2,
  261. sizeof wa_test2,
  262. TASKS_BASE_PRIORITY,
  263. 0);
  264. test_assert(err == OS_ERR_NAME_TAKEN, "name conflict not detected");
  265. err = OS_TaskCreate(&tid,
  266. "conflicting task",
  267. test_task1,
  268. (uint32 *)wa_test1,
  269. sizeof wa_test1,
  270. TASKS_BASE_PRIORITY,
  271. 0);
  272. test_assert(err == OS_ERR_NO_FREE_IDS, "stack conflict not detected");
  273. err = OS_TaskWait(tid);
  274. test_assert(err == OS_SUCCESS, "wait failed");
  275. test_assert_sequence("A", "task not executed");
  276. err = OS_TaskCreate(&tid,
  277. "running task",
  278. test_task1,
  279. (uint32 *)wa_test1,
  280. sizeof wa_test1,
  281. TASKS_BASE_PRIORITY,
  282. 0);
  283. test_assert(err == OS_SUCCESS, "task creation failed");
  284. err = OS_TaskWait(tid);
  285. test_assert(err == OS_SUCCESS, "wait failed");
  286. test_assert_sequence("A", "task not executed");]]></value>
  287. </code>
  288. </step>
  289. </steps>
  290. </case>
  291. <case>
  292. <brief>
  293. <value>OS_TaskCreate() priority ordering</value>
  294. </brief>
  295. <description>
  296. <value>Four tasks are created at different priorities and in different order. The execution order must happen in order of priority regardless the creation order.</value>
  297. </description>
  298. <condition>
  299. <value />
  300. </condition>
  301. <various_code>
  302. <setup_code>
  303. <value />
  304. </setup_code>
  305. <teardown_code>
  306. <value />
  307. </teardown_code>
  308. <local_variables>
  309. <value />
  310. </local_variables>
  311. </various_code>
  312. <steps>
  313. <step>
  314. <description>
  315. <value>Four tasks are created in priority order from low to high.</value>
  316. </description>
  317. <tags>
  318. <value />
  319. </tags>
  320. <code>
  321. <value><![CDATA[int32 err;
  322. uint32 tid1, tid2, tid3, tid4;
  323. err = OS_TaskCreate(&tid4,
  324. "running task 4",
  325. test_task4,
  326. (uint32 *)wa_test4,
  327. sizeof wa_test4,
  328. TASKS_BASE_PRIORITY - 0,
  329. 0);
  330. test_assert(err == OS_SUCCESS, "task 4 creation failed");
  331. err = OS_TaskCreate(&tid3,
  332. "running task 3",
  333. test_task3,
  334. (uint32 *)wa_test3,
  335. sizeof wa_test3,
  336. TASKS_BASE_PRIORITY - 1,
  337. 0);
  338. test_assert(err == OS_SUCCESS, "task 3 creation failed");
  339. err = OS_TaskCreate(&tid2,
  340. "running task 2",
  341. test_task2,
  342. (uint32 *)wa_test2,
  343. sizeof wa_test2,
  344. TASKS_BASE_PRIORITY - 2,
  345. 0);
  346. test_assert(err == OS_SUCCESS, "task 2 creation failed");
  347. err = OS_TaskCreate(&tid1,
  348. "running task 1",
  349. test_task1,
  350. (uint32 *)wa_test1,
  351. sizeof wa_test1,
  352. TASKS_BASE_PRIORITY - 3,
  353. 0);
  354. test_assert(err == OS_SUCCESS, "task 1 creation failed");]]></value>
  355. </code>
  356. </step>
  357. <step>
  358. <description>
  359. <value>Tasks are made runnable atomically and their execution order tested.</value>
  360. </description>
  361. <tags>
  362. <value />
  363. </tags>
  364. <code>
  365. <value><![CDATA[OS_TaskDelay(5);
  366. test_assert_sequence("ABCD", "task order violation");]]></value>
  367. </code>
  368. </step>
  369. <step>
  370. <description>
  371. <value>Four tasks are created in priority order from high to low.</value>
  372. </description>
  373. <tags>
  374. <value />
  375. </tags>
  376. <code>
  377. <value><![CDATA[int32 err;
  378. uint32 tid1, tid2, tid3, tid4;
  379. err = OS_TaskCreate(&tid1,
  380. "running task 1",
  381. test_task1,
  382. (uint32 *)wa_test1,
  383. sizeof wa_test1,
  384. TASKS_BASE_PRIORITY - 3,
  385. 0);
  386. test_assert(err == OS_SUCCESS, "task 1 creation failed");
  387. err = OS_TaskCreate(&tid2,
  388. "running task 2",
  389. test_task2,
  390. (uint32 *)wa_test2,
  391. sizeof wa_test2,
  392. TASKS_BASE_PRIORITY - 2,
  393. 0);
  394. test_assert(err == OS_SUCCESS, "task 2 creation failed");
  395. err = OS_TaskCreate(&tid3,
  396. "running task 3",
  397. test_task3,
  398. (uint32 *)wa_test3,
  399. sizeof wa_test3,
  400. TASKS_BASE_PRIORITY - 1,
  401. 0);
  402. test_assert(err == OS_SUCCESS, "task 3 creation failed");
  403. err = OS_TaskCreate(&tid4,
  404. "running task 4",
  405. test_task4,
  406. (uint32 *)wa_test4,
  407. sizeof wa_test4,
  408. TASKS_BASE_PRIORITY - 0,
  409. 0);
  410. test_assert(err == OS_SUCCESS, "task 4 creation failed");]]></value>
  411. </code>
  412. </step>
  413. <step>
  414. <description>
  415. <value>Tasks are made runnable atomically and their execution order tested.</value>
  416. </description>
  417. <tags>
  418. <value />
  419. </tags>
  420. <code>
  421. <value><![CDATA[OS_TaskDelay(5);
  422. test_assert_sequence("ABCD", "task order violation");]]></value>
  423. </code>
  424. </step>
  425. <step>
  426. <description>
  427. <value>Four tasks are created in an not ordered way.</value>
  428. </description>
  429. <tags>
  430. <value />
  431. </tags>
  432. <code>
  433. <value><![CDATA[int32 err;
  434. uint32 tid1, tid2, tid3, tid4;
  435. err = OS_TaskCreate(&tid2,
  436. "running task 2",
  437. test_task2,
  438. (uint32 *)wa_test2,
  439. sizeof wa_test2,
  440. TASKS_BASE_PRIORITY - 2,
  441. 0);
  442. test_assert(err == OS_SUCCESS, "task 2 creation failed");
  443. err = OS_TaskCreate(&tid1,
  444. "running task 1",
  445. test_task1,
  446. (uint32 *)wa_test1,
  447. sizeof wa_test1,
  448. TASKS_BASE_PRIORITY - 3,
  449. 0);
  450. test_assert(err == OS_SUCCESS, "task 1 creation failed");
  451. err = OS_TaskCreate(&tid4,
  452. "running task 4",
  453. test_task4,
  454. (uint32 *)wa_test4,
  455. sizeof wa_test4,
  456. TASKS_BASE_PRIORITY - 0,
  457. 0);
  458. test_assert(err == OS_SUCCESS, "task 4 creation failed");
  459. err = OS_TaskCreate(&tid3,
  460. "running task 3",
  461. test_task3,
  462. (uint32 *)wa_test3,
  463. sizeof wa_test3,
  464. TASKS_BASE_PRIORITY - 1,
  465. 0);
  466. test_assert(err == OS_SUCCESS, "task 3 creation failed");]]></value>
  467. </code>
  468. </step>
  469. <step>
  470. <description>
  471. <value>Tasks are made runnable atomically and their execution order tested.</value>
  472. </description>
  473. <tags>
  474. <value />
  475. </tags>
  476. <code>
  477. <value><![CDATA[OS_TaskDelay(5);
  478. test_assert_sequence("ABCD", "task order violation");]]></value>
  479. </code>
  480. </step>
  481. </steps>
  482. </case>
  483. <case>
  484. <brief>
  485. <value>OS_TaskDelete() errors</value>
  486. </brief>
  487. <description>
  488. <value>Parameters checking in OS_TaskDelete() is tested.</value>
  489. </description>
  490. <condition>
  491. <value />
  492. </condition>
  493. <various_code>
  494. <setup_code>
  495. <value />
  496. </setup_code>
  497. <teardown_code>
  498. <value />
  499. </teardown_code>
  500. <local_variables>
  501. <value />
  502. </local_variables>
  503. </various_code>
  504. <steps>
  505. <step>
  506. <description>
  507. <value>OS_TaskDelete() is invoked with task_id set to -1, an error is expected.</value>
  508. </description>
  509. <tags>
  510. <value />
  511. </tags>
  512. <code>
  513. <value><![CDATA[int32 err;
  514. err = OS_TaskDelete((uint32)-1);
  515. test_assert(err == OS_ERR_INVALID_ID, "wrong task id not detected");]]></value>
  516. </code>
  517. </step>
  518. </steps>
  519. </case>
  520. <case>
  521. <brief>
  522. <value>OS_TaskDelete() and OS_TaskInstallDeleteHandler() functionality</value>
  523. </brief>
  524. <description>
  525. <value>OS_TaskDelete() and OS_TaskInstallDeleteHandler() are tested for functionality.</value>
  526. </description>
  527. <condition>
  528. <value />
  529. </condition>
  530. <various_code>
  531. <setup_code>
  532. <value />
  533. </setup_code>
  534. <teardown_code>
  535. <value />
  536. </teardown_code>
  537. <local_variables>
  538. <value><![CDATA[uint32 tid;]]></value>
  539. </local_variables>
  540. </various_code>
  541. <steps>
  542. <step>
  543. <description>
  544. <value>Creating a task executing an infinite loop.</value>
  545. </description>
  546. <tags>
  547. <value />
  548. </tags>
  549. <code>
  550. <value><![CDATA[int32 err;
  551. err = OS_TaskCreate(&tid,
  552. "deletable task",
  553. test_task_delete,
  554. (uint32 *)wa_test1,
  555. sizeof wa_test1,
  556. TASKS_BASE_PRIORITY,
  557. 0);
  558. test_assert(err == OS_SUCCESS, "deletable task creation failed");]]></value>
  559. </code>
  560. </step>
  561. <step>
  562. <description>
  563. <value>Letting the task run for a while then deleting it. A check is performed on the correct execution of the delete handler.</value>
  564. </description>
  565. <tags>
  566. <value />
  567. </tags>
  568. <code>
  569. <value><![CDATA[int32 err;
  570. (void) OS_TaskDelay(50);
  571. err = OS_TaskDelete(tid);
  572. test_assert(err == OS_SUCCESS, "delete failed");
  573. test_assert_sequence("ABC", "events order violation");]]></value>
  574. </code>
  575. </step>
  576. </steps>
  577. </case>
  578. </cases>
  579. </sequence>
  580. <sequence>
  581. <type index="0">
  582. <value>Internal Tests</value>
  583. </type>
  584. <brief>
  585. <value>Queues Functionality</value>
  586. </brief>
  587. <description>
  588. <value>This sequence tests the NASA OSAL over ChibiOS/RT functionalities related to queues</value>
  589. </description>
  590. <condition>
  591. <value />
  592. </condition>
  593. <shared_code>
  594. <value><![CDATA[#include <string.h>
  595. #include "osapi.h"
  596. uint32 qid, tid;
  597. #define WRITER_NUM_MESSAGES 16
  598. #define MESSAGE_SIZE 20
  599. static void test_task_writer(void) {
  600. unsigned i;
  601. int32 err;
  602. for (i = 0; i < WRITER_NUM_MESSAGES; i++) {
  603. err = OS_QueuePut(qid, "Hello World", 12, 0);
  604. if (err != OS_SUCCESS) {
  605. test_emit_token('*');
  606. }
  607. }
  608. }]]></value>
  609. </shared_code>
  610. <cases>
  611. <case>
  612. <brief>
  613. <value>OS_QueueCreate() and OS_QueueDelete() errors</value>
  614. </brief>
  615. <description>
  616. <value>Parameters checking in OS_QueueCreate() and OS_QueueDelete() is tested.</value>
  617. </description>
  618. <condition>
  619. <value />
  620. </condition>
  621. <various_code>
  622. <setup_code>
  623. <value />
  624. </setup_code>
  625. <teardown_code>
  626. <value />
  627. </teardown_code>
  628. <local_variables>
  629. <value />
  630. </local_variables>
  631. </various_code>
  632. <steps>
  633. <step>
  634. <description>
  635. <value>OS_QueueCreate() is invoked with queue_id set to NULL, an error is expected.</value>
  636. </description>
  637. <tags>
  638. <value />
  639. </tags>
  640. <code>
  641. <value><![CDATA[int32 err;
  642. err = OS_QueueCreate(NULL, /* Error.*/
  643. "failing queue",
  644. 4,
  645. 128,
  646. 0);
  647. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  648. </code>
  649. </step>
  650. <step>
  651. <description>
  652. <value>OS_QueueCreate() is invoked with task_name set to NULL, an error is expected.</value>
  653. </description>
  654. <tags>
  655. <value />
  656. </tags>
  657. <code>
  658. <value><![CDATA[int32 err;
  659. uint32 qid;
  660. err = OS_QueueCreate(&qid,
  661. NULL, /* Error.*/
  662. 4,
  663. 128,
  664. 0);
  665. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  666. </code>
  667. </step>
  668. <step>
  669. <description>
  670. <value>OS_QueueCreate() is invoked with a very long task name, an error is expected.</value>
  671. </description>
  672. <tags>
  673. <value />
  674. </tags>
  675. <code>
  676. <value><![CDATA[int32 err;
  677. uint32 qid;
  678. err = OS_QueueCreate(&qid,
  679. "very very long queue name", /* Error.*/
  680. 4,
  681. 128,
  682. 0);
  683. test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected");]]></value>
  684. </code>
  685. </step>
  686. <step>
  687. <description>
  688. <value>OS_QueueDelete() is invoked with queue_id set to -1, an error is expected.</value>
  689. </description>
  690. <tags>
  691. <value />
  692. </tags>
  693. <code>
  694. <value><![CDATA[int32 err;
  695. err = OS_QueueDelete((uint32)-1);
  696. test_assert(err == OS_ERR_INVALID_ID, "wrong queue id not detected");]]></value>
  697. </code>
  698. </step>
  699. <step>
  700. <description>
  701. <value>OS_QueueCreate() is invoked twice with duplicated name, an error is expected, then the queue is deleted using OS_QueueDelete().</value>
  702. </description>
  703. <tags>
  704. <value />
  705. </tags>
  706. <code>
  707. <value><![CDATA[int32 err;
  708. uint32 qid1, qid2;
  709. err = OS_QueueCreate(&qid1, "my queue", 4, 128, 0);
  710. test_assert(err == OS_SUCCESS, "queue creation failed");
  711. err = OS_QueueCreate(&qid2, "my queue", 4, 128, 0);
  712. test_assert(err == OS_ERR_NAME_TAKEN, "name conflict not detected");
  713. err = OS_QueueDelete(qid1);
  714. test_assert(err == OS_SUCCESS, "queue deletion failed");]]></value>
  715. </code>
  716. </step>
  717. </steps>
  718. </case>
  719. <case>
  720. <brief>
  721. <value>OS_QueueGetIdByName() errors</value>
  722. </brief>
  723. <description>
  724. <value>Parameters checking in OS_QueueGetIdByName() is tested.</value>
  725. </description>
  726. <condition>
  727. <value />
  728. </condition>
  729. <various_code>
  730. <setup_code>
  731. <value />
  732. </setup_code>
  733. <teardown_code>
  734. <value />
  735. </teardown_code>
  736. <local_variables>
  737. <value />
  738. </local_variables>
  739. </various_code>
  740. <steps>
  741. <step>
  742. <description>
  743. <value>OS_QueueGetIdByName() is invoked with queue_id set to NULL, an error is expected.</value>
  744. </description>
  745. <tags>
  746. <value />
  747. </tags>
  748. <code>
  749. <value><![CDATA[int32 err;
  750. err = OS_QueueGetIdByName(NULL, "queue");
  751. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  752. </code>
  753. </step>
  754. <step>
  755. <description>
  756. <value>OS_QueueGetIdByName() is invoked with queue_name set to NULL, an error is expected.</value>
  757. </description>
  758. <tags>
  759. <value />
  760. </tags>
  761. <code>
  762. <value><![CDATA[int32 err;
  763. err = OS_QueueGetIdByName(&qid, NULL);
  764. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  765. </code>
  766. </step>
  767. <step>
  768. <description>
  769. <value>OS_QueueGetIdByName() is invoked with a very long task name, an error is expected.</value>
  770. </description>
  771. <tags>
  772. <value />
  773. </tags>
  774. <code>
  775. <value><![CDATA[int32 err;
  776. err = OS_QueueGetIdByName(&qid, "very very long queue name");
  777. test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected");]]></value>
  778. </code>
  779. </step>
  780. </steps>
  781. </case>
  782. <case>
  783. <brief>
  784. <value>OS_QueuePut() and OS_QueueGet() functionality</value>
  785. </brief>
  786. <description>
  787. <value>A task writes on a queue, the messages are retrieved on the other side in blocking mode.</value>
  788. </description>
  789. <condition>
  790. <value />
  791. </condition>
  792. <various_code>
  793. <setup_code>
  794. <value><![CDATA[qid = 0;
  795. tid = 0;]]></value>
  796. </setup_code>
  797. <teardown_code>
  798. <value><![CDATA[if (qid != 0) {
  799. (void) OS_QueueDelete(qid);
  800. }
  801. if (tid != 0) {
  802. (void) OS_TaskWait(tid);
  803. }]]></value>
  804. </teardown_code>
  805. <local_variables>
  806. <value><![CDATA[uint32 tid;
  807. unsigned i;]]></value>
  808. </local_variables>
  809. </various_code>
  810. <steps>
  811. <step>
  812. <description>
  813. <value>Creataing a queue with depth 4 and message size 20</value>
  814. </description>
  815. <tags>
  816. <value />
  817. </tags>
  818. <code>
  819. <value><![CDATA[int32 err;
  820. err = OS_QueueCreate(&qid, "test queue", 4, MESSAGE_SIZE, 0);
  821. test_assert(err == OS_SUCCESS, "queue creation failed");]]></value>
  822. </code>
  823. </step>
  824. <step>
  825. <description>
  826. <value>Creating the writer task.</value>
  827. </description>
  828. <tags>
  829. <value />
  830. </tags>
  831. <code>
  832. <value><![CDATA[int32 err;
  833. err = OS_TaskCreate(&tid,
  834. "writer task",
  835. test_task_writer,
  836. (uint32 *)wa_test1,
  837. sizeof wa_test1,
  838. TASKS_BASE_PRIORITY,
  839. 0);
  840. test_assert(err == OS_SUCCESS, "writer task creation failed");]]></value>
  841. </code>
  842. </step>
  843. <step>
  844. <description>
  845. <value>Reading messages from the writer task.</value>
  846. </description>
  847. <tags>
  848. <value />
  849. </tags>
  850. <code>
  851. <value><![CDATA[for (i = 0; i < WRITER_NUM_MESSAGES; i++) {
  852. int32 err;
  853. char data[MESSAGE_SIZE];
  854. uint32 copied;
  855. err = OS_QueueGet(qid, data, MESSAGE_SIZE, &copied, OS_Milli2Ticks(200));
  856. test_assert(err == OS_SUCCESS, "timed out");
  857. test_assert(strncmp(data, "Hello World", sizeof (data)) == 0,
  858. "wrong message");
  859. }]]></value>
  860. </code>
  861. </step>
  862. <step>
  863. <description>
  864. <value>Waiting for task termination then checking for errors.</value>
  865. </description>
  866. <tags>
  867. <value />
  868. </tags>
  869. <code>
  870. <value><![CDATA[(void) OS_TaskWait(tid);
  871. tid = 0;
  872. test_assert_sequence("", "queue write errors occurred");]]></value>
  873. </code>
  874. </step>
  875. </steps>
  876. </case>
  877. <case>
  878. <brief>
  879. <value>OS_QueueGet() with timeout functionality</value>
  880. </brief>
  881. <description>
  882. <value>OS_QueueGet() timeout functionality is tested.</value>
  883. </description>
  884. <condition>
  885. <value />
  886. </condition>
  887. <various_code>
  888. <setup_code>
  889. <value><![CDATA[qid = 0;
  890. (void) OS_QueueCreate(&qid, "test queue", 2, MESSAGE_SIZE, 0);]]></value>
  891. </setup_code>
  892. <teardown_code>
  893. <value><![CDATA[if (qid != 0) {
  894. OS_QueueDelete(qid);
  895. }]]></value>
  896. </teardown_code>
  897. <local_variables>
  898. <value><![CDATA[uint32 local_qid;
  899. uint32 copied;
  900. char data[MESSAGE_SIZE];]]></value>
  901. </local_variables>
  902. </various_code>
  903. <steps>
  904. <step>
  905. <description>
  906. <value>Retrieving the queue by name.</value>
  907. </description>
  908. <tags>
  909. <value />
  910. </tags>
  911. <code>
  912. <value><![CDATA[int32 err;
  913. err = OS_QueueGetIdByName(&local_qid, "test queue");
  914. test_assert(err == OS_SUCCESS, "queue not found");]]></value>
  915. </code>
  916. </step>
  917. <step>
  918. <description>
  919. <value>Get operation with a one second timeout, an error is expected.</value>
  920. </description>
  921. <tags>
  922. <value />
  923. </tags>
  924. <code>
  925. <value><![CDATA[int32 err;
  926. err = OS_QueueGet(qid, data, MESSAGE_SIZE, &copied, OS_Milli2Ticks(1000));
  927. test_assert(err == OS_QUEUE_TIMEOUT, "unexpected error code");]]></value>
  928. </code>
  929. </step>
  930. <step>
  931. <description>
  932. <value>Get operation in non-blocking mode, an error is expected.</value>
  933. </description>
  934. <tags>
  935. <value />
  936. </tags>
  937. <code>
  938. <value><![CDATA[int32 err;
  939. err = OS_QueueGet(qid, data, MESSAGE_SIZE, &copied, OS_CHECK);
  940. test_assert(err == OS_QUEUE_EMPTY, "unexpected error code");]]></value>
  941. </code>
  942. </step>
  943. </steps>
  944. </case>
  945. </cases>
  946. </sequence>
  947. <sequence>
  948. <type index="0">
  949. <value>Internal Tests</value>
  950. </type>
  951. <brief>
  952. <value>Timers Functionality</value>
  953. </brief>
  954. <description>
  955. <value>This sequence tests the NASA OSAL over ChibiOS/RT functionalities related to timers</value>
  956. </description>
  957. <condition>
  958. <value />
  959. </condition>
  960. <shared_code>
  961. <value><![CDATA[#include <string.h>
  962. #include "osapi.h"
  963. uint32 tmid;
  964. uint32 cnt;
  965. static void tmr_callback(uint32 timer_id) {
  966. (void)timer_id;
  967. cnt++;
  968. }]]></value>
  969. </shared_code>
  970. <cases>
  971. <case>
  972. <brief>
  973. <value>OS_TimerCreate() and OS_TimerDelete() errors</value>
  974. </brief>
  975. <description>
  976. <value>Parameters checking in OS_TimerCreate() and OS_TimerDelete() is tested.</value>
  977. </description>
  978. <condition>
  979. <value />
  980. </condition>
  981. <various_code>
  982. <setup_code>
  983. <value />
  984. </setup_code>
  985. <teardown_code>
  986. <value />
  987. </teardown_code>
  988. <local_variables>
  989. <value />
  990. </local_variables>
  991. </various_code>
  992. <steps>
  993. <step>
  994. <description>
  995. <value>OS_TimerCreate() is invoked with timer_id set to NULL, an error is expected.</value>
  996. </description>
  997. <tags>
  998. <value />
  999. </tags>
  1000. <code>
  1001. <value><![CDATA[int32 err;
  1002. uint32 accuracy;
  1003. err = OS_TimerCreate(NULL, /* Error.*/
  1004. "failing timer",
  1005. &accuracy,
  1006. tmr_callback);
  1007. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  1008. </code>
  1009. </step>
  1010. <step>
  1011. <description>
  1012. <value>OS_TimerCreate() is invoked with timer_name set to NULL, an error is expected.</value>
  1013. </description>
  1014. <tags>
  1015. <value />
  1016. </tags>
  1017. <code>
  1018. <value><![CDATA[int32 err;
  1019. uint32 tmid;
  1020. uint32 accuracy;
  1021. err = OS_TimerCreate(&tmid,
  1022. NULL, /* Error.*/
  1023. &accuracy,
  1024. tmr_callback);
  1025. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  1026. </code>
  1027. </step>
  1028. <step>
  1029. <description>
  1030. <value>OS_TimerCreate() is invoked with accuracy set to NULL, an error is expected.</value>
  1031. </description>
  1032. <tags>
  1033. <value />
  1034. </tags>
  1035. <code>
  1036. <value><![CDATA[int32 err;
  1037. uint32 tmid;
  1038. err = OS_TimerCreate(&tmid,
  1039. "failing timer",
  1040. NULL, /* Error.*/
  1041. tmr_callback);
  1042. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  1043. </code>
  1044. </step>
  1045. <step>
  1046. <description>
  1047. <value>OS_TimerCreate() is invoked with callback_ptr set to NULL, an error is expected.</value>
  1048. </description>
  1049. <tags>
  1050. <value />
  1051. </tags>
  1052. <code>
  1053. <value><![CDATA[int32 err;
  1054. uint32 tmid;
  1055. uint32 accuracy;
  1056. err = OS_TimerCreate(&tmid,
  1057. "failing timer",
  1058. &accuracy,
  1059. NULL); /* Error.*/
  1060. test_assert(err == OS_TIMER_ERR_INVALID_ARGS, "NULL not detected");]]></value>
  1061. </code>
  1062. </step>
  1063. <step>
  1064. <description>
  1065. <value>OS_TimerCreate() is invoked with a very long timer name, an error is expected.</value>
  1066. </description>
  1067. <tags>
  1068. <value />
  1069. </tags>
  1070. <code>
  1071. <value><![CDATA[int32 err;
  1072. uint32 tmid;
  1073. uint32 accuracy;
  1074. err = OS_TimerCreate(&tmid,
  1075. "very very long timer name", /* Error.*/
  1076. &accuracy,
  1077. tmr_callback);
  1078. test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected");]]></value>
  1079. </code>
  1080. </step>
  1081. <step>
  1082. <description>
  1083. <value>OS_TimerDelete() is invoked with timer_id set to -1, an error is expected.</value>
  1084. </description>
  1085. <tags>
  1086. <value />
  1087. </tags>
  1088. <code>
  1089. <value><![CDATA[int32 err;
  1090. err = OS_TimerDelete((uint32)-1);
  1091. test_assert(err == OS_ERR_INVALID_ID, "wrong timer id not detected");]]></value>
  1092. </code>
  1093. </step>
  1094. <step>
  1095. <description>
  1096. <value>OS_TimerCreate() is invoked twice with duplicated name, an error is expected, then the queue is deleted using OS_TimerDelete().</value>
  1097. </description>
  1098. <tags>
  1099. <value />
  1100. </tags>
  1101. <code>
  1102. <value><![CDATA[int32 err;
  1103. uint32 tmid1, tmid2;
  1104. uint32 accuracy;
  1105. err = OS_TimerCreate(&tmid1, "my timer", &accuracy, tmr_callback);
  1106. test_assert(err == OS_SUCCESS, "timer creation failed");
  1107. err = OS_TimerCreate(&tmid2, "my timer", &accuracy, tmr_callback);
  1108. test_assert(err == OS_ERR_NAME_TAKEN, "name conflict not detected");
  1109. err = OS_TimerDelete(tmid1);
  1110. test_assert(err == OS_SUCCESS, "timer deletion failed");]]></value>
  1111. </code>
  1112. </step>
  1113. </steps>
  1114. </case>
  1115. <case>
  1116. <brief>
  1117. <value>OS_TimerSet() errors</value>
  1118. </brief>
  1119. <description>
  1120. <value>Parameters checking in OS_TimerSet() is tested.</value>
  1121. </description>
  1122. <condition>
  1123. <value />
  1124. </condition>
  1125. <various_code>
  1126. <setup_code>
  1127. <value />
  1128. </setup_code>
  1129. <teardown_code>
  1130. <value />
  1131. </teardown_code>
  1132. <local_variables>
  1133. <value />
  1134. </local_variables>
  1135. </various_code>
  1136. <steps>
  1137. <step>
  1138. <description>
  1139. <value>OS_TimerSet() is invoked with timer_id set to -1, an error is expected.</value>
  1140. </description>
  1141. <tags>
  1142. <value />
  1143. </tags>
  1144. <code>
  1145. <value><![CDATA[int32 err;
  1146. err = OS_TimerSet((uint32)-1, 10, 10);
  1147. test_assert(err == OS_ERR_INVALID_ID, "invalid timer_id not detected");]]></value>
  1148. </code>
  1149. </step>
  1150. </steps>
  1151. </case>
  1152. <case>
  1153. <brief>
  1154. <value>OS_TimerGetIdByName() errors</value>
  1155. </brief>
  1156. <description>
  1157. <value>Parameters checking in OS_TimerGetIdByName() is tested.</value>
  1158. </description>
  1159. <condition>
  1160. <value />
  1161. </condition>
  1162. <various_code>
  1163. <setup_code>
  1164. <value />
  1165. </setup_code>
  1166. <teardown_code>
  1167. <value />
  1168. </teardown_code>
  1169. <local_variables>
  1170. <value />
  1171. </local_variables>
  1172. </various_code>
  1173. <steps>
  1174. <step>
  1175. <description>
  1176. <value>OS_TimerGetIdByName() is invoked with timer_id set to NULL, an error is expected.</value>
  1177. </description>
  1178. <tags>
  1179. <value />
  1180. </tags>
  1181. <code>
  1182. <value><![CDATA[int32 err;
  1183. err = OS_TimerGetIdByName(NULL, "timer");
  1184. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  1185. </code>
  1186. </step>
  1187. <step>
  1188. <description>
  1189. <value>OS_TimerGetIdByName() is invoked with timer name set to NULL, an error is expected.</value>
  1190. </description>
  1191. <tags>
  1192. <value />
  1193. </tags>
  1194. <code>
  1195. <value><![CDATA[int32 err;
  1196. err = OS_TimerGetIdByName(&tmid, NULL);
  1197. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  1198. </code>
  1199. </step>
  1200. <step>
  1201. <description>
  1202. <value>OS_TimerGetIdByName() is invoked with a very long task name, an error is expected.</value>
  1203. </description>
  1204. <tags>
  1205. <value />
  1206. </tags>
  1207. <code>
  1208. <value><![CDATA[int32 err;
  1209. err = OS_TimerGetIdByName(&tmid, "very very long timer name");
  1210. test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected");]]></value>
  1211. </code>
  1212. </step>
  1213. </steps>
  1214. </case>
  1215. <case>
  1216. <brief>
  1217. <value>OS_TimerSet() one-shot functionality</value>
  1218. </brief>
  1219. <description>
  1220. <value>A timer is tested in one-shot mode.</value>
  1221. </description>
  1222. <condition>
  1223. <value />
  1224. </condition>
  1225. <various_code>
  1226. <setup_code>
  1227. <value><![CDATA[uint32 accuracy;
  1228. cnt = 0;
  1229. tmid = 0;
  1230. (void) OS_TimerCreate(&tmid, "test timer", &accuracy, tmr_callback);]]></value>
  1231. </setup_code>
  1232. <teardown_code>
  1233. <value><![CDATA[if (tmid != 0) {
  1234. (void) OS_TimerDelete(tmid);
  1235. }]]></value>
  1236. </teardown_code>
  1237. <local_variables>
  1238. <value><![CDATA[uint32 local_tmid;]]></value>
  1239. </local_variables>
  1240. </various_code>
  1241. <steps>
  1242. <step>
  1243. <description>
  1244. <value>Retrieving the timer by name.</value>
  1245. </description>
  1246. <tags>
  1247. <value />
  1248. </tags>
  1249. <code>
  1250. <value><![CDATA[int32 err;
  1251. err = OS_TimerGetIdByName(&local_tmid, "test timer");
  1252. test_assert(err == OS_SUCCESS, "timer not found");]]></value>
  1253. </code>
  1254. </step>
  1255. <step>
  1256. <description>
  1257. <value>Setting up the timer for a 70mS one-shot tick.</value>
  1258. </description>
  1259. <tags>
  1260. <value />
  1261. </tags>
  1262. <code>
  1263. <value><![CDATA[uint32 err;
  1264. err = OS_TimerSet(local_tmid, 70000, 0);
  1265. test_assert(err == OS_SUCCESS, "timer setup failed");]]></value>
  1266. </code>
  1267. </step>
  1268. <step>
  1269. <description>
  1270. <value>Waiting one second then counting the occurred ticks.</value>
  1271. </description>
  1272. <tags>
  1273. <value />
  1274. </tags>
  1275. <code>
  1276. <value><![CDATA[(void) OS_TaskDelay(1000);
  1277. test_assert(cnt == 1, "wrong ticks");]]></value>
  1278. </code>
  1279. </step>
  1280. </steps>
  1281. </case>
  1282. <case>
  1283. <brief>
  1284. <value>OS_TimerSet() periodic functionality</value>
  1285. </brief>
  1286. <description>
  1287. <value>A timer is tested in periodic mode.</value>
  1288. </description>
  1289. <condition>
  1290. <value />
  1291. </condition>
  1292. <various_code>
  1293. <setup_code>
  1294. <value><![CDATA[uint32 accuracy;
  1295. cnt = 0;
  1296. tmid = 0;
  1297. (void) OS_TimerCreate(&tmid, "test timer", &accuracy, tmr_callback);]]></value>
  1298. </setup_code>
  1299. <teardown_code>
  1300. <value><![CDATA[if (tmid != 0) {
  1301. (void) OS_TimerSet(tmid, 0, 0);
  1302. (void) OS_TimerDelete(tmid);
  1303. }]]></value>
  1304. </teardown_code>
  1305. <local_variables>
  1306. <value><![CDATA[uint32 local_tmid;]]></value>
  1307. </local_variables>
  1308. </various_code>
  1309. <steps>
  1310. <step>
  1311. <description>
  1312. <value>Retrieving the timer by name.</value>
  1313. </description>
  1314. <tags>
  1315. <value />
  1316. </tags>
  1317. <code>
  1318. <value><![CDATA[int32 err;
  1319. err = OS_TimerGetIdByName(&local_tmid, "test timer");
  1320. test_assert(err == OS_SUCCESS, "timer not found");]]></value>
  1321. </code>
  1322. </step>
  1323. <step>
  1324. <description>
  1325. <value>Setting up the timer for a 70mS periodic tick.</value>
  1326. </description>
  1327. <tags>
  1328. <value />
  1329. </tags>
  1330. <code>
  1331. <value><![CDATA[uint32 err;
  1332. err = OS_TimerSet(local_tmid, 70000, 70000);
  1333. test_assert(err == OS_SUCCESS, "timer setup failed");]]></value>
  1334. </code>
  1335. </step>
  1336. <step>
  1337. <description>
  1338. <value>Waiting one second then counting the occurred ticks.</value>
  1339. </description>
  1340. <tags>
  1341. <value />
  1342. </tags>
  1343. <code>
  1344. <value><![CDATA[(void) OS_TaskDelay(1000);
  1345. test_assert(cnt == 14, "wrong ticks");]]></value>
  1346. </code>
  1347. </step>
  1348. <step>
  1349. <description>
  1350. <value>Stopping the timer.</value>
  1351. </description>
  1352. <tags>
  1353. <value />
  1354. </tags>
  1355. <code>
  1356. <value><![CDATA[uint32 err;
  1357. err = OS_TimerSet(local_tmid, 0, 0);
  1358. test_assert(err == OS_SUCCESS, "timer stop failed");]]></value>
  1359. </code>
  1360. </step>
  1361. </steps>
  1362. </case>
  1363. </cases>
  1364. </sequence>
  1365. <sequence>
  1366. <type index="0">
  1367. <value>Internal Tests</value>
  1368. </type>
  1369. <brief>
  1370. <value>Binary Semaphores Functionality</value>
  1371. </brief>
  1372. <description>
  1373. <value>This sequence tests the NASA OSAL over ChibiOS/RT functionalities related to binary semaphores.</value>
  1374. </description>
  1375. <condition>
  1376. <value />
  1377. </condition>
  1378. <shared_code>
  1379. <value><![CDATA[#include "osapi.h"
  1380. uint32 bsid;]]></value>
  1381. </shared_code>
  1382. <cases>
  1383. <case>
  1384. <brief>
  1385. <value>OS_BinSemCreate() and OS_BinSemDelete() errors</value>
  1386. </brief>
  1387. <description>
  1388. <value>Parameters checking in OS_BinSemCreate() and OS_BinSemDelete() is tested.</value>
  1389. </description>
  1390. <condition>
  1391. <value />
  1392. </condition>
  1393. <various_code>
  1394. <setup_code>
  1395. <value />
  1396. </setup_code>
  1397. <teardown_code>
  1398. <value />
  1399. </teardown_code>
  1400. <local_variables>
  1401. <value />
  1402. </local_variables>
  1403. </various_code>
  1404. <steps>
  1405. <step>
  1406. <description>
  1407. <value>OS_BinSemCreate() is invoked with sem_id set to NULL, an error is expected.</value>
  1408. </description>
  1409. <tags>
  1410. <value />
  1411. </tags>
  1412. <code>
  1413. <value><![CDATA[int32 err;
  1414. err = OS_BinSemCreate(NULL, /* Error.*/
  1415. "failing semaphore",
  1416. 0,
  1417. 0);
  1418. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  1419. </code>
  1420. </step>
  1421. <step>
  1422. <description>
  1423. <value>OS_BinSemCreate() is invoked with sem_name set to NULL, an error is expected.</value>
  1424. </description>
  1425. <tags>
  1426. <value />
  1427. </tags>
  1428. <code>
  1429. <value><![CDATA[int32 err;
  1430. err = OS_BinSemCreate(&bsid,
  1431. NULL, /* Error.*/
  1432. 0,
  1433. 0);
  1434. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  1435. </code>
  1436. </step>
  1437. <step>
  1438. <description>
  1439. <value>OS_BinSemCreate() is invoked with an invalid sem_initial_value, an error is expected.</value>
  1440. </description>
  1441. <tags>
  1442. <value />
  1443. </tags>
  1444. <code>
  1445. <value><![CDATA[int32 err;
  1446. err = OS_BinSemCreate(&bsid,
  1447. "failing semaphore",
  1448. 2, /* Error.*/
  1449. 0);
  1450. test_assert(err == OS_INVALID_INT_NUM, "counter error not detected");]]></value>
  1451. </code>
  1452. </step>
  1453. <step>
  1454. <description>
  1455. <value>OS_BinSemCreate() is invoked with a very long timer name, an error is expected.</value>
  1456. </description>
  1457. <tags>
  1458. <value />
  1459. </tags>
  1460. <code>
  1461. <value><![CDATA[#if 0 /* Semaphore name currently not implemented.*/
  1462. int32 err;
  1463. err = OS_BinSemCreate(&bsid,
  1464. "very very long semaphore name", /* Error.*/
  1465. 0,
  1466. 0);
  1467. test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected");
  1468. #endif]]></value>
  1469. </code>
  1470. </step>
  1471. <step>
  1472. <description>
  1473. <value>OS_BinSemDelete() is invoked with timer_id set to -1, an error is expected.</value>
  1474. </description>
  1475. <tags>
  1476. <value />
  1477. </tags>
  1478. <code>
  1479. <value><![CDATA[int32 err;
  1480. err = OS_BinSemDelete((uint32)-1);
  1481. test_assert(err == OS_ERR_INVALID_ID, "wrong semaphore id not detected");]]></value>
  1482. </code>
  1483. </step>
  1484. <step>
  1485. <description>
  1486. <value>OS_BinSemCreate() is invoked twice with duplicated name, an error is expected, then the queue is deleted using OS_BinSemDelete().</value>
  1487. </description>
  1488. <tags>
  1489. <value />
  1490. </tags>
  1491. <code>
  1492. <value><![CDATA[int32 err;
  1493. uint32 bsid1; /*, bsid2;*/
  1494. err = OS_BinSemCreate(&bsid1, "my semaphore", 0, 0);
  1495. test_assert(err == OS_SUCCESS, "semaphore creation failed");
  1496. #if 0 /* Semaphore name currently not implemented.*/
  1497. err = OS_BinSemCreate(&bsid2, "my semaphore", 0, 0);
  1498. test_assert(err == OS_ERR_NAME_TAKEN, "name conflict not detected");
  1499. #endif
  1500. err = OS_BinSemDelete(bsid1);
  1501. test_assert(err == OS_SUCCESS, "semaphore deletion failed");]]></value>
  1502. </code>
  1503. </step>
  1504. </steps>
  1505. </case>
  1506. <case>
  1507. <brief>
  1508. <value>OS_BinSemFlush() errors</value>
  1509. </brief>
  1510. <description>
  1511. <value>Parameters checking in OS_BinSemFlush() is tested.</value>
  1512. </description>
  1513. <condition>
  1514. <value />
  1515. </condition>
  1516. <various_code>
  1517. <setup_code>
  1518. <value />
  1519. </setup_code>
  1520. <teardown_code>
  1521. <value />
  1522. </teardown_code>
  1523. <local_variables>
  1524. <value />
  1525. </local_variables>
  1526. </various_code>
  1527. <steps>
  1528. <step>
  1529. <description>
  1530. <value>OS_BinSemFlush() is invoked with sem_id set to -1, an error is expected.</value>
  1531. </description>
  1532. <tags>
  1533. <value />
  1534. </tags>
  1535. <code>
  1536. <value><![CDATA[int32 err;
  1537. err = OS_BinSemFlush((uint32)-1);
  1538. test_assert(err == OS_ERR_INVALID_ID, "invalid sem_id not detected");]]></value>
  1539. </code>
  1540. </step>
  1541. </steps>
  1542. </case>
  1543. <case>
  1544. <brief>
  1545. <value>OS_BinSemGive() errors</value>
  1546. </brief>
  1547. <description>
  1548. <value>Parameters checking in OS_BinSemGive() is tested.</value>
  1549. </description>
  1550. <condition>
  1551. <value />
  1552. </condition>
  1553. <various_code>
  1554. <setup_code>
  1555. <value />
  1556. </setup_code>
  1557. <teardown_code>
  1558. <value />
  1559. </teardown_code>
  1560. <local_variables>
  1561. <value />
  1562. </local_variables>
  1563. </various_code>
  1564. <steps>
  1565. <step>
  1566. <description>
  1567. <value>OS_BinSemGive() is invoked with sem_id set to -1, an error is expected.</value>
  1568. </description>
  1569. <tags>
  1570. <value />
  1571. </tags>
  1572. <code>
  1573. <value><![CDATA[int32 err;
  1574. err = OS_BinSemGive((uint32)-1);
  1575. test_assert(err == OS_ERR_INVALID_ID, "invalid sem_id not detected");]]></value>
  1576. </code>
  1577. </step>
  1578. </steps>
  1579. </case>
  1580. <case>
  1581. <brief>
  1582. <value>OS_BinSemTake() errors</value>
  1583. </brief>
  1584. <description>
  1585. <value>Parameters checking in OS_BinSemTake() is tested.</value>
  1586. </description>
  1587. <condition>
  1588. <value />
  1589. </condition>
  1590. <various_code>
  1591. <setup_code>
  1592. <value />
  1593. </setup_code>
  1594. <teardown_code>
  1595. <value />
  1596. </teardown_code>
  1597. <local_variables>
  1598. <value />
  1599. </local_variables>
  1600. </various_code>
  1601. <steps>
  1602. <step>
  1603. <description>
  1604. <value>OS_BinSemTake() is invoked with sem_id set to -1, an error is expected.</value>
  1605. </description>
  1606. <tags>
  1607. <value />
  1608. </tags>
  1609. <code>
  1610. <value><![CDATA[int32 err;
  1611. err = OS_BinSemTake((uint32)-1);
  1612. test_assert(err == OS_ERR_INVALID_ID, "invalid sem_id not detected");]]></value>
  1613. </code>
  1614. </step>
  1615. </steps>
  1616. </case>
  1617. <case>
  1618. <brief>
  1619. <value>OS_BinSemTimedWait() errors</value>
  1620. </brief>
  1621. <description>
  1622. <value>Parameters checking in OS_BinSemTimedWait() is tested.</value>
  1623. </description>
  1624. <condition>
  1625. <value />
  1626. </condition>
  1627. <various_code>
  1628. <setup_code>
  1629. <value><![CDATA[bsid = 0;
  1630. (void) OS_BinSemCreate(&bsid, "test semaphore", 0, 0);]]></value>
  1631. </setup_code>
  1632. <teardown_code>
  1633. <value><![CDATA[if (bsid > 0) {
  1634. (void) OS_BinSemDelete(bsid);
  1635. }]]></value>
  1636. </teardown_code>
  1637. <local_variables>
  1638. <value />
  1639. </local_variables>
  1640. </various_code>
  1641. <steps>
  1642. <step>
  1643. <description>
  1644. <value>OS_BinSemTimedWait() is invoked with sem_id set to -1, an error is expected.</value>
  1645. </description>
  1646. <tags>
  1647. <value />
  1648. </tags>
  1649. <code>
  1650. <value><![CDATA[int32 err;
  1651. err = OS_BinSemTimedWait((uint32)-1, 1000);
  1652. test_assert(err == OS_ERR_INVALID_ID, "invalid sem_id not detected");]]></value>
  1653. </code>
  1654. </step>
  1655. <step>
  1656. <description>
  1657. <value>OS_BinSemTimedWait() is invoked with msecs set to 0, an error is expected.</value>
  1658. </description>
  1659. <tags>
  1660. <value />
  1661. </tags>
  1662. <code>
  1663. <value><![CDATA[int32 err;
  1664. err = OS_BinSemTimedWait(bsid, 0);
  1665. test_assert(err == OS_INVALID_INT_NUM, "invalid msec not detected");]]></value>
  1666. </code>
  1667. </step>
  1668. </steps>
  1669. </case>
  1670. <case>
  1671. <brief>
  1672. <value>OS_BinSemGetIdByName() errors</value>
  1673. </brief>
  1674. <description>
  1675. <value>Parameters checking in OS_BinSemGetIdByName() is tested.</value>
  1676. </description>
  1677. <condition>
  1678. <value />
  1679. </condition>
  1680. <various_code>
  1681. <setup_code>
  1682. <value />
  1683. </setup_code>
  1684. <teardown_code>
  1685. <value />
  1686. </teardown_code>
  1687. <local_variables>
  1688. <value />
  1689. </local_variables>
  1690. </various_code>
  1691. <steps>
  1692. <step>
  1693. <description>
  1694. <value>OS_BinSemGetIdByName() is invoked with sem_id set to NULL, an error is expected.</value>
  1695. </description>
  1696. <tags>
  1697. <value />
  1698. </tags>
  1699. <code>
  1700. <value><![CDATA[int32 err;
  1701. err = OS_BinSemGetIdByName(NULL, "semaphore");
  1702. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  1703. </code>
  1704. </step>
  1705. <step>
  1706. <description>
  1707. <value>OS_BinSemGetIdByName() is invoked with semaphore name set to NULL, an error is expected.</value>
  1708. </description>
  1709. <tags>
  1710. <value />
  1711. </tags>
  1712. <code>
  1713. <value><![CDATA[int32 err;
  1714. err = OS_BinSemGetIdByName(&bsid, NULL);
  1715. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  1716. </code>
  1717. </step>
  1718. <step>
  1719. <description>
  1720. <value>OS_BinSemGetIdByName() is invoked with a very long task name, an error is expected.</value>
  1721. </description>
  1722. <tags>
  1723. <value />
  1724. </tags>
  1725. <code>
  1726. <value><![CDATA[int32 err;
  1727. err = OS_BinSemGetIdByName(&bsid, "very very long semaphore name");
  1728. test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected");]]></value>
  1729. </code>
  1730. </step>
  1731. </steps>
  1732. </case>
  1733. <case>
  1734. <brief>
  1735. <value>OS_BinSemTimedWait() timeout functionality</value>
  1736. </brief>
  1737. <description>
  1738. <value>OS_BinSemCreate() timeout functionality is tested.</value>
  1739. </description>
  1740. <condition>
  1741. <value />
  1742. </condition>
  1743. <various_code>
  1744. <setup_code>
  1745. <value><![CDATA[bsid = 0;
  1746. (void) OS_BinSemCreate(&bsid, "test semaphore", 0, 0);]]></value>
  1747. </setup_code>
  1748. <teardown_code>
  1749. <value><![CDATA[if (bsid > 0) {
  1750. (void) OS_BinSemDelete(bsid);
  1751. }]]></value>
  1752. </teardown_code>
  1753. <local_variables>
  1754. <value />
  1755. </local_variables>
  1756. </various_code>
  1757. <steps>
  1758. <step>
  1759. <description>
  1760. <value>OS_BinSemTimedWait() is invoked with timeout set to one second, an error is expected.</value>
  1761. </description>
  1762. <tags>
  1763. <value />
  1764. </tags>
  1765. <code>
  1766. <value><![CDATA[int32 err;
  1767. err = OS_BinSemTimedWait(bsid, 1000);
  1768. test_assert(err == OS_SEM_TIMEOUT, "unexpected error code");]]></value>
  1769. </code>
  1770. </step>
  1771. </steps>
  1772. </case>
  1773. </cases>
  1774. </sequence>
  1775. <sequence>
  1776. <type index="0">
  1777. <value>Internal Tests</value>
  1778. </type>
  1779. <brief>
  1780. <value>Counter Semaphores Functionality</value>
  1781. </brief>
  1782. <description>
  1783. <value>This sequence tests the NASA OSAL over ChibiOS/RT functionalities related to counter semaphores.</value>
  1784. </description>
  1785. <condition>
  1786. <value />
  1787. </condition>
  1788. <shared_code>
  1789. <value><![CDATA[#include "osapi.h"
  1790. uint32 csid;]]></value>
  1791. </shared_code>
  1792. <cases>
  1793. <case>
  1794. <brief>
  1795. <value>OS_CountSemCreate() and OS_CountSemDelete() errors</value>
  1796. </brief>
  1797. <description>
  1798. <value>Parameters checking in OS_CountSemCreate() and OS_CountSemDelete() is tested.</value>
  1799. </description>
  1800. <condition>
  1801. <value />
  1802. </condition>
  1803. <various_code>
  1804. <setup_code>
  1805. <value />
  1806. </setup_code>
  1807. <teardown_code>
  1808. <value />
  1809. </teardown_code>
  1810. <local_variables>
  1811. <value />
  1812. </local_variables>
  1813. </various_code>
  1814. <steps>
  1815. <step>
  1816. <description>
  1817. <value>OS_CountSemCreate() is invoked with sem_id set to NULL, an error is expected.</value>
  1818. </description>
  1819. <tags>
  1820. <value />
  1821. </tags>
  1822. <code>
  1823. <value><![CDATA[int32 err;
  1824. err = OS_CountSemCreate(NULL, /* Error.*/
  1825. "failing semaphore",
  1826. 0,
  1827. 0);
  1828. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  1829. </code>
  1830. </step>
  1831. <step>
  1832. <description>
  1833. <value>OS_CountSemCreate() is invoked with sem_name set to NULL, an error is expected.</value>
  1834. </description>
  1835. <tags>
  1836. <value />
  1837. </tags>
  1838. <code>
  1839. <value><![CDATA[int32 err;
  1840. err = OS_CountSemCreate(&csid,
  1841. NULL, /* Error.*/
  1842. 0,
  1843. 0);
  1844. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  1845. </code>
  1846. </step>
  1847. <step>
  1848. <description>
  1849. <value>OS_CountSemCreate() is invoked with an invalid sem_initial_value, an error is expected.</value>
  1850. </description>
  1851. <tags>
  1852. <value />
  1853. </tags>
  1854. <code>
  1855. <value><![CDATA[int32 err;
  1856. err = OS_CountSemCreate(&csid,
  1857. "failing semaphore",
  1858. (uint32)-1, /* Error.*/
  1859. 0);
  1860. test_assert(err == OS_INVALID_INT_NUM, "counter error not detected");]]></value>
  1861. </code>
  1862. </step>
  1863. <step>
  1864. <description>
  1865. <value>OS_CountSemCreate() is invoked with a very long timer name, an error is expected.</value>
  1866. </description>
  1867. <tags>
  1868. <value />
  1869. </tags>
  1870. <code>
  1871. <value><![CDATA[#if 0 /* Semaphore name currently not implemented.*/
  1872. int32 err;
  1873. err = OS_CountSemCreate(&csid,
  1874. "very very long semaphore name",/* Error.*/
  1875. 0,
  1876. 0);
  1877. test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected");
  1878. #endif]]></value>
  1879. </code>
  1880. </step>
  1881. <step>
  1882. <description>
  1883. <value>OS_CountSemDelete() is invoked with timer_id set to -1, an error is expected.</value>
  1884. </description>
  1885. <tags>
  1886. <value />
  1887. </tags>
  1888. <code>
  1889. <value><![CDATA[int32 err;
  1890. err = OS_CountSemDelete((uint32)-1);
  1891. test_assert(err == OS_ERR_INVALID_ID, "wrong semaphore id not detected");]]></value>
  1892. </code>
  1893. </step>
  1894. <step>
  1895. <description>
  1896. <value>OS_CountSemCreate() is invoked twice with duplicated name, an error is expected, then the queue is deleted using OS_CountSemDelete().</value>
  1897. </description>
  1898. <tags>
  1899. <value />
  1900. </tags>
  1901. <code>
  1902. <value><![CDATA[int32 err;
  1903. uint32 csid1; /*, csid2;*/
  1904. err = OS_CountSemCreate(&csid1, "my semaphore", 0, 0);
  1905. test_assert(err == OS_SUCCESS, "semaphore creation failed");
  1906. #if 0 /* Semaphore name currently not implemented.*/
  1907. err = OS_CountSemCreate(&csid2, "my semaphore", 0, 0);
  1908. test_assert(err == OS_ERR_NAME_TAKEN, "name conflict not detected");
  1909. #endif
  1910. err = OS_CountSemDelete(csid1);
  1911. test_assert(err == OS_SUCCESS, "semaphore deletion failed");]]></value>
  1912. </code>
  1913. </step>
  1914. </steps>
  1915. </case>
  1916. <case>
  1917. <brief>
  1918. <value>OS_CountSemGive() errors</value>
  1919. </brief>
  1920. <description>
  1921. <value>Parameters checking in OS_CountSemGive() is tested.</value>
  1922. </description>
  1923. <condition>
  1924. <value />
  1925. </condition>
  1926. <various_code>
  1927. <setup_code>
  1928. <value />
  1929. </setup_code>
  1930. <teardown_code>
  1931. <value />
  1932. </teardown_code>
  1933. <local_variables>
  1934. <value />
  1935. </local_variables>
  1936. </various_code>
  1937. <steps>
  1938. <step>
  1939. <description>
  1940. <value>OS_CountSemGive() is invoked with sem_id set to -1, an error is expected.</value>
  1941. </description>
  1942. <tags>
  1943. <value />
  1944. </tags>
  1945. <code>
  1946. <value><![CDATA[int32 err;
  1947. err = OS_CountSemGive((uint32)-1);
  1948. test_assert(err == OS_ERR_INVALID_ID, "invalid sem_id not detected");]]></value>
  1949. </code>
  1950. </step>
  1951. </steps>
  1952. </case>
  1953. <case>
  1954. <brief>
  1955. <value>OS_CountSemTake() errors</value>
  1956. </brief>
  1957. <description>
  1958. <value>Parameters checking in OS_CountSemTake() is tested.</value>
  1959. </description>
  1960. <condition>
  1961. <value />
  1962. </condition>
  1963. <various_code>
  1964. <setup_code>
  1965. <value />
  1966. </setup_code>
  1967. <teardown_code>
  1968. <value />
  1969. </teardown_code>
  1970. <local_variables>
  1971. <value />
  1972. </local_variables>
  1973. </various_code>
  1974. <steps>
  1975. <step>
  1976. <description>
  1977. <value>OS_CountSemTake() is invoked with sem_id set to -1, an error is expected.</value>
  1978. </description>
  1979. <tags>
  1980. <value />
  1981. </tags>
  1982. <code>
  1983. <value><![CDATA[int32 err;
  1984. err = OS_CountSemTake((uint32)-1);
  1985. test_assert(err == OS_ERR_INVALID_ID, "invalid sem_id not detected");]]></value>
  1986. </code>
  1987. </step>
  1988. </steps>
  1989. </case>
  1990. <case>
  1991. <brief>
  1992. <value>OS_CountSemTimedWait() errors</value>
  1993. </brief>
  1994. <description>
  1995. <value>Parameters checking in OS_CountSemTimedWait() is tested.</value>
  1996. </description>
  1997. <condition>
  1998. <value />
  1999. </condition>
  2000. <various_code>
  2001. <setup_code>
  2002. <value><![CDATA[csid = 0;
  2003. (void) OS_CountSemCreate(&csid, "test semaphore", 0, 0);]]></value>
  2004. </setup_code>
  2005. <teardown_code>
  2006. <value><![CDATA[if (csid > 0) {
  2007. (void) OS_CountSemDelete(csid);
  2008. }]]></value>
  2009. </teardown_code>
  2010. <local_variables>
  2011. <value />
  2012. </local_variables>
  2013. </various_code>
  2014. <steps>
  2015. <step>
  2016. <description>
  2017. <value>OS_CountSemTimedWait() is invoked with sem_id set to -1, an error is expected.</value>
  2018. </description>
  2019. <tags>
  2020. <value />
  2021. </tags>
  2022. <code>
  2023. <value><![CDATA[int32 err;
  2024. err = OS_CountSemTimedWait((uint32)-1, 1000);
  2025. test_assert(err == OS_ERR_INVALID_ID, "invalid sem_id not detected");]]></value>
  2026. </code>
  2027. </step>
  2028. <step>
  2029. <description>
  2030. <value>OS_CountSemTimedWait() is invoked with msecs set to 0, an error is expected.</value>
  2031. </description>
  2032. <tags>
  2033. <value />
  2034. </tags>
  2035. <code>
  2036. <value><![CDATA[int32 err;
  2037. err = OS_CountSemTimedWait(csid, 0);
  2038. test_assert(err == OS_INVALID_INT_NUM, "invalid msec not detected");]]></value>
  2039. </code>
  2040. </step>
  2041. </steps>
  2042. </case>
  2043. <case>
  2044. <brief>
  2045. <value>OS_CountSemGetIdByName() errors</value>
  2046. </brief>
  2047. <description>
  2048. <value>Parameters checking in OS_CountSemGetIdByName() is tested.</value>
  2049. </description>
  2050. <condition>
  2051. <value />
  2052. </condition>
  2053. <various_code>
  2054. <setup_code>
  2055. <value />
  2056. </setup_code>
  2057. <teardown_code>
  2058. <value />
  2059. </teardown_code>
  2060. <local_variables>
  2061. <value />
  2062. </local_variables>
  2063. </various_code>
  2064. <steps>
  2065. <step>
  2066. <description>
  2067. <value>OS_CountSemGetIdByName() is invoked with sem_id set to NULL, an error is expected.</value>
  2068. </description>
  2069. <tags>
  2070. <value />
  2071. </tags>
  2072. <code>
  2073. <value><![CDATA[int32 err;
  2074. err = OS_CountSemGetIdByName(NULL, "semaphore");
  2075. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  2076. </code>
  2077. </step>
  2078. <step>
  2079. <description>
  2080. <value>OS_CountSemGetIdByName() is invoked with semaphore name set to NULL, an error is expected.</value>
  2081. </description>
  2082. <tags>
  2083. <value />
  2084. </tags>
  2085. <code>
  2086. <value><![CDATA[int32 err;
  2087. err = OS_CountSemGetIdByName(&csid, NULL);
  2088. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  2089. </code>
  2090. </step>
  2091. <step>
  2092. <description>
  2093. <value>OS_CountSemGetIdByName() is invoked with a very long task name, an error is expected.</value>
  2094. </description>
  2095. <tags>
  2096. <value />
  2097. </tags>
  2098. <code>
  2099. <value><![CDATA[int32 err;
  2100. err = OS_CountSemGetIdByName(&csid, "very very long semaphore name");
  2101. test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected");]]></value>
  2102. </code>
  2103. </step>
  2104. </steps>
  2105. </case>
  2106. <case>
  2107. <brief>
  2108. <value>OS_CountSemTimedWait() timeout functionality</value>
  2109. </brief>
  2110. <description>
  2111. <value>OS_CountSemCreate() timeout functionality is tested.</value>
  2112. </description>
  2113. <condition>
  2114. <value />
  2115. </condition>
  2116. <various_code>
  2117. <setup_code>
  2118. <value><![CDATA[csid = 0;
  2119. (void) OS_CountSemCreate(&csid, "test semaphore", 0, 0);]]></value>
  2120. </setup_code>
  2121. <teardown_code>
  2122. <value><![CDATA[if (csid > 0) {
  2123. (void) OS_CountSemDelete(csid);
  2124. }]]></value>
  2125. </teardown_code>
  2126. <local_variables>
  2127. <value />
  2128. </local_variables>
  2129. </various_code>
  2130. <steps>
  2131. <step>
  2132. <description>
  2133. <value>OS_CountSemTimedWait() is invoked with timeout set to one second, an error is expected.</value>
  2134. </description>
  2135. <tags>
  2136. <value />
  2137. </tags>
  2138. <code>
  2139. <value><![CDATA[int32 err;
  2140. err = OS_CountSemTimedWait(csid, 1000);
  2141. test_assert(err == OS_SEM_TIMEOUT, "unexpected error code");]]></value>
  2142. </code>
  2143. </step>
  2144. </steps>
  2145. </case>
  2146. </cases>
  2147. </sequence>
  2148. <sequence>
  2149. <type index="0">
  2150. <value>Internal Tests</value>
  2151. </type>
  2152. <brief>
  2153. <value>Mutex Semaphores Functionality</value>
  2154. </brief>
  2155. <description>
  2156. <value>This sequence tests the NASA OSAL over ChibiOS/RT functionalities related to mutex semaphores.</value>
  2157. </description>
  2158. <condition>
  2159. <value />
  2160. </condition>
  2161. <shared_code>
  2162. <value><![CDATA[#include "osapi.h"
  2163. uint32 msid;]]></value>
  2164. </shared_code>
  2165. <cases>
  2166. <case>
  2167. <brief>
  2168. <value>OS_MutSemCreate() and OS_MutSemDelete() errors</value>
  2169. </brief>
  2170. <description>
  2171. <value>Parameters checking in OS_MutSemCreate() and OS_MutSemDelete() is tested.</value>
  2172. </description>
  2173. <condition>
  2174. <value />
  2175. </condition>
  2176. <various_code>
  2177. <setup_code>
  2178. <value />
  2179. </setup_code>
  2180. <teardown_code>
  2181. <value />
  2182. </teardown_code>
  2183. <local_variables>
  2184. <value />
  2185. </local_variables>
  2186. </various_code>
  2187. <steps>
  2188. <step>
  2189. <description>
  2190. <value>OS_MutSemCreate() is invoked with sem_id set to NULL, an error is expected.</value>
  2191. </description>
  2192. <tags>
  2193. <value />
  2194. </tags>
  2195. <code>
  2196. <value><![CDATA[int32 err;
  2197. err = OS_MutSemCreate(NULL, /* Error.*/
  2198. "failing semaphore",
  2199. 0);
  2200. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  2201. </code>
  2202. </step>
  2203. <step>
  2204. <description>
  2205. <value>OS_MutSemCreate() is invoked with sem_name set to NULL, an error is expected.</value>
  2206. </description>
  2207. <tags>
  2208. <value />
  2209. </tags>
  2210. <code>
  2211. <value><![CDATA[int32 err;
  2212. err = OS_MutSemCreate(&msid,
  2213. NULL, /* Error.*/
  2214. 0);
  2215. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  2216. </code>
  2217. </step>
  2218. <step>
  2219. <description>
  2220. <value>OS_MutSemCreate() is invoked with a very long timer name, an error is expected.</value>
  2221. </description>
  2222. <tags>
  2223. <value />
  2224. </tags>
  2225. <code>
  2226. <value><![CDATA[#if 0 /* Semaphore name currently not implemented.*/
  2227. int32 err;
  2228. err = OS_MutSemCreate(&msid,
  2229. "very very long semaphore name", /* Error.*/
  2230. 0);
  2231. test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected");
  2232. #endif]]></value>
  2233. </code>
  2234. </step>
  2235. <step>
  2236. <description>
  2237. <value>OS_MutSemDelete() is invoked with timer_id set to -1, an error is expected.</value>
  2238. </description>
  2239. <tags>
  2240. <value />
  2241. </tags>
  2242. <code>
  2243. <value><![CDATA[int32 err;
  2244. err = OS_MutSemDelete((uint32)-1);
  2245. test_assert(err == OS_ERR_INVALID_ID, "wrong semaphore id not detected");]]></value>
  2246. </code>
  2247. </step>
  2248. <step>
  2249. <description>
  2250. <value>OS_MutSemCreate() is invoked twice with duplicated name, an error is expected, then the queue is deleted using OS_MutSemDelete().</value>
  2251. </description>
  2252. <tags>
  2253. <value />
  2254. </tags>
  2255. <code>
  2256. <value><![CDATA[int32 err;
  2257. uint32 msid1; /*, msid2;*/
  2258. err = OS_MutSemCreate(&msid1, "my semaphore", 0);
  2259. test_assert(err == OS_SUCCESS, "semaphore creation failed");
  2260. #if 0 /* Semaphore name currently not implemented.*/
  2261. err = OS_MutSemCreate(&msid2, "my semaphore", 0);
  2262. test_assert(err == OS_ERR_NAME_TAKEN, "name conflict not detected");
  2263. #endif
  2264. err = OS_MutSemDelete(msid1);
  2265. test_assert(err == OS_SUCCESS, "semaphore deletion failed");]]></value>
  2266. </code>
  2267. </step>
  2268. </steps>
  2269. </case>
  2270. <case>
  2271. <brief>
  2272. <value>OS_MutSemGive() errors</value>
  2273. </brief>
  2274. <description>
  2275. <value>Parameters checking in OS_MutSemGive() is tested.</value>
  2276. </description>
  2277. <condition>
  2278. <value />
  2279. </condition>
  2280. <various_code>
  2281. <setup_code>
  2282. <value />
  2283. </setup_code>
  2284. <teardown_code>
  2285. <value />
  2286. </teardown_code>
  2287. <local_variables>
  2288. <value />
  2289. </local_variables>
  2290. </various_code>
  2291. <steps>
  2292. <step>
  2293. <description>
  2294. <value>OS_MutSemGive() is invoked with sem_id set to -1, an error is expected.</value>
  2295. </description>
  2296. <tags>
  2297. <value />
  2298. </tags>
  2299. <code>
  2300. <value><![CDATA[int32 err;
  2301. err = OS_MutSemGive((uint32)-1);
  2302. test_assert(err == OS_ERR_INVALID_ID, "invalid sem_id not detected");]]></value>
  2303. </code>
  2304. </step>
  2305. </steps>
  2306. </case>
  2307. <case>
  2308. <brief>
  2309. <value>OS_MutSemTake() errors</value>
  2310. </brief>
  2311. <description>
  2312. <value>Parameters checking in OS_MutSemTake() is tested.</value>
  2313. </description>
  2314. <condition>
  2315. <value />
  2316. </condition>
  2317. <various_code>
  2318. <setup_code>
  2319. <value />
  2320. </setup_code>
  2321. <teardown_code>
  2322. <value />
  2323. </teardown_code>
  2324. <local_variables>
  2325. <value />
  2326. </local_variables>
  2327. </various_code>
  2328. <steps>
  2329. <step>
  2330. <description>
  2331. <value>OS_MutSemTake() is invoked with sem_id set to -1, an error is expected.</value>
  2332. </description>
  2333. <tags>
  2334. <value />
  2335. </tags>
  2336. <code>
  2337. <value><![CDATA[int32 err;
  2338. err = OS_MutSemTake((uint32)-1);
  2339. test_assert(err == OS_ERR_INVALID_ID, "invalid sem_id not detected");]]></value>
  2340. </code>
  2341. </step>
  2342. </steps>
  2343. </case>
  2344. <case>
  2345. <brief>
  2346. <value>OS_MutSemGetIdByName() errors</value>
  2347. </brief>
  2348. <description>
  2349. <value>Parameters checking in OS_MutSemGetIdByName() is tested.</value>
  2350. </description>
  2351. <condition>
  2352. <value />
  2353. </condition>
  2354. <various_code>
  2355. <setup_code>
  2356. <value />
  2357. </setup_code>
  2358. <teardown_code>
  2359. <value />
  2360. </teardown_code>
  2361. <local_variables>
  2362. <value />
  2363. </local_variables>
  2364. </various_code>
  2365. <steps>
  2366. <step>
  2367. <description>
  2368. <value>OS_MutSemGetIdByName() is invoked with sem_id set to NULL, an error is expected.</value>
  2369. </description>
  2370. <tags>
  2371. <value />
  2372. </tags>
  2373. <code>
  2374. <value><![CDATA[int32 err;
  2375. err = OS_MutSemGetIdByName(NULL, "semaphore");
  2376. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  2377. </code>
  2378. </step>
  2379. <step>
  2380. <description>
  2381. <value>OS_MutSemGetIdByName() is invoked with semaphore name set to NULL, an error is expected.</value>
  2382. </description>
  2383. <tags>
  2384. <value />
  2385. </tags>
  2386. <code>
  2387. <value><![CDATA[int32 err;
  2388. err = OS_MutSemGetIdByName(&msid, NULL);
  2389. test_assert(err == OS_INVALID_POINTER, "NULL not detected");]]></value>
  2390. </code>
  2391. </step>
  2392. <step>
  2393. <description>
  2394. <value>OS_MutSemGetIdByName() is invoked with a very long task name, an error is expected.</value>
  2395. </description>
  2396. <tags>
  2397. <value />
  2398. </tags>
  2399. <code>
  2400. <value><![CDATA[int32 err;
  2401. err = OS_MutSemGetIdByName(&msid, "very very long semaphore name");
  2402. test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected");]]></value>
  2403. </code>
  2404. </step>
  2405. </steps>
  2406. </case>
  2407. </cases>
  2408. </sequence>
  2409. </sequences>
  2410. </instance>
  2411. </instances>
  2412. <exportedFeatures />
  2413. </application>
  2414. </SPC5-Config>