adds travis-ci automated testing

This commit is contained in:
gnzlbg 2015-05-11 10:44:26 +02:00
parent 8208b49298
commit 2117568be5
4 changed files with 247 additions and 28 deletions

211
.travis.yml Normal file
View File

@ -0,0 +1,211 @@
# Adapted from various sources, including:
# - Louis Dionne's Hana: https://github.com/ldionne/hana
# - Paul Fultz II's FIT: https://github.com/pfultz2/Fit
# - Eric Niebler's range-v3: https://github.com/ericniebler/range-v3
language: cpp
# Test matrix:
# - Build matrix per compiler: C++11/C++14 + Debug/Release
# - Optionally: AddressSanitizer (ASAN)
# - Valgrind: all release builds are also tested with valgrind
# - clang 3.4, 3.5, 3.6, trunk
# - Note: 3.4 and trunk are tested with/without ASAN,
# the rest is only tested with ASAN=On.
# - gcc 4.9, 5.0
#
matrix:
include:
# Test clang-3.5: C++11/C++14, Buidd=Debug/Release, ASAN=On/Off
# - env: CLANG_VERSION=3.5 BUILD_TYPE=Debug CPP=11 ASAN=On LIBCXX=On
# os: linux
# addons: &clang35
# apt:
# packages:
# - clang-3.5
# - valgrind
# sources:
# - ubuntu-toolchain-r-test
# - llvm-toolchain-precise-3.5
# - env: CLANG_VERSION=3.5 BUILD_TYPE=Release CPP=11 ASAN=On LIBCXX=On
# os: linux
# addons: *clang35
# - env: CLANG_VERSION=3.5 BUILD_TYPE=Debug CPP=14 ASAN=On LIBCXX=On
# os: linux
# addons: *clang35
# - env: CLANG_VERSION=3.5 BUILD_TYPE=Release CPP=14 ASAN=On LIBCXX=On
# os: linux
# addons: *clang35
# Uncomment these to test without AddressSanitizer
# - env: CLANG_VERSION=3.5 BUILD_TYPE=Debug CPP=11 ASAN=Off LIBCXX=On
# os: linux
# addons: *clang35
# - env: CLANG_VERSION=3.5 BUILD_TYPE=Release CPP=11 ASAN=Off LIBCXX=On
# os: linux
# addons: *clang35
# - env: CLANG_VERSION=3.5 BUILD_TYPE=Debug CPP=14 ASAN=Off LIBCXX=On
# os: linux
# addons: *clang35
# - env: CLANG_VERSION=3.5 BUILD_TYPE=Release CPP=14 ASAN=Off LIBCXX=On
# os: linux
# addons: *clang35
# Test clang-3.6: C++11/C++14, Buidd=Debug/Release, ASAN=On/Off
# - env: CLANG_VERSION=3.6 BUILD_TYPE=Debug CPP=11 ASAN=On LIBCXX=On
# os: linux
# addons: &clang36
# apt:
# packages:
# - clang-3.6
# - valgrind
# sources:
# - ubuntu-toolchain-r-test
# - llvm-toolchain-precise-3.6
# - env: CLANG_VERSION=3.6 BUILD_TYPE=Release CPP=11 ASAN=On LIBCXX=On
# os: linux
# addons: *clang36
# - env: CLANG_VERSION=3.6 BUILD_TYPE=Debug CPP=14 ASAN=On LIBCXX=On
# os: linux
# addons: *clang36
# - env: CLANG_VERSION=3.6 BUILD_TYPE=Release CPP=14 ASAN=On LIBCXX=On
# os: linux
# addons: *clang36
# Uncomment these to test without AddressSanitizer
# - env: CLANG_VERSION=3.6 BUILD_TYPE=Debug CPP=11 ASAN=Off LIBCXX=On
# os: linux
# addons: *clang36
# - env: CLANG_VERSION=3.6 BUILD_TYPE=Release CPP=11 ASAN=Off LIBCXX=On
# os: linux
# addons: *clang36
# - env: CLANG_VERSION=3.6 BUILD_TYPE=Debug CPP=14 ASAN=Off LIBCXX=On
# os: linux
# addons: *clang36
# - env: CLANG_VERSION=3.6 BUILD_TYPE=Release CPP=14 ASAN=Off LIBCXX=On
# os: linux
# addons: *clang36
# Test clang-3.7: C++11/C++14, Buidd=Debug/Release, ASAN=On/Off
- env: CLANG_VERSION=3.7 BUILD_TYPE=Debug CPP=11 ASAN=On LIBCXX=On
os: linux
addons: &clang37
apt:
packages:
- clang-3.7
- valgrind
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise
# - env: CLANG_VERSION=3.7 BUILD_TYPE=Release CPP=11 ASAN=On LIBCXX=On
# os: linux
# addons: *clang37
# - env: CLANG_VERSION=3.7 BUILD_TYPE=Debug CPP=14 ASAN=On LIBCXX=On
# os: linux
# addons: *clang37
# - env: CLANG_VERSION=3.7 BUILD_TYPE=Release CPP=14 ASAN=On LIBCXX=On
# os: linux
# addons: *clang37
# - env: CLANG_VERSION=3.7 BUILD_TYPE=Debug CPP=11 ASAN=Off LIBCXX=On
# os: linux
# addons: *clang37
# - env: CLANG_VERSION=3.7 BUILD_TYPE=Release CPP=11 ASAN=Off LIBCXX=On
# os: linux
# addons: *clang37
# - env: CLANG_VERSION=3.7 BUILD_TYPE=Debug CPP=14 ASAN=Off LIBCXX=On
# os: linux
# addons: *clang37
# - env: CLANG_VERSION=3.7 BUILD_TYPE=Release CPP=14 ASAN=Off LIBCXX=On
# os: linux
# addons: *clang37
# Test gcc-4.9: C++11, Build=Debug/Release, ASAN=Off
# - env: GCC_VERSION=4.9 BUILD_TYPE=Debug CPP=11 ASAN=Off LIBCXX=Off
# os: linux
# addons: &gcc49
# apt:
# packages:
# - g++-4.9
# - valgrind
# sources:
# - ubuntu-toolchain-r-test
# - env: GCC_VERSION=4.9 BUILD_TYPE=Release CPP=11 ASAN=Off LIBCXX=Off
# os: linux
# addons: *gcc49
# Test gcc-5.0: C++11/14, Build=Debug/Release, ASAN=Off
# - env: GCC_VERSION=5 BUILD_TYPE=Debug CPP=11 ASAN=Off LIBCXX=Off
# os: linux
# addons: &gcc5
# apt:
# packages:
# - gcc-5
# - valgrind
# sources:
# - ubuntu-toolchain-r-test
# - env: GCC_VERSION=5 BUILD_TYPE=Release CPP=11 ASAN=Off LIBCXX=Off
# os: linux
# addons: *gcc5
# - env: GCC_VERSION=5 BUILD_TYPE=Debug CPP=14 ASAN=Off LIBCXX=Off
# os: linux
# addons: *gcc5
# - env: GCC_VERSION=5 BUILD_TYPE=Release CPP=14 ASAN=Off LIBCXX=Off
# os: linux
# addons: *gcc5
# Install dependencies
before_install:
- export CHECKOUT_PATH=`pwd`;
- if [ -n "$GCC_VERSION" ]; then export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; fi
- if [ -n "$CLANG_VERSION" ]; then export CXX="clang++-${CLANG_VERSION}" CC="clang-${CLANG_VERSION}"; fi
- if [ "$CLANG_VERSION" == "3.4" ]; then export CXX="/usr/local/clang-3.4/bin/clang++" CC="/usr/local/clang-3.4/bin/clang"; fi
- which $CXX
- which $CC
- which valgrind
- if [ -n "$CLANG_VERSION" ]; then sudo CXX=$CXX CC=$CC ./install_libcxx.sh; fi
install:
- cd $CHECKOUT_PATH
# Workaround for valgrind bug: https://bugs.kde.org/show_bug.cgi?id=326469.
# It is fixed in valgrind 3.10 so this won't be necessary if someone
# replaces the current valgrind (3.7) with valgrind-3.10
- sed -i 's/march=native/msse4.2/' example/Makefile
- if [ ! -d build ]; then mkdir build; fi
- export CXX_FLAGS=""
- export CXX_LINKER_FLAGS=""
- if [ -z "$BUILD_TYPE" ]; then export BUILD_TYPE=Release; fi
- if [ "$ASAN" == "On"]; then export CXX_FLAGS="${CXX_FLAGS} -fsanitize=address,undefined,integer -fno-omit-frame-pointer -fno-sanitize=unsigned-integer-overflow"; fi
- if [ -n "$CLANG_VERSION" ]; then CXX_FLAGS="${CXX_FLAGS} -D__extern_always_inline=inline"; fi
- if [ "$LIBCXX" == "On" ]; then CXX_FLAGS="${CXX_FLAGS} -stdlib=libc++ -I/usr/include/c++/v1/"; fi
- if [ "$LIBCXX" == "On" ]; then CXX_LINKER_FLAGS="${CXX_FLAGS} -L/usr/lib/ -lc++"; fi
# Build examples
- cd example
- make CXXFLAGS="${CXX_FLAGS} ${CXX_LINKER_FLAGS}" VERBOSE=1
script:
- ./example
- ./bench
- valgrind --trace-children=yes --leak-check=full ./example
- valgrind --trace-children=yes --leak-check=full ./bench
notifications:
email: false

View File

@ -1,6 +1,6 @@
# spdlog # spdlog
Very fast, header only, C++ logging library. Very fast, header only, C++ logging library. [![Build Status](https://travis-ci.org/gabime/spdlog.svg?branch=master)](https://travis-ci.org/gabime/spdlog)
## Install ## Install
Just copy the files to your build tree and use a C++11 compiler Just copy the files to your build tree and use a C++11 compiler
@ -155,4 +155,3 @@ void custom_class_example()
## Documentation ## Documentation
Documentation can be found in the [wiki](https://github.com/gabime/spdlog/wiki/1.-QuickStart) pages. Documentation can be found in the [wiki](https://github.com/gabime/spdlog/wiki/1.-QuickStart) pages.

View File

@ -1,6 +1,7 @@
CXX ?= g++ CXX ?= g++
CXXFLAGS = -march=native -Wall -Wshadow -Wextra -pedantic -std=c++11 -pthread -Wl,--no-as-needed -I../include CXXFLAGS =
CXX_RELEASE_FLAGS = -O3 -flto CXX_FLAGS = -Wall -Wshadow -Wextra -pedantic -std=c++11 -pthread -I../include
CXX_RELEASE_FLAGS = -O3 -march=native
CXX_DEBUG_FLAGS= -g CXX_DEBUG_FLAGS= -g
@ -8,19 +9,17 @@ all: example bench
debug: example-debug bench-debug debug: example-debug bench-debug
example: example.cpp example: example.cpp
$(CXX) example.cpp -o example $(CXXFLAGS) $(CXX_RELEASE_FLAGS) $(CXX) example.cpp -o example $(CXX_FLAGS) $(CXX_RELEASE_FLAGS) $(CXXFLAGS)
bench: bench.cpp bench: bench.cpp
$(CXX) bench.cpp -o bench $(CXXFLAGS) $(CXX_RELEASE_FLAGS) $(CXX) bench.cpp -o bench $(CXX_FLAGS) $(CXX_RELEASE_FLAGS) $(CXXFLAGS)
example-debug: example.cpp example-debug: example.cpp
$(CXX) example.cpp -o example-debug $(CXXFLAGS) $(CXX_DEBUG_FLAGS) $(CXX) example.cpp -o example-debug $(CXX_FLAGS) $(CXX_DEBUG_FLAGS) $(CXXFLAGS)
bench-debug: bench.cpp bench-debug: bench.cpp
$(CXX) bench.cpp -o bench-debug $(CXXFLAGS) $(CXX_DEBUG_FLAGS) $(CXX) bench.cpp -o bench-debug $(CXX_FLAGS) $(CXX_DEBUG_FLAGS) $(CXXFLAGS)
clean: clean:
rm -f *.o logs/*.txt example example-debug bench bench-debug rm -f *.o logs/*.txt example example-debug bench bench-debug
@ -28,5 +27,3 @@ clean:
rebuild: clean all rebuild: clean all
rebuild-debug: clean debug rebuild-debug: clean debug

12
install_libcxx.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
#
# Install libc++ under travis
svn --quiet co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx
mkdir libcxx/build
(cd libcxx/build && cmake .. -DLIBCXX_CXX_ABI=libstdc++ -DLIBCXX_CXX_ABI_INCLUDE_PATHS="/usr/include/c++/4.6;/usr/include/c++/4.6/x86_64-linux-gnu")
make -C libcxx/build cxx -j2
sudo cp libcxx/build/lib/libc++.so.1.0 /usr/lib/
sudo cp -r libcxx/build/include/c++/v1 /usr/include/c++/v1/
sudo ln -sf /usr/lib/libc++.so.1.0 /usr/lib/libc++.so
sudo ln -sf /usr/lib/libc++.so.1.0 /usr/lib/libc++.so.1