bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Sitnicki <jakub@cloudflare.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>
Cc: bpf <bpf@vger.kernel.org>, Networking <netdev@vger.kernel.org>,
	kernel-team@cloudflare.com
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix spurious failures in accept due to EAGAIN
Date: Fri, 13 Mar 2020 17:42:36 +0100	[thread overview]
Message-ID: <87o8t0xl37.fsf@cloudflare.com> (raw)
In-Reply-To: <CAEf4BzbsDMbmury9Z-+j=egsfJf4uKxsu0Fsdr4YpP1FgvBiiQ@mail.gmail.com>

On Thu, Mar 12, 2020 at 06:57 PM CET, Andrii Nakryiko wrote:
> Thanks for looking into this. Can you please verify that test
> successfully fails (not hangs) when, say, network is down (do `ip link
> set lo down` before running test?). The reason I'm asking is that I
> just fixed a problem in tcp_rtt selftest, in which accept() would
> block forever, even if listening socket was closed.

While on the topic writing network tests with test_progs.

There are a couple pain points because all tests run as one process:

1) resource cleanup on failure

   Tests can't simply exit(), abort(), or error() on failure. Instead
   they need to clean up all resources, like opened file descriptors and
   memory allocations, and propagate the error up to the main test
   function so it can return to the test runner.

2) terminating in timely fashion

   We don't have an option of simply setting alarm() to terminate after
   a reasnable timeout without worrying about I/O syscalls in blocking
   mode being stuck.

Careful error and timeout handling makes test code more complicated that
it really needs to be, IMHO. Making writing as well as maintaing them
harder.

What if we extended test_progs runner to support process-per-test
execution model? Perhaps as an opt-in for selected tests.

Is that in line with the plans/vision for BPF selftests?

  parent reply	other threads:[~2020-03-13 16:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 17:11 [PATCH bpf-next] selftests/bpf: Fix spurious failures in accept due to EAGAIN Jakub Sitnicki
2020-03-12 17:57 ` Andrii Nakryiko
2020-03-12 19:19   ` Jakub Sitnicki
2020-03-13 16:42   ` Jakub Sitnicki [this message]
2020-03-13 18:30     ` Andrii Nakryiko
2020-03-14  2:48     ` Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o8t0xl37.fsf@cloudflare.com \
    --to=jakub@cloudflare.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).