From: Martin KaFai Lau <martin.lau@linux.dev>
To: bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
kernel-team@meta.com
Subject: Re: [PATCH bpf-next] selftests/bpf: Remove "&>" usage in the selftests
Date: Fri, 26 Jan 2024 22:08:21 -0800 [thread overview]
Message-ID: <330bfcd9-452c-49ac-9651-b33f0f7c3421@linux.dev> (raw)
In-Reply-To: <20240127025017.950825-1-martin.lau@linux.dev>
On 1/26/24 6:50 PM, Martin KaFai Lau wrote:
> diff --git a/tools/testing/selftests/bpf/prog_tests/lwt_redirect.c b/tools/testing/selftests/bpf/prog_tests/lwt_redirect.c
> index 59b38569f310..beeb3ac1c361 100644
> --- a/tools/testing/selftests/bpf/prog_tests/lwt_redirect.c
> +++ b/tools/testing/selftests/bpf/prog_tests/lwt_redirect.c
> @@ -85,7 +85,7 @@ static void ping_dev(const char *dev, bool is_ingress)
> snprintf(ip, sizeof(ip), "20.0.0.%d", link_index);
>
> /* We won't get a reply. Don't fail here */
> - SYS_NOFAIL("ping %s -c1 -W1 -s %d >/dev/null 2>&1",
> + SYS_NOFAIL("ping %s -c1 -W1 -s %d",
> ip, ICMP_PAYLOAD_SIZE);
> }
The "lwt_redirect/lwt_redirect_normal" is flaky now in s390.
I don't see how this change affected it other than
moving the ">/dev/null 2>&1" part to SYS_NOFAIL.
====
Error: #142/1 lwt_redirect/lwt_redirect_normal
test_lwt_redirect_run:PASS:netns_create 0 nsec
open_netns:PASS:malloc token 0 nsec
open_netns:PASS:open /proc/self/ns/net 0 nsec
open_netns:PASS:open netns fd 0 nsec
open_netns:PASS:setns 0 nsec
test_lwt_redirect_run:PASS:setns 0 nsec
open_tuntap:PASS:open(/dev/net/tun) 0 nsec
open_tuntap:PASS:ioctl(TUNSETIFF) 0 nsec
open_tuntap:PASS:fcntl(O_NONBLOCK) 0 nsec
setup_redirect_target:PASS:open_tuntap 0 nsec
setup_redirect_target:PASS:if_nametoindex 0 nsec
setup_redirect_target:PASS:ip link add link_err type dummy 0 nsec
setup_redirect_target:PASS:ip link set lo up 0 nsec
setup_redirect_target:PASS:ip addr add dev lo 10.0.0.1/32 0 nsec
setup_redirect_target:PASS:ip link set link_err up 0 nsec
setup_redirect_target:PASS:ip link set tap0 up 0 nsec
setup_redirect_target:PASS:ip route add 10.0.0.0/24 dev link_err encap bpf xmit obj test_lwt_redirect.bpf.o sec redir_ingress 0 nsec
setup_redirect_target:PASS:ip route add 20.0.0.0/24 dev link_err encap bpf xmit obj test_lwt_redirect.bpf.o sec redir_egress 0 nsec
test_lwt_redirect_normal:PASS:setup_redirect_target 0 nsec
ping_dev:PASS:if_nametoindex 0 nsec
send_and_capture_test_packets:FAIL:wait_for_epacket unexpected wait_for_epacket: actual 0 != expected 1
(/tmp/work/bpf/bpf/tools/testing/selftests/bpf/prog_tests/lwt_redirect.c:175: errno: Success) test_lwt_redirect_normal egress test fails
====
May be the timeout is too short...
static void send_and_capture_test_packets(const char *test_name, int tap_fd,
const char *target_dev, bool need_mac)
{
int psock = -1;
struct timeval timeo = {
.tv_sec = 0,
.tv_usec = 250000,
};
/* ... */
}
[ ... ]
> diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h
> index 2f9f6f250f17..80df51244886 100644
> --- a/tools/testing/selftests/bpf/test_progs.h
> +++ b/tools/testing/selftests/bpf/test_progs.h
> @@ -385,10 +385,15 @@ int test__join_cgroup(const char *path);
> goto goto_label; \
> })
>
> +#define ALL_TO_DEV_NULL " >/dev/null 2>&1"
> +
> #define SYS_NOFAIL(fmt, ...) \
> ({ \
> char cmd[1024]; \
> - snprintf(cmd, sizeof(cmd), fmt, ##__VA_ARGS__); \
> + int n; \
> + n = snprintf(cmd, sizeof(cmd), fmt, ##__VA_ARGS__); \
> + if (n < sizeof(cmd) && sizeof(cmd) - n >= sizeof(ALL_TO_DEV_NULL)) \
> + strcat(cmd, ALL_TO_DEV_NULL); \
> system(cmd); \
> })
next prev parent reply other threads:[~2024-01-27 6:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-27 2:50 [PATCH bpf-next] selftests/bpf: Remove "&>" usage in the selftests Martin KaFai Lau
2024-01-27 4:56 ` Yonghong Song
2024-01-27 6:14 ` Martin KaFai Lau
2024-01-27 6:27 ` Yonghong Song
2024-01-27 6:08 ` Martin KaFai Lau [this message]
2024-01-29 20:50 ` patchwork-bot+netdevbpf
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=330bfcd9-452c-49ac-9651-b33f0f7c3421@linux.dev \
--to=martin.lau@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@meta.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.