Debian Codegraph @

Documents/README.APIFuzzing

raw
1 ~~~~~~~
2 Fuzzing
3 ~~~~~~~
4
5 .. include:: prologue.rst
6
7 Principle
8 =========
9
10 BRLTTY has some support for testing it through fuzzing, i.e. feeding it with
11 more or less random content, to check that it does not fall into pieces.
12
13 Building
14 --------
15
16 Building with fuzzing support is
17
18 CC=clang ./configure --enable-api-fuzzing
19
20 (Fuzzing is only supported with the clang compiler)
21
22 This will also enable the address and undefined-behavior sanitizers.
23
24 Running
25 -------
26
27 To start a fuzzing session, one has to set the fuzz BrlAPI parameter, for
28 instance to start 1000 fuzzing loops:
29
30 ./run-brltty -b xw -x no -A fuzz=1000 -n -e
31
32 It can be useful to try different fuzzing seeds with:
33
34 ./run-brltty -b xw -x no -A fuzz=1000,fuzzseed=1234 -n -e
35
36 The initial steps of BrlAPI connections are not fuzzed by default, so the fuzzer
37 does not have to get it right before fuzzing the rest of the protocol. To fuzz
38 these initial steps, one can use:
39
40 ./run-brltty -b xw -x no -A fuzz=1000,fuzzhead=on -n -e
41
42 Conversely, one can concentrate the fuzzing on the writeText operation only (in
43 latin1) with:
44
45 ./run-brltty -b xw -x no -A fuzz=1000,fuzzwrite=on -n -e
46
47 And in utf8:
48
49 ./run-brltty -b xw -x no -A fuzz=1000,fuzzwriteutf8=on -n -e
50
51 Reproducing
52 -----------
53
54 Once a bug is detected by the fuzzer, it emits a crash file. One can reproduce
55 the behavior with:
56
57 ./run-brltty -b xw -x no -A crash=crash-da39a3ee5e6b4b0d3255bfef95601890afd80709 -n -e
58
59 and use gdb etc. at will to understand the bug, and eventually check when it is
60 fixed.