xref: /OK3568_Linux_fs/kernel/tools/testing/selftests/livepatch/README (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun====================
2*4882a593SmuzhiyunLivepatch Self Tests
3*4882a593Smuzhiyun====================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunThis is a small set of sanity tests for the kernel livepatching.
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunThe test suite loads and unloads several test kernel modules to verify
8*4882a593Smuzhiyunlivepatch behavior.  Debug information is logged to the kernel's message
9*4882a593Smuzhiyunbuffer and parsed for expected messages.  (Note: the tests will compare
10*4882a593Smuzhiyunthe message buffer for only the duration of each individual test.)
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunConfig
14*4882a593Smuzhiyun------
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunSet these config options and their prerequisites:
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunCONFIG_LIVEPATCH=y
19*4882a593SmuzhiyunCONFIG_TEST_LIVEPATCH=m
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunRunning the tests
23*4882a593Smuzhiyun-----------------
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunTest kernel modules are built as part of lib/ (make modules) and need to
26*4882a593Smuzhiyunbe installed (make modules_install) as the test scripts will modprobe
27*4882a593Smuzhiyunthem.
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunTo run the livepatch selftests, from the top of the kernel source tree:
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun  % make -C tools/testing/selftests TARGETS=livepatch run_tests
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunAdding tests
35*4882a593Smuzhiyun------------
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunSee the common functions.sh file for the existing collection of utility
38*4882a593Smuzhiyunfunctions, most importantly setup_config(), start_test() and
39*4882a593Smuzhiyuncheck_result().  The latter function greps the kernel's ring buffer for
40*4882a593Smuzhiyun"livepatch:" and "test_klp" strings, so tests be sure to include one of
41*4882a593Smuzhiyunthose strings for result comparison.  Other utility functions include
42*4882a593Smuzhiyungeneral module loading and livepatch loading helpers (waiting for patch
43*4882a593Smuzhiyuntransitions, sysfs entries, etc.)
44