libcryfs/.travisci/build_and_test.sh

63 lines
1.7 KiB
Bash
Raw Normal View History

2018-02-18 03:54:22 +01:00
#!/bin/bash
set -ev
# Use new clang on linux
if [ "${TRAVIS_OS_NAME}" == "linux" ] && [ "$CXX" == "clang++" ]; then
echo Switch to Clang 3.7
export CXX="clang++-3.7" CC="clang-3.7"
else
echo Do not switch to Clang 3.7 because we are either not Linux or not Clang.
fi
# If using gcc on mac, actually use it ("gcc" just links to clang, but "gcc-4.8" is gcc, https://github.com/travis-ci/travis-ci/issues/2423)
# Note: This must be here and not in install.sh, because environment variables can't be passed between scripts.
if [ "${TRAVIS_OS_NAME}" == "osx" ] && [ "${CXX}" == "g++" ]; then
echo Switch to actual g++ and not just the AppleClang symlink
export CXX="g++-7" CC="gcc-7"
else
echo Do not switch to actual g++ because we are either not osx or not g++
fi
# Setup ccache
export PATH="/usr/local/opt/ccache/libexec:$PATH"
export CCACHE_COMPILERCHECK=content
export CCACHE_COMPRESS=1
export CCACHE_SLOPPINESS=include_file_mtime
ccache --max-size=512M
ccache --show-stats
2018-02-18 03:54:22 +01:00
# Detect number of CPU cores
export NUMCORES=`grep -c ^processor /proc/cpuinfo`
if [ ! -n "$NUMCORES" ]; then
export NUMCORES=`sysctl -n hw.ncpu`
fi
echo Using $NUMCORES cores
echo Using CXX compiler $CXX and C compiler $CC
2018-02-18 03:54:22 +01:00
# Setup target directory
mkdir cmake
cd cmake
cmake --version
# Build
cmake .. -DBUILD_TESTING=on -DCMAKE_BUILD_TYPE=Debug
make -j$NUMCORES
ccache --show-stats
2018-02-18 03:54:22 +01:00
# Test
./test/gitversion/gitversion-test
./test/cpp-utils/cpp-utils-test
./test/parallelaccessstore/parallelaccessstore-test
./test/blockstore/blockstore-test
./test/blobstore/blobstore-test
2018-05-28 04:47:32 +02:00
./test/cryfs/cryfs-test
2018-02-18 03:54:22 +01:00
# TODO Also run on osx once fixed
if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
./test/fspp/fspp-test
./test/cryfs-cli/cryfs-cli-test
fi