# HG changeset patch # User lorewang # Date 1289454550 -28800 # Node ID 85cca48b42934e795dfdb5ca41139afb791cb2ad # Parent 02e65118a7464687859e46c2a6d2572d0118a245# Parent f0d451bf8bcb7ec10fe4525b1cf086c97ffde8ee merge after pull diff -r 02e65118a746 -r 85cca48b4293 bintools/evalid/EvalidCompare.pm --- a/bintools/evalid/EvalidCompare.pm Tue Nov 09 17:18:57 2010 +0800 +++ b/bintools/evalid/EvalidCompare.pm Thu Nov 11 13:49:10 2010 +0800 @@ -62,7 +62,8 @@ 'Unknown library' => 'identical', 'chm file' => 'chm_file', 'Header file' => 'header', - 'Distribution Policy' => 'distpol' + 'Distribution Policy' => 'distpol', + 'Rofs image' => 'img' ); @@ -83,7 +84,8 @@ ignore => {filter => \&FilterAll}, chm_file => {expandor => 'hh -decompile %TEMPDIR% %FILE%', rawretry => 1}, header => {filter => \&FilterCVSTags}, - distpol => {filter => \&DistributionPolicyFilter} + distpol => {filter => \&DistributionPolicyFilter}, + img => {expandor => 'readimage -z %TEMPDIR% %FILE%', rawretry => 1} ); @@ -93,6 +95,7 @@ my $log; my $verbose; +my $keepgoing; my $toRoot; my $dumpDir; @@ -108,6 +111,8 @@ my $file2 = shift; $verbose = defined($_[0]) ? shift : 0; $log = defined($_[0]) ? shift : *STDOUT; + $keepgoing = defined($_[0]) ? shift : 0; + # Try binary compare first (to keep semantics the same as evalid)... if (DoCompareFiles($file1, $file2, 'unknown format')) { return 1,'identical'; @@ -354,6 +359,11 @@ return "chm file"; } + if ($typeBuf =~/^(ROFS|ROFx)/) { + # img file + return "Rofs image"; + } + if ($file =~ m/\.(iby|h|hby|hrh|oby|rsg|cpp)$/i) { return "Header file"; } @@ -811,34 +821,62 @@ }, $tempdir2; #Work out the if the two file lists are different + my @tmpfiles; foreach my $file (sort keys %iFileList1) { if (! defined $iFileList2{$file}) { # If the filename does not exist in the second filelist the compressed files cannot be the same. print ($log "Did not find $file in $file2\n") if ($verbose); - return 0; + if(!$keepgoing){ + return 0; + }else{ + push @tmpfiles, $file; + } } else { delete $iFileList2{$file} } } + foreach my $file (@tmpfiles) + { + delete $iFileList1{$file}; + } # There are extra files in the second compressed file therefore the compressed files cannot be the same. if (scalar(keys %iFileList2) > 0) { print ($log "$file2 contained more files than $file1\n") if ($verbose); - return 0; + if (!$keepgoing){ + return 0; + }else{ + foreach my $file (sort keys %iFileList2){ + print ($log "Dig not find $file in $file1\n") if ($verbose); + } + } } print($log "Comparing content\n") if ($verbose); #filelist1 and filelist2 contain all the same filenames, now compare the contents of each file - my $same = -1; # Variable to store collated result of comparison, assume an error + my $same = 1; # Variable to store collated result of comparison, assume an error foreach my $file (keys %iFileList1) { - my $type; - ($same, $type) = CompareFiles($tempdir1.$file,$tempdir2.$file, $verbose, $log); + my $tmpsame; + my $type; + ($tmpsame, $type) = CompareFiles($tempdir1.$file,$tempdir2.$file, $verbose, $log, $keepgoing); print ($log "Comparing $tempdir1.$file against $tempdir2.$file\n") if ($verbose); - last if ($same == 0); # do not bother comparing more files if one of the expanded files is different. + if (!$keepgoing){ + if ($tmpsame == 0){ # do not bother comparing more files if one of the expanded files is different. + $same = 0; + last; + } + }else{ + if ($tmpsame == 0){ + print ($log "Failed\n\n") if ($verbose); + $same = 0; + }else{ + print ($log "OK\n\n") if ($verbose); + } + } } #Cleanup the temporary directories diff -r 02e65118a746 -r 85cca48b4293 bintools/evalid/EvalidCompare.pm.bak --- a/bintools/evalid/EvalidCompare.pm.bak Tue Nov 09 17:18:57 2010 +0800 +++ b/bintools/evalid/EvalidCompare.pm.bak Thu Nov 11 13:49:10 2010 +0800 @@ -62,7 +62,8 @@ 'Unknown library' => 'identical', 'chm file' => 'chm_file', 'Header file' => 'header', - 'Distribution Policy' => 'distpol' + 'Distribution Policy' => 'distpol', + 'Rofs image' => 'img' ); @@ -83,7 +84,8 @@ ignore => {filter => \&FilterAll}, chm_file => {expandor => 'hh -decompile %TEMPDIR% %FILE%', rawretry => 1}, header => {filter => \&FilterCVSTags}, - distpol => {filter => \&DistributionPolicyFilter} + distpol => {filter => \&DistributionPolicyFilter}, + img => {expandor => 'readimage -z %TEMPDIR% %FILE%', rawretry => 1} ); @@ -93,6 +95,7 @@ my $log; my $verbose; +my $keepgoing; my $toRoot; my $dumpDir; @@ -108,6 +111,8 @@ my $file2 = shift; $verbose = defined($_[0]) ? shift : 0; $log = defined($_[0]) ? shift : *STDOUT; + $keepgoing = defined($_[0]) ? shift : 0; + # Try binary compare first (to keep semantics the same as evalid)... if (DoCompareFiles($file1, $file2, 'unknown format')) { return 1,'identical'; @@ -240,7 +245,7 @@ open (FILE, $file) or die "Error: Couldn't open \"$file\" for reading: $!\n"; binmode (FILE); - while ($typeBuf =~ /^.{48}([0-9 ]{9})\x60\x0A(......)/s) { + while ($typeBuf =~ /^.{48}([0-9 ]{9}).\x60\x0A(......)/s) { # $1 is the size of the archive member, $2 is first 6 bytes of the file # There may be several different sorts of file in the archive, and we # need to scan through until we find a type we recognize: @@ -354,6 +359,11 @@ return "chm file"; } + if ($typeBuf =~/^(ROFS|ROFx)/) { + # img file + return "Rofs image"; + } + if ($file =~ m/\.(iby|h|hby|hrh|oby|rsg|cpp)$/i) { return "Header file"; } @@ -811,34 +821,62 @@ }, $tempdir2; #Work out the if the two file lists are different + my @tmpfiles; foreach my $file (sort keys %iFileList1) { if (! defined $iFileList2{$file}) { # If the filename does not exist in the second filelist the compressed files cannot be the same. print ($log "Did not find $file in $file2\n") if ($verbose); - return 0; + if(!$keepgoing){ + return 0; + }else{ + push @tmpfiles, $file; + } } else { delete $iFileList2{$file} } } + foreach my $file (@tmpfiles) + { + delete $iFileList1{$file}; + } # There are extra files in the second compressed file therefore the compressed files cannot be the same. if (scalar(keys %iFileList2) > 0) { print ($log "$file2 contained more files than $file1\n") if ($verbose); - return 0; + if (!$keepgoing){ + return 0; + }else{ + foreach my $file (sort keys %iFileList2){ + print ($log "Dig not find $file in $file1\n") if ($verbose); + } + } } print($log "Comparing content\n") if ($verbose); #filelist1 and filelist2 contain all the same filenames, now compare the contents of each file - my $same = -1; # Variable to store collated result of comparison, assume an error + my $same = 1; # Variable to store collated result of comparison, assume an error foreach my $file (keys %iFileList1) { - my $type; - ($same, $type) = CompareFiles($tempdir1.$file,$tempdir2.$file, $verbose, $log); - print ($log "Comparing $tempdir1.$file against $tempdir2.$file\n") if ($verbose); - last if ($same == 0); # do not bother comparing more files if one of the expanded files is different. + my $tmpsame; + my $type; + ($tmpsame, $type) = CompareFiles($tempdir1.$file,$tempdir2.$file, $verbose, $log, $keepgoing); + print ($log "Comparing $tempdir1.$file against $tempdir2.$file, $tmpsame, $keepgoing\n") if ($verbose); + if (!$keepgoing){ + if ($tmpsame == 0){ # do not bother comparing more files if one of the expanded files is different. + $same = 0; + last; + } + }else{ + if ($tmpsame == 0){ + print ($log "Failed\n\n") if ($verbose); + $same = 0; + }else{ + print ($log "OK\n\n") if ($verbose); + } + } } #Cleanup the temporary directories diff -r 02e65118a746 -r 85cca48b4293 bintools/evalid/evalid.pl --- a/bintools/evalid/evalid.pl Tue Nov 09 17:18:57 2010 +0800 +++ b/bintools/evalid/evalid.pl Thu Nov 11 13:49:10 2010 +0800 @@ -27,13 +27,14 @@ my $passed=0; my $failed=0; -GetOptions("c", "v", "l=s", "g", "f", "m", "u", "x=s@", "i=s@", "d=s"); +GetOptions("c", "v", "l=s", "k", "g", "f", "m", "u", "x=s@", "i=s@", "d=s"); $opt_v = $opt_v; # To keep -w quiet. $opt_g = $opt_g; # To keep -w quiet. $opt_f = $opt_f; # To keep -w quiet. $opt_m = $opt_m; # To keep -w quiet. $opt_u = $opt_u; # To keep -w quiet. $opt_d = $opt_d; # To keep -w quiet. +$opt_k = $opt_k; # To keep -w quiet. unless ((@ARGV > 1) && (@ARGV < 4)) { @@ -61,6 +62,7 @@ -v -- verbose information about failed comparisons -c -- print results to standard output -l -- append results to + -k -- keep going The default is equivalent to "-l evalid.lis" @@ -311,7 +313,7 @@ return; } - my ($same, $type) = EvalidCompare::CompareFiles($left, $right, $opt_v, $log); + my ($same, $type) = EvalidCompare::CompareFiles($left, $right, $opt_v, $log, $opt_k); if ($same) { identical($left, $right, $type); diff -r 02e65118a746 -r 85cca48b4293 bintools/evalid/evalid.txt --- a/bintools/evalid/evalid.txt Tue Nov 09 17:18:57 2010 +0800 +++ b/bintools/evalid/evalid.txt Thu Nov 11 13:49:10 2010 +0800 @@ -238,3 +238,18 @@ When using the MD5 comparing functionality EVALID processes the contents of the temporary directory using the standard EVALID process but amalgamates the results in to one MD5 signiture. + +-------- +(ROFS IMAGE file) + +EVALID applies "readimage -z" to each file expanding it to a temporary directory and then compares +the contents of the temporary directory using the following process: + +When directly comparing two Rofs image files EVALID will first compare the file listing of the temporary +directories and return failed if the file listing is not identical. +If the file listing are identical it will then compare the contents of the two temporary directories +using the normal EVALID process. + +When "-k" (keepgoing) option is specified, EVALID will first compare the file listing. If "-v" option sepcified, +list the files which do not exist in both directories. Then it will compare the contents of the directories. +If "-v" option specified, it will report the result for every file in the directories. diff -r 02e65118a746 -r 85cca48b4293 bintools/evalid/left/fail/Image_file/rofs.img Binary file bintools/evalid/left/fail/Image_file/rofs.img has changed diff -r 02e65118a746 -r 85cca48b4293 bintools/evalid/left/ok/Image_file/rofs.img Binary file bintools/evalid/left/ok/Image_file/rofs.img has changed diff -r 02e65118a746 -r 85cca48b4293 bintools/evalid/right/fail/Image_file/rofs.img Binary file bintools/evalid/right/fail/Image_file/rofs.img has changed diff -r 02e65118a746 -r 85cca48b4293 bintools/evalid/right/ok/Image_file/rofs.img Binary file bintools/evalid/right/ok/Image_file/rofs.img has changed diff -r 02e65118a746 -r 85cca48b4293 bintools/evalid/tools_evalid.history.xml --- a/bintools/evalid/tools_evalid.history.xml Tue Nov 09 17:18:57 2010 +0800 +++ b/bintools/evalid/tools_evalid.history.xml Thu Nov 11 13:49:10 2010 +0800 @@ -19,6 +19,10 @@ + + EVALID : add Rofs image file comparison support + + EVALID : evalid not so happy identifying libs created by new mwldsym2.exe diff -r 02e65118a746 -r 85cca48b4293 bintools/evalid/tools_evalid.history.xml.bak --- a/bintools/evalid/tools_evalid.history.xml.bak Tue Nov 09 17:18:57 2010 +0800 +++ b/bintools/evalid/tools_evalid.history.xml.bak Thu Nov 11 13:49:10 2010 +0800 @@ -18,6 +18,14 @@ + + + EVALID : add Rofs image file comparison support + + + + EVALID : evalid not so happy identifying libs created by new mwldsym2.exe + EVALID : x86 static library comparisons sometimes fail when they shouldn't