selftests: bpf: fix use of undeclared RET_IF macro
commit634efb7504
("selftests: bpf: Reset global state between reuseport test runs") uses a macro RET_IF which doesn't exist in the v4.19 tree. It is defined as follows: #define RET_IF(condition, tag, format...) ({ if (CHECK_FAIL(condition)) { printf(tag " " format); return; } }) CHECK_FAIL in turn is defined as: #define CHECK_FAIL(condition) ({ int __ret = !!(condition); int __save_errno = errno; if (__ret) { test__fail(); fprintf(stdout, "%s:FAIL:%d\n", __func__, __LINE__); } errno = __save_errno; __ret; }) Replace occurences of RET_IF with CHECK. This will abort the test binary if clearing the intermediate state fails. Fixes:634efb7504
("selftests: bpf: Reset global state between reuseport test runs") Reported-by: kernel test robot <rong.a.chen@intel.com> Signed-off-by: Lorenz Bauer <lmb@cloudflare.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
75e36c19ff
commit
6f89ad2e79
1 changed files with 4 additions and 4 deletions
|
@ -616,13 +616,13 @@ static void cleanup_per_test(void)
|
||||||
|
|
||||||
for (i = 0; i < NR_RESULTS; i++) {
|
for (i = 0; i < NR_RESULTS; i++) {
|
||||||
err = bpf_map_update_elem(result_map, &i, &zero, BPF_ANY);
|
err = bpf_map_update_elem(result_map, &i, &zero, BPF_ANY);
|
||||||
RET_IF(err, "reset elem in result_map",
|
CHECK(err, "reset elem in result_map",
|
||||||
"i:%u err:%d errno:%d\n", i, err, errno);
|
"i:%u err:%d errno:%d\n", i, err, errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = bpf_map_update_elem(linum_map, &zero, &zero, BPF_ANY);
|
err = bpf_map_update_elem(linum_map, &zero, &zero, BPF_ANY);
|
||||||
RET_IF(err, "reset line number in linum_map", "err:%d errno:%d\n",
|
CHECK(err, "reset line number in linum_map", "err:%d errno:%d\n",
|
||||||
err, errno);
|
err, errno);
|
||||||
|
|
||||||
for (i = 0; i < REUSEPORT_ARRAY_SIZE; i++)
|
for (i = 0; i < REUSEPORT_ARRAY_SIZE; i++)
|
||||||
close(sk_fds[i]);
|
close(sk_fds[i]);
|
||||||
|
|
Loading…
Reference in a new issue