[PATCH mptcp-next] Squash to "selftests: bpf: verify ca_name of struct mptcp_sock"

Geliang Tang posted 1 patch 1 year, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/76fb385e983811d40ebcac3602ff034b169e96a9.1651904166.git.geliang.tang@suse.com
Maintainers: Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>, Martin KaFai Lau <kafai@fb.com>, KP Singh <kpsingh@kernel.org>, Mat Martineau <mathew.j.martineau@linux.intel.com>, Alexei Starovoitov <ast@kernel.org>, Andrii Nakryiko <andrii@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Shuah Khan <shuah@kernel.org>, John Fastabend <john.fastabend@gmail.com>, Matthieu Baerts <matthieu.baerts@tessares.net>
tools/testing/selftests/bpf/prog_tests/mptcp.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
[PATCH mptcp-next] Squash to "selftests: bpf: verify ca_name of struct mptcp_sock"
Posted by Geliang Tang 1 year, 10 months ago
Address to Andrii's comments:
- use ASSERT_* instead of CHECK_FAIL

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 tools/testing/selftests/bpf/prog_tests/mptcp.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index ad7f91d35e96..ebc9a187acd6 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -86,16 +86,12 @@ void get_msk_ca_name(char ca_name[])
 	int fd;
 
 	fd = open("/proc/sys/net/ipv4/tcp_congestion_control", O_RDONLY);
-	if (CHECK_FAIL(fd < 0)) {
-		log_err("Failed to open tcp_congestion_control");
+	if (!ASSERT_GT(fd, 0, "Failed to open tcp_congestion_control"))
 		return;
-	}
 
 	len = read(fd, ca_name, TCP_CA_NAME_MAX);
-	if (CHECK_FAIL(len < 0)) {
-		log_err("Failed to read ca_name");
+	if (!ASSERT_GT(len, 0, "Failed to read ca_name"))
 		goto err;
-	}
 
 	if (len > 0 && ca_name[len - 1] == '\n')
 		ca_name[len - 1] = '\0';
-- 
2.34.1