diff --git a/bin/tests/b9tsummary.pl b/bin/tests/b9tsummary.pl index 6d6b561089..378f7898b3 100755 --- a/bin/tests/b9tsummary.pl +++ b/bin/tests/b9tsummary.pl @@ -38,6 +38,12 @@ $BuildProblemsFile = "buildproblems.html"; $TestFile = ".test"; +# +# name of file containing test problems derived from $TestFile +# + +$TestSummaryFile = "testsummary.html"; + # # where the host specific builds take place # @@ -77,8 +83,11 @@ $Nfbp = 0; # number of other build problems $Nobp = 0; -# number of test problems -$Ntprobs = 0; +# number of fatal test problems +$Nftp = 0; + +# number of other test problems +$Notp = 0; # flag to signal bad test journal format $BadTest = 0; @@ -212,37 +221,46 @@ sub doHost { $Ntprobs = 0; $BadTest = 0; - %buildprobs = &buildCheck("$hostpath") if (-r "$hostpath/$BuildFile"); - %testprobs = &testCheck("$hostpath") if (-r "$hostpath/$TestFile"); + if ((-r "$hostpath/$BuildFile") && (-s "$hostpath/$BuildFile")) { + %buildprobs = &buildCheck("$hostpath"); + if ($Nfbp == 0) { + $bstatus = "ok"; + $bcolor = "green"; - # - # then print summary data in html format with links to the raw and processed data - # - - if (! -r "$hostpath/$BuildFile") { - $bcolor = "red"; + if ((-r "$hostpath/$TestFile") && (-s "$hostpath/$TestFile")) { + %testprobs = &testCheck("$hostpath"); + if ($BadTest) { + $tstatus = "inspect ($BadTestReason)"; + $tcolor = "blue"; + } + else { + if ($Nftp) { + $tstatus = "fail"; + $tcolor = "red"; + } + else { + $tstatus = "pass"; + $tcolor = "green"; + } + } + } + else { + $tstatus = "not available (no journal)"; + $tcolor = "red"; + } + } + else { + $bstatus = "broken"; + $tstatus = "not available (build status)"; + $bcolor = "red"; + $tcolor = "black"; + } + } + else { $bstatus = "not available"; - } - elsif ($Nfbp) { + $tstatus = "not available (build status)"; $bcolor = "red"; - $bstatus = "broken"; - } - else { - $bcolor = "green"; - $bstatus = "ok"; - } - - if ($BadTest) { - $tstatus = "not available ($BadTestReason)"; - } - elsif ($bstatus =~ /not available|broken/) { - $tstatus = "not available (no results)"; - } - elsif ($Ntprobs) { - $tstatus = "broken"; - } - else { - $tstatus = "ok"; + $tcolor = "black"; } printf(DEBUG "Host %s STATUS: bstatus %s, tstatus %s, badtest %d, reason %s\n", $hostid, $bstatus, $tstatus, $BadTest, $BadTestReason) if ($Debug); @@ -258,14 +276,14 @@ sub doHost { printf("%s", $bcolor, $bstatus); printf("\n"); printf("\t\t"); - printf("%d/%d", $Nfbp, $Nobp); + printf("%d/%d", $bcolor, $Nfbp, $Nobp); printf("\n"); } if ($tstatus =~ /not available/) { - printf("\t\t%s\n", $tstatus); + printf("\t\t%s\n", $tcolor, $tstatus); } else { - printf("\t\t%s\n", $tstatus); + printf("\t\t%s\n", $tcolor, $tstatus); } printf("\t\n"); @@ -274,6 +292,9 @@ sub doHost { # mkdir("$B9HostPath/$hostid", 0755) if (! -d "$B9HostPath/$hostid"); + `rm -f "$B9HostPath/$hostid/$ConfigFile"`; + `rm -f "$B9HostPath/$hostid/$BuildFile"`; + `rm -f "$B9HostPath/$hostid/$TestFile"`; `cp "$hostpath/$ConfigFile" "$B9HostPath/$hostid"` if (-r "$hostpath/$ConfigFile"); `cp "$hostpath/$BuildFile" "$B9HostPath/$hostid"` if (-r "$hostpath/$BuildFile"); `cp "$hostpath/$TestFile" "$B9HostPath/$hostid"` if (-r "$hostpath/$TestFile"); @@ -390,16 +411,17 @@ sub buildCheck { # # run thru the test results file for host at $hostpath +# write the test results file # return %probs # format key == funcname:assertion_number, value == test_result -# set $Ntprobs as a side effect +# set $Nftp and $Notp as a side effect # sub testCheck { local($hostpath) = @_; - local($funcname, $anum, $atext); - local(%probs); - local($intest, $intestcase, $inassert, $ininfo, $inresult); + local($funcname, $anum, $atext, $hostid); + local(%probs, @junk, $junk); + local($intest, $intestcase, $inassert, $ininfo, $inresult, $ntestsets); # initialize the well known test problems array if (-f "$hostpath/$WktpFile") { @@ -420,74 +442,112 @@ sub testCheck { return; } + @junk = split(/\//, $hostpath); + $hostid = $junk[$#junk]; + $intest = 0; open(XXX, "< $hostpath/$TestFile"); + open(YYY, "> $B9HostPath/$hostid/$TestSummaryFile"); +# printf(YYY "\n\n"); +# printf(YYY "\n"); while () { - next if ($_ !~ /^(S|I|T|A|R):/); - $intest = 1 if (/^S:(Mon|Tue|Wed|Thu|Fri|Sat|Sun)/); + next unless ($_ =~ /^(S|I|T|A|R|E):/); + chop; + + if (/^S:([^:]*):(Mon|Tue|Wed|Thu|Fri|Sat|Sun)/) { + $intest = 1; + $testname = $1; + ++$ntestsets; + printf(YYY "%s\n
\n", $_); + next; + } + + if (/^E:(Mon|Tue|Wed|Thu|Fri|Sat|Sun)/) { + $intest = 0; + printf(YYY "%s\n
\n", $_); + next; + } if (/^T:([^:]*):([^:]*):/) { if ($intest == 0) { $BadTest = 1; - $BadTestReason = "T"; + $BadTestReason = "T$."; } $funcname = $1; $anum = $2; - $intestcase = 1; $inassert = 0; $ininfo = 0; $inresult = 0; - + ($junk = $funcname) =~ s/\//\\\//g; + s/$junk/$1<\/B>/; + printf(YYY "%s\n
\n", $_); next; } if (/^A:(.*)$/) { - if (($intestcase == 0) || ($inresult == 1)) { + if (($intest == 0) || ($intestcase == 0) || ($inresult == 1)) { $BadTest = 1; - $BadTestReason = "A"; + $BadTestReason = "A$."; } + $atext = $1; $inassert = 1; - $atext = 1; + s/A:(.*)/A:$1<\/FONT>/; + printf(YYY "%s\n
\n", $_); next; } if (/^I:(.*)$/) { - if ($inassert == 0) { + if (($intest == 0) || ($intestcase == 0) || ($inassert == 0)) { $BadTest = 1; - $BadTestReason = "I"; + $BadTestReason = "I$."; } $ininfo = 1; + printf(YYY "%s\n
\n", $_); next; } if (/^R:(.*)$/) { - if (($intestcase == 0) || ($inassert == 0)) { + if (($intest == 0) || ($intestcase == 0) || ($inassert == 0)) { $BadTest = 1; - $BadTestReason = "R"; + $BadTestReason = "R:$intest:$intestcase:$inassert:$."; } - $inresult = 1; - $intestcase = 0; - $result = $1; + $inresult = 1; if ($result =~ /FAIL|UNRESOLVED|UNINITIATED/) { # # skip if in the (ignorable) well known test problems list # - next if defined($wktp{"$funcname:$anum"}); - $probs{"$funcname:$anum"} = $result; - ++$Ntprobs; + if (defined($wktp{"$funcname:$anum"})) { + ++$Notp; + } + else { + $probs{"$funcname:$anum"} = $result; + ++$Nftp; + s/(FAIL|UNRESOLVED|UNITIATED)/$1<\/FONT>/; + } } + elsif ($result =~ /PASS|UNTESTED/) { + s/(PASS|UNTESTED)/$1<\/FONT>/; + } + printf(YYY "%s\n
\n", $_); next; } } close(XXX); - if ($intest == 0) { +# printf(YYY "\n\n"); + close(YYY); + + if ($ntestsets == 0) { $BadTest = 1; - $BadTestReason = "no results"; + $BadTestReason = "no tests"; } return(%probs); } +# +# write the build problems file +# + sub wbpf { local($hostid, %buildprobs) = @_; local($prob, $filename, $lastfilename, $linenumber, $severity); @@ -522,7 +582,7 @@ sub wbpf { } # printf(XXX "\n\n"); -# printf("\n"); +# printf("\n"); close(XXX); }