summaryrefslogtreecommitdiff
path: root/Meta
diff options
context:
space:
mode:
authorDavidKorczynski <david@adalogics.com>2020-11-27 22:57:02 +0000
committerGitHub <noreply@github.com>2020-11-27 23:57:02 +0100
commitff8ac601849e61194b663fb73ca971a12fe7cab0 (patch)
treee5aab7feea7842de48ccbfd1ef145a1da5f87b9e /Meta
parent83f6b8bc9a4a332d9532a4e0bebcf9c40d00df1b (diff)
downloadserenity-ff8ac601849e61194b663fb73ca971a12fe7cab0.zip
Lagom: Various fixes to make Lagom run on OSS-Fuzz (#4176)
Diffstat (limited to 'Meta')
-rw-r--r--Meta/Lagom/CMakeLists.txt121
-rw-r--r--Meta/Lagom/Fuzzers/CMakeLists.txt12
2 files changed, 75 insertions, 58 deletions
diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt
index d2c733212a..a5a287177b 100644
--- a/Meta/Lagom/CMakeLists.txt
+++ b/Meta/Lagom/CMakeLists.txt
@@ -1,7 +1,12 @@
cmake_minimum_required (VERSION 3.0)
project (Lagom)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option -O2 -Wall -Wextra -Werror -std=c++2a -fPIC -g -Wno-deprecated-copy")
+if (NOT ENABLE_OSS_FUZZ)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option -O2 -Wall -Wextra -Werror -std=c++2a -fPIC -g -Wno-deprecated-copy")
+else()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++2a -fPIC -g -Wno-deprecated-copy")
+endif()
+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconsumed -Wno-overloaded-virtual")
@@ -68,67 +73,71 @@ include_directories (../../)
include_directories (../../Libraries/)
add_library(LagomCore ${LAGOM_CORE_SOURCES})
+
+
if (BUILD_LAGOM)
add_library(Lagom $<TARGET_OBJECTS:LagomCore> ${LAGOM_MORE_SOURCES})
-
- add_executable(TestApp TestApp.cpp)
- target_link_libraries(TestApp Lagom)
- target_link_libraries(TestApp stdc++)
-
- add_executable(TestJson TestJson.cpp)
- target_link_libraries(TestJson Lagom)
- target_link_libraries(TestJson stdc++)
-
- add_executable(adjtime_lagom ../../Userland/adjtime.cpp)
- set_target_properties(adjtime_lagom PROPERTIES OUTPUT_NAME adjtime)
- target_link_libraries(adjtime_lagom Lagom)
-
- add_executable(js_lagom ../../Userland/js.cpp)
- set_target_properties(js_lagom PROPERTIES OUTPUT_NAME js)
- target_link_libraries(js_lagom Lagom)
- target_link_libraries(js_lagom stdc++)
- target_link_libraries(js_lagom pthread)
-
- add_executable(ntpquery_lagom ../../Userland/ntpquery.cpp)
- set_target_properties(ntpquery_lagom PROPERTIES OUTPUT_NAME ntpquery)
- target_link_libraries(ntpquery_lagom Lagom)
-
- add_executable(test-js_lagom ../../Userland/test-js.cpp)
- set_target_properties(test-js_lagom PROPERTIES OUTPUT_NAME test-js)
- target_link_libraries(test-js_lagom Lagom)
- target_link_libraries(test-js_lagom stdc++)
- target_link_libraries(test-js_lagom pthread)
-
- add_executable(test-crypto_lagom ../../Userland/test-crypto.cpp)
- set_target_properties(test-crypto_lagom PROPERTIES OUTPUT_NAME test-crypto)
- target_link_libraries(test-crypto_lagom Lagom)
- target_link_libraries(test-crypto_lagom stdc++)
- add_test(
- NAME Crypto
- COMMAND test-crypto_lagom test -t -s google.com --ca-certs-file ../../Base/etc/ca_certs.ini
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- )
-
- add_executable(disasm_lagom ../../Userland/disasm.cpp)
- set_target_properties(disasm_lagom PROPERTIES OUTPUT_NAME disasm)
- target_link_libraries(disasm_lagom Lagom)
- target_link_libraries(disasm_lagom stdc++)
-
- add_executable(shell_lagom ${SHELL_SOURCES})
- set_target_properties(shell_lagom PROPERTIES OUTPUT_NAME shell)
- target_link_libraries(shell_lagom Lagom)
- target_link_libraries(shell_lagom stdc++)
- target_link_libraries(shell_lagom pthread)
- foreach(TEST_PATH ${SHELL_TESTS})
- get_filename_component(TEST_NAME ${TEST_PATH} NAME_WE)
+
+ if (NOT ENABLE_OSS_FUZZ)
+ add_executable(TestApp TestApp.cpp)
+ target_link_libraries(TestApp Lagom)
+ target_link_libraries(TestApp stdc++)
+
+ add_executable(TestJson TestJson.cpp)
+ target_link_libraries(TestJson Lagom)
+ target_link_libraries(TestJson stdc++)
+
+ add_executable(adjtime_lagom ../../Userland/adjtime.cpp)
+ set_target_properties(adjtime_lagom PROPERTIES OUTPUT_NAME adjtime)
+ target_link_libraries(adjtime_lagom Lagom)
+
+ add_executable(js_lagom ../../Userland/js.cpp)
+ set_target_properties(js_lagom PROPERTIES OUTPUT_NAME js)
+ target_link_libraries(js_lagom Lagom)
+ target_link_libraries(js_lagom stdc++)
+ target_link_libraries(js_lagom pthread)
+
+ add_executable(ntpquery_lagom ../../Userland/ntpquery.cpp)
+ set_target_properties(ntpquery_lagom PROPERTIES OUTPUT_NAME ntpquery)
+ target_link_libraries(ntpquery_lagom Lagom)
+
+ add_executable(test-js_lagom ../../Userland/test-js.cpp)
+ set_target_properties(test-js_lagom PROPERTIES OUTPUT_NAME test-js)
+ target_link_libraries(test-js_lagom Lagom)
+ target_link_libraries(test-js_lagom stdc++)
+ target_link_libraries(test-js_lagom pthread)
+
+ add_executable(test-crypto_lagom ../../Userland/test-crypto.cpp)
+ set_target_properties(test-crypto_lagom PROPERTIES OUTPUT_NAME test-crypto)
+ target_link_libraries(test-crypto_lagom Lagom)
+ target_link_libraries(test-crypto_lagom stdc++)
add_test(
- NAME "Shell-${TEST_NAME}"
- COMMAND shell_lagom "${TEST_PATH}"
+ NAME Crypto
+ COMMAND test-crypto_lagom test -t -s google.com --ca-certs-file ../../Base/etc/ca_certs.ini
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
- endforeach()
+
+ add_executable(disasm_lagom ../../Userland/disasm.cpp)
+ set_target_properties(disasm_lagom PROPERTIES OUTPUT_NAME disasm)
+ target_link_libraries(disasm_lagom Lagom)
+ target_link_libraries(disasm_lagom stdc++)
+
+ add_executable(shell_lagom ${SHELL_SOURCES})
+ set_target_properties(shell_lagom PROPERTIES OUTPUT_NAME shell)
+ target_link_libraries(shell_lagom Lagom)
+ target_link_libraries(shell_lagom stdc++)
+ target_link_libraries(shell_lagom pthread)
+ foreach(TEST_PATH ${SHELL_TESTS})
+ get_filename_component(TEST_NAME ${TEST_PATH} NAME_WE)
+ add_test(
+ NAME "Shell-${TEST_NAME}"
+ COMMAND shell_lagom "${TEST_PATH}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+ endforeach()
+ endif()
endif()
-if (ENABLE_FUZZER_SANITIZER)
+if (ENABLE_FUZZER_SANITIZER OR ENABLE_OSS_FUZZ)
add_subdirectory(Fuzzers)
endif()
diff --git a/Meta/Lagom/Fuzzers/CMakeLists.txt b/Meta/Lagom/Fuzzers/CMakeLists.txt
index 9b1256b46a..902b9f5e0d 100644
--- a/Meta/Lagom/Fuzzers/CMakeLists.txt
+++ b/Meta/Lagom/Fuzzers/CMakeLists.txt
@@ -1,12 +1,18 @@
function(add_simple_fuzzer name)
add_executable(${name} "${name}.cpp")
- target_compile_options(${name}
+
+ if (ENABLE_OSS_FUZZ)
+ target_link_libraries(${name}
+ PUBLIC Lagom)
+ else()
+ target_compile_options(${name}
PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize=fuzzer>
)
- target_link_libraries(${name}
+ target_link_libraries(${name}
PUBLIC Lagom
PRIVATE $<$<C_COMPILER_ID:Clang>:-fsanitize=fuzzer>
)
+ endif()
endfunction()
add_simple_fuzzer(FuzzBMPLoader)
@@ -22,6 +28,7 @@ add_simple_fuzzer(FuzzPPMLoader)
add_simple_fuzzer(FuzzJs)
add_simple_fuzzer(FuzzMarkdown)
+if (NOT ENABLE_OSS_FUZZ)
add_executable(FuzzilliJs FuzzilliJs.cpp)
target_compile_options(FuzzilliJs
PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize-coverage=trace-pc-guard>
@@ -30,3 +37,4 @@ target_link_libraries(FuzzilliJs
PUBLIC Lagom
PRIVATE $<$<C_COMPILER_ID:Clang>:-fsanitize-coverage=trace-pc-guard>
)
+endif()