18c2ecf20Sopenharmony_ci====================
28c2ecf20Sopenharmony_ciLivepatch Self Tests
38c2ecf20Sopenharmony_ci====================
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciThis is a small set of sanity tests for the kernel livepatching.
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciThe test suite loads and unloads several test kernel modules to verify
88c2ecf20Sopenharmony_cilivepatch behavior.  Debug information is logged to the kernel's message
98c2ecf20Sopenharmony_cibuffer and parsed for expected messages.  (Note: the tests will compare
108c2ecf20Sopenharmony_cithe message buffer for only the duration of each individual test.)
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciConfig
148c2ecf20Sopenharmony_ci------
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciSet these config options and their prerequisites:
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciCONFIG_LIVEPATCH=y
198c2ecf20Sopenharmony_ciCONFIG_TEST_LIVEPATCH=m
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciRunning the tests
238c2ecf20Sopenharmony_ci-----------------
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciTest kernel modules are built as part of lib/ (make modules) and need to
268c2ecf20Sopenharmony_cibe installed (make modules_install) as the test scripts will modprobe
278c2ecf20Sopenharmony_cithem.
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciTo run the livepatch selftests, from the top of the kernel source tree:
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci  % make -C tools/testing/selftests TARGETS=livepatch run_tests
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciAdding tests
358c2ecf20Sopenharmony_ci------------
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciSee the common functions.sh file for the existing collection of utility
388c2ecf20Sopenharmony_cifunctions, most importantly setup_config(), start_test() and
398c2ecf20Sopenharmony_cicheck_result().  The latter function greps the kernel's ring buffer for
408c2ecf20Sopenharmony_ci"livepatch:" and "test_klp" strings, so tests be sure to include one of
418c2ecf20Sopenharmony_cithose strings for result comparison.  Other utility functions include
428c2ecf20Sopenharmony_cigeneral module loading and livepatch loading helpers (waiting for patch
438c2ecf20Sopenharmony_citransitions, sysfs entries, etc.)
44