aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/CMakeLists.txt48
-rw-r--r--tests/ocsptest.bat11
-rw-r--r--tests/pq_test.bat7
-rw-r--r--tests/servertest.bat7
-rw-r--r--tests/ssltest.bat10
-rw-r--r--tests/testdsa.bat15
-rw-r--r--tests/testenc.bat22
-rw-r--r--tests/testrsa.bat15
-rw-r--r--tests/tlstest.bat7
9 files changed, 66 insertions, 76 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 4cc55d8..4942e0a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -24,6 +24,8 @@ foreach(lib IN LISTS OPENSSL_LIBS)
24 endif() 24 endif()
25endforeach() 25endforeach()
26 26
27file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} TEST_SOURCE_DIR)
28
27# aeadtest 29# aeadtest
28add_executable(aeadtest aeadtest.c) 30add_executable(aeadtest aeadtest.c)
29target_link_libraries(aeadtest ${TESTS_LIBS}) 31target_link_libraries(aeadtest ${TESTS_LIBS})
@@ -242,9 +244,9 @@ if(ENABLE_EXTRATESTS)
242 add_executable(ocsp_test ocsp_test.c) 244 add_executable(ocsp_test ocsp_test.c)
243 target_link_libraries(ocsp_test ${TESTS_LIBS}) 245 target_link_libraries(ocsp_test ${TESTS_LIBS})
244 if(NOT MSVC) 246 if(NOT MSVC)
245 add_test(ocsptest ${CMAKE_CURRENT_SOURCE_DIR}/ocsptest.sh) 247 add_test(NAME ocsptest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ocsptest.sh)
246 else() 248 else()
247 add_test(ocsptest ${CMAKE_CURRENT_SOURCE_DIR}/ocsptest.bat) 249 add_test(NAME ocsptest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ocsptest.bat $<TARGET_FILE:ocsp_test>)
248 endif() 250 endif()
249endif() 251endif()
250 252
@@ -281,11 +283,11 @@ add_test(poly1305test poly1305test)
281add_executable(pq_test pq_test.c) 283add_executable(pq_test pq_test.c)
282target_link_libraries(pq_test ${TESTS_LIBS}) 284target_link_libraries(pq_test ${TESTS_LIBS})
283if(NOT MSVC) 285if(NOT MSVC)
284 add_test(pq_test ${CMAKE_CURRENT_SOURCE_DIR}/pq_test.sh) 286 add_test(NAME pq_test COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/pq_test.sh)
285else() 287else()
286 add_test(pq_test ${CMAKE_CURRENT_SOURCE_DIR}/pq_test.bat) 288 add_test(NAME pq_test COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/pq_test.bat $<TARGET_FILE:pq_test>)
287endif() 289endif()
288set_tests_properties(pq_test PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}") 290set_tests_properties(pq_test PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
289 291
290# randtest 292# randtest
291add_executable(randtest randtest.c) 293add_executable(randtest randtest.c)
@@ -325,11 +327,11 @@ add_test(rsa_test rsa_test)
325add_executable(servertest servertest.c) 327add_executable(servertest servertest.c)
326target_link_libraries(servertest ${TESTS_LIBS}) 328target_link_libraries(servertest ${TESTS_LIBS})
327if(NOT MSVC) 329if(NOT MSVC)
328 add_test(servertest ${CMAKE_CURRENT_SOURCE_DIR}/servertest.sh) 330 add_test(NAME servertest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/servertest.sh)
329else() 331else()
330 add_test(servertest ${CMAKE_CURRENT_SOURCE_DIR}/servertest.bat) 332 add_test(NAME servertest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/servertest.bat $<TARGET_FILE:servertest>)
331endif() 333endif()
332set_tests_properties(servertest PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}") 334set_tests_properties(servertest PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
333 335
334# sha1test 336# sha1test
335add_executable(sha1test sha1test.c) 337add_executable(sha1test sha1test.c)
@@ -355,35 +357,35 @@ add_test(ssl_versions ssl_versions)
355add_executable(ssltest ssltest.c) 357add_executable(ssltest ssltest.c)
356target_link_libraries(ssltest ${TESTS_LIBS}) 358target_link_libraries(ssltest ${TESTS_LIBS})
357if(NOT MSVC) 359if(NOT MSVC)
358 add_test(ssltest ${CMAKE_CURRENT_SOURCE_DIR}/ssltest.sh) 360 add_test(NAME ssltest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ssltest.sh)
359else() 361else()
360 add_test(ssltest ${CMAKE_CURRENT_SOURCE_DIR}/ssltest.bat) 362 add_test(NAME ssltest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ssltest.bat $<TARGET_FILE:ssltest> $<TARGET_FILE:openssl>)
361endif() 363endif()
362set_tests_properties(ssltest PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}") 364set_tests_properties(ssltest PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
363 365
364# testdsa 366# testdsa
365if(NOT MSVC) 367if(NOT MSVC)
366 add_test(testdsa ${CMAKE_CURRENT_SOURCE_DIR}/testdsa.sh) 368 add_test(NAME testdsa COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/testdsa.sh)
367else() 369else()
368 add_test(testdsa ${CMAKE_CURRENT_SOURCE_DIR}/testdsa.bat) 370 add_test(NAME testdsa COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/testdsa.bat $<TARGET_FILE:openssl>)
369endif() 371endif()
370set_tests_properties(testdsa PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}") 372set_tests_properties(testdsa PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
371 373
372# testenc 374# testenc
373if(NOT MSVC) 375if(NOT MSVC)
374 add_test(testenc ${CMAKE_CURRENT_SOURCE_DIR}/testenc.sh) 376 add_test(NAME testenc COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/testenc.sh)
375else() 377else()
376 add_test(testenc ${CMAKE_CURRENT_SOURCE_DIR}/testenc.bat) 378 add_test(NAME testenc COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/testenc.bat $<TARGET_FILE:openssl>)
377endif() 379endif()
378set_tests_properties(testenc PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}") 380set_tests_properties(testenc PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
379 381
380# testrsa 382# testrsa
381if(NOT MSVC) 383if(NOT MSVC)
382 add_test(testrsa ${CMAKE_CURRENT_SOURCE_DIR}/testrsa.sh) 384 add_test(NAME testrsa COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/testrsa.sh)
383else() 385else()
384 add_test(testrsa ${CMAKE_CURRENT_SOURCE_DIR}/testrsa.bat) 386 add_test(NAME testrsa COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/testrsa.bat $<TARGET_FILE:openssl>)
385endif() 387endif()
386set_tests_properties(testrsa PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}") 388set_tests_properties(testrsa PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
387 389
388# timingsafe 390# timingsafe
389add_executable(timingsafe timingsafe.c) 391add_executable(timingsafe timingsafe.c)
@@ -407,11 +409,11 @@ endif()
407add_executable(tlstest ${TLSTEST_SRC}) 409add_executable(tlstest ${TLSTEST_SRC})
408target_link_libraries(tlstest ${TESTS_LIBS}) 410target_link_libraries(tlstest ${TESTS_LIBS})
409if(NOT MSVC) 411if(NOT MSVC)
410 add_test(tlstest ${CMAKE_CURRENT_SOURCE_DIR}/tlstest.sh) 412 add_test(NAME tlstest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tlstest.sh)
411else() 413else()
412 add_test(tlstest ${CMAKE_CURRENT_SOURCE_DIR}/tlstest.bat) 414 add_test(NAME tlstest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tlstest.bat $<TARGET_FILE:tlstest>)
413endif() 415endif()
414set_tests_properties(tlstest PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}") 416set_tests_properties(tlstest PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")
415 417
416# tls_ext_alpn 418# tls_ext_alpn
417add_executable(tls_ext_alpn tls_ext_alpn.c) 419add_executable(tls_ext_alpn tls_ext_alpn.c)
diff --git a/tests/ocsptest.bat b/tests/ocsptest.bat
index fa0ae42..2b6b66b 100644
--- a/tests/ocsptest.bat
+++ b/tests/ocsptest.bat
@@ -1,11 +1,12 @@
1@echo off 1@echo off
2setlocal enabledelayedexpansion 2setlocal enabledelayedexpansion
3REM ocsptest.bat 3REM ocspocsp_test_bin.bat
4 4
5set TEST=Debug\ocsp_test.exe 5set ocsp_test_bin=%1
6if not exist %TEST% exit /b 1 6set ocsp_test_bin=%ocsp_test_bin:/=\%
7if not exist %ocsp_test_bin% exit /b 1
7 8
8%TEST% www.amazon.com 443 & if !errorlevel! neq 0 exit /b 1 9%ocsp_test_bin% www.amazon.com 443 & if !errorlevel! neq 0 exit /b 1
9%TEST% cloudflare.com 443 & if !errorlevel! neq 0 exit /b 1 10%ocsp_test_bin% cloudflare.com 443 & if !errorlevel! neq 0 exit /b 1
10 11
11endlocal 12endlocal
diff --git a/tests/pq_test.bat b/tests/pq_test.bat
index b665874..084f06d 100644
--- a/tests/pq_test.bat
+++ b/tests/pq_test.bat
@@ -2,13 +2,14 @@
2setlocal enabledelayedexpansion 2setlocal enabledelayedexpansion
3REM pq_test.bat 3REM pq_test.bat
4 4
5set TEST=Debug\pq_test.exe 5set pq_test_bin=%1
6if not exist %TEST% exit /b 1 6set pq_test_bin=%pq_test_bin:/=\%
7if not exist %pq_test_bin% exit /b 1
7 8
8set pq_output=pq_output.txt 9set pq_output=pq_output.txt
9if exist %pq_output% del %pq_output% 10if exist %pq_output% del %pq_output%
10 11
11%TEST% > %pq_output% 12%pq_test_bin% > %pq_output%
12fc /b %pq_output% %srcdir%\pq_expected.txt 13fc /b %pq_output% %srcdir%\pq_expected.txt
13 14
14endlocal 15endlocal
diff --git a/tests/servertest.bat b/tests/servertest.bat
index d3dd178..8c9bd97 100644
--- a/tests/servertest.bat
+++ b/tests/servertest.bat
@@ -2,13 +2,10 @@
2setlocal enabledelayedexpansion 2setlocal enabledelayedexpansion
3REM servertest.bat 3REM servertest.bat
4 4
5set servertest_bin=Debug\servertest.exe 5set servertest_bin=%1
6set servertest_bin=%servertest_bin:/=\%
6if not exist %servertest_bin% exit /b 1 7if not exist %servertest_bin% exit /b 1
7 8
8if "%srcdir%"=="" (
9 set srcdir=.
10)
11
12%servertest_bin% %srcdir%\server.pem %srcdir%\server.pem %srcdir%\ca.pem 9%servertest_bin% %srcdir%\server.pem %srcdir%\server.pem %srcdir%\ca.pem
13if !errorlevel! neq 0 ( 10if !errorlevel! neq 0 (
14 exit /b 1 11 exit /b 1
diff --git a/tests/ssltest.bat b/tests/ssltest.bat
index e52efed..f068cb0 100644
--- a/tests/ssltest.bat
+++ b/tests/ssltest.bat
@@ -2,16 +2,14 @@
2setlocal enabledelayedexpansion 2setlocal enabledelayedexpansion
3REM ssltest.bat 3REM ssltest.bat
4 4
5set ssltest_bin=Debug\ssltest.exe 5set ssltest_bin=%1
6set ssltest_bin=%ssltest_bin:/=\%
6if not exist %ssltest_bin% exit /b 1 7if not exist %ssltest_bin% exit /b 1
7 8
8set openssl_bin=..\apps\openssl\Debug\openssl.exe 9set openssl_bin=%2
10set openssl_bin=%openssl_bin:/=\%
9if not exist %openssl_bin% exit /b 1 11if not exist %openssl_bin% exit /b 1
10 12
11if "%srcdir%"=="" (
12 set srcdir=.
13)
14
15%srcdir%\testssl.bat %srcdir%\server.pem %srcdir%\server.pem %srcdir%\ca.pem ^ 13%srcdir%\testssl.bat %srcdir%\server.pem %srcdir%\server.pem %srcdir%\ca.pem ^
16 %ssltest_bin% %openssl_bin% 14 %ssltest_bin% %openssl_bin%
17if !errorlevel! neq 0 ( 15if !errorlevel! neq 0 (
diff --git a/tests/testdsa.bat b/tests/testdsa.bat
index 9a9690e..898ded8 100644
--- a/tests/testdsa.bat
+++ b/tests/testdsa.bat
@@ -5,29 +5,26 @@ REM testdsa.bat
5 5
6REM # Test DSA certificate generation of openssl 6REM # Test DSA certificate generation of openssl
7 7
8set cmd=..\apps\openssl\Debug\openssl.exe 8set openssl_bin=%1
9if not exist %cmd% exit /b 1 9set openssl_bin=%openssl_bin:/=\%
10 10if not exist %openssl_bin% exit /b 1
11if "%srcdir%"=="" (
12 set srcdir=.
13)
14 11
15REM # Generate DSA paramter set 12REM # Generate DSA paramter set
16%cmd% dsaparam 512 -out dsa512.pem 13%openssl_bin% dsaparam 512 -out dsa512.pem
17if !errorlevel! neq 0 ( 14if !errorlevel! neq 0 (
18 exit /b 1 15 exit /b 1
19) 16)
20 17
21 18
22REM # Generate a DSA certificate 19REM # Generate a DSA certificate
23%cmd% req -config %srcdir%\openssl.cnf -x509 -newkey dsa:dsa512.pem -out testdsa.pem -keyout testdsa.key 20%openssl_bin% req -config %srcdir%\openssl.cnf -x509 -newkey dsa:dsa512.pem -out testdsa.pem -keyout testdsa.key
24if !errorlevel! neq 0 ( 21if !errorlevel! neq 0 (
25 exit /b 1 22 exit /b 1
26) 23)
27 24
28 25
29REM # Now check the certificate 26REM # Now check the certificate
30%cmd% x509 -text -in testdsa.pem 27%openssl_bin% x509 -text -in testdsa.pem
31if !errorlevel! neq 0 ( 28if !errorlevel! neq 0 (
32 exit /b 1 29 exit /b 1
33) 30)
diff --git a/tests/testenc.bat b/tests/testenc.bat
index a925ec3..93dfc0c 100644
--- a/tests/testenc.bat
+++ b/tests/testenc.bat
@@ -3,16 +3,16 @@ setlocal enabledelayedexpansion
3REM testenc.bat 3REM testenc.bat
4 4
5set test=p 5set test=p
6set cmd=..\apps\openssl\Debug\openssl.exe
7if not exist %cmd% exit /b 1
8 6
9set srcdir=..\..\tests 7set openssl_bin=%1
8set openssl_bin=%openssl_bin:/=\%
9if not exist %openssl_bin% exit /b 1
10 10
11copy %srcdir%\openssl.cnf %test% 11copy %srcdir%\openssl.cnf %test%
12 12
13echo cat 13echo cat
14%cmd% enc -in %test% -out %test%.cipher 14%openssl_bin% enc -in %test% -out %test%.cipher
15%cmd% enc -in %test%.cipher -out %test%.clear 15%openssl_bin% enc -in %test%.cipher -out %test%.clear
16fc /b %test% %test%.clear 16fc /b %test% %test%.clear
17if !errorlevel! neq 0 ( 17if !errorlevel! neq 0 (
18 exit /b 1 18 exit /b 1
@@ -21,8 +21,8 @@ if !errorlevel! neq 0 (
21) 21)
22 22
23echo base64 23echo base64
24%cmd% enc -a -e -in %test% -out %test%.cipher 24%openssl_bin% enc -a -e -in %test% -out %test%.cipher
25%cmd% enc -a -d -in %test%.cipher -out %test%.clear 25%openssl_bin% enc -a -d -in %test%.cipher -out %test%.clear
26fc /b %test% %test%.clear 26fc /b %test% %test%.clear
27if !errorlevel! neq 0 ( 27if !errorlevel! neq 0 (
28 exit /b 1 28 exit /b 1
@@ -45,8 +45,8 @@ for %%i in (
45 rc4 rc4-40 45 rc4 rc4-40
46) do ( 46) do (
47 echo %%i 47 echo %%i
48 %cmd% %%i -e -k test -in %test% -out %test%.%%i.cipher 48 %openssl_bin% %%i -e -k test -in %test% -out %test%.%%i.cipher
49 %cmd% %%i -d -k test -in %test%.%%i.cipher -out %test%.%%i.clear 49 %openssl_bin% %%i -d -k test -in %test%.%%i.cipher -out %test%.%%i.clear
50 fc /b %test% %test%.%%i.clear 50 fc /b %test% %test%.%%i.clear
51 if !errorlevel! neq 0 ( 51 if !errorlevel! neq 0 (
52 exit /b 1 52 exit /b 1
@@ -55,8 +55,8 @@ for %%i in (
55 ) 55 )
56 56
57 echo %%i base64 57 echo %%i base64
58 %cmd% %%i -a -e -k test -in %test% -out %test%.%%i.cipher 58 %openssl_bin% %%i -a -e -k test -in %test% -out %test%.%%i.cipher
59 %cmd% %%i -a -d -k test -in %test%.%%i.cipher -out %test%.%%i.clear 59 %openssl_bin% %%i -a -d -k test -in %test%.%%i.cipher -out %test%.%%i.clear
60 fc /b %test% %test%.%%i.clear 60 fc /b %test% %test%.%%i.clear
61 if !errorlevel! neq 0 ( 61 if !errorlevel! neq 0 (
62 exit /b 1 62 exit /b 1
diff --git a/tests/testrsa.bat b/tests/testrsa.bat
index 6d88d21..59c3b5d 100644
--- a/tests/testrsa.bat
+++ b/tests/testrsa.bat
@@ -5,29 +5,26 @@ REM testrsa.bat
5 5
6REM # Test RSA certificate generation of openssl 6REM # Test RSA certificate generation of openssl
7 7
8set cmd=..\apps\openssl\Debug\openssl.exe 8set openssl_bin=%1
9if not exist %cmd% exit /b 1 9set openssl_bin=%openssl_bin:/=\%
10 10if not exist %openssl_bin% exit /b 1
11if "%srcdir%"=="" (
12 set srcdir=.
13)
14 11
15REM # Generate RSA private key 12REM # Generate RSA private key
16%cmd% genrsa -out rsakey.pem 13%openssl_bin% genrsa -out rsakey.pem
17if !errorlevel! neq 0 ( 14if !errorlevel! neq 0 (
18 exit /b 1 15 exit /b 1
19) 16)
20 17
21 18
22REM # Generate an RSA certificate 19REM # Generate an RSA certificate
23%cmd% req -config %srcdir%\openssl.cnf -key rsakey.pem -new -x509 -days 365 -out rsacert.pem 20%openssl_bin% req -config %srcdir%\openssl.cnf -key rsakey.pem -new -x509 -days 365 -out rsacert.pem
24if !errorlevel! neq 0 ( 21if !errorlevel! neq 0 (
25 exit /b 1 22 exit /b 1
26) 23)
27 24
28 25
29REM # Now check the certificate 26REM # Now check the certificate
30%cmd% x509 -text -in rsacert.pem 27%openssl_bin% x509 -text -in rsacert.pem
31if !errorlevel! neq 0 ( 28if !errorlevel! neq 0 (
32 exit /b 1 29 exit /b 1
33) 30)
diff --git a/tests/tlstest.bat b/tests/tlstest.bat
index b7b1ecf..25664cf 100644
--- a/tests/tlstest.bat
+++ b/tests/tlstest.bat
@@ -2,13 +2,10 @@
2setlocal enabledelayedexpansion 2setlocal enabledelayedexpansion
3REM tlstest.bat 3REM tlstest.bat
4 4
5set tlstest_bin=Debug\tlstest.exe 5set tlstest_bin=%1
6set tlstest_bin=%tlstest_bin:/=\%
6if not exist %tlstest_bin% exit /b 1 7if not exist %tlstest_bin% exit /b 1
7 8
8if "%srcdir%"=="" (
9 set srcdir=.
10)
11
12%tlstest_bin% %srcdir%\ca.pem %srcdir%\server.pem %srcdir%\server.pem 9%tlstest_bin% %srcdir%\ca.pem %srcdir%\server.pem %srcdir%\server.pem
13if !errorlevel! neq 0 ( 10if !errorlevel! neq 0 (
14 exit /b 1 11 exit /b 1