aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2018-06-27 13:19:21 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-06-27 21:23:12 +0200
commitcd3170fcb174954eb28629cad8667f8de45963a3 (patch)
tree0662719230074a9b5f4889c57d1513e590a9d568
parent9eaf55898e949f9e4812f251fdeab3f2e618047c (diff)
downloadlibssh-cd3170fcb174954eb28629cad8667f8de45963a3.tar.gz
libssh-cd3170fcb174954eb28629cad8667f8de45963a3.tar.xz
libssh-cd3170fcb174954eb28629cad8667f8de45963a3.zip
gitlab: Use wine to run tests built for Windows
When building in a cross-compiling environment, use wine to run the tests. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--.gitlab-ci.yml14
-rw-r--r--cmake/Modules/AddCMockaTest.cmake10
2 files changed, 19 insertions, 5 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index db037e6f..a2872bde 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -217,10 +217,13 @@ tumbleweed/static-analysis:
mingw64:
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$MINGW_BUILD
script:
+ - Xvfb :1 -screen 0 1024x768x16 -ac +extension GLX +render -noreset -nolisten tcp &
+ - export DISPLAY=:1
- mkdir -p obj && cd obj && mingw64-cmake -DCMAKE_BUILD_TYPE=Debug
-DWITH_SSH1=ON -DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON
- -DWITH_PCAP=ON -DWITH_TESTING=ON .. && make -j$(nproc) &&
- ctest --output-on-failure
+ -DWITH_PCAP=ON -DWITH_TESTING=ON .. && make -j$(nproc)
+ - export WINEPATH=/usr/x86_64-w64-mingw32/sys-root/mingw/bin
+ - ctest --output-on-failure
tags:
- shared
except:
@@ -236,10 +239,13 @@ mingw64:
mingw32:
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$MINGW_BUILD
script:
+ - Xvfb :1 -screen 0 1024x768x16 -ac +extension GLX +render -noreset -nolisten tcp &
+ - export DISPLAY=:1
- mkdir -p obj && cd obj && mingw32-cmake -DCMAKE_BUILD_TYPE=Debug
-DWITH_SSH1=ON -DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON
- -DWITH_PCAP=ON -DWITH_TESTING=ON .. && make -j$(nproc) &&
- ctest --output-on-failure
+ -DWITH_PCAP=ON -DWITH_TESTING=ON .. && make -j$(nproc)
+ - export WINEPATH=/usr/i686-w64-mingw32/sys-root/mingw/bin
+ - ctest --output-on-failure
tags:
- shared
except:
diff --git a/cmake/Modules/AddCMockaTest.cmake b/cmake/Modules/AddCMockaTest.cmake
index 77325eeb..75318137 100644
--- a/cmake/Modules/AddCMockaTest.cmake
+++ b/cmake/Modules/AddCMockaTest.cmake
@@ -23,8 +23,16 @@ if(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
set(CMAKE_EXEC_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address" CACHE STRING "Address sanitizer executable linker flags")
endif(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
+if (CMAKE_CROSSCOMPILING)
+ if (WIN32)
+ find_program(WINE_EXECUTABLE
+ NAMES wine)
+ set(TARGET_SYSTEM_EMULATOR ${WINE_EXECUTABLE})
+ endif()
+endif()
+
function (ADD_CMOCKA_TEST _testName _testSource)
add_executable(${_testName} ${_testSource})
target_link_libraries(${_testName} ${ARGN})
- add_test(${_testName} ${CMAKE_CURRENT_BINARY_DIR}/${_testName}${CMAKE_EXECUTABLE_SUFFIX})
+ add_test(${_testName} ${TARGET_SYSTEM_EMULATOR} ${CMAKE_CURRENT_BINARY_DIR}/${_testName}${CMAKE_EXECUTABLE_SUFFIX})
endfunction (ADD_CMOCKA_TEST)