]> www.wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
tcl_tests: Integrate TCL tests into build system
authorVitaly Chikunov <vt@altlinux.org>
Sun, 10 Nov 2019 02:05:31 +0000 (05:05 +0300)
committerDmitry Belyavskiy <beldmit@users.noreply.github.com>
Sat, 11 Jan 2020 21:20:37 +0000 (00:20 +0300)
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.

CMakeLists.txt
tcl_tests/openssl-gost.cnf [new file with mode: 0644]
tcl_tests/runtest.sh
tcl_tests/test.tcl

index 407302b452dc500a7891b8f63e12f775c0eb6393..36613f1c74b07331b86a4cfb8fbaae05a3618c6a 100644 (file)
@@ -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 (file)
index 0000000..6fd5305
--- /dev/null
@@ -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
index 11fdedad284b14a88fdb233b41dd4de68308da0d..c3fc81200c976a6be9f4581e2a00d70ef6c24bdf 100644 (file)
@@ -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 
index cf7c2b7121cc56e6bcf3ef2cb481aa666097a8e1..e281f1a729c3d5c26c0d006fbbbdc502e50957b9 100644 (file)
@@ -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"]
        }
        #
        # Вызывается при пропуске теста