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

tools/testing/selftests/kcmp/kcmp_test.c: print reason for failure in kcmp_test

I was curious why sys_kcmp wasn't working, which led me to the testcase.
It turned out I hadn't enabled CHECKPOINT_RESTORE in the kernel I was
testing. Add a decoding of errno to the testcase to make that obvious.

Signed-off-by: Dave Jones <davej@redhat.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Dave Jones and committed by
Linus Torvalds
2bf1cbf1 5a55f8bb

+4 -2
+4 -2
tools/testing/selftests/kcmp/kcmp_test.c
··· 72 72 /* This one should return same fd */ 73 73 ret = sys_kcmp(pid1, pid2, KCMP_FILE, fd1, fd1); 74 74 if (ret) { 75 - printf("FAIL: 0 expected but %d returned\n", ret); 75 + printf("FAIL: 0 expected but %d returned (%s)\n", 76 + ret, strerror(errno)); 76 77 ret = -1; 77 78 } else 78 79 printf("PASS: 0 returned as expected\n"); ··· 81 80 /* Compare with self */ 82 81 ret = sys_kcmp(pid1, pid1, KCMP_VM, 0, 0); 83 82 if (ret) { 84 - printf("FAIL: 0 expected but %li returned\n", ret); 83 + printf("FAIL: 0 expected but %li returned (%s)\n", 84 + ret, strerror(errno)); 85 85 ret = -1; 86 86 } else 87 87 printf("PASS: 0 returned as expected\n");