X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=host%2Fshavs_test.rb;h=225c38133b0907b8723582865490f87885c18f1d;hb=600e82c981df8a6e446c6469e7e6be627ec027de;hp=1ce86fbcd69686c9ece0f3183161e29cc564e439;hpb=4147d732efd04605764a2820d4478f33a0cdf1fa;p=avr-crypto-lib.git diff --git a/host/shavs_test.rb b/host/shavs_test.rb index 1ce86fb..225c381 100644 --- a/host/shavs_test.rb +++ b/host/shavs_test.rb @@ -25,16 +25,19 @@ require 'serialport' def init_system sleep 1 $sp.print("echo off \r") + print("DBG i: " + "echo off \r"+"\n") if $debug # line = $sp.readlines() # print("DBG 0.0: ") # print(line) # sleep 1 $sp.print("shavs_set #{$algo_select} \r") + print("DBG i: " + "shavs_set #{$algo_select} \r"+"\n") if $debug # line = $sp.readlines() # print("DBG 0.1: ") # print(line) # sleep 1 $sp.print("shavs_test1 \r") + print("DBG i: " + "shavs_test1 \r"+"\n") if $debug # line = $sp.readlines() # print("DBG 0.2: ") # print(line) @@ -52,15 +55,16 @@ end def send_md(md_string) for i in 0..md_string.length-1 $sp.print(md_string[i].chr) -# print(md_string[i].chr) +# print("DBG s: "+ md_string[i].chr) if $debug if(i%20==19) - sleep(0.1) +# sleep(0.1) end end end def run_test(filename) errors = 0 + line=1 if not File.exist?(filename) puts("ERROR file "+filename+" does not exist!") end @@ -88,7 +92,8 @@ def run_test(filename) b = (/[\s]*MD[\s]*=[\s]*([0-9a-fA-F]*).*/.match(avr_md))[1]; a.upcase! b.upcase! - puts("") if (pos%$linewidth==0 and $linewidth!=0) + printf("\n%4d: ", line) if (pos%$linewidth==0 and $linewidth!=0) + line += 1 if (pos%$linewidth==0 and $linewidth!=0) #putc((a==b)?'*':'!') if(a==b) putc('*') @@ -128,9 +133,9 @@ init_system() for i in (5..(ARGV.size-1)) errors = run_test(ARGV[i]) if errors == 0 - puts("[ok]") + puts("\n[ok]") else - puts("[errors: "+errors.to_s+"]") + puts("\n[errors: "+errors.to_s+"]") end end $sp.print("EXIT\r");