blob: 1642c12c578687cadd13ac871c64153fb63e783a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __TEST_UTILS_H
#define __TEST_UTILS_H
#include <bpf/libbpf.h>
#include <xdp/libxdp.h>
#define __unused __attribute__((unused))
static int libbpf_silent_func(__unused enum libbpf_print_level level,
__unused const char *format,
__unused va_list args)
{
return 0;
}
static inline void silence_libbpf_logging(void)
{
libbpf_set_print(libbpf_silent_func);
}
static int libxdp_silent_func(__unused enum libxdp_print_level level,
__unused const char *format,
__unused va_list args)
{
return 0;
}
static int libxdp_verbose_func(__unused enum libxdp_print_level level,
__unused const char *format,
__unused va_list args)
{
fprintf(stderr, " ");
vfprintf(stderr, format, args);
return 0;
}
static inline void silence_libxdp_logging(void)
{
libxdp_set_print(libxdp_silent_func);
}
static inline void verbose_libxdp_logging(void)
{
libxdp_set_print(libxdp_verbose_func);
}
#endif
|