From b747f448c1d8c8ac08b785b3f2598bc69adaaa7b Mon Sep 17 00:00:00 2001 From: William King Date: Thu, 7 Oct 1999 00:20:33 +0000 Subject: [PATCH] modify to error scanning algorithms added host specific regex file and patterns with assigned severity levels report fatal errors separate from other errors suppress duplicate messages various other minor features --- bin/tests/b9tsummary.pl | 240 +++++++++++++++++++--------------------- 1 file changed, 115 insertions(+), 125 deletions(-) diff --git a/bin/tests/b9tsummary.pl b/bin/tests/b9tsummary.pl index 815affb859..e01baefac2 100755 --- a/bin/tests/b9tsummary.pl +++ b/bin/tests/b9tsummary.pl @@ -8,6 +8,12 @@ $Debug = 1; $Home = $ENV{"HOME"}; $DebugFile = "$Home/b9t/b9tsummary.dbg"; +# +# level of severity at which a fatal error is considered to have occurred +# + +$HaltLevel = 2; + # # name of file containing stdout/stderr of host specific autoconf config # @@ -24,7 +30,7 @@ $BuildFile = ".build"; # name of file containing build problems abstracted from $BuildFile # -$BuildProblemsFile = ".buildproblems"; +$BuildProblemsFile = "buildproblems.html"; # # name of file containing stdout/stderr of host specific make test @@ -57,21 +63,21 @@ $WktpFile = ".wktp"; # # name of file containing perl style regular # expressions used to identify build problems -# in make output +# in make output. $1 should, if possible, +# identify the source filename and $2 should, +# if possible, identify the linenumber of the problem # -$BadRxFile = ".badrx"; +$RxFile = ".b9trx"; -# -# name of file containing perl style regular -# expression identifying cc warning messages -# and allowing extraction of filename into -# $1 and line number into $2 -# -$CcrxFile = ".ccrx"; +# number of fatal build problems +$Nfbp = 0; -$Nbprobs = 0; +# number of other build problems +$Nobp = 0; + +# number of test problems $Ntprobs = 0; # @@ -96,7 +102,7 @@ $B9HostPath = "$B9HomePath/hosts"; # URL of the bind9 report directory # -$B9HomeURL = "http://$B9Host/support/build-reports/bind9"; +$B9HomeURL = "http://$B9Host/bind9"; # # URL of the bind9 hosts specific directory @@ -137,15 +143,16 @@ printf("

\n"); printf("

\n"); printf("

\n"); printf("\n"); -printf("\t\n"); -printf("\t\n", $when); -printf("\t\n"); +printf("\t\n"); +printf("\t\n", $when); +printf("\t\n"); printf("\t\n"); printf("\t\t\n"); -printf("\t\t\n"); +printf("\t\t\n"); +printf("\t\t\n"); +printf("\t\t\n"); printf("\t\n"); -printf("\n"); +printf("\n"); # # produce status info for each host @@ -173,9 +180,9 @@ close(DEBUG) if ($Debug); sub doHost { local($hostpath) = @_; local($entry, $prob, $line, $bstatus, $tstatus); - local(@junk, $junk, $hostid); + local(@junk, $junk, $hostid, $bcolor, $tcolor); local(%buildprobs, %testprobs); - local($filename, $linenumber, $message, $lastfilename); + local($severity, $filename, $linenumber, $message, $lastfilename); @junk = split(/\//, $hostpath); $hostid = $junk[$#junk]; @@ -185,7 +192,8 @@ sub doHost { # # scan the build and test results files for problems # - $Nbprobs = 0; + $Nfbp = 0; + $Nobp = 0; $Ntprobs = 0; %buildprobs = &buildCheck("$hostpath") if (-r "$hostpath/$BuildFile"); @@ -196,16 +204,19 @@ sub doHost { # if (! -r "$hostpath/$BuildFile") { + $bcolor = "red"; $bstatus = "not available"; } - elsif ($Nbprobs) { + elsif ($Nfbp) { + $bcolor = "red"; $bstatus = "broken"; } else { + $bcolor = "green"; $bstatus = "ok"; } - if ($Nbprobs) { + if ($Nfbp) { $tstatus = "not available"; } elsif ($Ntprobs) { @@ -219,13 +230,14 @@ sub doHost { printf("\t\t\n", $hostid); if ($bstatus =~ /not available/) { printf("\t\t\n", $bstatus); + printf("\t\t\n"); } else { printf("\t\t\n"); + printf("\t\t\n"); } if ($tstatus =~ /not available/) { @@ -249,51 +261,28 @@ sub doHost { # write the build problems file # - if ($Nbprobs) { - open(XXX, "> $B9HostPath/$hostid/$BuildProblemsFile"); - printf(XXX "bind9 %s build problems by filename\n\n", $hostid); - foreach $prob (sort keys %buildprobs) { - ($filename, $linenumber) = split(/\:/, $prob); - next if ($filename eq "SYSTEM"); - $message = $buildprobs{$prob}; - if ($filename ne $lastfilename) { - printf(XXX "%s\n", $filename); - } - chop $message ; - $message =~ s/\n/\n\t/g; - printf(XXX "\t%s\n", $message); - $lastfilename = $filename; - } - if (defined($buildprobs{"SYSTEM:GENERAL"})) { - printf(XXX "MISC\n"); - $message = $buildprobs{"SYSTEM:GENERAL"}; - chop $message; - $message =~ s/\n/\n\t/g; - printf(XXX "\t%s\n", $message); - } - close(XXX); - } - - &printBuildProblems($hostid, %buildprobs) if ($Debug); + &wbpf($hostid, %buildprobs) if ($Nfbp + $Nobp); } # # scan the build results file for host at $hostpath for build problems # return %probs -# format key == filename:linenumber, content == text of problem line -# set $Nbprobs as a side effect +# format key == filename:linenumber:severity, content == text of problem line +# set $Nfbp and $Nobp as a side effect # sub buildCheck { local($hostpath) = @_; - local(%probs, $filename, $linenumber, $class); - local(%wkbp, @badrx, $matched, $exp, $ccrx); + local($filename, $linenumber, $severity); + local(%probs, %wkbp, @rxset); + local($matched, $exp, $entry, $ccrx); # initialize the well known build problems array, if available if (-r "$hostpath/$WkbpFile") { open(XXX, "< $hostpath/$WkbpFile"); while() { - next if /^\#/; # skip comments + next if /^\#/; # skip comments + next if /^\s*$/; # and blank lines chop; ($filename, $linenumber) = split; $wkbp{"$filename:$linenumber"} = 1; @@ -301,97 +290,78 @@ sub buildCheck { close(XXX); } - # initialize the host specific bad regex array, if available - if (-r "$hostpath/$BadRxFile") { - open(XXX, "< $hostpath/$BadRxFile"); + # initialize the host specific regex array, if available + if (-r "$hostpath/$RxFile") { + open(XXX, "< $hostpath/$RxFile"); while() { - next if /^\#/; # skip comments + next if /^\#/; # skip comments + next if /^\s*$/; # and blank lines chop; - push(@badrx, $_); + printf(DEBUG "RX: <%s>\n", $_) if ($Debug); + push(@rxset, $_); } close(XXX); } - # intitialize the host specific cc messages regex, if available - if (-r "$hostpath/$CcrxFile") { - open(XXX, "< $hostpath/$CcrxFile"); - while() { - next if /^\#/; # skip comments - $ccrx = $_; - } - close(XXX); - chop($ccrx); - print DEBUG "ccrx:<$ccrx>\n" if ($Debug); - } - # scan stdout/stderr of make all for problems open(XXX, "< $hostpath/$BuildFile"); while () { undef $filename; undef $linenumber; + undef $severity; + undef $1; + undef $2; + $matched = 0; chop; - # - # first check for common generic warning messages - # - $matched = 1 if (/(([eE]rror)|([wW]arning)|([fF]ail)|([sS]top)|([eE]xit))\s/); + foreach $entry (@rxset) { + ($severity, $exp) = split(/\s/, $entry, 2); + if (/$exp/) { + $filename = $1 if defined($1); + $linenumber = $2 if defined($2); + $matched = 1; - print DEBUG "matched default: $_\n" if ($Debug && $matched); - - # - # now check all regexes in @badrx - # - if (! $matched) { - foreach $exp (@badrx) { - if (/$exp/) { - print DEBUG "badrx $exp matched: $_\n" if ($Debug); - $matched = 1; - last; - } + last; } } - # - # now check for host specific or generic compiler warnings - # - if (defined($ccrx)) { - if (/$ccrx/) { - $filename = $1; - $linenumber = $2; - $matched = 1; - print DEBUG "matched ccrx: $_\n" if ($Debug); - } - } - elsif (/\s*"?([^\s]*)"?,?\s*line\s*([0-9]*):/) { - $filename = $1; - $filename =~ s/\"//; - $filename =~ s/,//; - $linenumber = $2; - $matched = 1; - } next unless $matched; - print DEBUG "problem: $_\n" if ($Debug); + if ($Debug) { + printf(DEBUG "LINE %d: %s\n", $., $_); + printf(DEBUG "MATCHES: exp<%s>\tfn<%s>\tln<%s>\tsev<%s>\n", $exp, $filename, $linenumber, $severity); + } - if (defined($filename) && defined($linenumber)) { + if (length($filename) && length($linenumber)) { $filename = $1 if ($filename =~ /.*(bind9.*)/); + # ignore it if its in the well known build problems list if (defined($wkbp{"$filename:$linenumber"})) { - print DEBUG "ignoring build problem\n" if ($Debug); + print DEBUG "IGNORED\n" if ($Debug); next; } } else { - $filename = "SYSTEM"; - $linenumber = "GENERAL"; + $filename = "MISC"; + $linenumber = "0"; } - $probs{"$filename:$linenumber"} .= "$_\n"; - ++$Nbprobs; + + # avoid duplicates + next if (index($probs{"$filename:$linenumber:$severity"}, $_) >= 0); + + $probs{"$filename:$linenumber:$severity"} .= "$_\n"; + if ($severity >= $HaltLevel) { + ++$Nfbp; + } + else { + ++$Nobp; + } + printf(DEBUG "PROBLEM: fn<%s>\tln<%s>\tsev<%s>\n\n", $filename, $linenumber, $severity) if ($Debug); } close(XXX); return(%probs); @@ -450,16 +420,36 @@ sub testCheck { return(%probs); } -sub printBuildProblems { - local($host, %probs) = @_; - local($key, $prob, $filename, $linenumber); +sub wbpf { + local($hostid, %buildprobs) = @_; + local($prob, $filename, $lastfilename, $linenumber, $severity); + local(@messageset, $message); - printf(DEBUG "Host:$host\n"); - foreach $key (sort keys %probs) { - ($filename, $linenumber) = split(/:/, $key); - $prob = $probs{$key}; - printf(DEBUG "%s:%s:%s", $filename, $linenumber, $prob); + open(XXX, "> $B9HostPath/$hostid/$BuildProblemsFile"); + printf(XXX "\n\n"); + printf(XXX "\n"); + printf(XXX "bind9 %s build problems by filename\n", $hostid); + printf(XXX "\n\n"); + + foreach $prob (sort keys %buildprobs) { + + ($filename, $linenumber, $severity) = split(/\:/, $prob); + + printf(XXX "

%s\n
\n", $filename) if ($filename ne $lastfilename); + + @messageset = split(/\n/, $buildprobs{$prob}); + foreach $message (@messageset) { + if ($severity >= $HaltLevel) { + printf(XXX "%s\n
\n", $message); + } + else { + printf(XXX "%s\n
\n", $message); + } + } + $lastfilename = $filename; } - printf(DEBUG "\n"); + + printf(XXX "\n\n"); + close(XXX); }

 
bind9 status %s
 
 
bind9 status %s
 
host\n"); -printf("\t\tbuild statustest statusbuild statusfatal/othertest status


%s%s "); - printf("%s", $bstatus); - if ($bstatus =~ /broken/) { - printf("   (%d)", $Nbprobs); - } + printf("%s", $bcolor, $bstatus); + printf(""); + printf("%d/%d", $Nfbp, $Nobp); printf("