On Thu, Jun 09, 2022 at 02:16:34PM -0600, Shuah Khan wrote: > On 6/3/22 8:32 AM, Marcos Paulo de Souza wrote: > > Hi there, > > > > The first patch moves the current livepatch tests to selftests, allowing it > > be better suited to contain more complex tests, like using userspace C code > > to use the livepatched kernel code. As a bonus it allows to use > > "gen_tar" to export the livepatch selftests, rebuild the modules by > > running make in selftests/livepatch directory and simplifies the process > > of creating and debugging new selftests. > > > > In general selftests don't include modules. We keep test modules under lib. > One of the reasons is that modules have dependencies on the kernel and should > be built when kernel is built. > > I don't fully buy the argument that moving modules under selftest would simplify > the process. As mentioned by Joe in other reply, epbf also contains a kernel module. > > > It keeps the ability to execute the tests by running the shell scripts, > > like "test-livepatch.sh", but beware that the kernel modules > > might not be up-to-date. > > > > I am not what you mean by this. The plan is to upstream some tests that SUSE is using: https://github.com/lpechacek/qa_test_klp/ The current patchset implement the tc_3 from the above repository. > > > The second patch includes a new test to exercise the functionality to livepatch > > a heavy hammered function. The test uses getpid in this case. > > > > I tested the changes by running the tests within the kernel source tree and running > > from the gen_tar extracted directory. > > > > I would like to understand the negatives of continuing to keep modules under lib? Along with the ability to test different kernel versions by exporting the tests, the plan is to have a template kernel module, for building them on the fly. Such approach would benefit porting more tests from this repository. One example is the testcase 5, which applies successive livepatches one after another, just changing it's name. The current patchset makes this move easier in the future. > > thanks, > -- Shuah