tools/testing/selftests/kcmp/kcmp_test.c: print reason for failure in kcmp_test
authorDave Jones <davej@redhat.com>
Tue, 18 Dec 2012 00:04:52 +0000 (16:04 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 18 Dec 2012 01:15:27 +0000 (17:15 -0800)
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>
tools/testing/selftests/kcmp/kcmp_test.c

index 358cc6bfa35db71d099ed3f4dcec5e2c0cd66ae8..fa4f1b37e0456eb2934f825f2e0e256449de4dad 100644 (file)
@@ -72,7 +72,8 @@ 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");
@@ -80,7 +81,8 @@ int main(int argc, char **argv)
                /* 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");