Re: [PATCH v3 2/3] livepatch: Move tests from lib/livepatch to selftests/livepatch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2023-12-11 at 14:56 -0700, Shuah Khan wrote:
> On 12/7/23 12:19, mpdesouza@xxxxxxxx wrote:
> > On Thu, 2023-12-07 at 10:20 -0500, Joe Lawrence wrote:
> > > On 12/6/23 10:05, Miroslav Benes wrote:
> > > > On Fri, 1 Dec 2023, Joe Lawrence wrote:
> > > > 
> > > > > On Tue, Oct 31, 2023 at 06:10:52PM -0300, Marcos Paulo de
> > > > > Souza
> > > > > wrote:
> > > > > > The modules are being moved from lib/livepatch to
> > > > > > tools/testing/selftests/livepatch/test_modules.
> > > > > > 
> > > > > > This code moving will allow writing more complex tests,
> > > > > > like
> > > > > > for example an
> > > > > > userspace C code that will call a livepatched kernel
> > > > > > function.
> > > > > > 
> > > > > > The modules are now built as out-of-tree
> > > > > > modules, but being part of the kernel source means they
> > > > > > will be
> > > > > > maintained.
> > > > > > 
> > > > > > Another advantage of the code moving is to be able to
> > > > > > easily
> > > > > > change,
> > > > > > debug and rebuild the tests by running make on the
> > > > > > selftests/livepatch directory,
> > > > > > which is not currently possible since the modules on
> > > > > > lib/livepatch are
> > > > > > build and installed using the "modules" target.
> > > > > > 
> > > > > > The current approach also keeps the ability to execute the
> > > > > > tests manually by
> > > > > > executing the scripts inside selftests/livepatch directory,
> > > > > > as
> > > > > > it's currently
> > > > > > supported. If the modules are modified, they needed to be
> > > > > > rebuilt before running
> > > > > > the scripts though.
> > > > > > 
> > > > > > The modules are built before running the selftests when
> > > > > > using
> > > > > > the
> > > > > > kselftest invocations:
> > > > > > 
> > > > > > 	make kselftest TARGETS=livepatch
> > > > > > or
> > > > > > 	make -C tools/testing/selftests/livepatch
> > > > > > run_tests
> > > > > > 
> > > > > 
> > > > > Quick question:
> > > > > 
> > > > > - We have been building with CONFIG_LIVEPATCH_TEST=m to
> > > > > generate
> > > > > the
> > > > >    test modules at kernel build time
> > > > > 
> > > > > - Our packaging filters out the selftest scripts and
> > > > > supporting
> > > > > modules
> > > > >    from the general kernel RPM package into their subpackages
> > > > > 
> > > > > - Tests are run as part of CKI or other manual tests by
> > > > > installing the
> > > > >    pre-built packages from the previous step
> > > > > 
> > > > > 
> > > > > After this patch, we would need to add something like the
> > > > > following to
> > > > > our kernel build, before packaging:
> > > > > 
> > > > >    $ make KDIR=$(pwd) -C tools/testing/selftests/livepatch/
> > > > >           ^^^^
> > > > > 
> > > > > If this is the correct way to build the test modules for
> > > > > *this*
> > > > > tree and
> > > > > /lib/modules/$(shell uname -r)/build... it might be useful to
> > > > > document
> > > > > in the commit message as an alternative use case.
> > 
> > That's right:
> > 
> > $ make -C tools/testing/selftests/livepatch/
> > 
> > is indeed the way to build the tests without running them. KDIR
> > will be
> > set to  /lib/modules/$(shell uname -r)/build is empty.
> > 
> > Yes, I can definitely add documentation about it inside the
> > tools/testing/selftests/livepatch/README.
> > 
> 
> How does the default kselftest run work with these changes?
> 
> make ksefltest - does this still work as it did before this change?

Yes,

make kselftest TARGETS=livepatch

works the same as before. As well the

make -C tools/testing/selftests/livepatch run_tests

Both ways work as before.
> 
> thanks,
> -- Shuah
> 






[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux