Skip to contentSkip to conversation

selftests/livepatch: normalize sysctl error message

PATCH In review Joe Lawrence 3 participants 3 messages Aug 11, 2022 – Sep 23, 2022

Subsystems (2)
lore
Share & tools
lore

Joe Lawrence

author maintainer
#0 lore raw

PATCH 1/1 selftests/livepatch: normalize sysctl error message

The livepatch kselftests rely on comparing expected and actual output from such commands as sysctl. A recent commit in procps-ng v4.0.0 [1] changed sysctl's output to emit key pathnames like:

sysctl: setting key "/proc/sys/kernel/ftrace_enabled": Device or resource busy

versus previous dotted output:

sysctl: setting key "kernel.ftrace_enabled": Device or resource busy

The modification in output was later reverted [2], but since the change has been tagged in procps-ng v4.0.0, update the livepatch kselftest to handle either case.

[1] https://gitlab.com/procps-ng/procps/-/commit/6389deca5bf667f5fab5912acde78ba8e0febbc7
[2] https://gitlab.com/procps-ng/procps/-/commit/b159c198c9160a8eb13254e2b631d0035b9b542c

---
 tools/testing/selftests/livepatch/functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/livepatch/functions.sh +1 -1
index 9230b869371d..d5001c9eb72e 100644
@@ -86,7 +86,7 @@ function set_ftrace_enabled() {
 
 	if [[ "$result" != "$1" ]] ; then
 		if [[ $can_fail -eq 1 ]] ; then
-			echo "livepatch: $err" > /dev/kmsg
+			echo "livepatch: $err" | sed 's#/proc/sys/kernel/#kernel.#' > /dev/kmsg
 			return
 		fi
 
Signature · 1 line
2.26.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Joe Lawrence

The livepatch kselftests rely on comparing expected and actual output from such commands as sysctl. A recent commit in procps-ng v4.0.0 [1] changed sysctl's output to emit key pathnames like:

sysctl: setting key "/proc/sys/kernel/ftrace_enabled": Device or resource busy

versus previous dotted output:

sysctl: setting key "kernel.ftrace_enabled": Device or resource busy

The modification in output was later reverted [2], but since the change has been tagged in procps-ng v4.0.0, update the livepatch kselftest to handle either case.

Quoted 5 lines

[1] https://gitlab.com/procps-ng/procps/-/commit/6389deca5bf667f5fab5912acde78ba8e0febbc7
[2] https://gitlab.com/procps-ng/procps/-/commit/b159c198c9160a8eb13254e2b631d0035b9b542c

Quoted 17 lines
---
 tools/testing/selftests/livepatch/functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/livepatch/functions.sh +1 -1
index 9230b869371d..d5001c9eb72e 100644
@@ -86,7 +86,7 @@ function set_ftrace_enabled() {
 
 	if [[ "$result" != "$1" ]] ; then
 		if [[ $can_fail -eq 1 ]] ; then
-			echo "livepatch: $err" > /dev/kmsg
+			echo "livepatch: $err" | sed 's#/proc/sys/kernel/#kernel.#' > /dev/kmsg
 			return
 		fi
 
Signature · 2 lines
Thanks,
Kamalesh
maintainer
#2 lore raw
In reply to Joe Lawrence
Quoted 14 lines · Joe Lawrence

The livepatch kselftests rely on comparing expected and actual output from such commands as sysctl. A recent commit in procps-ng v4.0.0 [1] changed sysctl's output to emit key pathnames like:

sysctl: setting key "/proc/sys/kernel/ftrace_enabled": Device or resource busy

versus previous dotted output:

sysctl: setting key "kernel.ftrace_enabled": Device or resource busy

The modification in output was later reverted [2], but since the change has been tagged in procps-ng v4.0.0, update the livepatch kselftest to handle either case.

Quoted 5 lines

[1] https://gitlab.com/procps-ng/procps/-/commit/6389deca5bf667f5fab5912acde78ba8e0febbc7
[2] https://gitlab.com/procps-ng/procps/-/commit/b159c198c9160a8eb13254e2b631d0035b9b542c

JFYI, the patch has been committed into livepatching.git, branch for-6.1/fixes.

Best Regards,
Petr