Skip to content

Commit fe9a71a

Browse files
Geliang TangKernel Patches Daemon
authored andcommitted
selftests/bpf: Define ENOTSUPP in testing_helpers.h
ENOTSUPP are defined in so many places in bpf selftests, this patch moves this definition into testing_helpers.h, which is almost included by each tests. And drop all other duplicate definitions. Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
1 parent 327f48b commit fe9a71a

File tree

6 files changed

+4
-20
lines changed

6 files changed

+4
-20
lines changed

tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
#include "tcp_ca_kfunc.skel.h"
1717
#include "bpf_cc_cubic.skel.h"
1818

19-
#ifndef ENOTSUPP
20-
#define ENOTSUPP 524
21-
#endif
22-
2319
static const unsigned int total_bytes = 10 * 1024 * 1024;
2420
static int expected_stg = 0xeB9F;
2521

tools/testing/selftests/bpf/prog_tests/lsm_cgroup.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
#include "cgroup_helpers.h"
1111
#include "network_helpers.h"
1212

13-
#ifndef ENOTSUPP
14-
#define ENOTSUPP 524
15-
#endif
16-
1713
static struct btf *btf;
1814

1915
static __u32 query_prog_cnt(int cgroup_fd, const char *attach_func)

tools/testing/selftests/bpf/prog_tests/sock_addr.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
#include "getpeername_unix_prog.skel.h"
2424
#include "network_helpers.h"
2525

26-
#ifndef ENOTSUPP
27-
# define ENOTSUPP 524
28-
#endif
29-
3026
#define TEST_NS "sock_addr"
3127
#define TEST_IF_PREFIX "test_sock_addr"
3228
#define TEST_IPV4 "127.0.0.4"

tools/testing/selftests/bpf/test_maps.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
#include "test_maps.h"
2727
#include "testing_helpers.h"
2828

29-
#ifndef ENOTSUPP
30-
#define ENOTSUPP 524
31-
#endif
32-
3329
int skips;
3430

3531
static struct bpf_map_create_opts map_opts = { .sz = sizeof(map_opts) };

tools/testing/selftests/bpf/test_verifier.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
#include "../../../include/linux/filter.h"
4343
#include "testing_helpers.h"
4444

45-
#ifndef ENOTSUPP
46-
#define ENOTSUPP 524
47-
#endif
48-
4945
#define MAX_INSNS BPF_MAXINSNS
5046
#define MAX_EXPECTED_INSNS 32
5147
#define MAX_UNEXPECTED_INSNS 32

tools/testing/selftests/bpf/testing_helpers.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
#include <bpf/libbpf.h>
1010
#include <time.h>
1111

12+
#ifndef ENOTSUPP
13+
#define ENOTSUPP 524
14+
#endif
15+
1216
#define __TO_STR(x) #x
1317
#define TO_STR(x) __TO_STR(x)
1418

0 commit comments

Comments
 (0)