]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
selftests/bpf: Use cpu_number only on arches that have it
authorIlya Leoshkevich <iii@linux.ibm.com>
Wed, 13 Oct 2021 16:08:59 +0000 (18:08 +0200)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 20 Oct 2021 18:40:01 +0000 (11:40 -0700)
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: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211013160902.428340-2-iii@linux.ibm.com
tools/testing/selftests/bpf/prog_tests/btf_dump.c

index 87f9df653e4e23d289f562b3ff71a02c24976dec..12f457b6786dd2ceeeacbd9000eb7123de1a3c40 100644 (file)
@@ -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);
 }