]> www.wagner.pp.ru Git - openssl-gost/engine.git/blob - tcl_tests/calchash.tcl
tcl_tests: Add TCL tests files
[openssl-gost/engine.git] / tcl_tests / calchash.tcl
1 #!/usr/bin/tclsh
2 # -*- coding: cp1251 -*-
3 lappend auto_path [file dirname [info script]]
4 package require test
5
6 if {$::tcl_platform(platform) eq "windows"} {
7         set prefix {//laputa/dist/magpro/FSB_CryptoPack_21.1/binaries}
8 } else {
9         set prefix {/net/laputa/pub/magpro/FSB_CryptoPack_21.1/binaries}
10 }
11 set PREFIX_ENV_NAME CALCHASH_PREFIX
12 if {$argc != 1} {
13         puts stderr "Usage $argv0 path"
14         puts stderr "This script tests programms prefix/path/calchach and prefix/path/gostsum."
15         puts stderr "Defauld prefix is $prefix"
16         puts stderr "Prefix can be changes by envirament veriable $PREFIX_ENV_NAME"
17         exit 1
18 }
19
20 if {[info exist env($PREFIX_ENV_NAME)]} {
21         set prefix $env($PREFIX_ENV_NAME)
22 }
23 set path [lindex $argv 0]
24
25 set testdir [exec hostname]-hashes
26 puts $testdir
27 catch {file delete -force $testdir}
28 file mkdir $testdir
29 cd $testdir
30
31 start_tests "Тесты для программ calchash и gostsum"
32
33 test -createsfiles dgst.dat "calchash" {
34         makeFile dgst.dat [string repeat "Test data to digest.\n" 100] binary
35         string match *DB9232D96CAE7AABA817350EF6CF4C25604D8FD36965F78CEB3CE59FD31CCB2A [exec $prefix/$path/calchash dgst.dat]
36 } 0 1 
37
38 test -platform unix "gostsum (paramset cryptopro-A)" {
39         exec $prefix/$path/gostsum dgst.dat
40 } 0 "5c8621c036f8636fa3ea711a78e5051f607c87b4b715482af74b2b1cce62e442 dgst.dat" 
41
42
43 test -platform unix "gostsum -t (paramset test)" {
44         exec $prefix/$path/gostsum -t dgst.dat
45 } 0 "db9232d96cae7aaba817350ef6cf4c25604d8fd36965f78ceb3ce59fd31ccb2a dgst.dat" 
46
47
48 end_tests