From fc71242e259105afd94a2a333fdf514b14393d74 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sat, 17 Feb 2018 18:54:22 -0800 Subject: [PATCH] Fix Travis CI build --- .travis.yml | 32 ++---------------- .travisci/build_and_test.sh | 33 +++++++++++++++++++ .travisci/install.sh | 31 +++++++++++++++++ .../install_boost.sh | 0 src/cryfs/CryfsException.h | 1 + .../EncryptedBlockStoreTest_Specific.cpp | 2 +- .../IntegrityBlockStoreTest_Specific.cpp | 2 +- 7 files changed, 69 insertions(+), 32 deletions(-) create mode 100755 .travisci/build_and_test.sh create mode 100755 .travisci/install.sh rename travis.install_boost.sh => .travisci/install_boost.sh (100%) diff --git a/.travis.yml b/.travis.yml index dd895ec5..03aa961c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,34 +18,6 @@ addons: - libcrypto++-dev - libfuse-dev install: -# Use new clang on linux -- if [ "${TRAVIS_OS_NAME}" == "linux" ] && [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; 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) -- if [ "${TRAVIS_OS_NAME}" == "osx" ] && ["${CXX}" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi -# 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 -# Install dependencies -- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then ./travis.install_boost.sh; fi -- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then brew cask install osxfuse && brew install cryptopp; fi -# By default, travis only fetches the newest 50 commits. We need more in case we're further from the last version tag, so the build doesn't fail because it can't generate the version number. -- git fetch --unshallow -# Setup target directory -- mkdir cmake -- cd cmake -- cmake --version -# Use /dev/urandom when /dev/random is accessed, because travis doesn't have enough entropy -- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then sudo cp -a /dev/urandom /dev/random; fi +- .travisci/install.sh script: -- cmake .. -DBUILD_TESTING=on -DCMAKE_BUILD_TYPE=Debug -- make -j$NUMCORES -- ./test/gitversion/gitversion-test -- ./test/cpp-utils/cpp-utils-test -# TODO Also run on osx once fixed -- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then ./test/fspp/fspp-test || exit 1; fi -- ./test/parallelaccessstore/parallelaccessstore-test -- ./test/blockstore/blockstore-test -- ./test/blobstore/blobstore-test -# TODO Also run on osx once fixed -- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then ./test/cryfs/cryfs-test || exit 1; fi -- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then ./test/cryfs-cli/cryfs-cli-test || exit 1; fi +- .travisci/build_and_test.sh diff --git a/.travisci/build_and_test.sh b/.travisci/build_and_test.sh new file mode 100755 index 00000000..2acccc19 --- /dev/null +++ b/.travisci/build_and_test.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -e + +# 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 + +# Setup target directory +mkdir cmake +cd cmake +cmake --version + +# Build +cmake .. -DBUILD_TESTING=on -DCMAKE_BUILD_TYPE=Debug +make -j$NUMCORES + +# Test +./test/gitversion/gitversion-test +./test/cpp-utils/cpp-utils-test +./test/parallelaccessstore/parallelaccessstore-test +./test/blockstore/blockstore-test +./test/blobstore/blobstore-test + +# TODO Also run on osx once fixed +if [ "${TRAVIS_OS_NAME}" == "linux" ]; then + ./test/fspp/fspp-test + ./test/cryfs/cryfs-test + ./test/cryfs-cli/cryfs-cli-test +fi diff --git a/.travisci/install.sh b/.travisci/install.sh new file mode 100755 index 00000000..f836f1a4 --- /dev/null +++ b/.travisci/install.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -e + +# Use new clang on linux +if [ "${TRAVIS_OS_NAME}" == "linux" ] && [ "$CXX" = "clang++" ]; then + export CXX="clang++-3.7" CC="clang-3.7" +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) +if [ "${TRAVIS_OS_NAME}" == "osx" ] && ["${CXX}" = "g++" ]; then + export CXX="g++-4.8" CC="gcc-4.8" +fi + +# Install dependencies +if [ "${TRAVIS_OS_NAME}" == "linux" ]; then + ./.travisci/install_boost.sh +fi + +if [ "${TRAVIS_OS_NAME}" == "osx" ]; then + brew cask install osxfuse + brew install cryptopp +fi + +# By default, travis only fetches the newest 50 commits. We need more in case we're further from the last version tag, so the build doesn't fail because it can't generate the version number. +git fetch --unshallow + +# Use /dev/urandom when /dev/random is accessed, because travis doesn't have enough entropy +if [ "${TRAVIS_OS_NAME}" == "linux" ]; then + sudo cp -a /dev/urandom /dev/random +fi diff --git a/travis.install_boost.sh b/.travisci/install_boost.sh similarity index 100% rename from travis.install_boost.sh rename to .travisci/install_boost.sh diff --git a/src/cryfs/CryfsException.h b/src/cryfs/CryfsException.h index 24926dd6..d17ad9ab 100644 --- a/src/cryfs/CryfsException.h +++ b/src/cryfs/CryfsException.h @@ -4,6 +4,7 @@ #include "ErrorCodes.h" #include +#include namespace cryfs { diff --git a/test/blockstore/implementations/encrypted/EncryptedBlockStoreTest_Specific.cpp b/test/blockstore/implementations/encrypted/EncryptedBlockStoreTest_Specific.cpp index b38efb57..82099074 100644 --- a/test/blockstore/implementations/encrypted/EncryptedBlockStoreTest_Specific.cpp +++ b/test/blockstore/implementations/encrypted/EncryptedBlockStoreTest_Specific.cpp @@ -47,7 +47,7 @@ public: void ModifyBaseBlock(const blockstore::BlockId &blockId) { auto block = baseBlockStore->load(blockId).value(); - byte* middle_byte = static_cast(block.data()) + 10; + CryptoPP::byte* middle_byte = static_cast(block.data()) + 10; *middle_byte = *middle_byte + 1; baseBlockStore->store(blockId, block); } diff --git a/test/blockstore/implementations/integrity/IntegrityBlockStoreTest_Specific.cpp b/test/blockstore/implementations/integrity/IntegrityBlockStoreTest_Specific.cpp index 677cc4fa..c816fd8e 100644 --- a/test/blockstore/implementations/integrity/IntegrityBlockStoreTest_Specific.cpp +++ b/test/blockstore/implementations/integrity/IntegrityBlockStoreTest_Specific.cpp @@ -68,7 +68,7 @@ public: void modifyBlock(const blockstore::BlockId &blockId) { auto block = blockStore->load(blockId).value(); - byte* first_byte = static_cast(block.data()); + CryptoPP::byte* first_byte = static_cast(block.data()); *first_byte = *first_byte + 1; blockStore->store(blockId, block); }