diff options
author | Eduard Zingerman <eddyz87@gmail.com> | 2024-07-22 16:38:43 -0700 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2024-07-29 15:05:06 -0700 |
commit | ee7fe84468b1732fe65c5af3836437d54ac4c419 (patch) | |
tree | 2c03dfb7e6b7d0471715e2273a28801c6b260bad /tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c | |
parent | 9c9f7339131030949a8ef111080427ff1a8085b5 (diff) |
selftests/bpf: __arch_* macro to limit test cases to specific archs
Add annotations __arch_x86_64, __arch_arm64, __arch_riscv64
to specify on which architecture the test case should be tested.
Several __arch_* annotations could be specified at once.
When test case is not run on current arch it is marked as skipped.
For example, the following would be tested only on arm64 and riscv64:
SEC("raw_tp")
__arch_arm64
__arch_riscv64
__xlated("1: *(u64 *)(r10 - 16) = r1")
__xlated("2: call")
__xlated("3: r1 = *(u64 *)(r10 - 16);")
__success
__naked void canary_arm64_riscv64(void)
{
asm volatile (
"r1 = 1;"
"*(u64 *)(r10 - 16) = r1;"
"call %[bpf_get_smp_processor_id];"
"r1 = *(u64 *)(r10 - 16);"
"exit;"
:
: __imm(bpf_get_smp_processor_id)
: __clobber_all);
}
On x86 it would be skipped:
#467/2 verifier_nocsr/canary_arm64_riscv64:SKIP
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20240722233844.1406874-10-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c')
0 files changed, 0 insertions, 0 deletions