filter_modify: fix leaks on exceptions #11833
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run unit tests | |
on: | |
push: | |
branches: | |
- master | |
- 3.2 | |
- 3.1 | |
- 3.0 | |
- 2.2 | |
- 2.1 | |
- 2.0 | |
- 1.9 | |
- 1.8 | |
pull_request: | |
paths-ignore: | |
- '.github/**' | |
- 'dockerfiles/**' | |
- 'docker_compose/**' | |
- 'packaging/**' | |
- '.gitignore' | |
- 'appveyor.yml' | |
- 'examples/**' | |
branches: | |
- master | |
- 3.2 | |
- 3.1 | |
- 3.0 | |
- 2.2 | |
- 2.1 | |
- 2.0 | |
- 1.9 | |
- 1.8 | |
types: [opened, reopened, synchronize] | |
workflow_dispatch: | |
jobs: | |
run-ubuntu-unit-tests: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
flb_option: | |
- "-DFLB_JEMALLOC=On" | |
- "-DFLB_JEMALLOC=Off" | |
- "-DFLB_SMALL=On" | |
- "-DSANITIZE_ADDRESS=On" | |
- "-DSANITIZE_UNDEFINED=On" | |
- "-DFLB_COVERAGE=On" | |
- "-DFLB_SANITIZE_MEMORY=On" | |
- "-DFLB_SANITIZE_THREAD=On" | |
- "-DFLB_SIMD=On" | |
- "-DFLB_SIMD=Off" | |
cmake_version: | |
- "3.31.6" | |
compiler: | |
- gcc: | |
cc: gcc | |
cxx: g++ | |
- clang: | |
cc: clang | |
cxx: clang++ | |
exclude: | |
- flb_option: "-DFLB_COVERAGE=On" | |
compiler: | |
cc: clang | |
cxx: clang++ | |
permissions: | |
contents: read | |
steps: | |
- name: Setup environment | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-9 g++-9 clang-12 libsystemd-dev gcovr libyaml-dev libbpf-dev linux-tools-common | |
sudo ln -s /usr/bin/llvm-symbolizer-12 /usr/bin/llvm-symbolizer || true | |
- name: Install cmake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: "${{ matrix.cmake_version }}" | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: calyptia/fluent-bit-ci | |
path: ci | |
- name: ${{ matrix.compiler.cc }} & ${{ matrix.compiler.cxx }} - ${{ matrix.flb_option }} | |
run: | | |
echo "CC = $CC, CXX = $CXX, FLB_OPT = $FLB_OPT" | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 | |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90 | |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 90 | |
sudo usermod -a -G systemd-journal $(id -un) | |
sudo -E su -p $(id -un) -c "PATH=$PATH ci/scripts/run-unit-tests.sh" | |
env: | |
CC: ${{ matrix.compiler.cc }} | |
CXX: ${{ matrix.compiler.cxx }} | |
FLB_OPT: ${{ matrix.flb_option }} | |
CALYPTIA_FLEET_TOKEN: ${{ secrets.CALYPTIA_FLEET_TOKEN }} | |
run-macos-unit-tests: | |
# We chain this after Linux one as there are costs and restrictions associated | |
needs: | |
- run-ubuntu-unit-tests | |
runs-on: macos-latest | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
flb_option: | |
- "-DFLB_JEMALLOC=Off" | |
- "-DFLB_SANITIZE_MEMORY=On" | |
- "-DFLB_SANITIZE_THREAD=On" | |
cmake_version: | |
- "3.31.6" | |
permissions: | |
contents: read | |
steps: | |
- name: Install cmake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: "${{ matrix.cmake_version }}" | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: calyptia/fluent-bit-ci | |
path: ci | |
- name: ${{ matrix.flb_option }} | |
run: | | |
echo "CC = $CC, CXX = $CXX, FLB_OPT = $FLB_OPT" | |
brew update | |
brew install bison flex openssl || true | |
ci/scripts/run-unit-tests.sh | |
env: | |
CC: gcc | |
CXX: g++ | |
FLB_OPT: ${{ matrix.flb_option }} | |
run-aarch64-unit-tests: | |
runs-on: ${{(github.repository == 'fluent/fluent-bit') && 'ubuntu-22.04-arm' || 'ubuntu-latest' }} | |
permissions: | |
contents: read | |
needs: | |
- run-ubuntu-unit-tests | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- name: "Aarch64 testing" | |
flb_option: "-DFLB_WITHOUT_flb-it-network=1 -DFLB_WITHOUT_flb-it-fstore=1" | |
omit_option: "" | |
global_option: "-DFLB_BACKTRACE=Off -DFLB_SHARED_LIB=Off -DFLB_DEBUG=On -DFLB_ALL=On -DFLB_EXAMPLES=Off" | |
unit_test_option: "-DFLB_TESTS_INTERNAL=On" | |
compiler_cc: gcc | |
compiler_cxx: g++ | |
cmake_version: "3.31.6" | |
cmake_home: "/opt/cmake" | |
steps: | |
- name: Checkout Fluent Bit code | |
uses: actions/checkout@v4 | |
- name: Setup environment | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-9 g++-9 clang-12 flex bison libsystemd-dev gcovr libyaml-dev libbpf-dev linux-tools-common curl tar gzip | |
sudo ln -s /usr/bin/llvm-symbolizer-12 /usr/bin/llvm-symbolizer || true | |
sudo mkdir -p "${CMAKE_HOME}" | |
cmake_url="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-$(uname -m).tar.gz" | |
cmake_dist="$(mktemp --suffix ".tar.gz")" | |
echo "Downloading CMake ${CMAKE_VERSION}: ${cmake_url} -> ${cmake_dist}" | |
curl -jksSL -o "${cmake_dist}" "${cmake_url}" | |
echo "Extracting CMake ${CMAKE_VERSION}: ${cmake_dist} -> ${CMAKE_HOME}" | |
sudo tar -xzf "${cmake_dist}" -C "${CMAKE_HOME}" --strip-components 1 | |
rm "${cmake_dist}" | |
env: | |
CMAKE_HOME: ${{ matrix.config.cmake_home }} | |
CMAKE_VERSION: ${{ matrix.config.cmake_version }} | |
- name: Build and test with arm runners | |
run: | | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 | |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90 | |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 90 | |
export nparallel=$(( $(getconf _NPROCESSORS_ONLN) > 8 ? 8 : $(getconf _NPROCESSORS_ONLN) )) | |
export FLB_OPTION="${{ matrix.config.flb_option }}" | |
export FLB_OMIT_OPTION="${{ matrix.config.omit_option }}" | |
export GLOBAL_OPTION="${{ matrix.config.global_option }}" | |
export FLB_UNIT_TEST_OPTION="${{ matrix.config.unit_test_option }}" | |
export FLB_OPT="${FLB_OPTION} ${GLOBAL_OPTION} ${FLB_UNIT_TEST_OPTION} ${FLB_OMIT_OPTION}" | |
echo "CC = ${{ matrix.config.compiler_cc }}, CXX = ${{ matrix.config.compiler_cxx }}, FLB_OPT = $FLB_OPT" | |
if [[ -n "${CMAKE_HOME}" ]]; then | |
export PATH="${CMAKE_HOME}/bin:${PATH}" | |
fi | |
cmake ${FLB_OPT} ../ | |
make -j $nparallel | |
ctest -j $nparallel --build-run-dir . --output-on-failure | |
working-directory: build | |
env: | |
CC: ${{ matrix.config.compiler_cc }} | |
CXX: ${{ matrix.config.compiler_cxx }} | |
CALYPTIA_FLEET_TOKEN: ${{ secrets.CALYPTIA_FLEET_TOKEN }} | |
CMAKE_HOME: ${{ matrix.config.cmake_home }} | |
run-qemu-ubuntu-unit-tests: | |
# We chain this after Linux one as there are CPU time costs for QEMU emulation | |
needs: | |
- run-ubuntu-unit-tests | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: | |
- s390x | |
- riscv64 | |
steps: | |
- name: Checkout Fluent Bit code | |
uses: actions/checkout@v4 | |
- name: Prepare and build with QEMU ${{ matrix.arch }} | |
uses: uraimo/run-on-arch-action@v3 | |
id: build-and-test-on-qemu | |
with: | |
arch: ${{ matrix.arch }} | |
distro: ubuntu22.04 | |
shell: /bin/bash | |
dockerRunArgs: | | |
--volume "/var/lib/dbus/machine-id:/var/lib/dbus/machine-id" | |
--volume "/etc/machine-id:/etc/machine-id" | |
install: | | |
apt-get update | |
apt-get install -y gcc-12 g++-12 libyaml-dev flex bison libssl-dev libbpf-dev linux-tools-common | |
apt-get satisfy -y cmake "cmake (<< 4.0)" | |
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 90 | |
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 90 | |
run: | | |
cd build | |
export nparallel=$(( $(getconf _NPROCESSORS_ONLN) > 8 ? 8 : $(getconf _NPROCESSORS_ONLN) )) | |
export FLB_OPTION="-DFLB_WITHOUT_flb-it-network=1 -DFLB_WITHOUT_flb-it-fstore=1" | |
export FLB_OMIT_OPTION="" | |
export GLOBAL_OPTION="-DFLB_BACKTRACE=Off -DFLB_SHARED_LIB=Off -DFLB_DEBUG=On -DFLB_ALL=On -DFLB_EXAMPLES=Off" | |
export FLB_UNIT_TEST_OPTION="-DFLB_TESTS_INTERNAL=On" | |
export FLB_OPT="${FLB_OPTION} ${GLOBAL_OPTION} ${FLB_UNIT_TEST_OPTION} ${FLB_OMIT_OPTION}" | |
export CC=gcc | |
export CXX=g++ | |
echo "CC = $CC, CXX = $CXX, FLB_OPT = $FLB_OPT" | |
cmake ${FLB_OPT} ../ | |
make -j $nparallel | |
ctest -j $nparallel --build-run-dir . --output-on-failure | |
# Required check looks at this so do not remove | |
run-all-unit-tests: | |
if: always() | |
runs-on: ubuntu-latest | |
name: Unit tests (matrix) | |
permissions: | |
contents: none | |
needs: | |
- run-macos-unit-tests | |
- run-ubuntu-unit-tests | |
- run-aarch64-unit-tests | |
- run-qemu-ubuntu-unit-tests | |
steps: | |
- name: Check build matrix status | |
# Ignore MacOS failures | |
if: ${{ needs.run-ubuntu-unit-tests.result != 'success' }} | |
run: exit 1 |