Skip to content

Commit

Permalink
Add shutdowntest to build
Browse files Browse the repository at this point in the history
  • Loading branch information
botovq committed Jan 19, 2024
1 parent dcd0473 commit 267dada
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,17 @@ add_executable(sha_test sha_test.c)
target_link_libraries(sha_test ${OPENSSL_TEST_LIBS})
add_test(sha_test sha_test)

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

# signertest
if(NOT CMAKE_SYSTEM_NAME MATCHES "WindowsStore")
set(SIGNERTEST_SRC signertest.c)
Expand Down
6 changes: 6 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,12 @@ TESTS += sha_test
check_PROGRAMS += sha_test
sha_test_SOURCES = sha_test.c

# shutdowntest
TESTS += shutdowntest.sh
check_PROGRAMS += shutdowntest
shutdowntest_SOURCES = shutdowntest.c
EXTRA_DIST += shutdowntest.sh shutdowntest.bat

# signertest
TESTS += signertest
check_PROGRAMS += signertest
Expand Down
14 changes: 14 additions & 0 deletions tests/shutdowntest.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@echo off
setlocal enabledelayedexpansion
REM shutdowntest.bat

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

%shutdowntest_bin% %srcdir%\server.pem %srcdir%\server.pem %srcdir%\ca.pem
if !errorlevel! neq 0 (
exit /b 1
)

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

shutdowntest_bin=./shutdowntest
if [ -e ./shutdowntest.exe ]; then
shutdowntest_bin=./shutdowntest.exe
fi

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

$shutdowntest_bin $srcdir/server.pem $srcdir/server.pem $srcdir/ca.pem

0 comments on commit 267dada

Please sign in to comment.