嵌入式 C++ 中的持续集成/单元测试系统
通常使用哪些工具进行单元测试,尤其是嵌入式系统的持续集成?
我特别认为你通常必须交叉编译和部署,而且你不能轻松地可视化目标平台。运行测试代码和框架也可能很困难。
我可以用什么来缓解这些困难呢?
(我认为它应该是某种双重目标,构建服务器在更容易的目标上运行测试)
What tools are generally used for unit testing and especially continuous integration for embedded systems?
I am especially thinking that you usually have to cross-compile and deploy, and also that you can't easily visualize the target platform. Also it can be difficult to run test-code and frameworks.
What could I use too alleviate these difficulties?
(I think it should be some kind of dual targeting, where the build server runs its tests on a easier target)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
对于单元测试,请查看 Unity。
http://sourceforge.net/apps/trac/unity/wiki
它是一个真正的轻量级测试工具(2 x .h 和 1 x .c 文件),由 Ruby 脚本支持。我们一直在嵌入式 ARM7 目标系统中使用进行单元测试(通过串行端口重定向测试报告)。
CMock 也支持(惊喜,惊喜)Mocking。尽管范围并不广泛,但它们的伟大之处在于它们非常易于使用。
关于 CI,如果您是基于 Linux 的,那么 Hudson(现在的 Jenkins)非常好。
另请参阅 CppUTest 并查看 James Grenning 的书“TDD for Embedded C”,网址为 http://renaissancesoftware.net/
For unit testing, take a look at Unity.
http://sourceforge.net/apps/trac/unity/wiki
It is a really lightweight test harness (2 x .h and 1 x .c file) supported by Ruby scripts. We have been using in an embedded ARM7 target system for unit testing (redirecting test reporting over a serial port).
It is also supported by CMock for (surprise, surprise) Mocking. Even though not extensive, the great thing about these is they are so easy to use.
Regarding CI, then Hudson (now Jenkins) is very good if you're Linux based.
Also look at CppUTest and check out James Grenning's book "TDD for Embedded C" at http://renaissancesoftware.net/
在工作中,我使用 embUnit 框架:
http://embunit.sourceforge.net/embunit/index.html
这个框架的好处是它很精简。它不需要任何外部库(甚至不需要 libc)。您可以轻松挂钩自己的输出函数,因此如果您工作的系统与外界的唯一连接是 jtag 或 UART,那么 embUnit 仍然可以工作。
At work I use the embUnit framework:
http://embunit.sourceforge.net/embunit/index.html
The nice thing about this framework is, that it's lean. It does not require any external libraries (not even libc). You can hook your own output function with ease so if you work on a system where the only connection to the outside world is jtag or an UART, then embUnit will still work.
我使用过 RCUNIT 和 CANTATA++ 用于在 PC 上测试嵌入式代码。任何 Nunit 都应该轻松集成到任何连续测试平台中。我们发现在 PC 上模拟硬件并仅在最终集成期间在目标上进行测试要容易得多。
硬件接口抽象对于 PC 上的嵌入式代码进行单元测试至关重要。这对于持续集成非常有效,因为它在 PC 上运行,仅模拟硬件访问。只需付出一点努力,我们就可以在 PC 上测试 95% 的代码以进行持续集成。
您还可以查看以下问题:
I have used RCUNIT and CANTATA++ for unit testing embedded code on the PC. Any Nunit should easily integrate into any continuous test platform. We found it an lot easier to just simulate the hardware on the PC and only test on the target during final integration.
Hardware interface abstraction is crucial for unit testing embedded code on the PC. This works well with continuous integration since it is run on a pc with just the hardware access simulated. With a little effort we could test 95% of the code on a PC for continues integration.
You could also look at these questions:
我见过 C(pp)unit 在一个系统上使用,可以让您通过 JTAG 启动到目标。
有助于对控制台通讯等进行排序。
但它可以发挥作用。
I've seen C(pp)unit used on a system that let you launch to the target via JTAG.
Helps to have console comms etc sorted.
But it can work.
我正在开发一个开源 工具,它要么是一个最小的测试或可以在通过调试器运行时提供详细信息。
I'm working on an open-source tool for that, that is either a minimal test or can provide detailed information when run through the debugger.