diff options
author | Michael Grunder <michael.grunder@gmail.com> | 2020-04-02 22:41:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-02 22:41:34 -0700 |
commit | cc9d03297177eb8504c7353db673b9dc6f64ea07 (patch) | |
tree | ae3711309b9f25b40611f125b029314bff1c7b70 /test.sh | |
parent | ec18d790f165da1b2e7528828518a3034aa74b9c (diff) |
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.
Diffstat (limited to 'test.sh')
-rwxr-xr-x | test.sh | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -4,7 +4,9 @@ REDIS_SERVER=${REDIS_SERVER:-redis-server} REDIS_PORT=${REDIS_PORT:-56379} REDIS_SSL_PORT=${REDIS_SSL_PORT:-56443} TEST_SSL=${TEST_SSL:-0} +SKIPS_AS_FAILS=${SKIPS_AS_FAILS-:0} SSL_TEST_ARGS= +SKIPS_ARG= tmpdir=$(mktemp -d) PID_FILE=${tmpdir}/hiredis-test-redis.pid @@ -67,4 +69,10 @@ fi cat ${tmpdir}/redis.conf ${REDIS_SERVER} ${tmpdir}/redis.conf -${TEST_PREFIX:-} ./hiredis-test -h 127.0.0.1 -p ${REDIS_PORT} -s ${SOCK_FILE} ${SSL_TEST_ARGS} +# Wait until we detect the unix socket +while [ ! -S "${SOCK_FILE}" ]; do sleep 1; done + +# Treat skips as failures if directed +[ "$SKIPS_AS_FAILS" = 1 ] && SKIPS_ARG="--skips-as-fails" + +${TEST_PREFIX:-} ./hiredis-test -h 127.0.0.1 -p ${REDIS_PORT} -s ${SOCK_FILE} ${SSL_TEST_ARGS} ${SKIPS_ARG} |