aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Ellerman <[email protected]>2015-09-22 14:58:58 -0700
committerLinus Torvalds <[email protected]>2015-09-22 15:09:53 -0700
commit56ed8f169e225dce1f9e40f6eee2e2dabe7d06fc (patch)
tree6ecc1d7d2eaec950afcc43130565fa0daecce574
parent67f6a029b2ccf3399783a0ff2f812666f290d94f (diff)
userfaultfd: selftest: only warn if __NR_userfaultfd is undefined
If __NR_userfaultfd is not yet defined by the arch, warn but still build and run the userfaultfd selftest successfully. Signed-off-by: Michael Ellerman <[email protected]> Signed-off-by: Andrea Arcangeli <[email protected]> Cc: Dr. David Alan Gilbert <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Thierry Reding <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--tools/testing/selftests/vm/userfaultfd.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
index a9e0b9143f06..0671ae1d1052 100644
--- a/tools/testing/selftests/vm/userfaultfd.c
+++ b/tools/testing/selftests/vm/userfaultfd.c
@@ -66,9 +66,7 @@
#include <pthread.h>
#include <linux/userfaultfd.h>
-#ifndef __NR_userfaultfd
-#error "missing __NR_userfaultfd definition"
-#endif
+#ifdef __NR_userfaultfd
static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size;
@@ -631,3 +629,15 @@ int main(int argc, char **argv)
nr_pages, nr_pages_per_cpu);
return userfaultfd_stress();
}
+
+#else /* __NR_userfaultfd */
+
+#warning "missing __NR_userfaultfd definition"
+
+int main(void)
+{
+ printf("skip: Skipping userfaultfd test (missing __NR_userfaultfd)\n");
+ return 0;
+}
+
+#endif /* __NR_userfaultfd */