Fuzzing: Allow linking to other fuzzing engines

oss-fuzz sets the environment variable LIB_FUZZING_ENGINE
to link with AFL or libFuzzer. If this variable is not set,
libFuzzer will be used as before, only that the right qmake
variable will be used for doing so.

Change-Id: If9fe7739a8d2d4a76f4633a75cad3d2e935f3b61
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
This commit is contained in:
Robert Loehning 2020-01-02 19:05:37 +01:00
parent 71477104eb
commit 1f87fb359f
5 changed files with 30 additions and 5 deletions

View File

@ -2,4 +2,9 @@ QT -= gui
CONFIG += console
CONFIG -= app_bundle
SOURCES += main.cpp
LIBS += -fsanitize=fuzzer
FUZZ_ENGINE = $$(LIB_FUZZING_ENGINE)
isEmpty(FUZZ_ENGINE) {
QMAKE_LFLAGS += -fsanitize=fuzzer
} else {
LIBS += $$FUZZ_ENGINE
}

View File

@ -1,3 +1,8 @@
QT += gui
SOURCES += main.cpp
LIBS += -fsanitize=fuzzer
FUZZ_ENGINE = $$(LIB_FUZZING_ENGINE)
isEmpty(FUZZ_ENGINE) {
QMAKE_LFLAGS += -fsanitize=fuzzer
} else {
LIBS += $$FUZZ_ENGINE
}

View File

@ -1,3 +1,8 @@
QT += widgets
SOURCES += main.cpp
LIBS += -fsanitize=fuzzer
FUZZ_ENGINE = $$(LIB_FUZZING_ENGINE)
isEmpty(FUZZ_ENGINE) {
QMAKE_LFLAGS += -fsanitize=fuzzer
} else {
LIBS += $$FUZZ_ENGINE
}

View File

@ -1,4 +1,9 @@
CONFIG += console
CONFIG -= app_bundle
SOURCES += main.cpp
LIBS += -fsanitize=fuzzer
FUZZ_ENGINE = $$(LIB_FUZZING_ENGINE)
isEmpty(FUZZ_ENGINE) {
QMAKE_LFLAGS += -fsanitize=fuzzer
} else {
LIBS += $$FUZZ_ENGINE
}

View File

@ -1,3 +1,8 @@
QT += widgets
SOURCES += main.cpp
LIBS += -fsanitize=fuzzer
FUZZ_ENGINE = $$(LIB_FUZZING_ENGINE)
isEmpty(FUZZ_ENGINE) {
QMAKE_LFLAGS += -fsanitize=fuzzer
} else {
LIBS += $$FUZZ_ENGINE
}