# HG changeset patch # User Dario Sestito # Date 1250605949 -3600 # Node ID 4dc3b5b1577c6a9ce1f721712ed4b4476bd91e15 # Parent 35ec0d29a3d865d04b463c5ad5080b2ea9db0591 Enable analysis of Raptor warnings. Publish to Diamonds diff -r 35ec0d29a3d8 -r 4dc3b5b1577c common/build.xml --- 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 @@ + diff -r 35ec0d29a3d8 -r 4dc3b5b1577c common/diamonds/sf-run-analysis.xml.ftl --- 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 @@ 10 -<#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 /> + - ${ant['sf.job.totalyarperrors']} - 0 - ${raptor_count} - 0 - 0 - 0 - 0 + ${raptor_errors} + ${raptor_warnings} + ${ant['sf.job.totalyarperrors']} diff -r 35ec0d29a3d8 -r 4dc3b5b1577c common/tools/raptor/RaptorCommon.pm --- 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'; diff -r 35ec0d29a3d8 -r 4dc3b5b1577c common/tools/raptor/RaptorError.pm --- 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); } diff -r 35ec0d29a3d8 -r 4dc3b5b1577c common/tools/raptor/RaptorWarning.pm --- 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; ; $linecount++) { } + close(FILE); + + process($characters, '', '', '', "warnings.txt", $linecount); $characters = ''; - - close(FILE); }