1a2818ee4SJoe Lawrence==================== 2a2818ee4SJoe LawrenceLivepatch Self Tests 3a2818ee4SJoe Lawrence==================== 4a2818ee4SJoe Lawrence 5a2818ee4SJoe LawrenceThis is a small set of sanity tests for the kernel livepatching. 6a2818ee4SJoe Lawrence 7a2818ee4SJoe LawrenceThe test suite loads and unloads several test kernel modules to verify 8a2818ee4SJoe Lawrencelivepatch behavior. Debug information is logged to the kernel's message 92eeb0d45SJoe Lawrencebuffer and parsed for expected messages. (Note: the tests will compare 102eeb0d45SJoe Lawrencethe message buffer for only the duration of each individual test.) 11a2818ee4SJoe Lawrence 12a2818ee4SJoe Lawrence 13a2818ee4SJoe LawrenceConfig 14a2818ee4SJoe Lawrence------ 15a2818ee4SJoe Lawrence 16a2818ee4SJoe LawrenceSet these config options and their prerequisites: 17a2818ee4SJoe Lawrence 18a2818ee4SJoe LawrenceCONFIG_LIVEPATCH=y 19a2818ee4SJoe LawrenceCONFIG_TEST_LIVEPATCH=m 20a2818ee4SJoe Lawrence 21a2818ee4SJoe Lawrence 22a2818ee4SJoe LawrenceRunning the tests 23a2818ee4SJoe Lawrence----------------- 24a2818ee4SJoe Lawrence 25a2818ee4SJoe LawrenceTest kernel modules are built as part of lib/ (make modules) and need to 26a2818ee4SJoe Lawrencebe installed (make modules_install) as the test scripts will modprobe 27a2818ee4SJoe Lawrencethem. 28a2818ee4SJoe Lawrence 29a2818ee4SJoe LawrenceTo run the livepatch selftests, from the top of the kernel source tree: 30a2818ee4SJoe Lawrence 31a2818ee4SJoe Lawrence % make -C tools/testing/selftests TARGETS=livepatch run_tests 32a2818ee4SJoe Lawrence 33a2818ee4SJoe Lawrence 34a2818ee4SJoe LawrenceAdding tests 35a2818ee4SJoe Lawrence------------ 36a2818ee4SJoe Lawrence 37a2818ee4SJoe LawrenceSee the common functions.sh file for the existing collection of utility 382eeb0d45SJoe Lawrencefunctions, most importantly setup_config(), start_test() and 392eeb0d45SJoe Lawrencecheck_result(). The latter function greps the kernel's ring buffer for 402eeb0d45SJoe Lawrence"livepatch:" and "test_klp" strings, so tests be sure to include one of 412eeb0d45SJoe Lawrencethose strings for result comparison. Other utility functions include 422eeb0d45SJoe Lawrencegeneral module loading and livepatch loading helpers (waiting for patch 432eeb0d45SJoe Lawrencetransitions, sysfs entries, etc.) 44