Skip to content

Commit

Permalink
Land #1139 - link renegotiation test to build
Browse files Browse the repository at this point in the history
  • Loading branch information
botovq committed Feb 3, 2025
2 parents 7e58cd8 + 5bbae88 commit 7e7df6a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ tests/mlkem*
tests/mont*
tests/parse*
tests/policy*
tests/renegotiation_test*
tests/rfc3779*
tests/rfc5280time*
tests/ssl_get_shared_ciphers*
Expand Down
12 changes: 12 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,18 @@ add_executable(record_layer_test record_layer_test.c)
target_link_libraries(record_layer_test ${OPENSSL_TEST_LIBS})
add_platform_test(record_layer_test record_layer_test)

# renegotiation_test
set(RENEGOTIATION_TEST_SRC renegotiation_test.c)
add_executable(renegotiation_test ${RENEGOTIATION_TEST_SRC})
target_link_libraries(renegotiation_test ${OPENSSL_TEST_LIBS})
prepare_emscripten_test_target(renegotiation_test)
if(NOT MSVC)
add_test(NAME renegotiation_test COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/renegotiation_test.sh)
else()
add_test(NAME renegotiation_test COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/renegotiation_test.bat $<TARGET_FILE:renegotiation_test>)
endif()
set_tests_properties(renegotiation_test PROPERTIES ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}")

# rfc3779
add_executable(rfc3779 rfc3779.c)
target_link_libraries(rfc3779 ${OPENSSL_TEST_LIBS})
Expand Down
6 changes: 6 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,12 @@ TESTS += record_layer_test
check_PROGRAMS += record_layer_test
record_layer_test_SOURCES = record_layer_test.c

# renegotiation_test
TESTS += renegotiation_test.sh
check_PROGRAMS += renegotiation_test
renegotiation_test_SOURCES = renegotiation_test.c
EXTRA_DIST += renegotiation_test.sh renegotiation_test.bat

# rfc3779
TESTS += rfc3779
rfc3779_CPPFLAGS = $(AM_CPPFLAGS)
Expand Down
14 changes: 14 additions & 0 deletions tests/renegotiation_test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@echo off
setlocal enabledelayedexpansion
REM renegotiation_test.bat

set renegotiation_test_bin=%1
set renegotiation_test_bin=%renegotiation_test_bin:/=\%
if not exist %renegotiation_test_bin% exit /b 1

%renegotiation_test_bin% %srcdir%\server1-rsa.pem %srcdir%\server1-rsa-chain.pem %srcdir%\ca-root-rsa.pem
if !errorlevel! neq 0 (
exit /b 1
)

endlocal
15 changes: 15 additions & 0 deletions tests/renegotiation_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
set -e

renegotiation_test_bin=./renegotiation_test
if [ -e ./renegotiation_test.exe ]; then
renegotiation_test_bin=./renegotiation_test.exe
elif [ -e ./renegotiation_test.js ]; then
renegotiation_test_bin="node ./renegotiation_test.js"
fi

if [ -z $srcdir ]; then
srcdir=.
fi

$renegotiation_test_bin $srcdir/server1-rsa.pem $srcdir/server1-rsa-chain.pem $srcdir/ca-root-rsa.pem

0 comments on commit 7e7df6a

Please sign in to comment.