summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Loehning <robert.loehning@qt.io>2020-01-02 19:05:37 +0100
committerRobert Loehning <robert.loehning@qt.io>2020-01-03 18:05:08 +0100
commit1f87fb359fdff14e42662384a9c8a0bcb3837671 (patch)
treeb2d578dca0b41454c0c551c27ff737f4a94cdb84
parent71477104eb0be31452664e22927beb909465ffcd (diff)
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>
-rw-r--r--tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/readnext.pro7
-rw-r--r--tests/libfuzzer/gui/iccparser/iccparser.pro7
-rw-r--r--tests/libfuzzer/gui/text/qtextdocument/setHtml/setHtml.pro7
-rw-r--r--tests/libfuzzer/gui/text/qtextdocument/setMarkdown/setMarkdown.pro7
-rw-r--r--tests/libfuzzer/gui/text/qtextlayout/beginLayout/beginLayout.pro7
5 files changed, 30 insertions, 5 deletions
diff --git a/tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/readnext.pro b/tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/readnext.pro
index 2fda3ecefd..6c988c2434 100644
--- a/tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/readnext.pro
+++ b/tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/readnext.pro
@@ -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
+}
diff --git a/tests/libfuzzer/gui/iccparser/iccparser.pro b/tests/libfuzzer/gui/iccparser/iccparser.pro
index bf4037eae7..934ff81077 100644
--- a/tests/libfuzzer/gui/iccparser/iccparser.pro
+++ b/tests/libfuzzer/gui/iccparser/iccparser.pro
@@ -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
+}
diff --git a/tests/libfuzzer/gui/text/qtextdocument/setHtml/setHtml.pro b/tests/libfuzzer/gui/text/qtextdocument/setHtml/setHtml.pro
index c9b14f6caf..af5ef9e940 100644
--- a/tests/libfuzzer/gui/text/qtextdocument/setHtml/setHtml.pro
+++ b/tests/libfuzzer/gui/text/qtextdocument/setHtml/setHtml.pro
@@ -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
+}
diff --git a/tests/libfuzzer/gui/text/qtextdocument/setMarkdown/setMarkdown.pro b/tests/libfuzzer/gui/text/qtextdocument/setMarkdown/setMarkdown.pro
index 4a2dfa51b9..758622e1af 100644
--- a/tests/libfuzzer/gui/text/qtextdocument/setMarkdown/setMarkdown.pro
+++ b/tests/libfuzzer/gui/text/qtextdocument/setMarkdown/setMarkdown.pro
@@ -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
+}
diff --git a/tests/libfuzzer/gui/text/qtextlayout/beginLayout/beginLayout.pro b/tests/libfuzzer/gui/text/qtextlayout/beginLayout/beginLayout.pro
index c9b14f6caf..af5ef9e940 100644
--- a/tests/libfuzzer/gui/text/qtextlayout/beginLayout/beginLayout.pro
+++ b/tests/libfuzzer/gui/text/qtextlayout/beginLayout/beginLayout.pro
@@ -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
+}