Skip to content

Commit

Permalink
userfaultfd: selftest: return an error if BOUNCE_VERIFY fails
Browse files Browse the repository at this point in the history
This will report the error in the exit code, in addition of the fprintf.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
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
Andrea Arcangeli authored and Linus Torvalds committed Sep 22, 2015
1 parent 1f5fee2 commit a5932bf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tools/testing/selftests/vm/userfaultfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ static int userfaultfd_stress(void)
struct uffdio_register uffdio_register;
struct uffdio_api uffdio_api;
unsigned long cpu;
int uffd_flags;
int uffd_flags, err;
unsigned long userfaults[nr_cpus];

if (posix_memalign(&area, page_size, nr_pages * page_size)) {
Expand Down Expand Up @@ -499,6 +499,7 @@ static int userfaultfd_stress(void)
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, 16*1024*1024);

err = 0;
while (bounces--) {
unsigned long expected_ioctls;

Expand Down Expand Up @@ -583,8 +584,9 @@ static int userfaultfd_stress(void)
area_dst + nr * page_size,
sizeof(pthread_mutex_t))) {
fprintf(stderr,
"error mutex 2 %lu\n",
"error mutex %lu\n",
nr);
err = 1;
bounces = 0;
}
if (*area_count(area_dst, nr) != count_verify[nr]) {
Expand All @@ -593,6 +595,7 @@ static int userfaultfd_stress(void)
*area_count(area_src, nr),
count_verify[nr],
nr);
err = 1;
bounces = 0;
}
}
Expand All @@ -609,7 +612,7 @@ static int userfaultfd_stress(void)
printf("\n");
}

return 0;
return err;
}

int main(int argc, char **argv)
Expand Down

0 comments on commit a5932bf

Please sign in to comment.