aboutsummaryrefslogtreecommitdiff
path: root/tcl_tests
diff options
context:
space:
mode:
authorVitaly Chikunov <vt@altlinux.org>2019-11-10 05:05:31 +0300
committerDmitry Belyavskiy <beldmit@users.noreply.github.com>2020-01-12 00:20:37 +0300
commit46da0131e71906a5ec206a0c2b7fb60f74bb6844 (patch)
tree8b9c56a1f20e4da459e7af46c29b490f9350c198 /tcl_tests
parentb0f5bce10dcc05198e2e58ee08e1cc3dcd3d1aea (diff)
downloadgost-engine-46da0131e71906a5ec206a0c2b7fb60f74bb6844.zip
gost-engine-46da0131e71906a5ec206a0c2b7fb60f74bb6844.tar.gz
gost-engine-46da0131e71906a5ec206a0c2b7fb60f74bb6844.tar.bz2
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.
Diffstat (limited to 'tcl_tests')
-rw-r--r--tcl_tests/openssl-gost.cnf11
-rw-r--r--tcl_tests/runtest.sh11
-rw-r--r--tcl_tests/test.tcl7
3 files changed, 24 insertions, 5 deletions
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"]
}
#
# Вызывается при пропуске теста