mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-05-02 07:31:38 +02:00
add/modify cmake and travis to get the regression tests built with sanitizers
This commit is contained in:
parent
c027909acc
commit
dc51f6493b
41
.travis.yml
41
.travis.yml
@ -10,9 +10,10 @@ install:
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then ./cmake-3.7.1-Linux-x86_64.sh --prefix=${BASE}/usr --skip-license; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PATH="${BASE}/usr/bin:$PATH"; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export LD_LIBRARY_PATH="${BASE}/usr/lib:$LD_LIBRARY_PATH"; fi
|
||||
- if [ "$CXX" = "g++" ]; then export CXX="g++-6" CC="gcc-6"; fi
|
||||
- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then export CXX="clang++-3.9" CC="clang-3.9"; fi
|
||||
- if [ "$CXX" = "g++" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then cd /usr/include/c++/$(g++ -v 2>&1 | grep version | awk '{print $3}')/bits; ln -s ../ext/atomicity.h .; cd ${BASE}/usr; fi
|
||||
- if [ "$CXX" == "g++" ]; then export CXX="g++-6" CC="gcc-6"; fi
|
||||
- if [ "$CXX" == "clang++" ] && [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$MSGPACK_FUZZ_REGRESSION" != "ON" ]; then export CXX="clang++-3.9" CC="clang-3.9"; fi
|
||||
- if [ "$CXX" == "clang++" ] && [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$MSGPACK_FUZZ_REGRESSION" == "ON" ]; then export CXX="clang++-5.0" CC="clang-5.0"; fi
|
||||
- if [ "$CXX" == "g++" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then cd /usr/include/c++/$(g++ -v 2>&1 | grep version | awk '{print $3}')/bits; ln -s ../ext/atomicity.h .; cd ${BASE}/usr; fi
|
||||
#gtest
|
||||
- wget https://github.com/google/googletest/archive/release-1.7.0.zip -O googletest-release-1.7.0.zip
|
||||
- unzip -q googletest-release-1.7.0.zip
|
||||
@ -27,9 +28,10 @@ install:
|
||||
- mv *.a ${BASE}/usr/lib
|
||||
- cd ..
|
||||
# valgrind
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then wget http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2 && tar xjf valgrind-3.12.0.tar.bz2 && cd valgrind-3.12.0 && ./configure --prefix=${BASE}/usr > /dev/null && make -j3 > /dev/null && make install > /dev/null && cd ..; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$MSGPACK_FUZZ_REGRESSION" != "ON" ]; then wget http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2 && tar xjf valgrind-3.12.0.tar.bz2 && cd valgrind-3.12.0 && ./configure --prefix=${BASE}/usr > /dev/null && make -j3 > /dev/null && make install > /dev/null && cd ..; fi
|
||||
# boost
|
||||
- if [ "$BOOST" == "ON" ]; then wget http://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.zip && unzip -q boost_1_66_0.zip && cd boost_1_66_0 && ./bootstrap.sh && ./b2 -j3 --prefix=${BASE}/usr --with-chrono --with-context --with-system --with-timer address-model=${ARCH} install > /dev/null && cd ..; fi
|
||||
- if [ "$BOOST" == "ON" ] && [ "MSGPACK_FUZZ_REGRESSION" != "ON" ]; then wget http://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.zip && unzip -q boost_1_66_0.zip && cd boost_1_66_0 && ./bootstrap.sh && ./b2 -j3 --prefix=${BASE}/usr --with-chrono --with-context --with-system --with-timer address-model=${ARCH} install > /dev/null && cd ..; fi
|
||||
- if [ "$MSGPACK_FUZZ_REGRESSION" == "ON" ]; then wget http://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.zip && unzip -q boost_1_66_0.zip && cd boost_1_66_0 && ./bootstrap.sh --with-toolset=clang && ./b2 clean && ./b2 -j$(nproc) --prefix=${BASE}/usr --with-system --with-filesystem address-model=${ARCH} install > /dev/null && cd ..; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s /usr/include/x86_64-linux-gnu/zconf.h /usr/include; fi
|
||||
|
||||
matrix:
|
||||
@ -209,6 +211,35 @@ matrix:
|
||||
- zlib1g-dev
|
||||
- bzip2
|
||||
- libc6-dbg
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: ACTION="ci/build_regression.sh" ARCH="64" SAN="UBSAN" MSGPACK_FUZZ_REGRESSION="ON"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.9
|
||||
- llvm-toolchain-precise
|
||||
packages:
|
||||
- bzip2
|
||||
- clang-5.0
|
||||
script:
|
||||
- CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}" GTEST_ROOT="${BASE}/gtest" BOOST_ROOT="${BASE}/boost" CTEST_OUTPUT_ON_FAILURE=1 MSGPACK_SAN="${SAN}" ci/build_regression.sh
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: ACTION="ci/build_regression.sh" ARCH="64" SAN="ASAN" MSGPACK_FUZZ_REGRESSION="ON"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.9
|
||||
- llvm-toolchain-precise
|
||||
packages:
|
||||
- bzip2
|
||||
- clang-5.0
|
||||
script:
|
||||
- CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}" GTEST_ROOT="${BASE}/gtest" BOOST_ROOT="${BASE}/boost" CTEST_OUTPUT_ON_FAILURE=1 MSGPACK_SAN="${SAN}" ci/build_regression.sh
|
||||
|
||||
|
||||
script:
|
||||
- CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}/usr/lib:${BASE}/build" GTEST_ROOT="${BASE}/usr" BOOST_ROOT="${BASE}/usr" CFLAGS="-Werror -g" CXXFLAGS="-Werror -g" ${ACTION}
|
||||
|
@ -150,7 +150,7 @@ ENDFOREACH ()
|
||||
FIND_PACKAGE (GTest)
|
||||
FIND_PACKAGE (ZLIB)
|
||||
FIND_PACKAGE (Threads)
|
||||
IF (GTEST_FOUND AND ZLIB_FOUND AND THREADS_FOUND)
|
||||
IF (GTEST_FOUND AND ZLIB_FOUND AND THREADS_FOUND AND NOT "${MSGPACK_FUZZ_REGRESSION}" STREQUAL "ON")
|
||||
OPTION (MSGPACK_BUILD_TESTS "Build msgpack tests." ON)
|
||||
ENDIF ()
|
||||
|
||||
@ -226,6 +226,18 @@ IF (MSGPACK_ENABLE_SHARED)
|
||||
SET_TARGET_PROPERTIES (msgpackc PROPERTIES SOVERSION 2 VERSION 2.0.0)
|
||||
ENDIF ()
|
||||
|
||||
# enable regression testing
|
||||
IF ("${MSGPACK_FUZZ_REGRESSION}" STREQUAL "ON" AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
SET (CMAKE_CXX_FLAGS "-DMSGPACK_USE_BOOST ${CMAKE_CXX_FLAGS}")
|
||||
SET (Boost_USE_MULTITHREADED ON)
|
||||
SET (Boost_USE_STATIC_RUNTIME OFF)
|
||||
|
||||
enable_testing ()
|
||||
ADD_SUBDIRECTORY (fuzz)
|
||||
SET (MSGPACK_BUILD_EXAMPLES OFF)
|
||||
ENDIF ()
|
||||
|
||||
|
||||
IF (MSGPACK_BUILD_TESTS)
|
||||
ENABLE_TESTING ()
|
||||
# MEMORYCHECK_COMMAND_OPTIONS needs to place prior to CTEST_MEMORYCHECK_COMMAND
|
||||
|
49
ci/build_regression.sh
Executable file
49
ci/build_regression.sh
Executable file
@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p build
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
cd build
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
if [ "${ARCH}" == "32" ]
|
||||
then
|
||||
echo "64 bit support required for regressions"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cmake -DMSGPACK_FUZZ_REGRESSION="ON" -DMSGPACK_CXX11="ON" -DMSGPACK_BOOST=${BOOST} -DMSGPACK_SAN=${MSGPACK_SAN} -v ..
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
make
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
make test
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
exit 0
|
Loading…
x
Reference in New Issue
Block a user