开发者

Using the check test unit framework in an embedded device?

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.


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: Doing C code unit testing on a shoestring.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜