Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/kcmp: Make the test output consistent and clear

Make the output format of this test consistent. Currently the output is
as follows:

+TAP version 13
+1..1
+# selftests: kcmp: kcmp_test
+# pid1: 45814 pid2: 45815 FD: 1 FILES: 1 VM: 2 FS: 1 SIGHAND: 2
+ IO: 0 SYSVSEM: 0 INV: -1
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# # Planned tests != run tests (0 != 3)
+# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
+# # Planned tests != run tests (0 != 3)
+# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
+# # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
+ok 1 selftests: kcmp: kcmp_test

With this patch applied the output is as follows:

+TAP version 13
+1..1
+# selftests: kcmp: kcmp_test
+# TAP version 13
+# 1..3
+# pid1: 46330 pid2: 46331 FD: 1 FILES: 2 VM: 2 FS: 2 SIGHAND: 1
+ IO: 0 SYSVSEM: 0 INV: -1
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
+ok 1 selftests: kcmp: kcmp_test

Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Gautam Menghani and committed by
Shuah Khan
ff682226 b7ecce68

+4 -2
+4 -2
tools/testing/selftests/kcmp/kcmp_test.c
··· 88 88 int pid2 = getpid(); 89 89 int ret; 90 90 91 + ksft_print_header(); 92 + ksft_set_plan(3); 93 + 91 94 fd2 = open(kpath, O_RDWR, 0644); 92 95 if (fd2 < 0) { 93 96 perror("Can't open file"); ··· 155 152 ksft_inc_pass_cnt(); 156 153 } 157 154 158 - ksft_print_cnts(); 159 155 160 156 if (ret) 161 157 ksft_exit_fail(); ··· 164 162 165 163 waitpid(pid2, &status, P_ALL); 166 164 167 - return ksft_exit_pass(); 165 + return 0; 168 166 }