start to enable tlstest for portable

Disabled on Windows for now due to pipe2/socketpair support.
This commit is contained in:
Brent Cook 2017-01-13 09:10:59 -06:00
parent 1d934cd2d8
commit fa20dae329
5 changed files with 53 additions and 3 deletions

View File

@ -261,9 +261,9 @@ if(NOT BUILD_SHARED)
endif()
if(USE_SHARED)
set(OPENSSL_LIBS ssl-shared crypto-shared)
set(OPENSSL_LIBS tls-shared ssl-shared crypto-shared)
else()
set(OPENSSL_LIBS ssl crypto)
set(OPENSSL_LIBS tls ssl crypto)
endif()
if(CMAKE_HOST_WIN32)

View File

@ -12,7 +12,9 @@ include_directories(
add_definitions(-D_PATH_SSL_CA_FILE=\"${CMAKE_CURRENT_SOURCE_DIR}/../apps/openssl/cert.pem\")
foreach(lib IN LISTS OPENSSL_LIBS)
if(${lib} STREQUAL "ssl-shared")
if(${lib} STREQUAL "tls-shared")
set(TESTS_LIBS ${TESTS_LIBS} tls)
elseif(${lib} STREQUAL "ssl-shared")
set(TESTS_LIBS ${TESTS_LIBS} ssl)
elseif(${lib} STREQUAL "crypto-shared")
set(TESTS_LIBS ${TESTS_LIBS} crypto)
@ -342,6 +344,18 @@ add_executable(timingsafe timingsafe.c)
target_link_libraries(timingsafe ${TESTS_LIBS})
add_test(timingsafe timingsafe)
# tlstest
if(NOT CMAKE_HOST_WIN32 AND NOT CMAKE_SYSTEM_NAME MATCHES "MINGW")
add_executable(tlstest tlstest.c)
target_link_libraries(tlstest ${TESTS_LIBS})
if(NOT MSVC)
add_test(tlstest ${CMAKE_CURRENT_SOURCE_DIR}/tlstest.sh)
else()
add_test(tlstest ${CMAKE_CURRENT_SOURCE_DIR}/tlstest.bat)
endif()
set_tests_properties(tlstest PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}")
endif()
# tls_ext_alpn
add_executable(tls_ext_alpn tls_ext_alpn.c)
target_link_libraries(tls_ext_alpn ${TESTS_LIBS})
@ -365,6 +379,7 @@ add_test(x25519test x25519test)
if(ENABLE_VSTEST AND USE_SHARED)
add_custom_command(TARGET x25519test POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:tls-shared>"
"$<TARGET_FILE:ssl-shared>"
"$<TARGET_FILE:crypto-shared>"
"${CMAKE_CURRENT_BINARY_DIR}"

View File

@ -332,6 +332,14 @@ TESTS += timingsafe
check_PROGRAMS += timingsafe
timingsafe_SOURCES = timingsafe.c
# tlstest
if !HOST_WIN
TESTS += tlstest.sh
check_PROGRAMS += tlstest
tlstest_SOURCES = tlstest.c
EXTRA_DIST += tlstest.sh tlstest.bat
endif
# tls_ext_alpn
TESTS += tls_ext_alpn
check_PROGRAMS += tls_ext_alpn

14
tests/tlstest.bat Normal file
View File

@ -0,0 +1,14 @@
@echo off
setlocal enabledelayedexpansion
REM tlstest.bat
set tlstest_bin=Debug\tlstest.exe
if not exist %tlstest_bin% exit /b 1
if "%srcdir%"=="" (
set srcdir=.
)
%tlstest_bin% %srcdir%\server.pem %srcdir%\server.pem %srcdir%\ca.pem
endlocal

13
tests/tlstest.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
set -e
tlstest_bin=./tlstest
if [ -e ./tlstest.exe ]; then
tlstest_bin=./tlstest.exe
fi
if [ -z $srcdir ]; then
srcdir=.
fi
$tlstest_bin $srcdir/server.pem $srcdir/server.pem $srcdir/ca.pem