posix: add fuzz testing using MAVLink messages

This adds the env option PX4_FUZZ which runs the LLVM libFuzzer which
throws random bytes at mavlink_receiver using MAVLink messages over UDP.

The MAVLink messages that are being sent are valid, so the CRC is
calculated but the payload and msgid, etc. are generally garbage, unless
the fuzzing gets a msgid right by chance.

As I understand it, libFuzzer watches the test coverage and will try to
execute as much of the code as possible.
This commit is contained in:
Julian Oes
2022-01-07 10:17:12 -05:00
committed by Daniel Agar
parent c17a9e8003
commit 9eda5b373c
5 changed files with 200 additions and 4 deletions
+7
View File
@@ -158,6 +158,13 @@ else
CMAKE_ARGS += -DCMAKE_BUILD_TYPE=UndefinedBehaviorSanitizer
endif
# Fuzz Testing
ifdef PX4_FUZZ
export CC=clang
export CXX=clang++
CMAKE_ARGS += -DCMAKE_BUILD_TYPE=FuzzTesting
endif
endif
# Pick up specific Python path if set