From 5bbae88080d65f9e81ef31c28e356f202d3cb03a Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Mon, 3 Feb 2025 21:59:49 +0100 Subject: [PATCH] Link renegotiation test to build --- .gitignore | 1 + tests/CMakeLists.txt | 12 ++++++++++++ tests/Makefile.am | 6 ++++++ tests/renegotiation_test.bat | 14 ++++++++++++++ tests/renegotiation_test.sh | 15 +++++++++++++++ 5 files changed, 48 insertions(+) create mode 100644 tests/renegotiation_test.bat create mode 100755 tests/renegotiation_test.sh diff --git a/.gitignore b/.gitignore index 9a562e70c1..aedfede24c 100644 --- a/.gitignore +++ b/.gitignore @@ -120,6 +120,7 @@ tests/mlkem* tests/mont* tests/parse* tests/policy* +tests/renegotiation_test* tests/rfc3779* tests/rfc5280time* tests/ssl_get_shared_ciphers* diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f4fd85dd6c..fde5406d7d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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 $) +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}) diff --git a/tests/Makefile.am b/tests/Makefile.am index eeac7e19fd..f3414f6508 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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) diff --git a/tests/renegotiation_test.bat b/tests/renegotiation_test.bat new file mode 100644 index 0000000000..00860463cf --- /dev/null +++ b/tests/renegotiation_test.bat @@ -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 diff --git a/tests/renegotiation_test.sh b/tests/renegotiation_test.sh new file mode 100755 index 0000000000..bbf27c83c2 --- /dev/null +++ b/tests/renegotiation_test.sh @@ -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