selftests:proc add missing field KSM in smaps_rollup[] array

Message ID 20230930122523.118173-1-swarupkotikalapudi@gmail.com
State New
Headers
Series selftests:proc add missing field KSM in smaps_rollup[] array |

Commit Message

Swarup Laxman Kotiaklapudi Sept. 30, 2023, 12:25 p.m. UTC
  Missing field KSM is added in g_smaps_rollup[] array as it
fixes assert in function test_proc_pid_smaps_rollup()

Without this patchset test fails for "proc-empty-vm" as can be seen below:
$make TARGETS="proc" kselftest
...
  selftests: proc: proc-empty-vm
  proc-empty-vm: proc-empty-vm.c:299: test_proc_pid_smaps_rollup:
   Assertion `rv == sizeof(g_smaps_rollup) - 1' failed.
  /usr/bin/timeout: the monitored command dumped core
  Aborted
  not ok 5 selftests: proc: proc-empty-vm # exit=134
...

With this patchset test passes for "proc-empty-vm" as can be seen below:
$make TARGETS="proc" kselftest
....
timeout set to 45
selftests: proc: proc-empty-vm
ok 5 selftests: proc: proc-empty-vm
....

Signed-off-by: Swarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com>
---
 tools/testing/selftests/proc/proc-empty-vm.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Andrew Morton Oct. 1, 2023, 7:52 p.m. UTC | #1
On Sat, 30 Sep 2023 17:55:23 +0530 Swarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com> wrote:

> Missing field KSM is added in g_smaps_rollup[] array as it
> fixes assert in function test_proc_pid_smaps_rollup()
> 
> Without this patchset test fails for "proc-empty-vm" as can be seen below:
> $make TARGETS="proc" kselftest
> ...
>   selftests: proc: proc-empty-vm
>   proc-empty-vm: proc-empty-vm.c:299: test_proc_pid_smaps_rollup:
>    Assertion `rv == sizeof(g_smaps_rollup) - 1' failed.
>   /usr/bin/timeout: the monitored command dumped core
>   Aborted
>   not ok 5 selftests: proc: proc-empty-vm # exit=134
> ...
> 
> With this patchset test passes for "proc-empty-vm" as can be seen below:
> $make TARGETS="proc" kselftest
> ....
> timeout set to 45
> selftests: proc: proc-empty-vm
> ok 5 selftests: proc: proc-empty-vm
> ....
> 

Thanks.  We fixed this in

commit 9d1be94df5acd486b157e85ffa53d344e5b17e22
Author: Alexey Dobriyan <adobriyan@gmail.com>
Date:   Thu Sep 7 14:10:12 2023 +0300

    selftests/proc: fixup proc-empty-vm test after KSM changes
  

Patch

diff --git a/tools/testing/selftests/proc/proc-empty-vm.c b/tools/testing/selftests/proc/proc-empty-vm.c
index b16c13688b88..ee71ce52cb6a 100644
--- a/tools/testing/selftests/proc/proc-empty-vm.c
+++ b/tools/testing/selftests/proc/proc-empty-vm.c
@@ -267,6 +267,7 @@  static const char g_smaps_rollup[] =
 "Private_Dirty:         0 kB\n"
 "Referenced:            0 kB\n"
 "Anonymous:             0 kB\n"
+"KSM:                   0 kB\n"
 "LazyFree:              0 kB\n"
 "AnonHugePages:         0 kB\n"
 "ShmemPmdMapped:        0 kB\n"