Skip to content

Commit 5e4d468

Browse files
committed
selftests/livepatch: adopt to newer sysctl error format
With procfs v3.3.16, the sysctl command doesn't print the set key and value on error. This change breaks livepatch selftest test-ftrace.sh, that tests the interaction of sysctl ftrace_enabled: Make it work with all sysctl versions using '-q' option. Explicitly print the final status on success so that it can be verified in the log. The error message is enough on failure. Reported-by: Kamalesh Babulal <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Reviewed-by: Kamalesh Babulal <[email protected]> Reviewed-by: Joe Lawrence <[email protected]> Acked-by: Miroslav Benes <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2f3f651 commit 5e4d468

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

tools/testing/selftests/livepatch/functions.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ function set_dynamic_debug() {
7575
}
7676

7777
function set_ftrace_enabled() {
78-
result=$(sysctl kernel.ftrace_enabled="$1" 2>&1 | paste --serial --delimiters=' ')
78+
result=$(sysctl -q kernel.ftrace_enabled="$1" 2>&1 && \
79+
sysctl kernel.ftrace_enabled 2>&1)
7980
echo "livepatch: $result" > /dev/kmsg
8081
}
8182

tools/testing/selftests/livepatch/test-ftrace.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ livepatch: '$MOD_LIVEPATCH': initializing patching transition
5151
livepatch: '$MOD_LIVEPATCH': starting patching transition
5252
livepatch: '$MOD_LIVEPATCH': completing patching transition
5353
livepatch: '$MOD_LIVEPATCH': patching complete
54-
livepatch: sysctl: setting key \"kernel.ftrace_enabled\": Device or resource busy kernel.ftrace_enabled = 0
54+
livepatch: sysctl: setting key \"kernel.ftrace_enabled\": Device or resource busy
5555
% echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled
5656
livepatch: '$MOD_LIVEPATCH': initializing unpatching transition
5757
livepatch: '$MOD_LIVEPATCH': starting unpatching transition

0 commit comments

Comments
 (0)