Commit b16d12f3 authored by Ilya Leoshkevich's avatar Ilya Leoshkevich Committed by Andrii Nakryiko
Browse files

selftests/bpf: Use cpu_number only on arches that have it



cpu_number exists only on Intel and aarch64, so skip the test involing
it on other arches. An alternative would be to replace it with an
exported non-ifdefed primitive-typed percpu variable from the common
code, but there appears to be none.

Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211013160902.428340-2-iii@linux.ibm.com
parent b599015f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -778,8 +778,10 @@ static void test_btf_dump_struct_data(struct btf *btf, struct btf_dump *d,
static void test_btf_dump_var_data(struct btf *btf, struct btf_dump *d,
				   char *str)
{
#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__)
	TEST_BTF_DUMP_VAR(btf, d, NULL, str, "cpu_number", int, BTF_F_COMPACT,
			  "int cpu_number = (int)100", 100);
#endif
	TEST_BTF_DUMP_VAR(btf, d, NULL, str, "cpu_profile_flip", int, BTF_F_COMPACT,
			  "static int cpu_profile_flip = (int)2", 2);
}