Skip to content

Commit

Permalink
selftests/bpf: Remove too strict field offset relo test cases
Browse files Browse the repository at this point in the history
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 <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20191101222810.1246166-2-andriin@fb.com
  • Loading branch information
anakryiko authored and borkmann committed Nov 4, 2019
1 parent 1574cf8 commit 42765ed
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 90 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "core_reloc_types.h"

void f(struct core_reloc_arrays___err_wrong_val_type x) {}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

70 changes: 1 addition & 69 deletions tools/testing/selftests/bpf/progs/core_reloc_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,7 @@ struct core_reloc_arrays___err_non_array {
struct core_reloc_arrays_substruct d[1][2];
};

struct core_reloc_arrays___err_wrong_val_type1 {
char a[5]; /* char instead of int */
char b[2][3][4];
struct core_reloc_arrays_substruct c[3];
struct core_reloc_arrays_substruct d[1][2];
};

struct core_reloc_arrays___err_wrong_val_type2 {
struct core_reloc_arrays___err_wrong_val_type {
int a[5];
char b[2][3][4];
int c[3]; /* value is not a struct */
Expand Down Expand Up @@ -589,67 +582,6 @@ struct core_reloc_ints___bool {
int64_t s64_field;
};

struct core_reloc_ints___err_bitfield {
uint8_t u8_field;
int8_t s8_field;
uint16_t u16_field;
int16_t s16_field;
uint32_t u32_field: 32; /* bitfields are not supported */
int32_t s32_field;
uint64_t u64_field;
int64_t s64_field;
};

struct core_reloc_ints___err_wrong_sz_8 {
uint16_t u8_field; /* not 8-bit anymore */
int16_t s8_field; /* not 8-bit anymore */

uint16_t u16_field;
int16_t s16_field;
uint32_t u32_field;
int32_t s32_field;
uint64_t u64_field;
int64_t s64_field;
};

struct core_reloc_ints___err_wrong_sz_16 {
uint8_t u8_field;
int8_t s8_field;

uint32_t u16_field; /* not 16-bit anymore */
int32_t s16_field; /* not 16-bit anymore */

uint32_t u32_field;
int32_t s32_field;
uint64_t u64_field;
int64_t s64_field;
};

struct core_reloc_ints___err_wrong_sz_32 {
uint8_t u8_field;
int8_t s8_field;
uint16_t u16_field;
int16_t s16_field;

uint64_t u32_field; /* not 32-bit anymore */
int64_t s32_field; /* not 32-bit anymore */

uint64_t u64_field;
int64_t s64_field;
};

struct core_reloc_ints___err_wrong_sz_64 {
uint8_t u8_field;
int8_t s8_field;
uint16_t u16_field;
int16_t s16_field;
uint32_t u32_field;
int32_t s32_field;

uint32_t u64_field; /* not 64-bit anymore */
int32_t s64_field; /* not 64-bit anymore */
};

/*
* MISC
*/
Expand Down

0 comments on commit 42765ed

Please sign in to comment.