Saturday, 31 March 2018

Unit Testing Simple Linux Kernel Module

This morning, I am trying to learn Linux Kernel development from https://blog.sourcerer.io/writing-a-simple-linux-kernel-module-d9dc3762c234  Link  .

The examples are very good. However, I am looking for a way to do unit testing and I can't find any info on how to do this. I am a unit test advocate and I fully support unit testing. Why? Because system testing is expensive and from my experience, time-consuming.

I would like to unit test on Eclipse so that I could use Eclipse CDT and GDB's full power in terms of debugging.

Eclipse Oxygen.3 CDT Release (4.7.3)
With just a few #defines and #ifdefs, I was able to come up with a way to do simple unit tests using asserts. Nothing impressive actually, however the quick feedback of unit tests will be very helpful in getting good code coverage of testing.

I placed the source code demonstration here: Link

For now this will work, however I will be improving this and will be adding a proper unit testing framework.

No comments:

Post a Comment