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 (130 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

  You must be logged in to comment