summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/prog_tests/cgroup_link.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2021-04-26 12:29:45 -0700
committerAlexei Starovoitov <ast@kernel.org>2021-04-26 18:37:13 -0700
commit7a2fa70aaffc2f8823feca22709a00f5c069a8a9 (patch)
treec1b6ec1d78c4d6cdcc24fb8920a97c20393d9a2d /tools/testing/selftests/bpf/prog_tests/cgroup_link.c
parent87bd9e602e39585c5280556a2b6a6363bb334257 (diff)
downloadlinux-7a2fa70aaffc2f8823feca22709a00f5c069a8a9.tar.gz
linux-7a2fa70aaffc2f8823feca22709a00f5c069a8a9.tar.bz2
linux-7a2fa70aaffc2f8823feca22709a00f5c069a8a9.zip
selftests/bpf: Add remaining ASSERT_xxx() variants
Add ASSERT_TRUE/ASSERT_FALSE for conditions calculated with custom logic to true/false. Also add remaining arithmetical assertions: - ASSERT_LE -- less than or equal; - ASSERT_GT -- greater than; - ASSERT_GE -- greater than or equal. This should cover most scenarios where people fall back to error-prone CHECK()s. Also extend ASSERT_ERR() to print out errno, in addition to direct error. Also convert few CHECK() instances to ensure new ASSERT_xxx() variants work as expected. Subsequent patch will also use ASSERT_TRUE/ASSERT_FALSE more extensively. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Lorenz Bauer <lmb@cloudflare.com> Link: https://lore.kernel.org/bpf/20210426192949.416837-2-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/cgroup_link.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/cgroup_link.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/cgroup_link.c b/tools/testing/selftests/bpf/prog_tests/cgroup_link.c
index 4d9b514b3fd9..736796e56ed1 100644
--- a/tools/testing/selftests/bpf/prog_tests/cgroup_link.c
+++ b/tools/testing/selftests/bpf/prog_tests/cgroup_link.c
@@ -54,7 +54,7 @@ void test_cgroup_link(void)
for (i = 0; i < cg_nr; i++) {
cgs[i].fd = create_and_get_cgroup(cgs[i].path);
- if (CHECK(cgs[i].fd < 0, "cg_create", "fail: %d\n", cgs[i].fd))
+ if (!ASSERT_GE(cgs[i].fd, 0, "cg_create"))
goto cleanup;
}