Browse Source

-- Date: 2010/02/16
Reference: noref
Issue type: fix
Severity: Minor
Module(s): Appraiser
Description: Infinity strings changed, perl warning removed

-- Date: 2010/02/16
Reference: noref
Issue type: fix
Severity: Critical
Module(s): Gcov bridge
Description: gcov usage command corrected

-- Date: 2010/02/15
Reference: noref
Issue type: fix
Severity: Minor
Module(s): Parser
Description: regexp for C++ function identifier corrected

avkonst 15 years ago
parent
commit
81684e8bb9
4 changed files with 89 additions and 14 deletions
  1. 14 0
      changelog.txt
  2. 29 5
      lib/SWI/Appraiser.pm
  3. 27 8
      lib/SWI/Processor.pm
  4. 19 1
      test/swi_config_ddd.xml

+ 14 - 0
changelog.txt

@@ -22,6 +22,20 @@ ____________________________________________
 
 -- 2010/02/XX: VERSION 0.9.2 not yet released
 
+       -- Date:         2010/02/16
+          Reference:    noref
+          Issue type:   fix
+          Severity:     Minor
+          Module(s):    Appraiser
+          Description:  Infinity strings changed, perl warning removed
+
+       -- Date:         2010/02/16
+          Reference:    noref
+          Issue type:   fix
+          Severity:     Critical
+          Module(s):    Gcov bridge
+          Description:  gcov usage command corrected
+          
        -- Date:         2010/02/15
           Reference:    noref
           Issue type:   fix

+ 29 - 5
lib/SWI/Appraiser.pm

@@ -739,7 +739,7 @@ sub swiStatisticLevelGet
                   $objStat->{ $relation[0] }->{ $relation[1] }
                   ->{ $relation[2] };
 
-                if ( !defined($factor) || $factor == 0 )
+                if ( !defined($factor) )
                 {
                     STATUS(
 "Wrong configuration for the limit '$keyStat/$keySubStat/$type'. Relation "
@@ -758,12 +758,12 @@ sub swiStatisticLevelGet
                     # Devide negative number by zero, equals to -infinity
                     elsif ($objStat->{$keyStat}->{$keySubStat}->{$type} < 0)
                     {
-                        $statValue = "-Infinity";        
+                        $statValue = '(-)Infinity';        
                     }
                     # Devide positive number by zero, equals to infinity
                     else
                     {
-                        $statValue = "Infinity";
+                        $statValue = '(+)Infinity';
                     }
                 }
                 else
@@ -780,7 +780,15 @@ sub swiStatisticLevelGet
             if (   $limit->{"swi:warning"} > $limit->{"swi:notice"}
                 && $limit->{"swi:notice"} > $limit->{"swi:info"} )
             {
-                if ( $statValue eq "Infinity" || $statValue > $limit->{"swi:warning"} )
+                if ( $statValue eq '(-)Infinity' )
+                {
+                    $returnResult[0] = "regular";
+                    $returnResult[2] = "["
+                      . $statValue
+                      . " less than "
+                      . $limit->{"swi:info"} . "]";
+                }
+                elsif ( $statValue eq '(+)Infinity' || $statValue > $limit->{"swi:warning"} )
                 {
                     $returnResult[0] = "warning";
                     $returnResult[2] = "["
@@ -807,12 +815,24 @@ sub swiStatisticLevelGet
                 else
                 {
                     $returnResult[0] = "regular";
+                    $returnResult[2] = "["
+                      . $statValue
+                      . " less than "
+                      . $limit->{"swi:info"} . "]";
                 }
             }
             elsif ($limit->{"swi:warning"} < $limit->{"swi:notice"}
                 && $limit->{"swi:notice"} < $limit->{"swi:info"} )
             {
-                if ( $statValue eq "-Infinity" || $statValue < $limit->{"swi:warning"} )
+                if ( $statValue eq '(+)Infinity' )
+                {
+                    $returnResult[0] = "regular";
+                    $returnResult[2] = "["
+                      . $statValue
+                      . " greater than "
+                      . $limit->{"swi:info"} . "]";
+                }
+                elsif ( $statValue eq '(-)Infinity' || $statValue < $limit->{"swi:warning"} )
                 {
                     $returnResult[0] = "warning";
                     $returnResult[2] = "["
@@ -839,6 +859,10 @@ sub swiStatisticLevelGet
                 else
                 {
                     $returnResult[0] = "regular";
+                    $returnResult[2] = "["
+                      . $statValue
+                      . " greater than "
+                      . $limit->{"swi:info"} . "]";
                 }
             }
             else

+ 27 - 8
lib/SWI/Processor.pm

@@ -365,7 +365,8 @@ sub swiXmlReportPrint()
                     'swi:duplication' => '__REMOVE__',
                     'swi:length'      => '__REMOVE__',
                     'swi:lines'       => '__REMOVE__',
-                    'swi:checksum'    => '__REMOVE__'
+                    'swi:checksum'    => '__REMOVE__',
+                    'swi:coverage'    => '__REMOVE__'
                 }
             );
             $statStr =~ s/\n/\n        /g;
@@ -377,6 +378,7 @@ sub swiXmlReportPrint()
                 RootName => '' );
             $refStr =~ s/\n/\n      /g;
             $refStr =~ s/<anon /<swi:reference /g;
+            $refStr =~ s/<anon>\s*<\/anon>\s*/\n/g;
             print $fh "      ";
             print $fh $refStr;
             print $fh "      </swi:function>\n";
@@ -1044,17 +1046,34 @@ sub swiSourceIndexGcovAdd
     my $fh = new FileHandle( $location . "/" . $gcdaFile, "r" );
     if ( !defined($fh) )
     {
-        STATUS("gcda file '$location/$gcdaFile' is not found  for the '$file' source.");
+        STATUS(
+"gcda file '$location/$gcdaFile' is not found  for the '$file' source."
+        );
+
+        #foreach my $functionName ( keys %{$functionsData} )
+        #{
+        #    $functionsData->{$functionName}->{'swi:statistic'}
+        #      ->{'swi:coverage'} = {
+        #        'swi:gsum:lines'     => { 'swi:exact' => 0 },
+        #        'swi:gsum:branches'  => { 'swi:exact' => 0 },
+        #        'swi:gsum:calls'     => { 'swi:exact' => 0 },
+        #        'swi:gcov:lines'     => { 'swi:exact' => 0 },
+        #        'swi:gcov:branches'  => { 'swi:exact' => 0 },
+        #        'swi:gcov:takenonce' => { 'swi:exact' => 0 },
+        #        'swi:gcov:calls'     => { 'swi:exact' => 0 }
+        #      };
+        #}
     }
     else
     {
-        my $gcovCommand = 'gcov -f -b $location/$gcdaFile';
-        
+        my $gcovCommand = "gcov -f -b $location/$gcdaFile";
+
         my $gcovData = `$gcovCommand`;
-        $gcovData =~ s/No executable lines/Lines executed:100.OO% of O/g; 
-        $gcovData =~ s/No calls/Calls executed:100.00% of O/g; 
-        $gcovData =~ s/No branches/Branches executed:100.O0% of O\nTaken at least once:100.O0% of O/g; 
-        my @covData  = split( "\n\n", $gcovData );
+        $gcovData =~ s/No executable lines/Lines executed:100.OO% of O/g;
+        $gcovData =~ s/No calls/Calls executed:100.00% of O/g;
+        $gcovData =~
+s/No branches/Branches executed:100.O0% of O\nTaken at least once:100.O0% of O/g;
+        my @covData = split( "\n\n", $gcovData );
 
         foreach (@covData)
         {

+ 19 - 1
test/swi_config_ddd.xml

@@ -105,6 +105,12 @@
         <swi:globalcode>on</swi:globalcode>
       </swi:indexer:dup>
 
+      <swi:indexer:gcov>
+        <swi:enabled>on</swi:enabled>
+        <swi:filepattern>^.*[.][cC][pP]?[pP]?$</swi:filepattern>
+        <swi:sourcefile>(.*)[.][cC][pP]?[pP]?</swi:sourcefile>
+        <swi:gcdafile>${1}.gcda</swi:gcdafile>
+      </swi:indexer:gcov>
     </swi:module>
  
   </swi:modules>
@@ -159,6 +165,7 @@
   </swi:report>
   
   <swi:limits>
+    
     <swi:lines>
       <swi:comment:header>
         <swi:exact>
@@ -190,6 +197,17 @@
       </swi:symbols>
     </swi:duplication>
     
-  </swi:limits>
+    
+    <swi:coverage>
+      <swi:gcov:lines>
+        <swi:exact swi:relation="swi:coverage/swi:gsum:lines/swi:exact">
+          <swi:info>0.99</swi:info>
+          <swi:notice>0.9</swi:notice>
+          <swi:warning>0.84</swi:warning>
+        </swi:exact>
+      </swi:gcov:lines>
+    </swi:coverage>
+
+    </swi:limits>
 
 </swi:configuration>