merge after pull
authorlorewang
Thu, 11 Nov 2010 13:49:10 +0800
changeset 679 85cca48b4293
parent 675 02e65118a746 (current diff)
parent 678 f0d451bf8bcb (diff)
child 680 e4701f5f5159
merge after pull
--- 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
--- 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
--- 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 <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);
--- 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.
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
--- 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 @@
   <purpose>
   </purpose>
 	
+	<feature title="Rofs image comparison" revision="009">
+     EVALID : add Rofs image file comparison support
+  </feature>
+
 	<defect number="Bug 2413" title="evalid not so happy identifying libs created by new mwldsym2.exe" revision="008">
      EVALID : evalid not so happy identifying libs created by new mwldsym2.exe
   </defect>
--- 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 @@
 <relnotes name="EVALID">
   <purpose>
   </purpose>
+	
+	<feature title="Rofs image comparison" revision="008">
+     EVALID : add Rofs image file comparison support
+  </feature>
+
+	<defect number="Bug 2413" title="evalid not so happy identifying libs created by new mwldsym2.exe" revision="008">
+     EVALID : evalid not so happy identifying libs created by new mwldsym2.exe
+  </defect>
 
   <defect number="DEF120580" title="EVALID : x86 static library comparisons sometimes fail when they shouldn't" revision="007">
      EVALID : x86 static library comparisons sometimes fail when they shouldn't