对内核模块代码进行单元测试是否可行? [英] Is it feasible to unit test kernel module code ?

查看:189
本文介绍了对内核模块代码进行单元测试是否可行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果是的话,我应该使用哪种技术? 我正在考虑使用河马,因为它们可以用来模拟"C"方法.有没有更好的方法?如果可以,那么任何人都可以提供建议,或者您认为内核的单元测试是一个过大的杀伤力?

If so what technique should I use ? I am thinking about using hippomock as they can be used to mock "C" methods. Are there any better approaches ? If so can anyone give an advice, or do you think unit test for kernel is an overkill ?

推荐答案

自Linux内核版本5.5 KUnit 可用以来.这是内核的轻量级单元测试框架.

Since Linux kernel version 5.5 KUnit is available. It's a lightweight unit test framework for the kernel.

更多细节请看

  • https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html
  • https://kunit.dev/
  • https://lwn.net/Articles/780985/

这篇关于对内核模块代码进行单元测试是否可行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆