October 10, 2017 - Shuah Khan

Kselftest for Linux 4.14 to Add Support For Test Object Relocation

In the upcoming Linux 4.14-rc3 release, work continues to develop the Kselftest TAP13 framework API and convert tests to TAP13. The new tests include Kselftest common RUN_TESTS in lib.mk that have been enhanced to print TAP13 to cover test shell scripts that won’t be able to use the Kselftest TAP13 API; this also covers test programs that aren’t converted yet.

Several fixes have been made to existing tests to prevent failure in unsupported cases as part of an ongoing work based on feedback from Kselftest stable release users that don’t want the tests to fail due to unmet dependencies, such as config options being disabled.

Additionally, a new watchdog test has been added and much needed cleanups to the existing watchdog tests have been made by Eugeniu Rosca.

A New Kselftest Use-Case

A notable change in this release is new support for the “make O=dir kselftest” use-case.  Several developers rely on this use-case to relocate objects and keep their source tree clean. It comes in handy when developers want to build kernels for several architectures and/or with different config files from the same source tree and keep it clean. Objects for each of those builds are saved in separate object directories.

I added support for this use-case by extending the existing Kselftest KBUILD_OUTPUT use-case. The majority of changes have been made to the kselftest common infrastructure. Some test make files are changed as needed to address the custom build and run_tests.

With this change the following methods to build and run Kselftest are possible.

Build all, relocate objects to /tmp/kselftest, and run tests


Build TARGETS, relocate objects to /tmp/kselftest, and run tests


Clean tests


Better Test Summaries

One other important change is that messages from the Makefile are silenced during the test run, and the individual test results have been redirected to /tmp/testname files. This change makes it easier to understand the test results summary, while still being able to look at the detailed test output.

For example, running net tests after this change will output just the summary:

The detailed test results can be found under /tmp for each test:

Please check the Kselftest documentation for supported use-cases: Documentation/dev tools/kselftest.rst

Shuah Khan

About Shuah Khan

Shuah Khan is a Senior Linux Kernel Developer at Samsung's Open Source Group. She is a Linux Kernel Maintainer and Contributor who focuses on Linux Media Core and Power Management. She maintains Kernel Selftest framework. She has contributed to IOMMU, and DMA areas. In addition, she is helping with stable release kernel testing. She authored Linux Kernel Testing and Debugging paper published on the Linux Journal and writes Linux Journal kernel news articles. She has presented at several Linux conferences and Linux Kernel Developer Keynote Panels. She served on the Linux Foundation Technical Advisory Board. Prior to joining Samsung, she worked as a kernel and software developer at HP and Lucent.

Image Credits: OSDC

Development / Linux Debugging / kselftest /

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments Protected by WP-SpamShield Anti-Spam