On 05/04, Andrii Nakryiko wrote:
On Mon, May 4, 2020 at 10:37 AM Stanislav Fomichev <sdf@xxxxxxxxxx> wrote:
>
> Move the following routines that let us start a background listener
> thread and connect to a server by fd to the test_prog:
> * start_server_thread - start background INADDR_ANY thread
> * stop_server_thread - stop the thread
> * connect_to_fd - connect to the server identified by fd
>
> These will be used in the next commit.
>
> Also, extend these helpers to support AF_INET6 and accept the family
> as an argument.
>
> Cc: Andrey Ignatov <rdna@xxxxxx>
> Signed-off-by: Stanislav Fomichev <sdf@xxxxxxxxxx>
> ---
> .../selftests/bpf/prog_tests/tcp_rtt.c | 115 +--------------
> tools/testing/selftests/bpf/test_progs.c | 138 ++++++++++++++++++
> tools/testing/selftests/bpf/test_progs.h | 3 +
> 3 files changed, 144 insertions(+), 112 deletions(-)
Can this functionality be moved into a separate file, similar to
cgroup_helpers.{c.h}? This doesn't seem like helper routines needed
for most tests, so it doesn't make sense to me to keep piling
everything into test_progs.{c,h}.
test_progs_helpers.{c,h}? And maybe move existing helpers like
bpf_find_map, spin_lock_thread, etc in there?
Or do you think that these networking helpers should be completely
independent
from test_progs?