xref: /isa-l/doc/test.md (revision ece814e912667000624398d05062adb0685adad0)
1# ISA-L Testing
2
3Tests are divided into check tests, unit tests and fuzz tests. Check tests,
4built with `make check`, should have no additional dependencies. Other unit
5tests built with `make test` may have additional dependencies in order to make
6comparisons of the output of ISA-L to other standard libraries and ensure
7compatibility. Fuzz tests are meant to be run with a fuzzing tool such as [AFL]
8or [llvm libFuzzer] fuzzing to direct the input data based on coverage. There
9are a number of scripts in the /tools directory to help with automating the
10running of tests.
11
12## Test check
13
14`./tools/test_autorun.sh` is a helper script for kicking off check tests, that
15typically run for a few minutes, or extended tests that could run much
16longer. The command `test_autorun.sh check` build and runs all check tests with
17autotools and runs other short tests to ensure check tests, unit tests,
18examples, install, exe stack, format are correct. Each run of `test_autorun.sh`
19builds tests with a new random test seed that ensures that each run is unique to
20the seed but deterministic for debugging. Tests are also built with sanitizers
21and Electric Fence if available.
22
23## Extended tests
24
25Extended tests are initiated with the command `./tools/test_autorun.sh
26ext`. These build and run check tests, unit tests, and other utilities that can
27take much longer than check tests alone. This includes special compression tools
28and some cross targets such as the no-arch build of base functions only and
29mingw build if tools are available.
30
31## Fuzz testing
32
33`./tools/test_fuzz.sh` is a helper script for fuzzing to setup, build and run
34the ISA-L inflate fuzz tests on multiple fuzz tools. Fuzzing with
35[llvm libFuzzer] requires clang compiler tools with `-fsanitize=fuzzer` or
36`libFuzzer` installed. You can invoke the default fuzz tests under llvm with
37
38    ./tools/test_fuzz.sh -e checked
39
40To use [AFL], install tools and system setup for `afl-fuzz` and run
41
42    ./tools/test_fuzz.sh -e checked --afl 1 --llvm -1 -d 1
43
44This uses internal vectors as a seed. You can also specify a sample file to use
45as a seed instead with `-f <file>`. One of three fuzz tests can be invoked:
46checked, simple, and round_trip.
47
48[llvm libFuzzer]: https://llvm.org/docs/LibFuzzer.html
49[AFL]: https://github.com/google/AFL
50