Merge branch 'appveyor-cmake-v6'

This patch set introduces matrix for appveyor and fixes bugs related to win32,
during debugging this matrix. This should greatly reduce number of work for
making a release ('check under windows' part only).

Right now tests on appveyor still failes in summary, but we should dig into
problems, not hide them.

Test matrix looks like this:
- autotools
- autotools --disable-openssl
- autotools --disable-thread-support
- autotools --disable-debug-mode
- autotools --disable-malloc-replacement
- cmake
- cmake -DEVENT__DISABLE_OPENSSL=ON
- cmake -DEVENT__DISABLE_THREAD_SUPPORT=ON
- cmake -DEVENT__DISABLE_DEBUG_MODE=ON
- cmake -DEVENT__DISABLE_MM_REPLACEMENT=ON
- cmake -DEVENT__ENABLE_VERBOSE_DEBUG=ON
- cmake -DCMAKE_C_FLAGS='-DUNICODE -D_UNICODE'
And takes 90min (was 7min, and this is the sad part).

* appveyor-cmake-v6:
  test/ssl: use send()/recv()/EVUTIL_ERR_RW_RETRIABLE()/EVUTIL_SOCKET_ERROR() to fix win32
  test/https_basic: increase timeout for complete write (fixes win32)
  cmake: check for ZLIB_INCLUDE_DIR, since we can have only library without headers
  autotools/win32: fix searching ssl library
  appveyor/autotools: link with openssl by passing LDFLAGS/CFLAGS
  appveyor: image already had openssl installed
  cmake/win32: do not compile regress_thread on -DEVENT__DISABLE_THREAD_SUPPORT=ON
  cmake/win32: do not compile evthread_win32 on -DEVENT__DISABLE_THREAD_SUPPORT=ON
  appveyor: check -DUNICODE -D_UNICODE according to ReleaseChecklist (cmake only)
  cmake: fix -DEVENT__ENABLE_VERBOSE_DEBUG (typo on -DUSE_DEBUG)
  test: fix building with --disable-thread-support under win32
  cmake: do not use stderr for notifications/version-info
  autoconf: fix --disable-thread-support build under win32
  appveyor: ignore failure of mingw-get
  appveyor: drop shallow_clone, since we use tags for detecting version in cmake
  appveyor: support cmake & autotools using build matrix (like travis-ci has)

Fixes: #364
This commit is contained in:
Azat Khuzhin 2016-08-09 15:49:01 +03:00
commit 00514a2a1e
11 changed files with 92 additions and 58 deletions

View File

@ -143,7 +143,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
if (EVENT__ENABLE_VERBOSE_DEBUG)
add_definitions(-DUSE_DBUG=1)
add_definitions(-DUSE_DEBUG=1)
endif()
# Setup compiler flags for coverage.
@ -702,7 +702,7 @@ if (NOT EVENT__DISABLE_TESTS)
# Zlib is only used for testing.
find_package(ZLIB)
if (ZLIB_LIBRARY)
if (ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)
include_directories(${ZLIB_INCLUDE_DIRS})
set(EVENT__HAVE_ZLIB 1)
@ -730,7 +730,6 @@ if(WIN32)
buffer_iocp.c
bufferevent_async.c
event_iocp.c
evthread_win32.c
win32select.c)
list(APPEND HDR_PRIVATE WIN32-Code/getopt.h)
@ -974,14 +973,16 @@ if (NOT EVENT__DISABLE_TESTS)
if (WIN32)
list(APPEND SRC_REGRESS test/regress_iocp.c)
list(APPEND SRC_REGRESS test/regress_thread.c)
if (NOT EVENT__DISABLE_THREAD_SUPPORT)
list(APPEND SRC_REGRESS test/regress_thread.c)
endif()
endif()
if (CMAKE_USE_PTHREADS_INIT)
list(APPEND SRC_REGRESS test/regress_thread.c)
endif()
if (ZLIB_LIBRARY)
if (ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)
list(APPEND SRC_REGRESS test/regress_zlib.c)
endif()
@ -1406,9 +1407,9 @@ set(LIBEVENT_LIBRARIES
event_extra
CACHE STRING "Libevent libraries")
message("")
message(" ---( Libevent " ${EVENT_VERSION} " )---")
message("")
message(STATUS "")
message(STATUS " ---( Libevent " ${EVENT_VERSION} " )---")
message(STATUS "")
message(STATUS "Available event backends: ${BACKENDS}")
message(STATUS "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR})
message(STATUS "CMAKE_CURRENT_BINARY_DIR: " ${CMAKE_CURRENT_BINARY_DIR})
@ -1430,5 +1431,5 @@ message(STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} )
message(STATUS "CMAKE_C_COMPILER: " ${CMAKE_C_COMPILER} )
message(STATUS "CMAKE_AR: " ${CMAKE_AR} )
message(STATUS "CMAKE_RANLIB: " ${CMAKE_RANLIB} )
message("")
message(STATUS "")

View File

@ -142,10 +142,14 @@ include test/include.am
if BUILD_WIN32
SYS_LIBS = -lws2_32 -lshell32 -ladvapi32
SYS_SRC = win32select.c evthread_win32.c buffer_iocp.c event_iocp.c \
SYS_SRC = win32select.c buffer_iocp.c event_iocp.c \
bufferevent_async.c
SYS_INCLUDES = -IWIN32-Code -IWIN32-Code/nmake
if THREADS
SYS_SRC += evthread_win32.c
endif
else
SYS_LIBS =

View File

@ -1,45 +1,59 @@
version: 2.1.5.{build}
shallow_clone: true
os: Visual Studio 2015 RC
os: Visual Studio 2015
build:
verbosity: detailed
verbosity: detailed
environment:
global:
CYG_ROOT: C:/MinGW/msys/1.0
global:
CYG_ROOT: C:/MinGW/msys/1.0
matrix:
- EVENT_BUILD_METHOD: "autotools"
EVENT_CONFIGURE_OPTIONS: ""
- EVENT_BUILD_METHOD: "autotools"
EVENT_CONFIGURE_OPTIONS: "--disable-openssl"
- EVENT_BUILD_METHOD: "autotools"
EVENT_CONFIGURE_OPTIONS: "--disable-thread-support"
- EVENT_BUILD_METHOD: "autotools"
EVENT_CONFIGURE_OPTIONS: "--disable-debug-mode"
- EVENT_BUILD_METHOD: "autotools"
EVENT_CONFIGURE_OPTIONS: "--disable-malloc-replacement"
- EVENT_BUILD_METHOD: "cmake"
EVENT_CMAKE_OPTIONS: ""
- EVENT_BUILD_METHOD: "cmake"
EVENT_CMAKE_OPTIONS: "-DEVENT__DISABLE_OPENSSL=ON"
- EVENT_BUILD_METHOD: "cmake"
EVENT_CMAKE_OPTIONS: "-DEVENT__DISABLE_THREAD_SUPPORT=ON"
- EVENT_BUILD_METHOD: "cmake"
EVENT_CMAKE_OPTIONS: "-DEVENT__DISABLE_DEBUG_MODE=ON"
- EVENT_BUILD_METHOD: "cmake"
EVENT_CMAKE_OPTIONS: "-DEVENT__DISABLE_MM_REPLACEMENT=ON"
- EVENT_BUILD_METHOD: "cmake"
EVENT_CMAKE_OPTIONS: "-DEVENT__ENABLE_VERBOSE_DEBUG=ON"
- EVENT_BUILD_METHOD: "cmake"
EVENT_CMAKE_OPTIONS: "-DCMAKE_C_FLAGS='-DUNICODE -D_UNICODE'"
init:
- 'echo Building libevent %version% for Windows'
- 'echo System architecture: %PLATFORM%'
- 'echo Repo build branch is: %APPVEYOR_REPO_BRANCH%'
- 'echo Build folder is: %APPVEYOR_BUILD_FOLDER%'
- 'echo Building libevent %version% for Windows'
- 'echo System architecture: %PLATFORM%'
- 'echo Repo build branch is: %APPVEYOR_REPO_BRANCH%'
- 'echo Build folder is: %APPVEYOR_BUILD_FOLDER%'
- 'echo Repo build commit is: %APPVEYOR_REPO_COMMIT%'
- 'echo Cygwin root is: %CYG_ROOT%'
install:
- set PATH=%PATH%;C:\MinGW\msys\1.0\bin;C:\MinGW\bin
- appveyor DownloadFile https://strcpy.net/packages/Win32OpenSSL-1_0_2a.exe
- Win32OpenSSL-1_0_2a.exe /silent /verysilent /sp- /suppressmsgboxes
- C:\MinGW\bin\mingw-get install autotools autoconf automake
build_script:
- cmd: 'echo Cygwin root is: %CYG_ROOT%'
- cmd: 'echo Build folder is: %APPVEYOR_BUILD_FOLDER%'
- cmd: 'echo Repo build branch is: %APPVEYOR_REPO_BRANCH%'
- cmd: 'echo Repo build commit is: %APPVEYOR_REPO_COMMIT%'
- cmd: "echo installing stuff"
- cmd: 'echo "C:\MinGW /mingw" >%CYG_ROOT%/etc/fstab'
- cmd: 'C:\MinGW\bin\mingw-get install autotools autoconf automake python'
- cmd: 'echo Autogen running...'
- cmd: '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null;mount C:/MinGW /mingw; bash -x ./autogen.sh; ./configure; make; make verify"'
#install:
# - appveyor DownloadFile https://strcpy.net/packages/Win32OpenSSL-1_0_2a.exe
# - Win32OpenSSL-1_0_2a.exe /silent /verysilent /sp- /suppressmsgboxes
#build_script:
# - md build
# - cd build
# - cmake ..
# - cmake --build .
# - ctest --output-on-failure
cache:
- C:\OpenSSL-Win32
- ps: |
if ($env:EVENT_BUILD_METHOD -eq 'autotools') {
$env:PATH="$env:CYG_ROOT\bin;C:\MinGW\bin;$($env:PATH)"
bash -lc "echo 'C:\MinGW /mingw' > /etc/fstab"
bash -lc "echo 'C:\OpenSSL-Win32 /ssl' >> /etc/fstab"
$env:APPVEYOR_BUILD_FOLDER = $env:APPVEYOR_BUILD_FOLDER -replace "\\", "/"
bash -lc "exec 0</dev/null; exec 2>&1; cd $env:APPVEYOR_BUILD_FOLDER; bash -x ./autogen.sh && ./configure LDFLAGS='-L/ssl -L/ssl/lib -L/ssl/lib/MinGW' CFLAGS=-I/ssl/include $env:EVENT_CONFIGURE_OPTIONS && make && make verify"
} else {
md build
cd build
cmake .. $env:EVENT_CMAKE_OPTIONS
cmake --build .
ctest --output-on-failure
}

View File

@ -749,6 +749,7 @@ if test x$bwin32 != xtrue && test "$enable_thread_support" != "no"; then
#include <pthread.h> ]
)
fi
AM_CONDITIONAL(THREADS, [test "$enable_thread_support" != "no"])
AM_CONDITIONAL(PTHREADS, [test "$have_pthreads" != "no" && test "$enable_thread_support" != "no"])
# check if we should compile locking into the library
@ -777,7 +778,7 @@ fi
# check if we have and should use openssl
AM_CONDITIONAL(OPENSSL, [test "$enable_openssl" != "no" && test "$have_openssl" = "yes"])
if test "x$enable_openssl" = "xyes"; then
AC_SEARCH_LIBS([ERR_remove_thread_state], [crypto],
AC_SEARCH_LIBS([ERR_remove_thread_state], [crypto eay32],
[AC_DEFINE(HAVE_ERR_REMOVE_THREAD_STATE, 1, [Define to 1 if you have ERR_remove_thread_stat().])])
fi

View File

@ -26,12 +26,17 @@ case "$enable_openssl" in
save_LIBS="$LIBS"
LIBS=""
OPENSSL_LIBS=""
AC_SEARCH_LIBS([SSL_new], [ssl],
[have_openssl=yes
OPENSSL_LIBS="$LIBS -lcrypto $EV_LIB_GDI $EV_LIB_WS32 $OPENSSL_LIBADD"],
[have_openssl=no],
[-lcrypto $EV_LIB_GDI $EV_LIB_WS32 $OPENSSL_LIBADD])
LIBS="$save_LIBS"
for lib in crypto eay32; do
# clear cache
unset ac_cv_search_SSL_new
AC_SEARCH_LIBS([SSL_new], [ssl ssl32],
[have_openssl=yes
OPENSSL_LIBS="$LIBS -l$lib $EV_LIB_GDI $EV_LIB_WS32 $OPENSSL_LIBADD"],
[have_openssl=no],
[-l$lib $EV_LIB_GDI $EV_LIB_WS32 $OPENSSL_LIBADD])
LIBS="$save_LIBS"
test "$have_openssl" = "yes" && break
done
;;
esac
AC_SUBST(OPENSSL_INCS)

View File

@ -138,7 +138,9 @@ main(int argc, char **argv)
#ifdef _WIN32
case 'i':
use_iocp = 1;
#ifdef EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED
evthread_use_windows_threads();
#endif
event_config_set_flag(cfg,EVENT_BASE_FLAG_STARTUP_IOCP);
break;
#endif

View File

@ -101,8 +101,10 @@ regress_thread_SOURCES = test/regress_thread.c
PTHREAD_LIBS += libevent_pthreads.la
endif
if BUILD_WIN32
if THREADS
regress_thread_SOURCES = test/regress_thread.c
endif
endif
if ZLIB_REGRESS
regress_zlib_SOURCES = test/regress_zlib.c
endif

View File

@ -15,7 +15,9 @@ int main (int argc, char **argv)
int i, j;
const char *s1, *s2;
#ifdef EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED
evthread_use_windows_threads ();
#endif
s1 = evutil_socket_error_to_string (WSAEINTR);

View File

@ -478,7 +478,7 @@ http_basic_test_impl(void *arg, int ssl)
bufferevent_write(bev, http_request, strlen(http_request));
evutil_timerclear(&tv);
tv.tv_usec = 10000;
tv.tv_usec = 100000;
event_base_once(data->base,
-1, EV_TIMEOUT, http_complete_write, bev, &tv);

View File

@ -46,6 +46,7 @@
#include "event2/bufferevent_struct.h"
#include "event2/buffer.h"
#include "event2/listener.h"
#include "util-internal.h"
#include "regress.h"
#include "tinytest.h"
@ -555,9 +556,9 @@ static int
bio_rwcount_read(BIO *b, char *out, int outlen)
{
struct rwcount *rw = b->ptr;
ev_ssize_t ret = read(rw->fd, out, outlen);
ev_ssize_t ret = recv(rw->fd, out, outlen, 0);
++rw->read;
if (ret == -1 && errno == EAGAIN) {
if (ret == -1 && EVUTIL_ERR_RW_RETRIABLE(EVUTIL_SOCKET_ERROR())) {
BIO_set_retry_read(b);
}
return ret;
@ -567,9 +568,9 @@ bio_rwcount_write(BIO *b, const char *in, int inlen)
{
struct rwcount *rw = b->ptr;
ev_ssize_t ret = write(rw->fd, in, inlen);
ev_ssize_t ret = send(rw->fd, in, inlen, 0);
++rw->write;
if (ret == -1 && errno == EAGAIN) {
if (ret == -1 && EVUTIL_ERR_RW_RETRIABLE(EVUTIL_SOCKET_ERROR())) {
BIO_set_retry_write(b);
}
return ret;

View File

@ -279,7 +279,9 @@ test_ratelimiting(void)
#ifdef _WIN32
if (cfg_enable_iocp) {
#ifdef EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED
evthread_use_windows_threads();
#endif
event_config_set_flag(base_cfg, EVENT_BASE_FLAG_STARTUP_IOCP);
}
#endif