diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2015-09-22 14:58:58 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-22 15:09:53 -0700 |
commit | 56ed8f169e225dce1f9e40f6eee2e2dabe7d06fc (patch) | |
tree | 6ecc1d7d2eaec950afcc43130565fa0daecce574 | |
parent | 67f6a029b2ccf3399783a0ff2f812666f290d94f (diff) | |
download | op-kernel-dev-56ed8f169e225dce1f9e40f6eee2e2dabe7d06fc.zip op-kernel-dev-56ed8f169e225dce1f9e40f6eee2e2dabe7d06fc.tar.gz |
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 <mpe@ellerman.id.au>
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | tools/testing/selftests/vm/userfaultfd.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c index a9e0b91..0671ae1 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 */ |