views:

32

answers:

1

Has anyone used check as the unit test framework in an embedded device which also requires cross-compilation?

Is it even a good idea, or should I just use something else (e.g. embunit or similar)?

If so, how should I write the Makefile.ams and configure.ac? I haven't used autotools to begin with so all this cross-compilation stuff certainly doesn't help...

I could simply skip all the actual configuration checking since I only compile in one or two environments but do I need to compile check to the target? I can't figure from the instructions how to link the actual framework to my test code.

What would be the minimal files that I need? The examples do all the configuration stuff and I can't figure out what I can leave out.

A: 

As far as I can see "check" uses the fork() system call. When you are not using a UNIX-based operating system on your embedded target you shall encounter problems here. On the check manual page in Chapter 2.1 you will find a nice overview of alternative unit testing frameworks. Most frameworks rely on either some operating system calls or some standard library functions which may not be present on your embedded target.

I found macroexpressions unit testing framework MAESTRA very useful on embedded platforms. There was an interesting article on embedded.com some years ago (hxxp://www.eetimes.com/design/automotive-design/4007177/Doing-C-code-unit-testing-on-a-shoestring-Part-1-The-basics-and-the-tools).

But if you are dealing with lot of third-party code or an existing code base MAESTRA might not be the best choice, for it enforces a special coding standard for code instrumentation to work. This might as well collide with your companies own coding standard.

SqueakySquirrel