summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLi Zhijian <zhijianx.li@intel.com>2018-02-22 10:34:02 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-30 07:52:01 +0200
commita72612a1c39dd86863c1e3af57e321ad41a26f2d (patch)
tree9c4b5ef39dd6f1a15559a1b1e09ab831de5d7c84 /tools
parentdac5d3a100c62bba3795286d44ac9200573c9c44 (diff)
downloadlinux-stable-a72612a1c39dd86863c1e3af57e321ad41a26f2d.tar.gz
linux-stable-a72612a1c39dd86863c1e3af57e321ad41a26f2d.tar.bz2
linux-stable-a72612a1c39dd86863c1e3af57e321ad41a26f2d.zip
selftests/bpf/test_maps: exit child process without error in ENOMEM case
[ Upstream commit 80475c48c6a8a65171e035e0915dc7996b5a0a65 ] 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 <alexei.starovoitov@gmail.com> CC: Philip Li <philip.li@intel.com> Suggested-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Li Zhijian <zhijianx.li@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/bpf/test_maps.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
index 8b9470b5af6d..96c6238a4a1f 100644
--- a/tools/testing/selftests/bpf/test_maps.c
+++ b/tools/testing/selftests/bpf/test_maps.c
@@ -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);