Commit 9d234974 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Daniel Borkmann
Browse files

selftests/bpf: Add non-standardly sized enum tests for btf_dump



Add few custom enum definitions testing mode(byte) and mode(word)
attributes.

Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20221212211505.558851-4-andrii@kernel.org
parent 21a9a1bc
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -25,6 +25,39 @@ typedef enum {
	H = 2,
} e3_t;

/* ----- START-EXPECTED-OUTPUT ----- */
/*
 *enum e_byte {
 *	EBYTE_1 = 0,
 *	EBYTE_2 = 1,
 *} __attribute__((mode(byte)));
 *
 */
/* ----- END-EXPECTED-OUTPUT ----- */
enum e_byte {
	EBYTE_1,
	EBYTE_2,
} __attribute__((mode(byte)));

/* ----- START-EXPECTED-OUTPUT ----- */
/*
 *enum e_word {
 *	EWORD_1 = 0LL,
 *	EWORD_2 = 1LL,
 *} __attribute__((mode(word)));
 *
 */
/* ----- END-EXPECTED-OUTPUT ----- */
enum e_word {
	EWORD_1,
	EWORD_2,
} __attribute__((mode(word))); /* force to use 8-byte backing for this enum */

/* ----- START-EXPECTED-OUTPUT ----- */
enum e_big {
	EBIG_1 = 1000000000000ULL,
};

typedef int int_t;

typedef volatile const int * volatile const crazy_ptr_t;
@@ -224,6 +257,9 @@ struct root_struct {
	enum e2 _2;
	e2_t _2_1;
	e3_t _2_2;
	enum e_byte _100;
	enum e_word _101;
	enum e_big _102;
	struct struct_w_typedefs _3;
	anon_struct_t _7;
	struct struct_fwd *_8;