Skip to content

Commit 2ea8f6a

Browse files
eddyz87Alexei Starovoitov
authored andcommitted
selftests/bpf: test cases for compute_live_registers()
Cover instructions from each kind: - assignment - arithmetic - store/load - endian conversion - atomics - branches, conditional branches, may_goto, calls - LD_ABS/LD_IND - address_space_cast Signed-off-by: Eduard Zingerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 0fb3cf6 commit 2ea8f6a

File tree

6 files changed

+455
-14
lines changed

6 files changed

+455
-14
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
3+
#include "compute_live_registers.skel.h"
4+
#include "test_progs.h"
5+
6+
void test_compute_live_registers(void)
7+
{
8+
RUN_TESTS(compute_live_registers);
9+
}

tools/testing/selftests/bpf/progs/bpf_misc.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,21 @@
213213
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
214214
#endif
215215

216+
#if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \
217+
(defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \
218+
defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \
219+
defined(__TARGET_ARCH_loongarch)) && \
220+
__clang_major__ >= 18
221+
#define CAN_USE_GOTOL
222+
#endif
223+
224+
#if _clang_major__ >= 18
225+
#define CAN_USE_BPF_ST
226+
#endif
227+
228+
#if __clang_major__ >= 18 && defined(ENABLE_ATOMICS_TESTS) && \
229+
(defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86))
230+
#define CAN_USE_LOAD_ACQ_STORE_REL
231+
#endif
232+
216233
#endif

0 commit comments

Comments
 (0)