linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/bpf/test_maps: exit child process without error in ENOMEM case
@ 2018-02-12 13:52 Li Zhijian
  2018-02-14  3:28 ` Alexei Starovoitov
  0 siblings, 1 reply; 2+ messages in thread
From: Li Zhijian @ 2018-02-12 13:52 UTC (permalink / raw)
  To: shuah, ast, daniel
  Cc: linux-kernel, linux-kselftest, Li Zhijian, Alexei Starovoitov, Philip Li

From: Li Zhijian <zhijianx.li@intel.com>

test_maps contains a series of stress tests, and previously it will break the
reset 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 a ENOMEM failure

CC: Alexei Starovoitov <alexei.starovoitov@gmail.com>
CC: Philip Li <philip.li@intel.com>
Suggest-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Li Zhijian <zhijianx.li@intel.com>
---
 tools/testing/selftests/bpf/test_maps.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
index 436c4c7..9e03a4c 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);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests/bpf/test_maps: exit child process without error in ENOMEM case
  2018-02-12 13:52 [PATCH] selftests/bpf/test_maps: exit child process without error in ENOMEM case Li Zhijian
@ 2018-02-14  3:28 ` Alexei Starovoitov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2018-02-14  3:28 UTC (permalink / raw)
  To: Li Zhijian
  Cc: shuah, ast, daniel, linux-kernel, linux-kselftest, Li Zhijian, Philip Li

On Mon, Feb 12, 2018 at 09:52:04PM +0800, Li Zhijian wrote:
> From: Li Zhijian <zhijianx.li@intel.com>
> 
> test_maps contains a series of stress tests, and previously it will break the
> reset 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 a ENOMEM failure
> 
> CC: Alexei Starovoitov <alexei.starovoitov@gmail.com>
> CC: Philip Li <philip.li@intel.com>
> Suggest-by: Daniel Borkmann <daniel@iogearbox.net>
> Signed-off-by: Li Zhijian <zhijianx.li@intel.com>

could you please resend it and cc netdev so it appears in patchworks properly.

Thanks!


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-14  3:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-12 13:52 [PATCH] selftests/bpf/test_maps: exit child process without error in ENOMEM case Li Zhijian
2018-02-14  3:28 ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).