On Wed, 2024-04-24 at 16:47 +0100, Alan Maguire wrote: [...] > +static void test_distilled_base(void) > +{ [...] > + if (!ASSERT_EQ(0, btf__distill_base(btf2, &btf3, &btf4), > + "distilled_base") || > + !ASSERT_OK_PTR(btf3, "distilled_base") || > + !ASSERT_OK_PTR(btf4, "distilled_split")) > + goto cleanup; Maybe also assert the value of btf4->start_id? Otherwise look good. > + > + VALIDATE_RAW_BTF( > + btf4, > + "[1] INT 'int' size=4 bits_offset=0 nr_bits=32 encoding=SIGNED", > + "[2] FWD 's1' fwd_kind=struct", > + "[3] STRUCT '(anon)' size=12 vlen=2\n" > + "\t'f1' type_id=1 bits_offset=0\n" > + "\t'f2' type_id=2 bits_offset=32", > + "[4] FWD 'u1' fwd_kind=union", > + "[5] UNION '(anon)' size=4 vlen=1\n" > + "\t'f1' type_id=1 bits_offset=0", > + "[6] ENUM 'e1' encoding=UNSIGNED size=4 vlen=0", > + "[7] ENUM '(anon)' encoding=UNSIGNED size=4 vlen=1\n" > + "\t'av1' val=2", > + "[8] ENUM64 'e641' encoding=SIGNED size=8 vlen=0", > + "[9] ENUM64 '(anon)' encoding=SIGNED size=8 vlen=1\n" > + "\t'v1' val=1025", > + "[10] STRUCT 'embedded' size=4 vlen=0", > + "[11] FUNC_PROTO '(anon)' ret_type_id=1 vlen=1\n" > + "\t'p1' type_id=1", > + "[12] ARRAY '(anon)' type_id=1 index_type_id=1 nr_elems=3", > + "[13] PTR '(anon)' type_id=2", > + "[14] PTR '(anon)' type_id=3", > + "[15] CONST '(anon)' type_id=4", > + "[16] RESTRICT '(anon)' type_id=5", > + "[17] VOLATILE '(anon)' type_id=6", > + "[18] TYPEDEF 'et' type_id=7", > + "[19] CONST '(anon)' type_id=8", > + "[20] PTR '(anon)' type_id=9", > + "[21] STRUCT 'with_embedded' size=4 vlen=1\n" > + "\t'f1' type_id=10 bits_offset=0", > + "[22] FUNC 'fn' type_id=11 linkage=static", > + "[23] TYPEDEF 'arraytype' type_id=12"); > + > +cleanup: > + btf__free(btf4); > + btf__free(btf3); > + btf__free(btf2); > + btf__free(btf1); > +} [...]