Re: [PATCH bpf-next v2 3/4] selftests/bpf: Monitor traffic for sockmap_listen.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2024-07-23 at 11:24 -0700, Kui-Feng Lee wrote:
> Enable traffic monitor for each subtest of sockmap_listen.
> 
> Signed-off-by: Kui-Feng Lee <thinker.li@xxxxxxxxx>
> ---
>  tools/testing/selftests/bpf/prog_tests/sockmap_listen.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> index e91b59366030..62683ccb6d56 100644
> --- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> @@ -28,6 +28,7 @@
>  #include "test_sockmap_listen.skel.h"
>  
>  #include "sockmap_helpers.h"
> +#include "network_helpers.h"
>  
>  static void test_insert_invalid(struct test_sockmap_listen *skel
> __always_unused,
>  				int family, int sotype, int mapfd)
> @@ -1893,14 +1894,21 @@ static void test_udp_unix_redir(struct
> test_sockmap_listen *skel, struct bpf_map
>  {
>  	const char *family_name, *map_name;
>  	char s[MAX_TEST_NAME];
> +	struct tmonitor_ctx *tmon;
>  
>  	family_name = family_str(family);
>  	map_name = map_type_str(map);
>  	snprintf(s, sizeof(s), "%s %s %s", map_name, family_name,
> __func__);
>  	if (!test__start_subtest(s))
>  		return;
> +
> +	tmon = traffic_monitor_start(NULL);
> +	ASSERT_TRUE(tmon, "traffic_monitor_start");

Using ASSERT_TRUE() on a pointer is a bit strange, it's better to use
ASSERT_NEQ(NULL) like patch 2.

> +
>  	inet_unix_skb_redir_to_connected(skel, map, family);
>  	unix_inet_skb_redir_to_connected(skel, map, family);
> +
> +	traffic_monitor_stop(tmon);
>  }
>  
>  static void run_tests(struct test_sockmap_listen *skel, struct
> bpf_map *map,





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux