Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
feat(travis): run tests on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nurupo committed Oct 25, 2017
1 parent 319d871 commit 21af687
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,14 @@ if(${USE_FILTERAUDIO})
endif()
endif()

if (MINGW)
STRING(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
if (CMAKE_BUILD_TYPE_LOWER MATCHES debug)
# Allows wine to display source code file names and line numbers on crash in its backtrace
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gdwarf-2")
endif()
endif()

# the compiler flags for compiling C sources
MESSAGE( STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS} )

Expand Down
2 changes: 1 addition & 1 deletion cmake/Testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function(auto_test subsystem module)
Qt5::Test)
add_test(
NAME test_${module}
COMMAND test_${module})
COMMAND ${TEST_CROSSCOMPILING_EMULATOR} test_${module})
endfunction()

auto_test(core toxpk)
Expand Down
45 changes: 41 additions & 4 deletions windows/cross-compile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ then
exit 1
fi

if [ "$(id -u)" != "0" ]
if [[ "$(id -u)" != "0" ]]
then
echo "Error: This script must be run as root."
exit 1
Expand Down Expand Up @@ -142,6 +142,17 @@ then
fi


# Install wine to run qTox tests in
set +u
if [[ "$TRAVIS_CI_STAGE" == "stage3" ]]
then
dpkg --add-architecture i386
apt-get update
apt-get install -y wine wine32 wine64
fi
set -u


# Create the expected directory structure

# Just make sure those exist
Expand Down Expand Up @@ -275,7 +286,7 @@ then
# which happens when building Qt
CONFIGURE_EXTRA=""
set +u
if [ "$TRAVIS_CI_STAGE" == "stage1" ]
if [[ "$TRAVIS_CI_STAGE" == "stage1" ]]
then
CONFIGURE_EXTRA="-silent"
fi
Expand Down Expand Up @@ -355,7 +366,7 @@ fi

# Stop here if running the first stage on Travis CI
set +u
if [ "$TRAVIS_CI_STAGE" == "stage1" ]
if [[ "$TRAVIS_CI_STAGE" == "stage1" ]]
then
# Strip to reduce cache size
strip_all
Expand Down Expand Up @@ -957,7 +968,7 @@ fi

# Stop here if running the second stage on Travis CI
set +u
if [ "$TRAVIS_CI_STAGE" == "stage2" ]
if [[ "$TRAVIS_CI_STAGE" == "stage2" ]]
then
# Strip to reduce cache size
strip_all
Expand Down Expand Up @@ -1008,6 +1019,13 @@ echo "
SET(CMAKE_FIND_ROOT_PATH /usr/$ARCH-w64-mingw32 $CMAKE_FIND_ROOT_PATH)
" > toolchain.cmake

set +u
if [[ "$TRAVIS_CI_STAGE" == "stage3" ]]
then
echo "SET(TEST_CROSSCOMPILING_EMULATOR /usr/bin/wine)" >> toolchain.cmake
fi
set -u

if [[ "$BUILD_TYPE" == "release" ]]
then
cmake -DCMAKE_TOOLCHAIN_FILE=./toolchain.cmake \
Expand Down Expand Up @@ -1042,6 +1060,25 @@ cp /usr/lib/gcc/$ARCH-w64-mingw32/*-posix/libgcc_s_*.dll $QTOX_PREFIX_DIR
cp /usr/lib/gcc/$ARCH-w64-mingw32/*-posix/libstdc++-6.dll $QTOX_PREFIX_DIR
cp /usr/$ARCH-w64-mingw32/lib/libwinpthread-1.dll $QTOX_PREFIX_DIR

set +u
if [[ "$TRAVIS_CI_STAGE" == "stage3" ]]
then
# Setup wine
if [[ "$ARCH" == "i686" ]]
then
export WINEARCH=win32
elif [[ "$ARCH" == "x86_64" ]]
then
export WINEARCH=win64
fi
winecfg
# Add libgcc_s_*.dll, libwinpthread-1.dll, QtTest.dll, etc. into PATH env var of wine
export WINEPATH=`cd $QTOX_PREFIX_DIR ; winepath -w $(pwd)`\;`winepath -w $QT_PREFIX_DIR/bin/`
export CTEST_OUTPUT_ON_FAILURE=1
make test
fi
set -u

cd ..

# Setup gdb
Expand Down

0 comments on commit 21af687

Please sign in to comment.