1*a2818ee4SJoe Lawrence==================== 2*a2818ee4SJoe LawrenceLivepatch Self Tests 3*a2818ee4SJoe Lawrence==================== 4*a2818ee4SJoe Lawrence 5*a2818ee4SJoe LawrenceThis is a small set of sanity tests for the kernel livepatching. 6*a2818ee4SJoe Lawrence 7*a2818ee4SJoe LawrenceThe test suite loads and unloads several test kernel modules to verify 8*a2818ee4SJoe Lawrencelivepatch behavior. Debug information is logged to the kernel's message 9*a2818ee4SJoe Lawrencebuffer and parsed for expected messages. (Note: the tests will clear 10*a2818ee4SJoe Lawrencethe message buffer between individual tests.) 11*a2818ee4SJoe Lawrence 12*a2818ee4SJoe Lawrence 13*a2818ee4SJoe LawrenceConfig 14*a2818ee4SJoe Lawrence------ 15*a2818ee4SJoe Lawrence 16*a2818ee4SJoe LawrenceSet these config options and their prerequisites: 17*a2818ee4SJoe Lawrence 18*a2818ee4SJoe LawrenceCONFIG_LIVEPATCH=y 19*a2818ee4SJoe LawrenceCONFIG_TEST_LIVEPATCH=m 20*a2818ee4SJoe Lawrence 21*a2818ee4SJoe Lawrence 22*a2818ee4SJoe LawrenceRunning the tests 23*a2818ee4SJoe Lawrence----------------- 24*a2818ee4SJoe Lawrence 25*a2818ee4SJoe LawrenceTest kernel modules are built as part of lib/ (make modules) and need to 26*a2818ee4SJoe Lawrencebe installed (make modules_install) as the test scripts will modprobe 27*a2818ee4SJoe Lawrencethem. 28*a2818ee4SJoe Lawrence 29*a2818ee4SJoe LawrenceTo run the livepatch selftests, from the top of the kernel source tree: 30*a2818ee4SJoe Lawrence 31*a2818ee4SJoe Lawrence % make -C tools/testing/selftests TARGETS=livepatch run_tests 32*a2818ee4SJoe Lawrence 33*a2818ee4SJoe Lawrence 34*a2818ee4SJoe LawrenceAdding tests 35*a2818ee4SJoe Lawrence------------ 36*a2818ee4SJoe Lawrence 37*a2818ee4SJoe LawrenceSee the common functions.sh file for the existing collection of utility 38*a2818ee4SJoe Lawrencefunctions, most importantly set_dynamic_debug() and check_result(). The 39*a2818ee4SJoe Lawrencelatter function greps the kernel's ring buffer for "livepatch:" and 40*a2818ee4SJoe Lawrence"test_klp" strings, so tests be sure to include one of those strings for 41*a2818ee4SJoe Lawrenceresult comparison. Other utility functions include general module 42*a2818ee4SJoe Lawrenceloading and livepatch loading helpers (waiting for patch transitions, 43*a2818ee4SJoe Lawrencesysfs entries, etc.) 44