Add Valgrind to Travis CI, and improve the build Matrix with more variables

Should detect the slight bug we currently have in our test of Database read header
This commit is contained in:
Sébastien Rombauts 2020-01-04 17:35:31 +01:00
parent c06db7f48b
commit 5a1fa743e5
6 changed files with 59 additions and 42 deletions

View File

@ -16,25 +16,38 @@ matrix:
# GCC on Linux
##########################################################################
# GCC Debug build with GCov for coverage build
- dist: bionic
env:
- cc=gcc
- cxx=g++
- CXXFLAGS=""
- cc=gcc cxx=g++
- BUILD_TYPE=Debug
- ASAN=ON GCOV=ON
- COVERALLS=true
# GCC Debug build with Valgrind instead of Address Sanitizer
- dist: bionic
env:
- cc=gcc cxx=g++
- BUILD_TYPE=Debug
- VALGRIND=true
# GCC Release build
- dist: bionic
env:
- cc=gcc cxx=g++
- BUILD_TYPE=Release
- dist: xenial
env:
- cc=gcc
- cxx=g++
- CXXFLAGS=""
- cc=gcc cxx=g++
- BUILD_TYPE=Debug
- ASAN=ON
- dist: trusty
env:
- cc=gcc
- cxx=g++
- CXXFLAGS=""
- cc=gcc cxx=g++
- BUILD_TYPE=Debug
- ASAN=ON
##########################################################################
# Clang on Linux
@ -42,21 +55,21 @@ matrix:
- dist: bionic
env:
- cc=clang
- cxx=clang++
- CXXFLAGS=""
- cc=clang cxx=clang++
- BUILD_TYPE=Debug
- ASAN=ON
- dist: xenial
env:
- cc=clang
- cxx=clang++
- CXXFLAGS=""
- cc=clang cxx=clang++
- BUILD_TYPE=Debug
- ASAN=ON
- dist: trusty
env:
- cc=clang
- cxx=clang++
- CXXFLAGS=""
- cc=clang cxx=clang++
- BUILD_TYPE=Debug
- ASAN=ON
##########################################################################
# Clang on OSX
@ -65,17 +78,17 @@ matrix:
# Latest XCode
- os: osx
env:
- cc=clang
- cxx=clang++
- CXXFLAGS=""
- cc=clang cxx=clang++
- BUILD_TYPE=Debug
- ASAN=ON
# XCode 8.3
- os: osx
osx_image: xcode8.3
env:
- cc=clang
- cxx=clang++
- CXXFLAGS=""
- cc=clang cxx=clang++
- BUILD_TYPE=Debug
- ASAN=ON
before_install:
# Set the compiler environment variables properly
@ -83,6 +96,7 @@ before_install:
- export CXX=${cxx}
- ${CC} --version
- ${CXX} --version
- if [[ "$VALGRIND" == "true" ]]; then sudo apt-get install -qq valgrind ; fi
install:
# coveralls test coverage:
@ -92,13 +106,15 @@ install:
before_script:
- mkdir build
- cd build
- cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Debug -DSQLITECPP_USE_ASAN=ON -DSQLITECPP_USE_GCOV=ON -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..
- cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSQLITECPP_USE_ASAN=$ASAN -DSQLITECPP_USE_GCOV=$GCOV -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..
# build examples, and run tests (ie make & make test)
script:
- cmake --build .
- export ASAN_OPTIONS=verbosity=1:debug=1
- ctest --verbose --output-on-failure
- if [[ "$VALGRIND" == "true" ]]; then valgrind --leak-check=full --error-exitcode=1 ./SQLiteCpp_example1 ; fi
- if [[ "$VALGRIND" == "true" ]]; then valgrind --leak-check=full --error-exitcode=1 ./SQLiteCpp_tests ; fi
# generate and publish GCov coveralls results
after_success:

View File

@ -2,12 +2,12 @@ Mar 30 2012
- Start of a new thin C++ SQLite wrapper
Apr 2 2012
- The wrapper is functionnal
- The wrapper is functional
- Added documentation and examples
- Publication on GitHub
Version 0.1.0 - Apr 4 2012
- Added a Database::exec() methode to execute simple SQL statement
- Added a Database::exec() method to execute simple SQL statement
- Added a version number like in sqlite3.h, starting with 0.1.0
Version 0.2.0 - Apr 11 2012
@ -75,7 +75,7 @@ Version 1.3.0 - November 1 2015
- Added Backup class
Version 1.3.1 - February 10 2016
- Swith Linux/Mac build to the provided SQLite3 C library
- Switch Linux/Mac build to the provided SQLite3 C library
- Update SQLite3 from 3.8.8.3 to latest 3.10.2 (2016-01-20)
- Remove warnings
- Remove biicode support (defunct service, servers will shutdown the 16th of February 2016)
@ -157,9 +157,11 @@ Version 2.5.0 - December 31 2019
- #251 Added example for getHeaderInfo()
Version 3.0.0 - January 1 2020
- C++11 minimum
- C++11 is now required
- CMake 3.1 minimum
- Visual Studio 2015 minimum
- Googletest 1.10
- Remove Statement::isOk() deprecated in 2.2.0 when renamed to Statement::hasRow()
- Update Googletest to latest release 1.10
- Add Github Actions continuous integration solution
- Add Valgrind memcheck tool to Travis CI
- Remove Statement::isOk() deprecated in 2.2.0 when renamed to Statement::hasRow()
- Replace Database::backup() "C" implementation by calling the Backup class

View File

@ -43,14 +43,14 @@ else (MSVC)
set(CPPLINT_ARG_OUTPUT "--output=eclipse")
set(CPPCHECK_ARG_TEMPLATE "--template=gcc")
# Useful compile flags and extra warnings
add_compile_options(-fstack-protector -Wall -Wextra -Wpedantic -Wno-long-long -Wswitch-enum -Wshadow -Winline)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++0x-compat") # C++ only
add_compile_options(-fstack-protector)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wswitch-enum -Wshadow -Wno-long-long") # C++ only, don't bother with sqlite3
if (CMAKE_COMPILER_IS_GNUCXX)
# GCC flags
option(SQLITECPP_USE_GCOV "USE GCov instrumentation." OFF)
if (SQLITECPP_USE_GCOV)
message (STATUS "Using GCov instrumentation")
add_compile_options (-coverage) # NOTE -fkeep-inline-functions would be usefull but not working with current google test and gcc 4.8
add_compile_options (-coverage) # NOTE -fkeep-inline-functions would be useful but not working with current Google test and GCC 4.8
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -coverage")
endif ()
endif (CMAKE_COMPILER_IS_GNUCXX)
@ -83,7 +83,7 @@ endif ()
## Build the C++ Wrapper ##
# adding a new file require explicittly modifing the CMakeLists.txt
# adding a new file require explicitly modifying the CMakeLists.txt
# so that CMake knows that it should rebuild the project (it is best practice)
# list of sources files of the library
@ -307,7 +307,7 @@ if (SQLITECPP_BUILD_EXAMPLES)
# add the basic example executable
add_executable(SQLiteCpp_example1 ${SQLITECPP_EXAMPLES})
target_link_libraries(SQLiteCpp_example1 SQLiteCpp sqlite3)
# Link target with pthread and dl for linux
# Link target with pthread and dl for Linux
if (UNIX)
target_link_libraries(SQLiteCpp_example1 pthread)
if (NOT APPLE)
@ -329,12 +329,12 @@ if (SQLITECPP_BUILD_TESTS)
if (GTEST_FOUND)
target_link_libraries(SQLiteCpp_tests GTest::GTest GTest::Main SQLiteCpp sqlite3)
else (GTEST_FOUND)
# deactivate some warnings for compiling the gtest library
# deactivate some warnings for compiling the googletest library
if (NOT MSVC)
add_compile_options(-Wno-variadic-macros -Wno-long-long -Wno-switch-enum -Wno-float-equal -Wno-conversion-null -Wno-switch-default -Wno-pedantic)
endif (NOT MSVC)
# add the subdirectory containing the CMakeLists.txt for the gtest library
# add the subdirectory containing the CMakeLists.txt for the googletest library
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/googletest/CMakeLists.txt")
message(FATAL_ERROR "Missing 'googletest' submodule! Either use 'git submodule init' and 'git submodule update' to get googletest according to the README, or deactivate unit tests with -DSQLITECPP_BUILD_TESTS=OFF")
endif ()

View File

@ -72,6 +72,7 @@ Developments and tests are done under the following OSs:
- Windows 10, and Windows Server 2012 R2 & Windows Server 2016 (AppVeyor)
- OS X 10.11 (Travis CI)
- Github Actions
- Valgrind memcheck tool
And the following IDEs/Compilers
- GCC 4.8.4, 5.3.0 and 7.1.1 (C++11, C++14, C++17)

View File

@ -1,5 +1,3 @@
Switch to C++11 for v3.0.0
Add a Tutorial for SQLite newbies
Add a real example in the form of a small interactive console application

View File

@ -4,7 +4,7 @@
# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
# or copy at http://opensource.org/licenses/MIT)
# exit on firts error
# exit on first error
set -e
mkdir -p build