Skip to content

Commit 2837770

Browse files
bastien-curutchetKernel Patches Daemon
authored andcommitted
selftests/bpf: test_xsk: Move exit_with_error to xskxceiver.c
exit_with_error() isn't called by test_xsk.c. It shouldn't be called in the future either, since some resources need to be cleaned before exiting when an error occurs. Move the definition of exit_with_error() to xskxceiver.c, where it's still used. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
1 parent 5639cfd commit 2837770

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

tools/testing/selftests/bpf/test_xsk.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,6 @@
3434
extern bool opt_verbose;
3535
#define print_verbose(x...) do { if (opt_verbose) ksft_print_msg(x); } while (0)
3636

37-
static void __exit_with_error(int error, const char *file, const char *func, int line)
38-
{
39-
ksft_test_result_fail("[%s:%s:%i]: ERROR: %d/\"%s\"\n", file, func, line, error,
40-
strerror(error));
41-
ksft_exit_xfail();
42-
}
43-
#define exit_with_error(error) __exit_with_error(error, __FILE__, __func__, __LINE__)
4437

4538
static inline u32 ceil_u32(u32 a, u32 b)
4639
{

tools/testing/selftests/bpf/xskxceiver.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,15 @@ static u32 opt_run_test = RUN_ALL_TESTS;
107107

108108
void test__fail(void) { /* for network_helpers.c */ }
109109

110+
static void __exit_with_error(int error, const char *file, const char *func, int line)
111+
{
112+
ksft_test_result_fail("[%s:%s:%i]: ERROR: %d/\"%s\"\n", file, func, line,
113+
error, strerror(error));
114+
ksft_exit_xfail();
115+
}
116+
117+
#define exit_with_error(error) __exit_with_error(error, __FILE__, __func__, __LINE__)
118+
110119
static bool ifobj_zc_avail(struct ifobject *ifobject)
111120
{
112121
size_t umem_sz = DEFAULT_UMEM_BUFFERS * XSK_UMEM__DEFAULT_FRAME_SIZE;

0 commit comments

Comments
 (0)