Re: Test results as XML files
- Subject: Re: Test results as XML files
- From: James.Munns@xxxxxxxxxxxxx
- Date: Mon, 9 Feb 2015 13:46:53 +0100
- To: "James Grenning" <james@xxxxxxxxxxxx>
- Cc: "Andreas Schneider" <asn@xxxxxxxxxxxxxx>,cmocka@xxxxxxxxxxxxxx
Thanks for getting back to me, I have already instrumented some
pre-processor decisions to make the code work on both targets, these
remaining items are the ones I couldn't seem to fix without modification
of the CMocka framework (not desirable to be out of sync with mainline),
or modification of Code Under Test (not viable for adding additional tests
to legacy software). The majority of the issues here are due to underlying
differences between the C Standard Library and other "given components",
based on my embedded compiler's limited implementation of certain
Currently I have the luxury of completely separate "Make Files" (a real
make file with GCC+CI, an embedded project for the simulator target), so I
can set #defines and include paths as I see fit. This definitely has been
I believe you left a link out of your response, but I would be happy to
review any information you can provide. Even if it is not applicable to my
current issues, it may be helpful in the future.
From: "James Grenning" <james@xxxxxxxxxxxx>
Cc: "Andreas Schneider" <asn@xxxxxxxxxxxxxx>, cmocka@xxxxxxxxxxxxxx
Date: 09.02.2015 13:25
Subject: Re: Test results as XML files
You may be able to make your code work with cmocka in both environments
using various pre-processor controls. Here is an article that includes
testing problems and the the preprocessor controls that can be used to
solve those problems. I am not sure if these really apply to both your
issues or not. It probably could help with the typedef problem. I
consider the pre-processor the last tool to use when getting code into a
unit test harness. But sometimes it is the only option where you do not
need to change the code under test.
Something we did with CppUTest, another open source test harness I
contribute to, is to separate system dependent code. The makefile would
choose the appropriate platform files to build depending on the
platform. We have a PlatformSpecific.cpp file that would provide system
James Grenning - Author of TDD for Embedded C -
On 9 Feb 2015, at 3:54, James.Munns@xxxxxxxxxxxxx wrote:
> Hey Andreas, a couple of comments. The background for this is that I
> running tests using both GCC (for CI) as well as using an embedded
> compiler compiling to a simulator target (for the sake of developers
> the same IDE as primary development). This may not be within the scope
> your development, but may be useful to other users, portability wise.
> CMocka seems to make some assumptions at compile time, more or less
> the target environment is Unix-like/GCC compiled or Windows-like/VS
> compiled. This breaks compilation for me in a couple ways.
> 1: My embedded compiler defines some, but not all of the exception
> in the array in cmocka.c:281. This is not new to cMocka 1.0, for now I
> have added in a compiler flag to change the definition of this array.
> would be nice to have an option to be blind of exceptions at compile
> (sort of like 'handle_exceptions', but at compile time rather than
> 2: I had some problems with the 'uintptr_t' logic in cmocka.h:101.
> Probably nothing unique about that type, except that it was defined in
> another header file. Unfortunately I have no way of "informing"
> about my other 'stdint.h' file, and a re-def of uintptr_t makes the
> compiler sad. Again, this is not new to cMocka 1.0. It might be nice
> have some sort of user defined includes? Something like the following
> the top of the headers?:
> #ifdef _CMOCKA_USER_INCLUDES
> #include "cmocka_user_includes.h"
> 3. This one actually is new to cMocka 1.0. My compiler defines time.h,
> does not define the struct 'timespec'. Similar to my exceptions
> there is some handling for targets not supporting test timing, however
> this is not completely transparent at compile time. I could fill in
> definition of timespec, however I dont really have any way of letting
> cmocka.c know where to find it (modifying my compiler's time.h is not
> option). It would be nice to have a compiler flag to completely
> the timing component.
> Up to now I've just fixed items 1 and 2 in little hacks of the file
> are "good enough" for my compiler, though likely not very useful or
> portable. It would be nice to see these supported in mainline
> if you have any ideas.
> Please let me know if you have any questions, would like these filed
> tickets for addressing later, or have any changes you would like me to
> From: Andreas Schneider <asn@xxxxxxxxxxxxxx>
> To: cmocka@xxxxxxxxxxxxxx,
> Cc: James.Munns@xxxxxxxxxxxxx
> Date: 06.02.2015 13:04
> Subject: Re: Test results as XML files
> On Friday 06 February 2015 12:58:07 Andreas Schneider wrote:
>> On Friday 06 February 2015 11:39:59 James.Munns@xxxxxxxxxxxxx wrote:
>>> Will the source be pushed anywhere before the 1.0 release? I'd love
>>> test it out on my environment.
>> the source code is available here:
> Please let us know if it works for you. Suggestions and patches are
> welcome ;)
> MSA Technologies and Enterprise Services GmbH
> Firmensitz (Registered Headquarter): Thiemannstr. 1, 12059 Berlin
> Ust.-ID: DE 237 346 046
> Registergericht (Register Court): Amtsgericht Berlin-Charlottenburg
> Nr.93, HRB 92728 B
> Geschäftsführer (Managing Director): Richard W. Roda, Kenneth D.
> Krause, Steven C. Blanco
MSA Technologies and Enterprise Services GmbH
Firmensitz (Registered Headquarter): Thiemannstr. 1, 12059 Berlin
Ust.-ID: DE 237 346 046
Registergericht (Register Court): Amtsgericht Berlin-Charlottenburg Nr.93, HRB 92728 B
Geschäftsführer (Managing Director): Richard W. Roda, Kenneth D. Krause, Steven C. Blanco