mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-16 09:12:22 +00:00
Add testing of C++ with sanitizers (CI-Docker) (#5631)
* Add C++ build testing with clang and gcc This adds Dockerfiles which test building flatc and the C++ library against clang and gcc. See discussion at #5119. It is derived from the Travis CI tooling. The GRPC tests are failing due to #5099 so those are commented out. These are run from the .travis.yml file rather than the tests/docker/languages folder because the builds may each take longer than 30 minutes and were hitting Travis timeouts. Parallel builds and build caching attempt to keep the build times low. * Add GCC 8.3 and Clang 7.0 with sanitizers into CI (based on #5130) - Add a docker based on Debian Buster. - Add C++ building scripts for the docker. - Leak-sanitizer requires SYS_PTRACE.
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
ff3781dc2d
commit
091fa1fd1b
10
tests/docker/Dockerfile.testing.cpp.debian_buster
Normal file
10
tests/docker/Dockerfile.testing.cpp.debian_buster
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM debian:10.1-slim as base
|
||||
RUN apt -qq update >/dev/null
|
||||
RUN apt -qq install -y cmake make build-essential >/dev/null
|
||||
RUN apt -qq install -y autoconf git libtool >/dev/null
|
||||
RUN apt -qq install -y clang >/dev/null
|
||||
FROM base
|
||||
# Travis machines have 2 cores. Can be redefined with 'run --env PAR_JOBS=N'.
|
||||
ENV JOBS=2
|
||||
WORKDIR /flatbuffers
|
||||
ADD . .
|
||||
15
tests/docker/build_flatc.run.sh
Executable file
15
tests/docker/build_flatc.run.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
set -e
|
||||
|
||||
JOBS=${JOBS:-1}
|
||||
config=$1
|
||||
echo ""
|
||||
echo "Build 'flatc' compiler for '$config'"
|
||||
|
||||
cmake . -DCMAKE_BUILD_TYPE=$config \
|
||||
-DFLATBUFFERS_BUILD_FLATC=1 -DFLATBUFFERS_STATIC_FLATC=1 \
|
||||
-DFLATBUFFERS_BUILD_TESTS=0 -DFLATBUFFERS_INSTALL=0
|
||||
cmake --build . --target flatc --clean-first -- -j$JOBS
|
||||
|
||||
echo "Check generated code"
|
||||
.travis/check-generate-code.sh
|
||||
echo "Done"
|
||||
20
tests/docker/cpp_test.run.sh
Executable file
20
tests/docker/cpp_test.run.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
set -e
|
||||
|
||||
JOBS=${JOBS:-1}
|
||||
export UBSAN_OPTIONS=halt_on_error=1
|
||||
export ASAN_OPTIONS=halt_on_error=1
|
||||
export MAKEFLAGS="-j$JOBS"
|
||||
|
||||
config=$1
|
||||
echo ""
|
||||
echo "Build Flatbuffers project for '$config' with jobs=$JOBS"
|
||||
|
||||
cmake . -DCMAKE_BUILD_TYPE=$config \
|
||||
-DFLATBUFFERS_BUILD_TESTS=ON -DFLATBUFFERS_CODE_SANITIZE=ON
|
||||
cmake --build . --target all --clean-first -- -j$JOBS
|
||||
ctest --extra-verbose --output-on-failure -j$JOBS
|
||||
|
||||
echo "Check generated code"
|
||||
.travis/check-generate-code.sh
|
||||
|
||||
echo "C++ tests done"
|
||||
Reference in New Issue
Block a user