On Fri, Jan 28, 2022 at 5:33 PM Mauricio Vásquez <mauricio@xxxxxxxxxx> wrote: > > This commit implements some integration tests for "BTFGen". The goal > of such tests is to verify that the generated BTF file contains the > expected types. > This is not an exhaustive list of test cases. I'm not sure if this is the approach we should follow to implement such tests, it seems to me that checking each generated BTF file by hand is a lot of work but I don't have other ideas to simplify it. I considered different options to write these tests: 1. Use core_reloc_types.h to create a "source" BTF file with a lot of types, then run BTFGen for all test_core_reloc_*.o files and use the generated BTF file as btf_src_file in core_reloc.c. In other words, re-run all test_core_reloc tests using a generated BTF file as source instead of the "btf__core_reloc_" #name ".o" one. I think this test is great because it tests the full functionality and actually checks that the programs are able to run using the generated file. The problem is how do we test that the BTFGen is creating an optimized file? Just copying the source file without any modification will make all those tests pass. We could check that the generated file is small (by checking the size or the number of types) but it doesn't seem a very reliable approach to me. 2. We could write some .c files with the types we expect to have on the generated file and compare it with the generated file. The issue here is that comparing those BTF files doesn't seem to be too trivial... Do you have any suggestions about it? Thanks!