====== Testing LibElf ====== [[/LibElf|LibElf]] development is proceeding side-by-side with that of a test suite. ===== Pre-requisites ===== The test suite needs the following tools: * The ''%%py-yaml%%'' port in ''%%/usr/ports/devel/py-yaml%%''. Version 3.04 or later. * TET from the %%OpenGroup%%. See ''%%/usr/ports/misc/tet%%''. The 'lite' version of TET is recommended. ===== The elfc translator ===== 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. ===== Building the test suite ===== * Edit the top-level ''%%./Makefile%%'' and set the TET_ROOT variable to the path where the TET test suite is installed. * Subsequently, a ''%%make all%%'' at the top level will build the test suite under ''%%$OBJDIRPREFIX%%''. ===== Running the test suite ===== * A ''%%make execute%%'' will run ''%%tcc%%'', leaving a log in a ''%%results/NNNNe/%%'' directory under the top-level. * Specific tests can be run as follows: make execute TET_USER='-y REGEX'