Testing of Linux Kernel Modules
Åhman, Niro (2017)
Åhman, Niro
2017
Tietotekniikka
Tieto- ja sähkötekniikan tiedekunta - Faculty of Computing and Electrical Engineering
This publication is copyrighted. You may download, display and print it for Your own personal use. Commercial use is prohibited.
Hyväksymispäivämäärä
2017-06-07
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi:tty-201705191423
https://urn.fi/URN:NBN:fi:tty-201705191423
Tiivistelmä
Linux kernel's modular structure allows a developer to easily develop and implement drivers to the custom hardware usually found in embedded devices. Linux device drivers are implemented as part of the kernel which makes a defect in device driver or device easily break the whole system. Due to the nature of the embedded devices, testing of kernel drivers and related code is essential in finding possible defects before the end product is shipped to customer. This is especially important at Nokia Networks where SoC ASIC chips are part of the critical communication system infrastructure.
While testing is necessary it is also time consuming and the tools available are limited due to kernel modules existing in kernel space. Usually inspecting the Linux kernel module source code manually is enough as the source code consists mostly from simple functions and parts that repeat in multiple modules.
This thesis work introduces the basics of Linux operating system with focus on the kernel modules. The work also explains the key terminology and tools available for testing Linux kernel and Linux kernel modules.
In the execution part a new testing method to test Linux kernel modules in user space is introduced. This method allows a more detailed and specified method of testing. For unit testing the kernel modules we used a method of mocking the kernel functions to work with user space test framework. This allows writing of specific tests for kernel modules to see that they behaved like expected.
It was noticed that there is a place for this method. As the framework was developed rapidly it needs improvement and refactoring of algorithms before taken into active use. Due to rapid development the framework is simple and new features should also be added for example, support for code coverage measurement.
While testing is necessary it is also time consuming and the tools available are limited due to kernel modules existing in kernel space. Usually inspecting the Linux kernel module source code manually is enough as the source code consists mostly from simple functions and parts that repeat in multiple modules.
This thesis work introduces the basics of Linux operating system with focus on the kernel modules. The work also explains the key terminology and tools available for testing Linux kernel and Linux kernel modules.
In the execution part a new testing method to test Linux kernel modules in user space is introduced. This method allows a more detailed and specified method of testing. For unit testing the kernel modules we used a method of mocking the kernel functions to work with user space test framework. This allows writing of specific tests for kernel modules to see that they behaved like expected.
It was noticed that there is a place for this method. As the framework was developed rapidly it needs improvement and refactoring of algorithms before taken into active use. Due to rapid development the framework is simple and new features should also be added for example, support for code coverage measurement.