--- a/bintools/evalid/EvalidCompare.pm Tue Nov 02 09:31:04 2010 +0800
+++ b/bintools/evalid/EvalidCompare.pm Wed Nov 10 14:19:09 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
--- a/bintools/evalid/EvalidCompare.pm.bak Tue Nov 02 09:31:04 2010 +0800
+++ b/bintools/evalid/EvalidCompare.pm.bak Wed Nov 10 14:19:09 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
--- a/bintools/evalid/evalid.pl Tue Nov 02 09:31:04 2010 +0800
+++ b/bintools/evalid/evalid.pl Wed Nov 10 14:19:09 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 <logfile> -- append results to <logfile>
+ -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);
Binary file bintools/evalid/left/fail/Image_file/rofs.img has changed
Binary file bintools/evalid/left/ok/Image_file/rofs.img has changed
Binary file bintools/evalid/right/fail/Image_file/rofs.img has changed
Binary file bintools/evalid/right/ok/Image_file/rofs.img has changed