kernel - Regarding tools/testing/ktests or selftests

Greg KH greg at
Wed Oct 11 12:51:37 EDT 2017

On Wed, Oct 11, 2017 at 08:38:52PM +0530, Pintu Kumar wrote:
> Yes, I have seen many documentation and also the existing repos under selftests.
> But my requirement is little different.
> I think my requirement is some what similar to futex repo.
> Currently I am trying to under it. But still I am facing some issues
> in generating my 2 executable using kselftests.
> Also I found that current document does not explain much about how to
> include new tests.
> My requirement is as follows:
> I have a sub folders for test. Example: tools/testing/selftests/<my
> folders>/<folder1>

Why do you need <folder1>?  Just don't use it, you should not have so
many files for your test that you need to break it up even more, right?

> I have my own Makefile, and some set of C source files under folder1
> I also have a test script under folder1, that tests 2 executable
> generated out of 7 C files.
> I wanted to know how to make use of selftest framework to generate
> these 2 executable, and also execute my script to run the test.
> I have already includes <my folders> in top level Makefile under selftests.
> TARGETS = <my folders>
> Do, I need to create another Makefile under <my folders> and invoke
> folder1/Makefile from there?
> Or is there another way?

Try it and see!

And post your patch to the kselftest mailing list, if you have problems
with it.  Specifics are good, and the developers there can help you out.
Asking vague questions without seeing the code itself lends itself to
vague answers :)

good luck!

greg k-h

More information about the Kernelnewbies mailing list