162306a36Sopenharmony_ci==================== 262306a36Sopenharmony_ciLivepatch Self Tests 362306a36Sopenharmony_ci==================== 462306a36Sopenharmony_ci 562306a36Sopenharmony_ciThis is a small set of sanity tests for the kernel livepatching. 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciThe test suite loads and unloads several test kernel modules to verify 862306a36Sopenharmony_cilivepatch behavior. Debug information is logged to the kernel's message 962306a36Sopenharmony_cibuffer and parsed for expected messages. (Note: the tests will compare 1062306a36Sopenharmony_cithe message buffer for only the duration of each individual test.) 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ciConfig 1462306a36Sopenharmony_ci------ 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ciSet these config options and their prerequisites: 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ciCONFIG_LIVEPATCH=y 1962306a36Sopenharmony_ciCONFIG_TEST_LIVEPATCH=m 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciRunning the tests 2362306a36Sopenharmony_ci----------------- 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ciTest kernel modules are built as part of lib/ (make modules) and need to 2662306a36Sopenharmony_cibe installed (make modules_install) as the test scripts will modprobe 2762306a36Sopenharmony_cithem. 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ciTo run the livepatch selftests, from the top of the kernel source tree: 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci % make -C tools/testing/selftests TARGETS=livepatch run_tests 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ciAdding tests 3562306a36Sopenharmony_ci------------ 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ciSee the common functions.sh file for the existing collection of utility 3862306a36Sopenharmony_cifunctions, most importantly setup_config(), start_test() and 3962306a36Sopenharmony_cicheck_result(). The latter function greps the kernel's ring buffer for 4062306a36Sopenharmony_ci"livepatch:" and "test_klp" strings, so tests be sure to include one of 4162306a36Sopenharmony_cithose strings for result comparison. Other utility functions include 4262306a36Sopenharmony_cigeneral module loading and livepatch loading helpers (waiting for patch 4362306a36Sopenharmony_citransitions, sysfs entries, etc.) 44