mirror of
https://github.com/google/benchmark.git
synced 2024-12-26 12:30:14 +08:00
e63fb4961d
This patch begins a set of changes to convert the library to use JSON as the primary data type used to communicate with users; but for custom user input and output. The patch introduces the json.hpp header which is supplied by https://github.com/nlohmann/json. The header is used unmodified in the third_party directory. It is installed under the include/benchmark prefix. Additionally, this patch adds `Benchmark::WithInput` to allow the passing of arbitrary JSON as an input argument to a benchmark. The results of which can be accessed using `State::GetInput()`. This patch also adds `State::operator[](std::string)`, which allows users to report arbitrary JSON as output from a benchmark. See the documentation for examples.
206 lines
5.9 KiB
YAML
206 lines
5.9 KiB
YAML
sudo: required
|
|
dist: trusty
|
|
language: cpp
|
|
|
|
env:
|
|
global:
|
|
- /usr/local/bin:$PATH
|
|
|
|
matrix:
|
|
include:
|
|
- compiler: gcc
|
|
addons:
|
|
apt:
|
|
sources:
|
|
ubuntu-toolchain-r-test
|
|
packages:
|
|
- lcov
|
|
- g++-4.9
|
|
env: COMPILER=g++-4.9 C_COMPILER=gcc-4.9 BUILD_TYPE=Coverage
|
|
- compiler: gcc
|
|
addons:
|
|
apt:
|
|
sources:
|
|
ubuntu-toolchain-r-test
|
|
packages:
|
|
- g++-4.9
|
|
env: COMPILER=g++-4.9 C_COMPILER=gcc-4.9 BUILD_TYPE=Debug
|
|
- compiler: gcc
|
|
addons:
|
|
apt:
|
|
sources:
|
|
ubuntu-toolchain-r-test
|
|
packages:
|
|
- g++-4.9
|
|
env: COMPILER=g++-4.9 C_COMPILER=gcc-4.9 BUILD_TYPE=Release
|
|
- compiler: gcc
|
|
addons:
|
|
apt:
|
|
sources:
|
|
ubuntu-toolchain-r-test
|
|
packages:
|
|
- g++-4.9
|
|
- gcc-4.9-multilib
|
|
- g++-4.9-multilib
|
|
- gcc-multilib
|
|
env: COMPILER=g++-4.9 C_COMPILER=gcc-4.9 BUILD_TYPE=Debug BUILD_32_BITS=ON
|
|
- compiler: gcc
|
|
addons:
|
|
apt:
|
|
sources:
|
|
ubuntu-toolchain-r-test
|
|
packages:
|
|
- g++-4.9
|
|
- gcc-4.9-multilib
|
|
- g++-4.9-multilib
|
|
- gcc-multilib
|
|
env: COMPILER=g++-4.9 C_COMPILER=gcc-4.9 BUILD_TYPE=Release BUILD_32_BITS=ON
|
|
- compiler: gcc
|
|
addons:
|
|
apt:
|
|
sources:
|
|
- ubuntu-toolchain-r-test
|
|
packages:
|
|
- g++-6
|
|
env:
|
|
- COMPILER=g++-6 C_COMPILER=gcc-6 BUILD_TYPE=Debug
|
|
- EXTRA_FLAGS="-fno-omit-frame-pointer -g -O2 -fsanitize=undefined,address -fuse-ld=gold"
|
|
- compiler: clang
|
|
addons:
|
|
apt:
|
|
sources:
|
|
ubuntu-toolchain-r-test
|
|
packages:
|
|
- g++-4.9
|
|
env: COMPILER=clang++ C_COMPILER=clang BUILD_TYPE=Debug
|
|
- compiler: clang
|
|
addons:
|
|
apt:
|
|
sources:
|
|
ubuntu-toolchain-r-test
|
|
packages:
|
|
- g++-4.9
|
|
env: COMPILER=clang++ C_COMPILER=clang BUILD_TYPE=Release
|
|
# Clang w/ libc++
|
|
- compiler: clang
|
|
addons:
|
|
apt:
|
|
packages:
|
|
clang-3.8
|
|
env:
|
|
- COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug
|
|
- LIBCXX_BUILD=1
|
|
- EXTRA_FLAGS="-stdlib=libc++"
|
|
- compiler: clang
|
|
addons:
|
|
apt:
|
|
packages:
|
|
clang-3.8
|
|
env:
|
|
- COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Release
|
|
- LIBCXX_BUILD=1
|
|
- EXTRA_FLAGS="-stdlib=libc++"
|
|
# Clang w/ 32bit libc++
|
|
- compiler: clang
|
|
addons:
|
|
apt:
|
|
packages:
|
|
- clang-3.8
|
|
- g++-multilib
|
|
env:
|
|
- COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug
|
|
- LIBCXX_BUILD=1
|
|
- BUILD_32_BITS=ON
|
|
- EXTRA_FLAGS="-stdlib=libc++ -m32"
|
|
# Clang w/ 32bit libc++
|
|
- compiler: clang
|
|
addons:
|
|
apt:
|
|
packages:
|
|
- clang-3.8
|
|
- g++-multilib
|
|
env:
|
|
- COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Release
|
|
- LIBCXX_BUILD=1
|
|
- BUILD_32_BITS=ON
|
|
- EXTRA_FLAGS="-stdlib=libc++ -m32"
|
|
# Clang w/ libc++, ASAN, UBSAN
|
|
- compiler: clang
|
|
addons:
|
|
apt:
|
|
packages:
|
|
clang-3.8
|
|
env:
|
|
- COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug
|
|
- LIBCXX_BUILD=1 LIBCXX_SANITIZER="Undefined;Address"
|
|
- EXTRA_FLAGS="-stdlib=libc++ -g -O2 -fno-omit-frame-pointer -fsanitize=undefined,address -fno-sanitize-recover=all"
|
|
- UBSAN_OPTIONS=print_stacktrace=1
|
|
# Clang w/ libc++ and MSAN
|
|
- compiler: clang
|
|
addons:
|
|
apt:
|
|
packages:
|
|
clang-3.8
|
|
env:
|
|
- COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug
|
|
- LIBCXX_BUILD=1 LIBCXX_SANITIZER=MemoryWithOrigins
|
|
- EXTRA_FLAGS="-stdlib=libc++ -g -O2 -fno-omit-frame-pointer -fsanitize=memory -fsanitize-memory-track-origins"
|
|
# Clang w/ libc++ and MSAN
|
|
- compiler: clang
|
|
addons:
|
|
apt:
|
|
packages:
|
|
clang-3.8
|
|
env:
|
|
- COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=RelWithDebInfo
|
|
- LIBCXX_BUILD=1 LIBCXX_SANITIZER=Thread
|
|
- EXTRA_FLAGS="-stdlib=libc++ -g -O2 -fno-omit-frame-pointer -fsanitize=thread -fno-sanitize-recover=all"
|
|
|
|
- os: osx
|
|
osx_image: xcode8.3
|
|
compiler: clang
|
|
env:
|
|
- COMPILER=clang++ C_COMPILER=clang BUILD_TYPE=Debug
|
|
- os: osx
|
|
osx_image: xcode8.3
|
|
compiler: clang
|
|
env:
|
|
- COMPILER=clang++ C_COMPILER=clang BUILD_TYPE=Release
|
|
- os: osx
|
|
osx_image: xcode8.3
|
|
compiler: gcc
|
|
env:
|
|
- COMPILER=g++-7 C_COMPILER=gcc-7 BUILD_TYPE=Debug
|
|
|
|
before_script:
|
|
- if [ -z "$BUILD_32_BITS" ]; then
|
|
export BUILD_32_BITS=OFF && echo disabling 32 bit build;
|
|
fi
|
|
- if [ -n "${LIBCXX_BUILD}" ]; then
|
|
source .travis-libcxx-setup.sh;
|
|
fi
|
|
- mkdir -p build && cd build
|
|
|
|
install:
|
|
- if [ "${BUILD_TYPE}" == "Coverage" -a "${TRAVIS_OS_NAME}" == "linux" ]; then
|
|
PATH=~/.local/bin:${PATH};
|
|
pip install --user --upgrade pip;
|
|
pip install --user cpp-coveralls;
|
|
fi
|
|
- if [ "${C_COMPILER}" == "gcc-7" -a "${TRAVIS_OS_NAME}" == "osx" ]; then
|
|
rm -f /usr/local/include/c++;
|
|
brew update;
|
|
brew install gcc@7;
|
|
fi
|
|
|
|
script:
|
|
- export CC=${C_COMPILER} CXX=${COMPILER}
|
|
- cmake -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="${EXTRA_FLAGS}" -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON -DBENCHMARK_BUILD_32_BITS=${BUILD_32_BITS} ..
|
|
- make
|
|
- ctest -C ${BUILD_TYPE} --output-on-failure
|
|
|
|
after_success:
|
|
- if [ "${BUILD_TYPE}" == "Coverage" -a "${TRAVIS_OS_NAME}" == "linux" ]; then
|
|
coveralls --include src --include include --gcov-options '\-lp' --root .. --build-root .;
|
|
fi
|