Skip to content

Commit

Permalink
selftests/bpf/test_maps: exit child process without error in ENOMEM case
Browse files Browse the repository at this point in the history
test_maps contains a series of stress tests, and previously it will break the
rest tests when it failed to alloc memory.
-----------------------
Failed to create hashmap key=8 value=262144 'Cannot allocate memory'
Failed to create hashmap key=16 value=262144 'Cannot allocate memory'
Failed to create hashmap key=8 value=262144 'Cannot allocate memory'
Failed to create hashmap key=8 value=262144 'Cannot allocate memory'
test_maps: test_maps.c:955: run_parallel: Assertion `status == 0' failed.
Aborted
not ok 1..3 selftests:  test_maps [FAIL]
-----------------------
after this patch, the rest tests will be continue when it occurs an ENOMEM failure

CC: Alexei Starovoitov <[email protected]>
CC: Philip Li <[email protected]>
Suggested-by: Daniel Borkmann <[email protected]>
Signed-off-by: Li Zhijian <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
  • Loading branch information
zhijianli88 authored and borkmann committed Feb 22, 2018
1 parent 31a8260 commit 80475c4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/testing/selftests/bpf/test_maps.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ static void test_hashmap_sizes(int task, void *data)
fd = bpf_create_map(BPF_MAP_TYPE_HASH, i, j,
2, map_flags);
if (fd < 0) {
if (errno == ENOMEM)
return;
printf("Failed to create hashmap key=%d value=%d '%s'\n",
i, j, strerror(errno));
exit(1);
Expand Down

0 comments on commit 80475c4

Please sign in to comment.