Add fuzz build to CI
This commit is contained in:
20
.github/workflows/validate-cpp.yml
vendored
20
.github/workflows/validate-cpp.yml
vendored
@@ -31,6 +31,26 @@ jobs:
|
|||||||
- name: Unit tests
|
- name: Unit tests
|
||||||
run: ./unit_tests ${{ matrix.mode }}
|
run: ./unit_tests ${{ matrix.mode }}
|
||||||
|
|
||||||
|
|
||||||
|
build_fuzzers:
|
||||||
|
name: Build fuzzers [${{ matrix.toolchain }}][${{ matrix.mode }}]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
mode: [Debug, Release]
|
||||||
|
toolchain: [Clang]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup
|
||||||
|
uses: ./.github/actions/setup-cpp
|
||||||
|
with:
|
||||||
|
toolchain: ${{ matrix.toolchain }}
|
||||||
|
|
||||||
|
- name: Unit tests
|
||||||
|
run: ./build_fuzz_tests ${{ matrix.mode }}
|
||||||
|
|
||||||
benchmark:
|
benchmark:
|
||||||
name: Benchmark [${{ matrix.toolchain }}]
|
name: Benchmark [${{ matrix.toolchain }}]
|
||||||
runs-on: ${{ (matrix.toolchain == 'MSVC') && 'windows-latest' || 'ubuntu-latest' }}
|
runs-on: ${{ (matrix.toolchain == 'MSVC') && 'windows-latest' || 'ubuntu-latest' }}
|
||||||
|
28
build_fuzz_tests
Executable file
28
build_fuzz_tests
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the MIT license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
|
if [ "$#" -eq 0 ]; then
|
||||||
|
build_type="Debug"
|
||||||
|
else
|
||||||
|
build_type="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export CC=clang
|
||||||
|
export CXX=clang++
|
||||||
|
|
||||||
|
# Make sure libc++ isn't used, as libfuzzer is linked against stdlibc++ which causes conflicts
|
||||||
|
unset CXXFLAGS
|
||||||
|
export LDFLAGS=-lstdc++
|
||||||
|
|
||||||
|
if which ninja; then
|
||||||
|
set -e
|
||||||
|
cmake -B build -S . -D BUILD_FUZZ_TESTS=ON -D CMAKE_BUILD_TYPE="$build_type" -G Ninja
|
||||||
|
else
|
||||||
|
set -e
|
||||||
|
cmake -B build -S . -D BUILD_FUZZ_TESTS=ON -D CMAKE_BUILD_TYPE="$build_type"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cmake --build build --target fuzz_layout
|
Reference in New Issue
Block a user