From 5c911ad4b1fd63c951544de93870d059ec6d1558 Mon Sep 17 00:00:00 2001 From: Luke Date: Sun, 29 Nov 2020 19:01:40 +0000 Subject: [PATCH] Meta: Add GitHub Actions workflow for Lagom with Fuzzers There are cases where Lagom will build with GCC but not Clang. This often goes unnoticed for a while as we don't often build with Clang. However, this is now important to test in CI because of the OSS-Fuzz integration. Note that this only tests the build, it does not run any tests. Note that it also only builds LagomCore, Lagom and the fuzzers. It does not build the other programs that use Lagom. --- .github/workflows/cmake.yml | 28 ++++++++++++++++++++++++++++ Meta/Lagom/CMakeLists.txt | 2 +- Meta/Lagom/Fuzzers/CMakeLists.txt | 4 +++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9330a08bdb..014d62b0f4 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -105,3 +105,31 @@ jobs: ${{ toJSON(github.event) }} ] EOF + build_lagom_with_fuzzers: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + + # === OS SETUP === + + - name: Check versions + run: set +e; clang --version; clang++ --version + + # === PREPARE FOR BUILDING === + + # TODO: ccache + # https://cristianadam.eu/20200113/speeding-up-c-plus-plus-github-actions-using-ccache/ + # https://github.com/cristianadam/HelloWorld/blob/master/.github/workflows/build_cmake.yml + - name: Create build environment + working-directory: ${{ github.workspace }}/Meta/Lagom + run: | + mkdir -p Build + cd Build + cmake -DBUILD_LAGOM=ON -DENABLE_FUZZER_SANITIZER=ON -DENABLE_ADDRESS_SANITIZER=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .. + + # === ACTUALLY BUILD === + + - name: Build Lagom with Fuzzers + working-directory: ${{ github.workspace }}/Meta/Lagom/Build + run: cmake --build . -j2 diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 5eb301a53d..0e6fcea8ee 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -82,7 +82,7 @@ add_library(LagomCore ${LAGOM_CORE_SOURCES}) if (BUILD_LAGOM) add_library(Lagom $ ${LAGOM_MORE_SOURCES}) - if (NOT ENABLE_OSS_FUZZ) + if (NOT ENABLE_OSS_FUZZ AND NOT ENABLE_FUZZER_SANITIZER) add_executable(TestApp TestApp.cpp) target_link_libraries(TestApp Lagom) target_link_libraries(TestApp stdc++) diff --git a/Meta/Lagom/Fuzzers/CMakeLists.txt b/Meta/Lagom/Fuzzers/CMakeLists.txt index c872ecb44a..2c689d1617 100644 --- a/Meta/Lagom/Fuzzers/CMakeLists.txt +++ b/Meta/Lagom/Fuzzers/CMakeLists.txt @@ -31,8 +31,10 @@ add_simple_fuzzer(FuzzRegexECMA262) add_simple_fuzzer(FuzzRegexPosixExtended) add_simple_fuzzer(FuzzShell) -if (NOT ENABLE_OSS_FUZZ) +if (NOT ENABLE_OSS_FUZZ AND NOT ENABLE_FUZZER_SANITIZER) add_executable(FuzzilliJs FuzzilliJs.cpp) +# FIXME: For some reason, these option overrides are ignored and FuzzilliJs gets treated +# as a regular fuzzer. Once fixed, please remove the "AND NOT ENABLE_FUZZER_SANITIZER" above. target_compile_options(FuzzilliJs PRIVATE $<$:-g -O1 -fsanitize-coverage=trace-pc-guard> )