]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - host/shavs_test.rb
new makefile and modified build process
[avr-crypto-lib.git] / host / shavs_test.rb
index 225c38133b0907b8723582865490f87885c18f1d..4c8589dc902938b5926bfb7fda3e036c5dea5a68 100644 (file)
@@ -2,7 +2,7 @@
 # shavs_test.rb
 =begin
     This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2008  Daniel Otte (daniel.otte@rub.de)
+    Copyright (C) 2008, 2009  Daniel Otte (daniel.otte@rub.de)
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -18,7 +18,8 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 =end
 
-$debug = false
+$debug = true;
+$debug = false;
 require 'rubygems'
 require 'serialport'
 
@@ -57,7 +58,7 @@ def send_md(md_string)
     $sp.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
@@ -71,6 +72,7 @@ def run_test(filename)
   pos = 0
   file = File.new(filename, "r");
   until file.eof
+    sleep(0.5)
     begin
       lb=file.gets()
     end while not (file.eof or (/[\s]*Len[\s]*=.*/.match(lb)))
@@ -92,13 +94,14 @@ def run_test(filename)
        b = (/[\s]*MD[\s]*=[\s]*([0-9a-fA-F]*).*/.match(avr_md))[1];
        a.upcase!
        b.upcase!
-       printf("\n%4d: ", line) if (pos%$linewidth==0 and $linewidth!=0)
+       printf("\n%4d (%4d): ", line, (line-1)*$linewidth) if (pos%$linewidth==0 and $linewidth!=0)
        line += 1               if (pos%$linewidth==0 and $linewidth!=0)
        #putc((a==b)?'*':'!')
        if(a==b)
          putc('*')
        else
          putc('!')
+       #  printf("\nshould: %s\ngot:   %s\n",lb,avr_md)
          errors += 1;
        end  
        pos += 1
@@ -130,6 +133,7 @@ $algo_select = ARGV[4]
 
 init_system()
 
+errors = 0
 for i in (5..(ARGV.size-1))
   errors = run_test(ARGV[i])
   if errors == 0