X-Git-Url: http://www.wagner.pp.ru/gitweb/?a=blobdiff_plain;f=tcl_tests%2Ftest.tcl;h=276db7eb897ae0185205b758b9c7ba901157ac2f;hb=HEAD;hp=8e2b45a7556b7f4e6c233b6aa4adae952ad6ed1d;hpb=3b8ddfe2f303b8931842e52bdb5c07c97042f651;p=openssl-gost%2Fengine.git diff --git a/tcl_tests/test.tcl b/tcl_tests/test.tcl index 8e2b45a..276db7e 100644 --- a/tcl_tests/test.tcl +++ b/tcl_tests/test.tcl @@ -1,4 +1,3 @@ -# -*- coding: cp1251 -*- # Установка номера тестового ПРА namespace eval vizir { @@ -109,7 +108,7 @@ namespace eval test { } set test_id [file rootname [file tail [info script]]]$suffix set stat [open "stats" a] - fconfigure $stat -encoding cp1251 + fconfigure $stat -encoding utf-8 puts $stat [list $test_id [rus $t_name] $no $ok $failed $p_skip $c_skip] close $stat if {!$failed} { @@ -118,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 + } } # # Вовзращает идентификатор канала, куда пишется лог тестов. @@ -196,7 +198,8 @@ namespace eval test { set timestamp "$teststart+[expr $testend-$teststart]" } } - if {$status!=$exitStatus || ($status==1?![regexp --\ + if {($exitStatus!=-1 && $status!=$exitStatus) || + ($exitStatus!=0?![regexp --\ [rus $expectedResult] $result]:([info exists opts(-time)]?\ ![listcompare $result $expectedResult $opts(-time)]:\ [string compare "$result" "$expectedResult"]))} { @@ -263,21 +266,8 @@ proc listcompare {list1 list2 time} { } return 1 } -# Перекодирует строку из кодировки скрипта (assumed 1251) -# в текущую системную - -if {[encoding system] == "utf-8" } { - proc rus {string} { - return [encoding convertfrom cp1251 $string] -} - -} else { - -proc rus {string} " - return \[encoding convertfrom cp1251 \[encoding convertto [encoding system] \$string\]\] -" - + return $string } # # Пишет строку в лог @@ -296,7 +286,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"] } # # Вызывается при пропуске теста