From cc9d03297177eb8504c7353db673b9dc6f64ea07 Mon Sep 17 00:00:00 2001 From: Michael Grunder Date: Thu, 2 Apr 2020 22:41:34 -0700 Subject: Win32 tests and timeout fix (#776) Unit tests in Windows and a Windows timeout fix This commit gets our unit tests compiling and running on Windows as well as removes a duplicated `timeval` -> `DWORD` conversion logic in sockcompat.c There are minor differences in behavior between Linux and Windows to note: 1. In Windows, opening a non-existent hangs forever in WSAPoll whereas it correctly returns with a "Connection refused" error on Linux. For that reason, I simply skip this test in Windows. It may be related to this known issue: https://daniel.haxx.se/blog/2012/10/10/wsapoll-is-broken/ 2. Timeouts are handled slightly differently in Windows and Linux. In Linux, we intentionally set REDIS_ERR_IO for connection timeouts whereas in Windows we set REDIS_ERR_TIMEOUT. It may be prudent to fix this discrepancy although there are almost certainly users relying on the current behavior. --- .travis.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 7e20794..727d112 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ language: c -sudo: false compiler: - gcc - clang @@ -62,9 +61,9 @@ script: - mkdir build/ && cd build/ - cmake .. ${EXTRA_CMAKE_OPTS} - make VERBOSE=1 - - ctest -V + - SKIPS_AS_FAILS=1 ctest -V -matrix: +jobs: include: # Windows MinGW cross compile on Linux - os: linux @@ -90,8 +89,12 @@ matrix: - eval "${MATRIX_EVAL}" install: - choco install ninja + - choco install redis-64 -y + before_script: + - redis-server --service-install --service-name Redis --port 6379 + - redis-server --service-start script: - mkdir build && cd build - cmd.exe //C 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat' amd64 '&&' cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release '&&' ninja -v - - ctest -V + - ./hiredis-test.exe -- cgit v1.2.3