android_kernel_xiaomi_sm8450/tools/testing
YiFei Zhu 072d16abf5 selftests/bpf: Wait for receive in cg_storage_multi test
[ Upstream commit 5af607a861d43ffff830fc1890033e579ec44799 ]

In some cases the loopback latency might be large enough, causing
the assertion on invocations to be run before ingress prog getting
executed. The assertion would fail and the test would flake.

This can be reliably reproduced by arbitrarily increasing the
loopback latency (thanks to [1]):
  tc qdisc add dev lo root handle 1: htb default 12
  tc class add dev lo parent 1:1 classid 1:12 htb rate 20kbps ceil 20kbps
  tc qdisc add dev lo parent 1:12 netem delay 100ms

Fix this by waiting on the receive end, instead of instantly
returning to the assert. The call to read() will wait for the
default SO_RCVTIMEO timeout of 3 seconds provided by
start_server().

[1] https://gist.github.com/kstevens715/4598301

Reported-by: Martin KaFai Lau <martin.lau@linux.dev>
Link: https://lore.kernel.org/bpf/9c5c8b7e-1d89-a3af-5400-14fde81f4429@linux.dev/
Fixes: 3573f38401 ("selftests/bpf: Test CGROUP_STORAGE behavior on shared egress + ingress")
Acked-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: YiFei Zhu <zhuyifei@google.com>
Link: https://lore.kernel.org/r/20230405193354.1956209-1-zhuyifei@google.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-17 11:47:50 +02:00
..
fault-injection
ktest ktest.pl: Add RUN_TIMEOUT option with default unlimited 2023-03-11 16:40:05 +01:00
kunit tweewide: Fix most Shebang lines 2021-05-22 11:40:55 +02:00
nvdimm
radix-tree idr test suite: Create anchor before launching throbber 2021-04-16 11:43:21 +02:00
scatterlist
selftests selftests/bpf: Wait for receive in cg_storage_multi test 2023-05-17 11:47:50 +02:00
vsock