Skip to content

Commit

Permalink
userfaultfd: selftest: only warn if __NR_userfaultfd is undefined
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Ellerman authored and Linus Torvalds committed Sep 22, 2015
1 parent 67f6a02 commit 56ed8f1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tools/testing/selftests/vm/userfaultfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 */

0 comments on commit 56ed8f1

Please sign in to comment.