@@ -12,8 +12,6 @@ MOD_TARGET_BUSY=test_klp_callbacks_busy
1212setup_config
1313
1414
15- # TEST: target module before livepatch
16- #
1715# Test a combination of loading a kernel module and a livepatch that
1816# patches a function in the first module. Load the target module
1917# before the livepatch module. Unload them in the same order.
@@ -28,8 +26,7 @@ setup_config
2826# unpatching transition starts. klp_objects are reverted, post-patch
2927# callbacks execute and the transition completes.
3028
31- echo -n " TEST: target module before livepatch ... "
32- dmesg -C
29+ start_test " target module before livepatch"
3330
3431load_mod $MOD_TARGET
3532load_lp $MOD_LIVEPATCH
@@ -63,8 +60,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
6360$MOD_TARGET : ${MOD_TARGET} _exit"
6461
6562
66- # TEST: module_coming notifier
67- #
6863# This test is similar to the previous test, but (un)load the livepatch
6964# module before the target kernel module. This tests the livepatch
7065# core's module_coming handler.
@@ -78,8 +73,7 @@ $MOD_TARGET: ${MOD_TARGET}_exit"
7873# - On livepatch disable, all currently loaded klp_objects' (vmlinux and
7974# $MOD_TARGET) pre/post-unpatch callbacks are executed.
8075
81- echo -n " TEST: module_coming notifier ... "
82- dmesg -C
76+ start_test " module_coming notifier"
8377
8478load_lp $MOD_LIVEPATCH
8579load_mod $MOD_TARGET
@@ -114,8 +108,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
114108$MOD_TARGET : ${MOD_TARGET} _exit"
115109
116110
117- # TEST: module_going notifier
118- #
119111# Test loading the livepatch after a targeted kernel module, then unload
120112# the kernel module before disabling the livepatch. This tests the
121113# livepatch core's module_going handler.
@@ -129,8 +121,7 @@ $MOD_TARGET: ${MOD_TARGET}_exit"
129121# - When the livepatch is disabled, pre and post-unpatch callbacks are
130122# run for the remaining klp_object, vmlinux.
131123
132- echo -n " TEST: module_going notifier ... "
133- dmesg -C
124+ start_test " module_going notifier"
134125
135126load_mod $MOD_TARGET
136127load_lp $MOD_LIVEPATCH
@@ -165,8 +156,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
165156% rmmod $MOD_LIVEPATCH "
166157
167158
168- # TEST: module_coming and module_going notifiers
169- #
170159# This test is similar to the previous test, however the livepatch is
171160# loaded first. This tests the livepatch core's module_coming and
172161# module_going handlers.
@@ -180,8 +169,7 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
180169# from the $MOD_TARGET klp_object. As such, only pre and
181170# post-unpatch callbacks are executed when this occurs.
182171
183- echo -n " TEST: module_coming and module_going notifiers ... "
184- dmesg -C
172+ start_test " module_coming and module_going notifiers"
185173
186174load_lp $MOD_LIVEPATCH
187175load_mod $MOD_TARGET
@@ -217,8 +205,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
217205% rmmod $MOD_LIVEPATCH "
218206
219207
220- # TEST: target module not present
221- #
222208# A simple test of loading a livepatch without one of its patch target
223209# klp_objects ever loaded ($MOD_TARGET).
224210#
@@ -227,8 +213,7 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
227213# - As expected, only pre/post-(un)patch handlers are executed for
228214# vmlinux.
229215
230- echo -n " TEST: target module not present ... "
231- dmesg -C
216+ start_test " target module not present"
232217
233218load_lp $MOD_LIVEPATCH
234219disable_lp $MOD_LIVEPATCH
@@ -252,8 +237,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
252237% rmmod $MOD_LIVEPATCH "
253238
254239
255- # TEST: pre-patch callback -ENODEV
256- #
257240# Test a scenario where a vmlinux pre-patch callback returns a non-zero
258241# status (ie, failure).
259242#
@@ -265,8 +248,7 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
265248# The result is that the insmod command refuses to load the livepatch
266249# module.
267250
268- echo -n " TEST: pre-patch callback -ENODEV ... "
269- dmesg -C
251+ start_test " pre-patch callback -ENODEV"
270252
271253load_mod $MOD_TARGET
272254load_failing_mod $MOD_LIVEPATCH pre_patch_ret=-19
@@ -288,8 +270,6 @@ modprobe: ERROR: could not insert '$MOD_LIVEPATCH': No such device
288270$MOD_TARGET : ${MOD_TARGET} _exit"
289271
290272
291- # TEST: module_coming + pre-patch callback -ENODEV
292- #
293273# Similar to the previous test, setup a livepatch such that its vmlinux
294274# pre-patch callback returns success. However, when a targeted kernel
295275# module is later loaded, have the livepatch return a failing status
@@ -307,8 +287,7 @@ $MOD_TARGET: ${MOD_TARGET}_exit"
307287#
308288# - Pre/post-unpatch callbacks are run for the vmlinux klp_object.
309289
310- echo -n " TEST: module_coming + pre-patch callback -ENODEV ... "
311- dmesg -C
290+ start_test " module_coming + pre-patch callback -ENODEV"
312291
313292load_lp $MOD_LIVEPATCH
314293set_pre_patch_ret $MOD_LIVEPATCH -19
@@ -341,8 +320,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
341320% rmmod $MOD_LIVEPATCH "
342321
343322
344- # TEST: multiple target modules
345- #
346323# Test loading multiple targeted kernel modules. This test-case is
347324# mainly for comparing with the next test-case.
348325#
@@ -353,8 +330,7 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
353330# module. Post-patch callbacks are executed and the transition
354331# completes quickly.
355332
356- echo -n " TEST: multiple target modules ... "
357- dmesg -C
333+ start_test " multiple target modules"
358334
359335load_mod $MOD_TARGET_BUSY block_transition=N
360336load_lp $MOD_LIVEPATCH
@@ -402,8 +378,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
402378$MOD_TARGET_BUSY : ${MOD_TARGET_BUSY} _exit"
403379
404380
405- # TEST: busy target module
406- #
407381# A similar test as the previous one, but force the "busy" kernel module
408382# to block the livepatch transition.
409383#
@@ -431,8 +405,7 @@ $MOD_TARGET_BUSY: ${MOD_TARGET_BUSY}_exit"
431405# klp_object's post-patch callbacks executed, the remaining
432406# klp_object's pre-unpatch callbacks are skipped.
433407
434- echo -n " TEST: busy target module ... "
435- dmesg -C
408+ start_test " busy target module"
436409
437410load_mod $MOD_TARGET_BUSY block_transition=Y
438411load_lp_nowait $MOD_LIVEPATCH
@@ -478,17 +451,14 @@ $MOD_TARGET_BUSY: busymod_work_func exit
478451$MOD_TARGET_BUSY : ${MOD_TARGET_BUSY} _exit"
479452
480453
481- # TEST: multiple livepatches
482- #
483454# Test loading multiple livepatches. This test-case is mainly for comparing
484455# with the next test-case.
485456#
486457# - Load and unload two livepatches, pre and post (un)patch callbacks
487458# execute as each patch progresses through its (un)patching
488459# transition.
489460
490- echo -n " TEST: multiple livepatches ... "
491- dmesg -C
461+ start_test " multiple livepatches"
492462
493463load_lp $MOD_LIVEPATCH
494464load_lp $MOD_LIVEPATCH2
@@ -531,8 +501,6 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
531501% rmmod $MOD_LIVEPATCH "
532502
533503
534- # TEST: atomic replace
535- #
536504# Load multiple livepatches, but the second as an 'atomic-replace'
537505# patch. When the latter loads, the original livepatch should be
538506# disabled and *none* of its pre/post-unpatch callbacks executed. On
@@ -547,8 +515,7 @@ livepatch: '$MOD_LIVEPATCH': unpatching complete
547515# - Once the atomic replace module is loaded, only its pre and post
548516# unpatch callbacks are executed.
549517
550- echo -n " TEST: atomic replace ... "
551- dmesg -C
518+ start_test " atomic replace"
552519
553520load_lp $MOD_LIVEPATCH
554521load_lp $MOD_LIVEPATCH2 replace=1
0 commit comments