Skip to content

Commit ec1f77f

Browse files
eddyz87Alexei Starovoitov
authored andcommitted
selftests/bpf: test_loader.c:get_current_arch() should not return 0
At the moment, when test_loader.c:get_current_arch() can't determine the arch, it returns 0. The arch check in run_subtest() looks as follows: if ((get_current_arch() & spec->arch_mask) == 0) { test__skip(); return; } Which means that all test_loader based tests would be skipped if arch could not be determined. get_current_arch() recognizes x86_64, arm64 and riscv64. Which means that CI skips test_loader tests for s390. Fix this by making sure that get_current_arch() always returns non-zero value. In combination with default spec->arch_mask == -1 this should cover all possibilities. Fixes: f406026 ("selftests/bpf: by default use arch mask allowing all archs") Fixes: 7d743e4 ("selftests/bpf: __jited test tag to check disassembly after jit") Signed-off-by: Eduard Zingerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 7559a7a commit ec1f77f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tools/testing/selftests/bpf/test_loader.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,10 @@ static const char *skip_dynamic_pfx(const char *s, const char *pfx)
336336
}
337337

338338
enum arch {
339-
ARCH_X86_64 = 0x1,
340-
ARCH_ARM64 = 0x2,
341-
ARCH_RISCV64 = 0x4,
339+
ARCH_UNKNOWN = 0x1,
340+
ARCH_X86_64 = 0x2,
341+
ARCH_ARM64 = 0x4,
342+
ARCH_RISCV64 = 0x8,
342343
};
343344

344345
static int get_current_arch(void)
@@ -350,7 +351,7 @@ static int get_current_arch(void)
350351
#elif defined(__riscv) && __riscv_xlen == 64
351352
return ARCH_RISCV64;
352353
#endif
353-
return 0;
354+
return ARCH_UNKNOWN;
354355
}
355356

356357
/* Uses btf_decl_tag attributes to describe the expected test

0 commit comments

Comments
 (0)