Enable analysis of Raptor warnings. Publish to Diamonds
authorDario Sestito <darios@symbian.org>
Tue, 18 Aug 2009 15:32:29 +0100
changeset 364 4dc3b5b1577c
parent 350 35ec0d29a3d8
child 365 95e054b2bec1
Enable analysis of Raptor warnings. Publish to Diamonds
common/build.xml
common/diamonds/sf-run-analysis.xml.ftl
common/tools/raptor/RaptorCommon.pm
common/tools/raptor/RaptorError.pm
common/tools/raptor/RaptorWarning.pm
--- a/common/build.xml	Fri Aug 14 18:00:38 2009 +0100
+++ b/common/build.xml	Tue Aug 18 15:32:29 2009 +0100
@@ -910,6 +910,7 @@
           <exec executable="perl" dir="${sf.common.config.dir}/tools/raptor" failonerror="false" output="${build.log.dir}/analysis/${build.id}_raptorparse.log" append="true">
             <arg value="${sf.common.config.dir}/tools/raptor/parse.pl"/>
             <arg value="--error"/>
+            <arg value="--warning"/>
             <arg value="--log=@{raptorlogfile}"/>
             <arg value="--basedir=${build.log.dir}/raptorbits"/>
             <arg value="--append"/>
--- a/common/diamonds/sf-run-analysis.xml.ftl	Fri Aug 14 18:00:38 2009 +0100
+++ b/common/diamonds/sf-run-analysis.xml.ftl	Tue Aug 18 15:32:29 2009 +0100
@@ -3,19 +3,20 @@
 <diamonds-build>
   <schema>10</schema>
   
-<#assign raptor_count=0/>
+<#assign raptor_errors=0/>
+<#assign raptor_warnings=0/>
 <#list raptor_summary as raptor_item>
-<#assign raptor_count=raptor_count+1 />
+<#if raptor_item.category = "raptor_error">
+  <#assign raptor_errors=raptor_errors+1 />
+<#elseif raptor_item.category = "raptor_warning">
+  <#assign raptor_warnings=raptor_warnings+1 />
+</#if>
 </#list>
 
   <faults>
-    <total severity="error">${ant['sf.job.totalyarperrors']}</total>
-    <total severity="warning">0</total>
-    <total severity="warning_rvct_bad">${raptor_count}</total>
-    <total severity="warning_rvct_other">0</total>
-    <total severity="codescanner_high">0</total>
-    <total severity="codescanner_medium">0</total>
-    <total severity="codescanner_low">0</total>
+    <total severity="Raptor Errors">${raptor_errors}</total>
+    <total severity="Raptor Warnings">${raptor_warnings}</total>
+    <total severity="Recipes Failed">${ant['sf.job.totalyarperrors']}</total>
   </faults>
   
   <files>
--- a/common/tools/raptor/RaptorCommon.pm	Fri Aug 14 18:00:38 2009 +0100
+++ b/common/tools/raptor/RaptorCommon.pm	Tue Aug 18 15:32:29 2009 +0100
@@ -23,6 +23,9 @@
 our $CATEGORY_RAPTORERROR_MAKEEXITEDWITHERRORS = 'make_exited_with_errors';
 our $CATEGORY_RAPTORERROR_TOOLDIDNOTRETURNVERSION = 'tool_didnot_return_version';
 
+our $CATEGORY_RAPTORWARNING = 'raptor_warning';
+our $CATEGORY_RAPTORWARNING_MISSINGFLAGABIV2 = 'missing_enable_abiv2_mode';
+
 our $SEVERITY_UNKNOWN = 'unknown';
 our $SEVERITY_CRITICAL = 'critical';
 our $SEVERITY_MAJOR = 'major';
--- a/common/tools/raptor/RaptorError.pm	Fri Aug 14 18:00:38 2009 +0100
+++ b/common/tools/raptor/RaptorError.pm	Tue Aug 18 15:32:29 2009 +0100
@@ -92,7 +92,7 @@
 	$filename = "$::basedir/errors.txt";
 	if (!-f$filename)
 	{
-		print "Writing error file $filename\n";
+		print "Writing errors file $filename\n";
 		open(FILE, ">$filename");
 		close(FILE);
 	}
--- a/common/tools/raptor/RaptorWarning.pm	Fri Aug 14 18:00:38 2009 +0100
+++ b/common/tools/raptor/RaptorWarning.pm	Tue Aug 18 15:32:29 2009 +0100
@@ -27,6 +27,7 @@
 
 $buildlog_status->{name} = 'buildlog_status';
 $buildlog_status->{next_status} = {warning=>$buildlog_warning_status};
+$buildlog_status->{on_start} = 'RaptorWarning::on_start_buildlog';
 
 $buildlog_warning_status->{name} = 'buildlog_warning_status';
 $buildlog_warning_status->{next_status} = {};
@@ -34,29 +35,46 @@
 $buildlog_warning_status->{on_end} = 'RaptorWarning::on_end_buildlog_warning';
 $buildlog_warning_status->{on_chars} = 'RaptorWarning::on_chars_buildlog_warning';
 
+my $filename = '';
+
 my $characters = '';
 
 my $category = $RaptorCommon::CATEGORY_RAPTORWARNING;
 
 sub process
 {
-	my ($text) = @_;
+	my ($text, $component, $phase, $recipe, $file, $line) = @_;
 	
 	my $severity = $RaptorCommon::SEVERITY_UNKNOWN;
 	
-	if ($text =~ m,unmatchable,)
+	if ($text =~ m,missing flag ENABLE_ABIV2_MODE,)
 	{
-		$severity = $RaptorCommon::SEVERITY_CRITICAL;
-		
-		#dump_error($category, $severity, $text);
-		print "$category, $severity, $text\n";
+		$severity = $RaptorCommon::SEVERITY_NORMAL;
+		my $subcategory = $RaptorCommon::CATEGORY_RAPTORWARNING_MISSINGFLAGABIV2;
+		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
+	}
+	else # log everything by default
+	{
+		$severity = $RaptorCommon::SEVERITY_NORMAL;
+		my $subcategory = '';
+		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
 	}
 }
 
+sub on_start_buildlog
+{
+	RaptorCommon::init();
+	
+	$filename = "$::basedir/warnings.txt";
+	if (!-f$filename)
+	{
+		print "Writing warnings file $filename\n";
+		open(FILE, ">$filename");
+		close(FILE);
+	}
+}
 sub on_start_buildlog_warning
 {
-	my $filename = "$::basedir/warnings.txt";
-	print "Writing warning file $filename\n" if (!-f$filename);
 	open(FILE, ">>$filename");
 }
 
@@ -75,14 +93,19 @@
 {
 	#print "on_end_buildlog_warning\n";
 	
-	process($characters);
-	
 	print FILE $characters if ($characters =~ m,[^\s^\r^\n],);
 	print FILE "\n" if ($characters !~ m,[\r\n]$, );
+	close(FILE);
+	
+	# get the line number - not really optimized
+	my $linecount = 0;
+	open(FILE, "$filename");
+	for ($linecount = 0; <FILE>; $linecount++) { }
+	close(FILE);
+	
+	process($characters, '', '', '', "warnings.txt", $linecount);
 	
 	$characters = '';
-	
-	close(FILE);
 }