From: Vitaly Chikunov Date: Sun, 10 Nov 2019 02:05:31 +0000 (+0300) Subject: tcl_tests: Integrate TCL tests into build system X-Git-Tag: v3.0.0~254 X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=46da0131e71906a5ec206a0c2b7fb60f74bb6844;p=openssl-gost%2Fengine.git tcl_tests: Integrate TCL tests into build system Run `make tcl_tests' to run the tests. Tests report success state to make. Tests aren't run by default because of too many failures, yet. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 407302b..36613f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -236,6 +236,10 @@ add_custom_target(tags COMMAND ctags -R . ${OPENSSL_ROOT_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +add_custom_target(tcl_tests + COMMAND ENGINE_DIR=${OUTPUT_DIRECTORY} sh ./runtest.sh + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tcl_tests) + add_executable(test_tlstree test_tlstree.c) target_link_libraries(test_tlstree PUBLIC ${OPENSSL_CRYPTO_LIBRARY}) diff --git a/tcl_tests/openssl-gost.cnf b/tcl_tests/openssl-gost.cnf new file mode 100644 index 0000000..6fd5305 --- /dev/null +++ b/tcl_tests/openssl-gost.cnf @@ -0,0 +1,11 @@ +openssl_conf = openssl_def + +[openssl_def] +engines = engine_section + +[engine_section] +gost = gost_section + +[gost_section] +engine_id = gost +default_algorithms = ALL diff --git a/tcl_tests/runtest.sh b/tcl_tests/runtest.sh index 11fdeda..c3fc812 100644 --- a/tcl_tests/runtest.sh +++ b/tcl_tests/runtest.sh @@ -23,6 +23,7 @@ CRYPTOPACK_MAIN_VERSION=3 +: ${OPENSSL_APP:=$(which openssl 2>/dev/null)} if [ -z "$OPENSSL_APP" ]; then if [ "$OS" != "Windows NT" -a "$OS" != "Windows_NT" ]; then if [ -x /opt/cryptopack$CRYPTOPACK_MAIN_VERSION/bin/openssl ]; then @@ -43,7 +44,7 @@ else echo "Using $OPENSSL_APP as openssl" fi - +: ${TCLSH:=$(which tclsh)} if [ -z "$TCLSH" ]; then for version in "" 8.4 84 8.5 85 8.6 86; do for command in tclsh$version; do @@ -86,6 +87,7 @@ case "$ENGINE_NAME" in OTHER_DIR=`echo $TESTDIR |sed 's/cryptocom/gost/'` ;; gost) + BASE_TESTS="engine dgst mac pkcs8 enc req-genpkey req-newkey ca smime smime2 smimeenc cms cms2 cmsenc pkcs12 nopath ocsp ts ssl smime_io cms_io smimeenc_io cmsenc_io" OTHER_DIR=`echo $TESTDIR |sed 's/gost/cryptocom/'` ;; *) @@ -107,8 +109,10 @@ for t in $BASE_TESTS; do $TCLSH $t.try || fail=1 done -ALG_LIST="rsa:1024 gost2001:XA gost2012_256:XA gost2012_512:A" OPENSSL_CONF=`pwd`/openssl-gost.cnf $TCLSH ssl.try -clientconf `pwd`/openssl-cryptocom.cnf || fail=1 -ALG_LIST="rsa:1024 gost2001:XA gost2012_256:XA gost2012_512:A" OPENSSL_CONF=`pwd`/openssl-gost.cnf $TCLSH ssl.try -serverconf `pwd`/openssl-cryptocom.cnf || fail=1 +if false; then # ignore some tests for a time +: ${OPENSSL_CONF:=$PWD/openssl-gost.cnf} +ALG_LIST="rsa:1024 gost2001:XA gost2012_256:XA gost2012_512:A" $TCLSH ssl.try -clientconf $OPENSSL_CONF || fail=1 +ALG_LIST="rsa:1024 gost2001:XA gost2012_256:XA gost2012_512:A" $TCLSH ssl.try -serverconf $OPENSSL_CONF || fail=1 for t in $PKCS7_COMPATIBILITY_TESTS; do $TCLSH $t.try || fail=1 @@ -146,6 +150,7 @@ if [ -d OtherVersion ] ; then exit 1; esac fi +fi # false $TCLSH calcstat ${TESTDIR}/stats ${TESTDIR}/test.result grep "leaked" ${TESTDIR}/*.log if [ $fail -ne 0 ]; then diff --git a/tcl_tests/test.tcl b/tcl_tests/test.tcl index cf7c2b7..e281f1a 100644 --- a/tcl_tests/test.tcl +++ b/tcl_tests/test.tcl @@ -117,7 +117,10 @@ namespace eval test { if [info exists $file] {puts [test_log] "Deleting $file" file delete $file} } - } + } { + # signal to a caller that we had failures + exit 1 + } } # # Вовзращает идентификатор канала, куда пишется лог тестов. @@ -282,7 +285,7 @@ proc rus {string} { puts -nonewline [rus [format "Тест%5d: %-60s:" $no [string range $testname 0 59]]] flush stdout set curtest $testname - log [rus "Тест $no: $testname start"] + log [rus "\n\nТест $no: $testname start"] } # # Вызывается при пропуске теста