[SOCIS] Testing Framework

Marcin Bujar marcin.bujar at gmail.com
Thu Nov 21 14:20:24 UTC 2013


Hi Sebastian,

Unfortunately the project was on hold for a while now due to administrative
reasons. I am just about get back into it so expect more updates soon.

As to the thread safety of Unity I was not aware that was an explicit
requirement for a testing framework. If you are referring to accessing the
Unity struct then this is something I could serialize, or even better I
will check if somebody has implemented this already.

Thanks for pointing it out.


Marcin


On 20 November 2013 16:11, Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> Hello Marcin,
>
> I just checked out the Unity sources and had a brief look at it.  I see
> one major problem with this framework.  It is not thread-safe, e.g. you
> have functions like this:
>
> https://github.com/ThrowTheSwitch/Unity/blob/master/src/unity.c
>
> [...]
> //-----------------------------------------------
> void UnityAssertNumbersWithin( const _U_SINT delta,
>                                const _U_SINT expected,
>                                const _U_SINT actual,
>                                const char* msg,
>                                const UNITY_LINE_TYPE lineNumber,
>                                const UNITY_DISPLAY_STYLE_T style)
> {
>     UNITY_SKIP_EXECUTION;
>
>     if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
>     {
>         if (actual > expected)
>           Unity.CurrentTestFailed = ((actual - expected) > delta);
>         else
>           Unity.CurrentTestFailed = ((expected - actual) > delta);
>     }
>     else
>     {
>         if ((_U_UINT)actual > (_U_UINT)expected)
>             Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) >
> (_U_UINT)delta);
>         else
>             Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) >
> (_U_UINT)delta);
>     }
>
>     if (Unity.CurrentTestFailed)
>     {
>         UnityTestResultsFailBegin(lineNumber);
>         UnityPrint(UnityStrDelta);
>         UnityPrintNumberByStyle(delta, style);
>         UnityPrint(UnityStrExpected);
>         UnityPrintNumberByStyle(expected, style);
>         UnityPrint(UnityStrWas);
>         UnityPrintNumberByStyle(actual, style);
>         UnityAddMsgIfSpecified(msg);
>         UNITY_FAIL_AND_BAIL;
>     }
> }
> [...]
>
> So now if multiple threads call this function the result is unpredictable.
>
> Thread-safety is a mandatory feature for a unit test framework for RTEMS
> from my point of view, so either we add this to Unity or search for
> something else.
>
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.huber at embedded-brains.de
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20131121/fc863a26/attachment-0001.html>


More information about the devel mailing list