<div dir="ltr"><div><div><div><div>Hi all,<br><br></div>I thought I would update you on my progress with this project. So far I have implemented several tests to demonstrate how I see the new testsuite should be written. They are all committed to a separate repository which at this point I am not sure if you all have access to. I have tried to take existing tests and apart from using the Unity calls I also separated the tests to smaller functions if possible. The ones I implemented combine several tests for the RTEMS clock API, the corresponding POSIX clock API, and I also started writing a dynamic memory test. All the code compiles correctly on the sparc sis target using waf and runs in the simulator.<br>
<br></div>I have also modified a Unity ruby script for generating test runners and included it in the repository. It allows for the main function (in this case the Init task) to be generated with all the written test*() function calls being automatically added with their correct line numbers to be executed at runtime. The script generates a separate .c file which is linked with the other test .c files. The usage of this script is not necessary and an Init task can be added manually.<br>
<br></div>I have also been preparing a short document/manual with all the necessary information on how to convert the rest of the tests to this new format. It is currently in a pdf format but I can also include it on the wiki if that is preferrable once it is finished.<br>
<br>I hope my work will be useful and I welcome feedback once you can have a look at the code in the repo (Amar knows how to access it).<br><br><br></div>Marcin<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On 23 November 2013 16:05, Gedare Bloom <span dir="ltr"><<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The article [1] might be relevant.<br>
<br>
-Gedare<br>
<br>
[1] <a href="http://www.sciencedirect.com/science/article/pii/S0167642312000317" target="_blank">http://www.sciencedirect.com/science/article/pii/S0167642312000317</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, Nov 21, 2013 at 9:20 AM, Marcin Bujar <<a href="mailto:marcin.bujar@gmail.com">marcin.bujar@gmail.com</a>> wrote:<br>
> Hi Sebastian,<br>
><br>
> Unfortunately the project was on hold for a while now due to administrative<br>
> reasons. I am just about get back into it so expect more updates soon.<br>
><br>
> As to the thread safety of Unity I was not aware that was an explicit<br>
> requirement for a testing framework. If you are referring to accessing the<br>
> Unity struct then this is something I could serialize, or even better I will<br>
> check if somebody has implemented this already.<br>
><br>
> Thanks for pointing it out.<br>
><br>
><br>
> Marcin<br>
><br>
><br>
> On 20 November 2013 16:11, Sebastian Huber<br>
> <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br>
>><br>
>> Hello Marcin,<br>
>><br>
>> I just checked out the Unity sources and had a brief look at it. I see<br>
>> one major problem with this framework. It is not thread-safe, e.g. you have<br>
>> functions like this:<br>
>><br>
>> <a href="https://github.com/ThrowTheSwitch/Unity/blob/master/src/unity.c" target="_blank">https://github.com/ThrowTheSwitch/Unity/blob/master/src/unity.c</a><br>
>><br>
>> [...]<br>
>> //-----------------------------------------------<br>
>> void UnityAssertNumbersWithin( const _U_SINT delta,<br>
>> const _U_SINT expected,<br>
>> const _U_SINT actual,<br>
>> const char* msg,<br>
>> const UNITY_LINE_TYPE lineNumber,<br>
>> const UNITY_DISPLAY_STYLE_T style)<br>
>> {<br>
>> UNITY_SKIP_EXECUTION;<br>
>><br>
>> if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)<br>
>> {<br>
>> if (actual > expected)<br>
>> Unity.CurrentTestFailed = ((actual - expected) > delta);<br>
>> else<br>
>> Unity.CurrentTestFailed = ((expected - actual) > delta);<br>
>> }<br>
>> else<br>
>> {<br>
>> if ((_U_UINT)actual > (_U_UINT)expected)<br>
>> Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) ><br>
>> (_U_UINT)delta);<br>
>> else<br>
>> Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) ><br>
>> (_U_UINT)delta);<br>
>> }<br>
>><br>
>> if (Unity.CurrentTestFailed)<br>
>> {<br>
>> UnityTestResultsFailBegin(lineNumber);<br>
>> UnityPrint(UnityStrDelta);<br>
>> UnityPrintNumberByStyle(delta, style);<br>
>> UnityPrint(UnityStrExpected);<br>
>> UnityPrintNumberByStyle(expected, style);<br>
>> UnityPrint(UnityStrWas);<br>
>> UnityPrintNumberByStyle(actual, style);<br>
>> UnityAddMsgIfSpecified(msg);<br>
>> UNITY_FAIL_AND_BAIL;<br>
>> }<br>
>> }<br>
>> [...]<br>
>><br>
>> So now if multiple threads call this function the result is unpredictable.<br>
>><br>
>> Thread-safety is a mandatory feature for a unit test framework for RTEMS<br>
>> from my point of view, so either we add this to Unity or search for<br>
>> something else.<br>
>><br>
>><br>
>> --<br>
>> Sebastian Huber, embedded brains GmbH<br>
>><br>
>> Address : Dornierstr. 4, D-82178 Puchheim, Germany<br>
>> Phone : +49 89 189 47 41-16<br>
>> Fax : +49 89 189 47 41-09<br>
>> E-Mail : <a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a><br>
>> PGP : Public key available on request.<br>
>><br>
>> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.<br>
><br>
><br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> rtems-devel mailing list<br>
> <a href="mailto:rtems-devel@rtems.org">rtems-devel@rtems.org</a><br>
> <a href="http://www.rtems.org/mailman/listinfo/rtems-devel" target="_blank">http://www.rtems.org/mailman/listinfo/rtems-devel</a><br>
><br>
</div></div></blockquote></div><br></div>