diff mbox series

[3/3] userfaultfd/selftests: Hint the test runner on required privilege

Message ID 20201208024709.7701-4-peterx@redhat.com (mailing list archive)
State New, archived
Headers show
Series userfaultfd: selftests: Small fixes | expand

Commit Message

Peter Xu Dec. 8, 2020, 2:47 a.m. UTC
Now userfaultfd test program requires either root or ptrace privilege due to
the signal/event tests.  When UFFDIO_API failed, hint the test runner about
this fact verbosely.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 tools/testing/selftests/vm/userfaultfd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
index f0647bfda366..27a1709099d0 100644
--- a/tools/testing/selftests/vm/userfaultfd.c
+++ b/tools/testing/selftests/vm/userfaultfd.c
@@ -755,7 +755,8 @@  static int userfaultfd_open(int features)
 	uffdio_api.api = UFFD_API;
 	uffdio_api.features = features;
 	if (ioctl(uffd, UFFDIO_API, &uffdio_api)) {
-		fprintf(stderr, "UFFDIO_API\n");
+		fprintf(stderr, "UFFDIO_API failed.\nPlease make sure to "
+			"run with either root or ptrace capability.\n");
 		return 1;
 	}
 	if (uffdio_api.api != UFFD_API) {