Fix Windows tests within CMake
This commit is contained in:
parent
0263e69a93
commit
644c1097a8
@ -24,6 +24,8 @@ foreach(lib IN LISTS OPENSSL_LIBS)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} TEST_SOURCE_DIR)
|
||||
|
||||
# aeadtest
|
||||
add_executable(aeadtest aeadtest.c)
|
||||
target_link_libraries(aeadtest ${TESTS_LIBS})
|
||||
@ -242,9 +244,9 @@ if(ENABLE_EXTRATESTS)
|
||||
add_executable(ocsp_test ocsp_test.c)
|
||||
target_link_libraries(ocsp_test ${TESTS_LIBS})
|
||||
if(NOT MSVC)
|
||||
add_test(ocsptest ${CMAKE_CURRENT_SOURCE_DIR}/ocsptest.sh)
|
||||
add_test(NAME ocsptest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ocsptest.sh)
|
||||
else()
|
||||
add_test(ocsptest ${CMAKE_CURRENT_SOURCE_DIR}/ocsptest.bat)
|
||||
add_test(NAME ocsptest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ocsptest.bat $<TARGET_FILE:ocsp_test>)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -281,11 +283,11 @@ add_test(poly1305test poly1305test)
|
||||
add_executable(pq_test pq_test.c)
|
||||
target_link_libraries(pq_test ${TESTS_LIBS})
|
||||
if(NOT MSVC)
|
||||
add_test(pq_test ${CMAKE_CURRENT_SOURCE_DIR}/pq_test.sh)
|
||||
add_test(NAME pq_test COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/pq_test.sh)
|
||||
else()
|
||||
add_test(pq_test ${CMAKE_CURRENT_SOURCE_DIR}/pq_test.bat)
|
||||
add_test(NAME pq_test COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/pq_test.bat $<TARGET_FILE:pq_test>)
|
||||
endif()
|
||||
set_tests_properties(pq_test PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set_tests_properties(pq_test PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
|
||||
|
||||
# randtest
|
||||
add_executable(randtest randtest.c)
|
||||
@ -325,11 +327,11 @@ add_test(rsa_test rsa_test)
|
||||
add_executable(servertest servertest.c)
|
||||
target_link_libraries(servertest ${TESTS_LIBS})
|
||||
if(NOT MSVC)
|
||||
add_test(servertest ${CMAKE_CURRENT_SOURCE_DIR}/servertest.sh)
|
||||
add_test(NAME servertest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/servertest.sh)
|
||||
else()
|
||||
add_test(servertest ${CMAKE_CURRENT_SOURCE_DIR}/servertest.bat)
|
||||
add_test(NAME servertest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/servertest.bat $<TARGET_FILE:servertest>)
|
||||
endif()
|
||||
set_tests_properties(servertest PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set_tests_properties(servertest PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
|
||||
|
||||
# sha1test
|
||||
add_executable(sha1test sha1test.c)
|
||||
@ -355,35 +357,35 @@ add_test(ssl_versions ssl_versions)
|
||||
add_executable(ssltest ssltest.c)
|
||||
target_link_libraries(ssltest ${TESTS_LIBS})
|
||||
if(NOT MSVC)
|
||||
add_test(ssltest ${CMAKE_CURRENT_SOURCE_DIR}/ssltest.sh)
|
||||
add_test(NAME ssltest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ssltest.sh)
|
||||
else()
|
||||
add_test(ssltest ${CMAKE_CURRENT_SOURCE_DIR}/ssltest.bat)
|
||||
add_test(NAME ssltest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ssltest.bat $<TARGET_FILE:ssltest> $<TARGET_FILE:openssl>)
|
||||
endif()
|
||||
set_tests_properties(ssltest PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set_tests_properties(ssltest PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
|
||||
|
||||
# testdsa
|
||||
if(NOT MSVC)
|
||||
add_test(testdsa ${CMAKE_CURRENT_SOURCE_DIR}/testdsa.sh)
|
||||
add_test(NAME testdsa COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/testdsa.sh)
|
||||
else()
|
||||
add_test(testdsa ${CMAKE_CURRENT_SOURCE_DIR}/testdsa.bat)
|
||||
add_test(NAME testdsa COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/testdsa.bat $<TARGET_FILE:openssl>)
|
||||
endif()
|
||||
set_tests_properties(testdsa PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set_tests_properties(testdsa PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
|
||||
|
||||
# testenc
|
||||
if(NOT MSVC)
|
||||
add_test(testenc ${CMAKE_CURRENT_SOURCE_DIR}/testenc.sh)
|
||||
add_test(NAME testenc COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/testenc.sh)
|
||||
else()
|
||||
add_test(testenc ${CMAKE_CURRENT_SOURCE_DIR}/testenc.bat)
|
||||
add_test(NAME testenc COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/testenc.bat $<TARGET_FILE:openssl>)
|
||||
endif()
|
||||
set_tests_properties(testenc PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set_tests_properties(testenc PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
|
||||
|
||||
# testrsa
|
||||
if(NOT MSVC)
|
||||
add_test(testrsa ${CMAKE_CURRENT_SOURCE_DIR}/testrsa.sh)
|
||||
add_test(NAME testrsa COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/testrsa.sh)
|
||||
else()
|
||||
add_test(testrsa ${CMAKE_CURRENT_SOURCE_DIR}/testrsa.bat)
|
||||
add_test(NAME testrsa COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/testrsa.bat $<TARGET_FILE:openssl>)
|
||||
endif()
|
||||
set_tests_properties(testrsa PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set_tests_properties(testrsa PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
|
||||
|
||||
# timingsafe
|
||||
add_executable(timingsafe timingsafe.c)
|
||||
@ -407,11 +409,11 @@ endif()
|
||||
add_executable(tlstest ${TLSTEST_SRC})
|
||||
target_link_libraries(tlstest ${TESTS_LIBS})
|
||||
if(NOT MSVC)
|
||||
add_test(tlstest ${CMAKE_CURRENT_SOURCE_DIR}/tlstest.sh)
|
||||
add_test(NAME tlstest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tlstest.sh)
|
||||
else()
|
||||
add_test(tlstest ${CMAKE_CURRENT_SOURCE_DIR}/tlstest.bat)
|
||||
add_test(NAME tlstest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tlstest.bat $<TARGET_FILE:tlstest>)
|
||||
endif()
|
||||
set_tests_properties(tlstest PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set_tests_properties(tlstest PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
|
||||
|
||||
# tls_ext_alpn
|
||||
add_executable(tls_ext_alpn tls_ext_alpn.c)
|
||||
|
@ -1,11 +1,12 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
REM ocsptest.bat
|
||||
REM ocspocsp_test_bin.bat
|
||||
|
||||
set TEST=Debug\ocsp_test.exe
|
||||
if not exist %TEST% exit /b 1
|
||||
set ocsp_test_bin=%1
|
||||
set ocsp_test_bin=%ocsp_test_bin:/=\%
|
||||
if not exist %ocsp_test_bin% exit /b 1
|
||||
|
||||
%TEST% www.amazon.com 443 & if !errorlevel! neq 0 exit /b 1
|
||||
%TEST% cloudflare.com 443 & if !errorlevel! neq 0 exit /b 1
|
||||
%ocsp_test_bin% www.amazon.com 443 & if !errorlevel! neq 0 exit /b 1
|
||||
%ocsp_test_bin% cloudflare.com 443 & if !errorlevel! neq 0 exit /b 1
|
||||
|
||||
endlocal
|
||||
|
@ -2,13 +2,14 @@
|
||||
setlocal enabledelayedexpansion
|
||||
REM pq_test.bat
|
||||
|
||||
set TEST=Debug\pq_test.exe
|
||||
if not exist %TEST% exit /b 1
|
||||
set pq_test_bin=%1
|
||||
set pq_test_bin=%pq_test_bin:/=\%
|
||||
if not exist %pq_test_bin% exit /b 1
|
||||
|
||||
set pq_output=pq_output.txt
|
||||
if exist %pq_output% del %pq_output%
|
||||
|
||||
%TEST% > %pq_output%
|
||||
%pq_test_bin% > %pq_output%
|
||||
fc /b %pq_output% %srcdir%\pq_expected.txt
|
||||
|
||||
endlocal
|
||||
|
@ -2,13 +2,10 @@
|
||||
setlocal enabledelayedexpansion
|
||||
REM servertest.bat
|
||||
|
||||
set servertest_bin=Debug\servertest.exe
|
||||
set servertest_bin=%1
|
||||
set servertest_bin=%servertest_bin:/=\%
|
||||
if not exist %servertest_bin% exit /b 1
|
||||
|
||||
if "%srcdir%"=="" (
|
||||
set srcdir=.
|
||||
)
|
||||
|
||||
%servertest_bin% %srcdir%\server.pem %srcdir%\server.pem %srcdir%\ca.pem
|
||||
if !errorlevel! neq 0 (
|
||||
exit /b 1
|
||||
|
@ -2,16 +2,14 @@
|
||||
setlocal enabledelayedexpansion
|
||||
REM ssltest.bat
|
||||
|
||||
set ssltest_bin=Debug\ssltest.exe
|
||||
set ssltest_bin=%1
|
||||
set ssltest_bin=%ssltest_bin:/=\%
|
||||
if not exist %ssltest_bin% exit /b 1
|
||||
|
||||
set openssl_bin=..\apps\openssl\Debug\openssl.exe
|
||||
set openssl_bin=%2
|
||||
set openssl_bin=%openssl_bin:/=\%
|
||||
if not exist %openssl_bin% exit /b 1
|
||||
|
||||
if "%srcdir%"=="" (
|
||||
set srcdir=.
|
||||
)
|
||||
|
||||
%srcdir%\testssl.bat %srcdir%\server.pem %srcdir%\server.pem %srcdir%\ca.pem ^
|
||||
%ssltest_bin% %openssl_bin%
|
||||
if !errorlevel! neq 0 (
|
||||
|
@ -5,29 +5,26 @@ REM testdsa.bat
|
||||
|
||||
REM # Test DSA certificate generation of openssl
|
||||
|
||||
set cmd=..\apps\openssl\Debug\openssl.exe
|
||||
if not exist %cmd% exit /b 1
|
||||
|
||||
if "%srcdir%"=="" (
|
||||
set srcdir=.
|
||||
)
|
||||
set openssl_bin=%1
|
||||
set openssl_bin=%openssl_bin:/=\%
|
||||
if not exist %openssl_bin% exit /b 1
|
||||
|
||||
REM # Generate DSA paramter set
|
||||
%cmd% dsaparam 512 -out dsa512.pem
|
||||
%openssl_bin% dsaparam 512 -out dsa512.pem
|
||||
if !errorlevel! neq 0 (
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
|
||||
REM # Generate a DSA certificate
|
||||
%cmd% req -config %srcdir%\openssl.cnf -x509 -newkey dsa:dsa512.pem -out testdsa.pem -keyout testdsa.key
|
||||
%openssl_bin% req -config %srcdir%\openssl.cnf -x509 -newkey dsa:dsa512.pem -out testdsa.pem -keyout testdsa.key
|
||||
if !errorlevel! neq 0 (
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
|
||||
REM # Now check the certificate
|
||||
%cmd% x509 -text -in testdsa.pem
|
||||
%openssl_bin% x509 -text -in testdsa.pem
|
||||
if !errorlevel! neq 0 (
|
||||
exit /b 1
|
||||
)
|
||||
|
@ -3,16 +3,16 @@ setlocal enabledelayedexpansion
|
||||
REM testenc.bat
|
||||
|
||||
set test=p
|
||||
set cmd=..\apps\openssl\Debug\openssl.exe
|
||||
if not exist %cmd% exit /b 1
|
||||
|
||||
set srcdir=..\..\tests
|
||||
set openssl_bin=%1
|
||||
set openssl_bin=%openssl_bin:/=\%
|
||||
if not exist %openssl_bin% exit /b 1
|
||||
|
||||
copy %srcdir%\openssl.cnf %test%
|
||||
|
||||
echo cat
|
||||
%cmd% enc -in %test% -out %test%.cipher
|
||||
%cmd% enc -in %test%.cipher -out %test%.clear
|
||||
%openssl_bin% enc -in %test% -out %test%.cipher
|
||||
%openssl_bin% enc -in %test%.cipher -out %test%.clear
|
||||
fc /b %test% %test%.clear
|
||||
if !errorlevel! neq 0 (
|
||||
exit /b 1
|
||||
@ -21,8 +21,8 @@ if !errorlevel! neq 0 (
|
||||
)
|
||||
|
||||
echo base64
|
||||
%cmd% enc -a -e -in %test% -out %test%.cipher
|
||||
%cmd% enc -a -d -in %test%.cipher -out %test%.clear
|
||||
%openssl_bin% enc -a -e -in %test% -out %test%.cipher
|
||||
%openssl_bin% enc -a -d -in %test%.cipher -out %test%.clear
|
||||
fc /b %test% %test%.clear
|
||||
if !errorlevel! neq 0 (
|
||||
exit /b 1
|
||||
@ -45,8 +45,8 @@ for %%i in (
|
||||
rc4 rc4-40
|
||||
) do (
|
||||
echo %%i
|
||||
%cmd% %%i -e -k test -in %test% -out %test%.%%i.cipher
|
||||
%cmd% %%i -d -k test -in %test%.%%i.cipher -out %test%.%%i.clear
|
||||
%openssl_bin% %%i -e -k test -in %test% -out %test%.%%i.cipher
|
||||
%openssl_bin% %%i -d -k test -in %test%.%%i.cipher -out %test%.%%i.clear
|
||||
fc /b %test% %test%.%%i.clear
|
||||
if !errorlevel! neq 0 (
|
||||
exit /b 1
|
||||
@ -55,8 +55,8 @@ for %%i in (
|
||||
)
|
||||
|
||||
echo %%i base64
|
||||
%cmd% %%i -a -e -k test -in %test% -out %test%.%%i.cipher
|
||||
%cmd% %%i -a -d -k test -in %test%.%%i.cipher -out %test%.%%i.clear
|
||||
%openssl_bin% %%i -a -e -k test -in %test% -out %test%.%%i.cipher
|
||||
%openssl_bin% %%i -a -d -k test -in %test%.%%i.cipher -out %test%.%%i.clear
|
||||
fc /b %test% %test%.%%i.clear
|
||||
if !errorlevel! neq 0 (
|
||||
exit /b 1
|
||||
|
@ -5,29 +5,26 @@ REM testrsa.bat
|
||||
|
||||
REM # Test RSA certificate generation of openssl
|
||||
|
||||
set cmd=..\apps\openssl\Debug\openssl.exe
|
||||
if not exist %cmd% exit /b 1
|
||||
|
||||
if "%srcdir%"=="" (
|
||||
set srcdir=.
|
||||
)
|
||||
set openssl_bin=%1
|
||||
set openssl_bin=%openssl_bin:/=\%
|
||||
if not exist %openssl_bin% exit /b 1
|
||||
|
||||
REM # Generate RSA private key
|
||||
%cmd% genrsa -out rsakey.pem
|
||||
%openssl_bin% genrsa -out rsakey.pem
|
||||
if !errorlevel! neq 0 (
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
|
||||
REM # Generate an RSA certificate
|
||||
%cmd% req -config %srcdir%\openssl.cnf -key rsakey.pem -new -x509 -days 365 -out rsacert.pem
|
||||
%openssl_bin% req -config %srcdir%\openssl.cnf -key rsakey.pem -new -x509 -days 365 -out rsacert.pem
|
||||
if !errorlevel! neq 0 (
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
|
||||
REM # Now check the certificate
|
||||
%cmd% x509 -text -in rsacert.pem
|
||||
%openssl_bin% x509 -text -in rsacert.pem
|
||||
if !errorlevel! neq 0 (
|
||||
exit /b 1
|
||||
)
|
||||
|
@ -2,13 +2,10 @@
|
||||
setlocal enabledelayedexpansion
|
||||
REM tlstest.bat
|
||||
|
||||
set tlstest_bin=Debug\tlstest.exe
|
||||
set tlstest_bin=%1
|
||||
set tlstest_bin=%tlstest_bin:/=\%
|
||||
if not exist %tlstest_bin% exit /b 1
|
||||
|
||||
if "%srcdir%"=="" (
|
||||
set srcdir=.
|
||||
)
|
||||
|
||||
%tlstest_bin% %srcdir%\ca.pem %srcdir%\server.pem %srcdir%\server.pem
|
||||
if !errorlevel! neq 0 (
|
||||
exit /b 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user