From 350170b6abb3a6e566dd95791c5c0f2d8866e7e1 Mon Sep 17 00:00:00 2001 From: kinichiro Date: Sat, 11 Mar 2017 22:27:09 +0900 Subject: [PATCH] Add regress servertest --- tests/CMakeLists.txt | 10 ++++++++++ tests/Makefile.am | 6 ++++++ tests/servertest.bat | 17 +++++++++++++++++ tests/servertest.sh | 13 +++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 tests/servertest.bat create mode 100755 tests/servertest.sh diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 91dc99a..07444d0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -292,6 +292,16 @@ add_executable(rsa_test rsa_test.c) target_link_libraries(rsa_test ${TESTS_LIBS}) add_test(rsa_test rsa_test) +# servertest +add_executable(servertest servertest.c) +target_link_libraries(servertest ${TESTS_LIBS}) +if(NOT MSVC) + add_test(servertest ${CMAKE_CURRENT_SOURCE_DIR}/servertest.sh) +else() + add_test(servertest ${CMAKE_CURRENT_SOURCE_DIR}/servertest.bat) +endif() +set_tests_properties(servertest PROPERTIES ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR}") + # sha1test add_executable(sha1test sha1test.c) target_link_libraries(sha1test ${TESTS_LIBS}) diff --git a/tests/Makefile.am b/tests/Makefile.am index 7c61203..a071dff 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -294,6 +294,12 @@ TESTS += rsa_test check_PROGRAMS += rsa_test rsa_test_SOURCES = rsa_test.c +# servertest +TESTS += servertest.sh +check_PROGRAMS += servertest +servertest_SOURCES = servertest.c +EXTRA_DIST += servertest.sh servertest.bat + # sha1test TESTS += sha1test check_PROGRAMS += sha1test diff --git a/tests/servertest.bat b/tests/servertest.bat new file mode 100644 index 0000000..d3dd178 --- /dev/null +++ b/tests/servertest.bat @@ -0,0 +1,17 @@ +@echo off +setlocal enabledelayedexpansion +REM servertest.bat + +set servertest_bin=Debug\servertest.exe +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 +) + +endlocal diff --git a/tests/servertest.sh b/tests/servertest.sh new file mode 100755 index 0000000..f1efeb0 --- /dev/null +++ b/tests/servertest.sh @@ -0,0 +1,13 @@ +#!/bin/sh +set -e + +servertest_bin=./servertest +if [ -e ./servertest.exe ]; then + servertest_bin=./servertest.exe +fi + +if [ -z $srcdir ]; then + srcdir=. +fi + +$servertest_bin $srcdir/server.pem $srcdir/server.pem $srcdir/ca.pem