LibElf development is proceeding side-by-side with that of a test suite.
The test suite needs the following tools:
py-yaml port in /usr/ports/devel/py-yaml. Version 3.04 or later./usr/ports/misc/tet. The 'lite' version of TET is recommended.
This script in ts/tset/bin/elfc converts a textual (YAML) description of an ELF file to an equivalent binary file of the appropriate class and endianness. It offers nearly complete control over the contents of the generated ELF file.
It is used by the test suite to generate both well-formed and malformed ELF files for use by test cases.
For example:
% cat t.yaml ehdr: !Ehdr e_ident: !Ident ei_data: ELFDATA2MSB e_machine: EM_SPARCV9 e_type: ET_REL % ./tset/bin/elfc t.yaml % file a.out ELF 32-bit MSB relocatable, SPARC V9, version 1 (SYSV)
Most fields of the YAML file can be defaulted, allowing the YAML descriptions to be reasonably succinct.
./Makefile and set the TET_ROOT variable to the path where the TET test suite is installed.make all at the top level will build the test suite under $OBJDIRPREFIX.make execute will run tcc, leaving a log in a results/NNNNe/ directory under the top-level.make execute TET_USER='-y REGEX'