Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Unit Testing Loadable Kernel Module

chris Posts: 9

I just wrote my first character device and wanted to write some unit test for it using parasoft c++test. I know how to use parasoft for my regular user c code but being searching the net and can't find any example for creating unit tests, stubs, etc for this kernel module that i have. Is it even possible in parasoft? can someone please point me in the right direction?



  • Mirek
    Mirek Posts: 141 admin

    Hi @chris,

    Testing kernel modules is possible with Parasoft C/C++test, but it requires a custom setup. I think the best path to move forward would be to contact the support team so that they can guide you.

    Can you please share some details of your development environment? Which kernel version are you working with? What is the version of the GCC compiler?

  • chris
    chris Posts: 9

    I found this project klibc, so i'm in the process of following their example...cloned this project and also cloned linux source the process of building the kernel now and to leave it to do something else but will be getting back to it. Once I get to the part of creating the project i'll see if I have anymore question. I'm new to this area so sometimes hard to know what i dont know :smile:
    GCC compiler 7.x
    For some reason i feel like this is for testing the actual linux and not the LKM that i have but i could be wrong. Let me know if you are familiar with the klibc project

  • Mirek
    Mirek Posts: 141 admin

    Yes, we have experimented with klibc based setup recently. Again if you hit any problems when setting up, let us know, we can schedule a session to guide you.

  • chris
    chris Posts: 9

    hey @Mirek
    So I am stuck...i built the kernel, i followed the steps to create the C++test project using the bdf that was created from the trace of the linux make... so now i have a linux project and i have no idea how or where to put my LKM .c file to test :smile:
    How do i set up a session?

  • [Deleted User]
    [Deleted User] Posts: 0 admin

    Hi Chris, I sent you and email with info to connect

  • Hello Together, even I am trying to compile kernel code to get it compatible to parasoft. Please guide on this. I am not able to generate bdf.