Skip to content

Commit

Permalink
tools/testing/selftests/kcmp/kcmp_test.c: print reason for failure in…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Dave Jones authored and Linus Torvalds committed Dec 18, 2012
1 parent 5a55f8b commit 2bf1cbf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/testing/selftests/kcmp/kcmp_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,17 @@ int main(int argc, char **argv)
/* This one should return same fd */
ret = sys_kcmp(pid1, pid2, KCMP_FILE, fd1, fd1);
if (ret) {
printf("FAIL: 0 expected but %d returned\n", ret);
printf("FAIL: 0 expected but %d returned (%s)\n",
ret, strerror(errno));
ret = -1;
} else
printf("PASS: 0 returned as expected\n");

/* Compare with self */
ret = sys_kcmp(pid1, pid1, KCMP_VM, 0, 0);
if (ret) {
printf("FAIL: 0 expected but %li returned\n", ret);
printf("FAIL: 0 expected but %li returned (%s)\n",
ret, strerror(errno));
ret = -1;
} else
printf("PASS: 0 returned as expected\n");
Expand Down

0 comments on commit 2bf1cbf

Please sign in to comment.