From e59fd26d4987050e474a6de27dd503f32cc7820a Mon Sep 17 00:00:00 2001 From: iphydf Date: Wed, 24 Aug 2016 23:52:34 +0100 Subject: [PATCH] Add OSX and Windows build to travis config. Tests for Windows are disabled for now, until we figure out which tests can successfully run on wine and select only those. --- .travis.yml | 15 ++++++++++++--- CMakeLists.txt | 5 +++++ other/travis/env-linux.sh | 5 ++++- other/travis/env-osx.sh | 13 +++++++++++++ other/travis/env-windows.sh | 28 ++++++++++++++++++++++++++++ other/travis/toxcore-after_failure | 7 +++++++ other/travis/toxcore-osx-install | 3 +++ other/travis/toxcore-script | 8 +++----- other/travis/toxcore-windows-install | 7 +++++++ 9 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 other/travis/env-osx.sh create mode 100644 other/travis/env-windows.sh create mode 100755 other/travis/toxcore-after_failure create mode 100755 other/travis/toxcore-osx-install create mode 100755 other/travis/toxcore-windows-install diff --git a/.travis.yml b/.travis.yml index cfa9240d..50bedc8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,14 @@ matrix: compiler: gcc - env: JOB=toxcore ENV=linux compiler: clang + - env: JOB=toxcore ENV=osx + os: osx + - env: JOB=toxcore ENV=windows ARCH=i686 + services: + - docker + - env: JOB=toxcore ENV=windows ARCH=x86_64 + services: + - docker addons: apt: @@ -36,9 +44,10 @@ cache: - $HOME/.ghc - $HOME/cache -install: other/travis/phase $JOB $ENV install -script: other/travis/phase $JOB $ENV script -after_script: other/travis/phase $JOB $ENV after_script +install: other/travis/phase $JOB $ENV install +script: other/travis/phase $JOB $ENV script +after_script: other/travis/phase $JOB $ENV after_script +after_failure: other/travis/phase $JOB $ENV after_failure notifications: irc: "chat.freenode.net#toktok-status" diff --git a/CMakeLists.txt b/CMakeLists.txt index 399b2a07..aa889ce1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -402,6 +402,11 @@ function(make_version_script header ns lib) endfunction() option(STRICT_ABI "Enforce strict ABI export in dynamic libraries" OFF) +if(WIN32 OR APPLE) + # Windows and OSX don't have this linker functionality. + set(STRICT_ABI OFF) +endif() + if(STRICT_ABI) if(BUILD_TOXAV) make_version_script(${CMAKE_SOURCE_DIR}/toxav/toxav.h toxav toxav) diff --git a/other/travis/env-linux.sh b/other/travis/env-linux.sh index 0eb5e9ea..2544ee56 100644 --- a/other/travis/env-linux.sh +++ b/other/travis/env-linux.sh @@ -3,8 +3,11 @@ CMAKE=cmake NPROC=`nproc` CURDIR=$PWD -TESTS=true RUN() { "$@" } + +TESTS() { + "$@" +} diff --git a/other/travis/env-osx.sh b/other/travis/env-osx.sh new file mode 100644 index 00000000..e45c34a7 --- /dev/null +++ b/other/travis/env-osx.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +CMAKE=cmake +NPROC=`sysctl -n hw.ncpu` +CURDIR=$PWD + +RUN() { + "$@" +} + +TESTS() { + "$@" +} diff --git a/other/travis/env-windows.sh b/other/travis/env-windows.sh new file mode 100644 index 00000000..d7eecada --- /dev/null +++ b/other/travis/env-windows.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +CMAKE=$ARCH-w64-mingw32.shared-cmake +NPROC=`nproc` +CURDIR=/work + +RUN() { + ./dockcross "$@" +} + +ENABLE_WINDOWS_TESTS=false + +TESTS() { + # Download Microsoft DLLs. + curl http://www.dlldump.com/dllfiles/I/iphlpapi.dll -o _build/iphlpapi.dll + curl http://www.dlldump.com/dllfiles/W/ws2_32.dll -o _build/ws2_32.dll + + # Copy our dependency DLLs. + ./dockcross sh -c 'cp $WINEDLLPATH/*.dll _build' + + # Run tests in docker. + if $ENABLE_WINDOWS_TESTS; then + ./dockcross "$@" || { + cat _build/Testing/Temporary/LastTest.log + false + } + fi +} diff --git a/other/travis/toxcore-after_failure b/other/travis/toxcore-after_failure new file mode 100755 index 00000000..e1f5c399 --- /dev/null +++ b/other/travis/toxcore-after_failure @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ -d /cores ]; then + for core in /cores/*; do + lldb --core $core --one-line "bt all" < /dev/null + done +fi diff --git a/other/travis/toxcore-osx-install b/other/travis/toxcore-osx-install new file mode 100755 index 00000000..4b777340 --- /dev/null +++ b/other/travis/toxcore-osx-install @@ -0,0 +1,3 @@ +#!/bin/sh + +brew install libsodium libvpx opus libconfig check astyle diff --git a/other/travis/toxcore-script b/other/travis/toxcore-script index 96193855..b1e60763 100755 --- a/other/travis/toxcore-script +++ b/other/travis/toxcore-script @@ -8,9 +8,7 @@ export CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" # so it's disabled on Travis. RUN $CMAKE -B$BUILD_DIR -H. -DCMAKE_INSTALL_PREFIX:PATH=$CURDIR/_install -DDEBUG=ON -DASSOC_DHT=ON -DSTRICT_ABI=ON #-DASAN=ON -RUN make -C $BUILD_DIR -j$NPROC -k install +export CTEST_OUTPUT_ON_FAILURE=1 -if $TESTS; then - export CTEST_OUTPUT_ON_FAILURE=1 - RUN make -C $BUILD_DIR -j$NPROC test -fi +RUN make -C$BUILD_DIR -j$NPROC -k install +TESTS make -C$BUILD_DIR -j$NPROC test diff --git a/other/travis/toxcore-windows-install b/other/travis/toxcore-windows-install new file mode 100755 index 00000000..6160856b --- /dev/null +++ b/other/travis/toxcore-windows-install @@ -0,0 +1,7 @@ +#!/bin/sh + +DOCKER_IMAGE=toktoknet/windows:latest.$ARCH-shared + +docker pull $DOCKER_IMAGE +docker run --rm $DOCKER_IMAGE > dockcross +chmod +x dockcross