X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=host%2Fnessie_check.rb;h=cea8925e31438c8295f1b01ab5c89279d0677d13;hb=d72d6fbe7abbd26958657c877bc0a3dbef8148ce;hp=56bd17be50da837a7385a1df8989dcaf8b8c8c62;hpb=2dc047a070be7f0d64f4d4e7f4296a9650af07dc;p=avr-crypto-lib.git diff --git a/host/nessie_check.rb b/host/nessie_check.rb index 56bd17b..cea8925 100644 --- a/host/nessie_check.rb +++ b/host/nessie_check.rb @@ -1,4 +1,4 @@ -#!/usr/bin/ruby +#!/usr/bin/ruby # nessie_check.rb =begin This file is part of the AVR-Crypto-Lib. @@ -18,18 +18,24 @@ along with this program. If not, see . =end +$debug = true + def skip_header(file) begin l = file.gets().strip + l = '' if !l end until /[*]{10,}.*/.match(l) begin l = file.gets().strip + l = '' if !l end until /[*]{10,}.*/.match(l) begin l = file.gets().strip + l = '' if !l end until /[=]{5,}.*/.match(l) begin l = file.gets().strip + l = '' if !l end until /[=]{5,}.*/.match(l) end @@ -47,7 +53,7 @@ def get_next_assign(file, i) return nil if file.eof l = file.gets().strip() if not /[^=]+=[^=]+/.match(l) - value += l if /[0-9A-Fa-f]{5}/.match(l) + value += l if /^[0-9A-Fa-f]{5}/.match(l) end end until /[^=]+=[^=]+/.match(l) $last_assign[i] = l @@ -59,7 +65,7 @@ def get_next_assign(file, i) return nil if file.eof l = file.gets().strip() if not /[^=]+=[^=]+/.match(l) - value += l if /[0-9A-Fa-f]{5}/.match(l) + value += l if /^[0-9A-Fa-f]{5}/.match(l) end end until /[^=]+=[^=]+/.match(l) $last_assign[i] = l @@ -84,10 +90,10 @@ def compare(fname1, fname2) pos +=1 end if(a!=b and a!=nil and b!=nil) - $error = 1 - puts("a key: "+a[0]+" value: "+a[1]) - puts("b key: "+b[0]+" value: "+b[1]) - end + $error += 1 + puts("a key: "+a[0]+" value: "+a[1]) if $debug + puts("b key: "+b[0]+" value: "+b[1]) if $debug + end end until a==nil or b==nil end @@ -109,12 +115,16 @@ if ARGV.size==3 $quiet=true end else - f1 = ARGV[1] - f2 = ARGV[2] + f1 = ARGV[0] + f2 = ARGV[1] end - + puts("compare("+f1+", "+f2+")") compare(f1, f2) -puts($error==0?"[ok]":"[failed]") +if $error!=0 + puts("[failed] ("+$error.to_s()+")") +else + puts("[ok]") +end exit($error)