We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Phillip Johnston • 8 years ago

Thanks for writing this up. I was chatting with my buddy about strategies for simulating hardware for testing on your host PC. I had no idea cmocka exists, so glad to know I don't have to create it myself :).

Esteban Echeverry Perez • 8 years ago

Great article. Thank you!

a3zzat • 8 years ago

nice article

ad3a • 8 years ago

HI Sam,

nice article but here you're building for the host system, i.e. you're running the test suite on a host processor which will link against libcmocka built for the host itself. What about building cmocka directly for the embedded platform? Any idea for that?

Sam Lewis • 8 years ago

Good point! I'd argue that the logic you're unit testing should really work on any (standard) compiler, and if it doesn't I'd ask why not - platform independent code is nice!

I do see your point though, it'd be nicer to use the same compiler for testing and production code. Depending on the platform you're compiling for, it might even be possible to use cmocka.

ad3a • 8 years ago

Right, actually I spent the last couple of days trying to find if anybody has ever tried to build cmocka for some specific embedded platform... actually the cmocka documentation doesn't help a lot in this sense.
My goal would be to have the production code unit tested running on a simulator of the embedded platform, I really feel this would speed up code development and final integration and verification.

Harsha Mc • 8 years ago

@ad3a, your test environment on your desktop would not let you run a code built for embedded platform.

ad3a • 8 years ago

That's why I wrote "running on the simulator".