* [PATCH] selftests: livepatch: add test case of stack_order sysfs interface
@ 2024-10-07 14:11 Wardenjohn
2024-10-07 17:39 ` Josh Poimboeuf
0 siblings, 1 reply; 3+ messages in thread
From: Wardenjohn @ 2024-10-07 14:11 UTC (permalink / raw)
To: jpoimboe, mbenes, jikos, pmladek, joe.lawrence
Cc: live-patching, linux-kernel, Wardenjohn
Add test case of stack_order sysfs interface of livepatch.
Signed-off-by: Wardenjohn <zhangwarden@gmail.com>
---
.../testing/selftests/livepatch/test-sysfs.sh | 24 +++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/tools/testing/selftests/livepatch/test-sysfs.sh b/tools/testing/selftests/livepatch/test-sysfs.sh
index 05a14f5a7bfb..81776749a4e3 100755
--- a/tools/testing/selftests/livepatch/test-sysfs.sh
+++ b/tools/testing/selftests/livepatch/test-sysfs.sh
@@ -19,6 +19,7 @@ check_sysfs_rights "$MOD_LIVEPATCH" "enabled" "-rw-r--r--"
check_sysfs_value "$MOD_LIVEPATCH" "enabled" "1"
check_sysfs_rights "$MOD_LIVEPATCH" "force" "--w-------"
check_sysfs_rights "$MOD_LIVEPATCH" "replace" "-r--r--r--"
+check_sysfs_rights "$MOD_LIVEPATCH" "stack_order" "-r--r--r--"
check_sysfs_rights "$MOD_LIVEPATCH" "transition" "-r--r--r--"
check_sysfs_value "$MOD_LIVEPATCH" "transition" "0"
check_sysfs_rights "$MOD_LIVEPATCH" "vmlinux/patched" "-r--r--r--"
@@ -131,4 +132,27 @@ livepatch: '$MOD_LIVEPATCH': completing unpatching transition
livepatch: '$MOD_LIVEPATCH': unpatching complete
% rmmod $MOD_LIVEPATCH"
+start_test "sysfs test stack_order read"
+
+load_lp $MOD_LIVEPATCH
+
+check_sysfs_rights "$MOD_LIVEPATCH" "stack_order" "-r--r--r--"
+check_sysfs_value "$MOD_LIVEPATCH" "stack_order" "1"
+
+disable_lp $MOD_LIVEPATCH
+unload_lp $MOD_LIVEPATCH
+
+check_result "% insmod test_modules/$MOD_LIVEPATCH.ko replace=0
+livepatch: enabling patch '$MOD_LIVEPATCH'
+livepatch: '$MOD_LIVEPATCH': initializing patching transition
+livepatch: '$MOD_LIVEPATCH': starting patching transition
+livepatch: '$MOD_LIVEPATCH': completing patching transition
+livepatch: '$MOD_LIVEPATCH': patching complete
+% echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled
+livepatch: '$MOD_LIVEPATCH': initializing unpatching transition
+livepatch: '$MOD_LIVEPATCH': starting unpatching transition
+livepatch: '$MOD_LIVEPATCH': completing unpatching transition
+livepatch: '$MOD_LIVEPATCH': unpatching complete
+% rmmod $MOD_LIVEPATCH"
+
exit 0
--
2.18.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests: livepatch: add test case of stack_order sysfs interface
2024-10-07 14:11 [PATCH] selftests: livepatch: add test case of stack_order sysfs interface Wardenjohn
@ 2024-10-07 17:39 ` Josh Poimboeuf
2024-10-08 1:51 ` zhang warden
0 siblings, 1 reply; 3+ messages in thread
From: Josh Poimboeuf @ 2024-10-07 17:39 UTC (permalink / raw)
To: Wardenjohn
Cc: mbenes, jikos, pmladek, joe.lawrence, live-patching, linux-kernel
On Mon, Oct 07, 2024 at 10:11:39PM +0800, Wardenjohn wrote:
> Add test case of stack_order sysfs interface of livepatch.
>
> Signed-off-by: Wardenjohn <zhangwarden@gmail.com>
> ---
> .../testing/selftests/livepatch/test-sysfs.sh | 24 +++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/tools/testing/selftests/livepatch/test-sysfs.sh b/tools/testing/selftests/livepatch/test-sysfs.sh
> index 05a14f5a7bfb..81776749a4e3 100755
> --- a/tools/testing/selftests/livepatch/test-sysfs.sh
> +++ b/tools/testing/selftests/livepatch/test-sysfs.sh
> @@ -19,6 +19,7 @@ check_sysfs_rights "$MOD_LIVEPATCH" "enabled" "-rw-r--r--"
> check_sysfs_value "$MOD_LIVEPATCH" "enabled" "1"
> check_sysfs_rights "$MOD_LIVEPATCH" "force" "--w-------"
> check_sysfs_rights "$MOD_LIVEPATCH" "replace" "-r--r--r--"
> +check_sysfs_rights "$MOD_LIVEPATCH" "stack_order" "-r--r--r--"
> check_sysfs_rights "$MOD_LIVEPATCH" "transition" "-r--r--r--"
> check_sysfs_value "$MOD_LIVEPATCH" "transition" "0"
> check_sysfs_rights "$MOD_LIVEPATCH" "vmlinux/patched" "-r--r--r--"
> @@ -131,4 +132,27 @@ livepatch: '$MOD_LIVEPATCH': completing unpatching transition
> livepatch: '$MOD_LIVEPATCH': unpatching complete
> % rmmod $MOD_LIVEPATCH"
>
> +start_test "sysfs test stack_order read"
> +
> +load_lp $MOD_LIVEPATCH
> +
> +check_sysfs_rights "$MOD_LIVEPATCH" "stack_order" "-r--r--r--"
> +check_sysfs_value "$MOD_LIVEPATCH" "stack_order" "1"
At the very least this should load more than one module so it can verify
the stack orders match the load order.
--
Josh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests: livepatch: add test case of stack_order sysfs interface
2024-10-07 17:39 ` Josh Poimboeuf
@ 2024-10-08 1:51 ` zhang warden
0 siblings, 0 replies; 3+ messages in thread
From: zhang warden @ 2024-10-08 1:51 UTC (permalink / raw)
To: Josh Poimboeuf
Cc: Miroslav Benes, Jiri Kosina, Petr Mladek, Joe Lawrence,
live-patching, linux-kernel
Hi, Josh.
> On Oct 8, 2024, at 01:39, Josh Poimboeuf <jpoimboe@kernel.org> wrote:
>
> On Mon, Oct 07, 2024 at 10:11:39PM +0800, Wardenjohn wrote:
>> Add test case of stack_order sysfs interface of livepatch.
>>
>> Signed-off-by: Wardenjohn <zhangwarden@gmail.com>
>> ---
>> .../testing/selftests/livepatch/test-sysfs.sh | 24 +++++++++++++++++++
>> 1 file changed, 24 insertions(+)
>>
>> diff --git a/tools/testing/selftests/livepatch/test-sysfs.sh b/tools/testing/selftests/livepatch/test-sysfs.sh
>> index 05a14f5a7bfb..81776749a4e3 100755
>> --- a/tools/testing/selftests/livepatch/test-sysfs.sh
>> +++ b/tools/testing/selftests/livepatch/test-sysfs.sh
>> @@ -19,6 +19,7 @@ check_sysfs_rights "$MOD_LIVEPATCH" "enabled" "-rw-r--r--"
>> check_sysfs_value "$MOD_LIVEPATCH" "enabled" "1"
>> check_sysfs_rights "$MOD_LIVEPATCH" "force" "--w-------"
>> check_sysfs_rights "$MOD_LIVEPATCH" "replace" "-r--r--r--"
>> +check_sysfs_rights "$MOD_LIVEPATCH" "stack_order" "-r--r--r--"
>> check_sysfs_rights "$MOD_LIVEPATCH" "transition" "-r--r--r--"
>> check_sysfs_value "$MOD_LIVEPATCH" "transition" "0"
>> check_sysfs_rights "$MOD_LIVEPATCH" "vmlinux/patched" "-r--r--r--"
>> @@ -131,4 +132,27 @@ livepatch: '$MOD_LIVEPATCH': completing unpatching transition
>> livepatch: '$MOD_LIVEPATCH': unpatching complete
>> % rmmod $MOD_LIVEPATCH"
>>
>> +start_test "sysfs test stack_order read"
>> +
>> +load_lp $MOD_LIVEPATCH
>> +
>> +check_sysfs_rights "$MOD_LIVEPATCH" "stack_order" "-r--r--r--"
>> +check_sysfs_value "$MOD_LIVEPATCH" "stack_order" "1"
>
> At the very least this should load more than one module so it can verify
> the stack orders match the load order.
>
> --
> Josh
I got it. And I found more test modules in selftests/livepatch/test_modules
I will fix this problem with the modules inside.
Thank you!
Regards.
Wardenjohn.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-08 1:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 14:11 [PATCH] selftests: livepatch: add test case of stack_order sysfs interface Wardenjohn
2024-10-07 17:39 ` Josh Poimboeuf
2024-10-08 1:51 ` zhang warden
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox