06 Sep 2011, 19:43
Generic-user-small

Mikhail Gruzdev (5 posts)

I’m trying to apply unit testing and tdd for linux kernel modules and device drivers.

I have two options: 1. emulate whole kernel api and run test as userspace application 2. rewrite Unity somehow to operate on kernel level, and run the test as kernel module in virtual machine

The first option seems unreal. Of course, I can redefine kmalloc to malloc, but substitute the whole api? No way.

It looks more promising to reuse Unity code to create kernel-level test framework. But what about test-driving? I need to reset virtual machine after previous test crash, boot it (most time-consuming part), upload and insert test module.

06 Sep 2011, 19:46
Generic-user-small

Mikhail Gruzdev (5 posts)

I can’t use Unity because of libc dependency. But embunit framework will do the trick

Take a look at my embunit-based test module sample at https://github.com/gruzdev/embunit-lk/ .

Still looking for extremely quick solution for test running during tdd cycle…

07 Sep 2011, 16:39
James2009_pragsmall

James Grenning (141 posts)

You might want to stub out kernel functions. This has gotten some talk recently on the AgileEmbedded yahoo group http://tech.groups.yahoo.com/group/AgileEmbedded/

James

03 Sep 2013, 04:39
Generic-user-small

Doojin Kang (1 post)

I’m trying to use Unity in Kernel unit test. What will be the benefit when kernel has test framework? One clear thing is the test code can get direct access to the kernel functions.

10 Dec 2013, 04:05
James2009_pragsmall

James Grenning (141 posts)

Any progress? I found another small UT harness called cmocka that could also be helpful for kernel use.

  You must be logged in to comment