Skip to content

Commit 42765ed

Browse files
anakryikoborkmann
authored andcommitted
selftests/bpf: Remove too strict field offset relo test cases
As libbpf is going to gain support for more field relocations, including field size, some restrictions about exact size match are going to be lifted. Remove test cases that explicitly test such failures. Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 1574cf8 commit 42765ed

9 files changed

+4
-90
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include "core_reloc_types.h"
2+
3+
void f(struct core_reloc_arrays___err_wrong_val_type x) {}

tools/testing/selftests/bpf/progs/btf__core_reloc_arrays___err_wrong_val_type1.c

Lines changed: 0 additions & 3 deletions
This file was deleted.

tools/testing/selftests/bpf/progs/btf__core_reloc_arrays___err_wrong_val_type2.c

Lines changed: 0 additions & 3 deletions
This file was deleted.

tools/testing/selftests/bpf/progs/btf__core_reloc_ints___err_bitfield.c

Lines changed: 0 additions & 3 deletions
This file was deleted.

tools/testing/selftests/bpf/progs/btf__core_reloc_ints___err_wrong_sz_16.c

Lines changed: 0 additions & 3 deletions
This file was deleted.

tools/testing/selftests/bpf/progs/btf__core_reloc_ints___err_wrong_sz_32.c

Lines changed: 0 additions & 3 deletions
This file was deleted.

tools/testing/selftests/bpf/progs/btf__core_reloc_ints___err_wrong_sz_64.c

Lines changed: 0 additions & 3 deletions
This file was deleted.

tools/testing/selftests/bpf/progs/btf__core_reloc_ints___err_wrong_sz_8.c

Lines changed: 0 additions & 3 deletions
This file was deleted.

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

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -386,14 +386,7 @@ struct core_reloc_arrays___err_non_array {
386386
struct core_reloc_arrays_substruct d[1][2];
387387
};
388388

389-
struct core_reloc_arrays___err_wrong_val_type1 {
390-
char a[5]; /* char instead of int */
391-
char b[2][3][4];
392-
struct core_reloc_arrays_substruct c[3];
393-
struct core_reloc_arrays_substruct d[1][2];
394-
};
395-
396-
struct core_reloc_arrays___err_wrong_val_type2 {
389+
struct core_reloc_arrays___err_wrong_val_type {
397390
int a[5];
398391
char b[2][3][4];
399392
int c[3]; /* value is not a struct */
@@ -589,67 +582,6 @@ struct core_reloc_ints___bool {
589582
int64_t s64_field;
590583
};
591584

592-
struct core_reloc_ints___err_bitfield {
593-
uint8_t u8_field;
594-
int8_t s8_field;
595-
uint16_t u16_field;
596-
int16_t s16_field;
597-
uint32_t u32_field: 32; /* bitfields are not supported */
598-
int32_t s32_field;
599-
uint64_t u64_field;
600-
int64_t s64_field;
601-
};
602-
603-
struct core_reloc_ints___err_wrong_sz_8 {
604-
uint16_t u8_field; /* not 8-bit anymore */
605-
int16_t s8_field; /* not 8-bit anymore */
606-
607-
uint16_t u16_field;
608-
int16_t s16_field;
609-
uint32_t u32_field;
610-
int32_t s32_field;
611-
uint64_t u64_field;
612-
int64_t s64_field;
613-
};
614-
615-
struct core_reloc_ints___err_wrong_sz_16 {
616-
uint8_t u8_field;
617-
int8_t s8_field;
618-
619-
uint32_t u16_field; /* not 16-bit anymore */
620-
int32_t s16_field; /* not 16-bit anymore */
621-
622-
uint32_t u32_field;
623-
int32_t s32_field;
624-
uint64_t u64_field;
625-
int64_t s64_field;
626-
};
627-
628-
struct core_reloc_ints___err_wrong_sz_32 {
629-
uint8_t u8_field;
630-
int8_t s8_field;
631-
uint16_t u16_field;
632-
int16_t s16_field;
633-
634-
uint64_t u32_field; /* not 32-bit anymore */
635-
int64_t s32_field; /* not 32-bit anymore */
636-
637-
uint64_t u64_field;
638-
int64_t s64_field;
639-
};
640-
641-
struct core_reloc_ints___err_wrong_sz_64 {
642-
uint8_t u8_field;
643-
int8_t s8_field;
644-
uint16_t u16_field;
645-
int16_t s16_field;
646-
uint32_t u32_field;
647-
int32_t s32_field;
648-
649-
uint32_t u64_field; /* not 64-bit anymore */
650-
int32_t s64_field; /* not 64-bit anymore */
651-
};
652-
653585
/*
654586
* MISC
655587
*/

0 commit comments

Comments
 (0)