From ba5e1f51aca66869ca39eab5010a6c30a947ce85 Mon Sep 17 00:00:00 2001 From: david_williams <david_williams> Date: Sun, 29 Jul 2007 21:11:08 +0000 Subject: [PATCH] temporarily need report.php in "lower" directories for individual build pages --- downloadsites/webtools/committers/report.php | 147 ++++++++++++++++++ downloadsites/webtools/committers/report2.php | 127 +++++++++++++++ downloadsites/webtools/downloads/report.php | 147 ++++++++++++++++++ downloadsites/webtools/downloads/report2.php | 127 +++++++++++++++ 4 files changed, 548 insertions(+) create mode 100644 downloadsites/webtools/committers/report.php create mode 100644 downloadsites/webtools/committers/report2.php create mode 100644 downloadsites/webtools/downloads/report.php create mode 100644 downloadsites/webtools/downloads/report2.php diff --git a/downloadsites/webtools/committers/report.php b/downloadsites/webtools/committers/report.php new file mode 100644 index 000000000..826687900 --- /dev/null +++ b/downloadsites/webtools/committers/report.php @@ -0,0 +1,147 @@ +<?php + function count_pattern($directory, $filenameFilter, $pattern) + { + $count = 0; + $dir = dir($directory); + while ($anEntry = $dir->read()) + { + if ($anEntry != "." && $anEntry != "..") + { + $anEntry = $directory."/".$anEntry; + if (is_dir($anEntry)) + { + $count += count_pattern($anEntry, $filenameFilter, $pattern); + } + else + { + if (stristr($anEntry, $filenameFilter)) + { + $handle = @fopen($anEntry, "r"); + if (FALSE !== $handle) { + $size = filesize($anEntry); + $content = fread($handle, $size); + fclose($handle); + $count += substr_count($content, $pattern); + } + } + } + } + } + return $count; + } + + function parse_testResult($filename) + { + $junitFailures = 0; + $compileErrors = 0; + $compileWarnings = 0; + if (is_file($filename)) { + $handle = @fopen($filename, "r"); + if ($handle) + { + $size = filesize($filename); + $content = fread($handle, $size); + fclose($handle); + $junitStart = strpos($content, "Errors & Failures"); + $junitEnd = strpos($content, "</table>", $junitStart); + $junitInfo = substr($content, $junitStart, $junitEnd - $junitStart); + $start = strpos($junitInfo, "<td><b><font color=\"#ff0000\">"); + while ($start !== false) + { + $start += 29; + $stop = strpos($junitInfo, "</font></b></td>", $start); + if ($stop !== false) + { + $result = substr($junitInfo, $start, $stop - $start); + if (is_numeric($result)) + { + $junitFailures += $result; + } + else if (strcmp($result, "DNF") == 0) + { + $junitFailures++; + } + } + $start = strpos($junitInfo, "<td><b><font color=\"#ff0000\">", $stop); + } + $compileStart = strpos($content, "Compile Logs (Jar Files)"); + $compileEnd = strpos($content, "</table>", $compileStart); + $compileInfo = substr($content, $compileStart, $compileEnd - $compileStart); + $rowStart = strpos($compileInfo, "<tr>"); + while ($rowStart !== false) + { + $start += 4; + $rowStop = strpos($compileInfo, "</tr>", $rowStart); + if ($rowStop !== false) + { + $row = substr($compileInfo, $rowStart, $rowStop - $rowStart); + $cellStart = strpos($row, "<td"); + $gotError = false; + $gotWarning = false; + while ($cellStart !== false && (!$gotError || !$gotWarning)) + { + // this parsing logic got a bit more complicated in M2_33 basebuild, as the + // tag <td align="center"> was used, instead of <td> + // $cellStart += 4; + $cellStart = strpos($row, ">", $cellStart); + $cellStart = $cellStart + 1; + $cellStop = strpos($row, "</td>", $cellStart); + if ($cellStop !== false) + { + $cell = substr($row, $cellStart, $cellStop - $cellStart); + if (is_numeric($cell)) + { + if (!$gotError) + { + $compileErrors += $cell; + $gotError = true; + } + else if (!$gotWarning) + { + $compileWarnings += $cell; + $gotWarning = true; + } + } + } + // this parsing logic got a bit more complicated in M2_33 basebuild, as the + // tag <td align="center"> was used, instead of <td> + $cellStart = strpos($row, "<td", $cellStop); + } + } + $rowStart = strpos($compileInfo, "<tr>", $rowStop); + } + } + } + $results = array($compileErrors, $compileWarnings, $junitFailures); + return $results; + } + + function parse($filename, $key) + { + if (!is_readable($filename)) + { + return 0; + } + $value; + $handle = @fopen($filename, "r"); + if (!$handle) + { + return 0; + } + $size = filesize($filename); + $content = fread($handle, $size); + fclose($handle); + $start = strpos($content, $key); + while ($start !== false) + { + $start += strlen($key); + $stop = strpos($content, "\"", $start); + if ($stop !== false) + { + $value += substr($content, $start, $stop - $start); + } + $start = strpos($content, $key, $stop); + } + return $value; + } +?> diff --git a/downloadsites/webtools/committers/report2.php b/downloadsites/webtools/committers/report2.php new file mode 100644 index 000000000..0859c0d1b --- /dev/null +++ b/downloadsites/webtools/committers/report2.php @@ -0,0 +1,127 @@ + + <?php + +function parse2_testResults($filename) +{ + $junitFailures = -1; + if (is_file($filename)) { + $handle = @fopen($filename, "r"); + if ($handle) + { + $junitFailures = 0; + $size = filesize($filename); + $content = fread($handle, $size); + fclose($handle); + $junitStart = strpos($content, "Errors & Failures"); + $junitEnd = strpos($content, "</table>", $junitStart); + $junitInfo = substr($content, $junitStart, $junitEnd - $junitStart); + $start = strpos($junitInfo, "<td><b><font color=\"#ff0000\">"); + while ($start !== false) + { + $start += 29; + $stop = strpos($junitInfo, "</font></b></td>", $start); + if ($stop !== false) + { + $result = substr($junitInfo, $start, $stop - $start); + if (is_numeric($result)) + { + $junitFailures += $result; + } + else if (strcmp($result, "DNF") == 0) + { + $junitFailures++; + } + } + $start = strpos($junitInfo, "<td><b><font color=\"#ff0000\">", $stop); + } + $results = array($junitFailures); + return $results; + } + } +} + +function parse2_compileResults($filename) +{ + $compileErrors = 0; + $compileAccessWarnings = 0; + $compileOtherWarnings = 0; + if (is_file($filename)) { + //echo "$filename<br />"; + $handle = @fopen($filename, "r"); + if ($handle) + { + $size = filesize($filename); + //echo "size: $size<br />"; + $content = fread($handle, $size); + fclose($handle); + + //echo "$content"; + $compileStart = strpos($content, "<table id=tabledata"); + $compileEnd = strpos($content, "</table", $compileStart); + $compileInfo = substr($content, $compileStart, $compileEnd - $compileStart); + //echo "compileInfo: $compileInfo<br />"; + $rowStart = strpos($compileInfo, "<tr>"); + $rowStart = strpos($compileInfo, "<tr>"); + $start = $rowStart+4; + while ($rowStart !== false) + { + + $start += 4; + $rowStop = strpos($compileInfo, "</tr>", $rowStart); + //if ($rowStop !== false) + //{ + $row = substr($compileInfo, $rowStart, $rowStop - $rowStart); + //echo "$row"; + //while ($cellStart !== false) + //{ + // this parsing logic got a bit more complicated in M5_33 basebuild, as the + // a whole different structure was used. + // we'll try to quick fix this, but need our own index task + $cellStart = strpos($row, "#ERROR"); + $cellStart = strpos($row, ">", $cellStart); + $cellStart = $cellStart + 1; + $cellStop = strpos($row, "<", $cellStart); + if ($cellStop !== false) + { + $cell = substr($row, $cellStart, $cellStop - $cellStart); + if (is_numeric($cell)) + { + $compileErrors += $cell; + } + $cellStart = strpos($row, "#ACCESSRULES_WARNINGS"); + $cellStart = strpos($row, ">", $cellStart); + $cellStart = $cellStart + 1; + $cellStop = strpos($row, "<", $cellStart); + $cell = substr($row, $cellStart, $cellStop - $cellStart); + if (is_numeric($cell)) + { + $compileAccessWarnings += $cell; + } + $cellStart = strpos($row, "#OTHER_WARNINGS"); + $cellStart = strpos($row, ">", $cellStart); + $cellStart = $cellStart + 1; + $cellStop = strpos($row, "<", $cellStart); + $cell = substr($row, $cellStart, $cellStop - $cellStart); + if (is_numeric($cell)) + { + $compileOtherWarnings += $cell; + } + } + // look for next row. + //$cellStart = strpos($row, "<tr", $cellStop); + //} + //} + $rowStart = strpos($compileInfo, "<tr>", $rowStop); + } + } + } + + $results = array($compileErrors, $compileAccessWarnings, $compileOtherWarnings); + return $results; +} + + + +?> + + diff --git a/downloadsites/webtools/downloads/report.php b/downloadsites/webtools/downloads/report.php new file mode 100644 index 000000000..826687900 --- /dev/null +++ b/downloadsites/webtools/downloads/report.php @@ -0,0 +1,147 @@ +<?php + function count_pattern($directory, $filenameFilter, $pattern) + { + $count = 0; + $dir = dir($directory); + while ($anEntry = $dir->read()) + { + if ($anEntry != "." && $anEntry != "..") + { + $anEntry = $directory."/".$anEntry; + if (is_dir($anEntry)) + { + $count += count_pattern($anEntry, $filenameFilter, $pattern); + } + else + { + if (stristr($anEntry, $filenameFilter)) + { + $handle = @fopen($anEntry, "r"); + if (FALSE !== $handle) { + $size = filesize($anEntry); + $content = fread($handle, $size); + fclose($handle); + $count += substr_count($content, $pattern); + } + } + } + } + } + return $count; + } + + function parse_testResult($filename) + { + $junitFailures = 0; + $compileErrors = 0; + $compileWarnings = 0; + if (is_file($filename)) { + $handle = @fopen($filename, "r"); + if ($handle) + { + $size = filesize($filename); + $content = fread($handle, $size); + fclose($handle); + $junitStart = strpos($content, "Errors & Failures"); + $junitEnd = strpos($content, "</table>", $junitStart); + $junitInfo = substr($content, $junitStart, $junitEnd - $junitStart); + $start = strpos($junitInfo, "<td><b><font color=\"#ff0000\">"); + while ($start !== false) + { + $start += 29; + $stop = strpos($junitInfo, "</font></b></td>", $start); + if ($stop !== false) + { + $result = substr($junitInfo, $start, $stop - $start); + if (is_numeric($result)) + { + $junitFailures += $result; + } + else if (strcmp($result, "DNF") == 0) + { + $junitFailures++; + } + } + $start = strpos($junitInfo, "<td><b><font color=\"#ff0000\">", $stop); + } + $compileStart = strpos($content, "Compile Logs (Jar Files)"); + $compileEnd = strpos($content, "</table>", $compileStart); + $compileInfo = substr($content, $compileStart, $compileEnd - $compileStart); + $rowStart = strpos($compileInfo, "<tr>"); + while ($rowStart !== false) + { + $start += 4; + $rowStop = strpos($compileInfo, "</tr>", $rowStart); + if ($rowStop !== false) + { + $row = substr($compileInfo, $rowStart, $rowStop - $rowStart); + $cellStart = strpos($row, "<td"); + $gotError = false; + $gotWarning = false; + while ($cellStart !== false && (!$gotError || !$gotWarning)) + { + // this parsing logic got a bit more complicated in M2_33 basebuild, as the + // tag <td align="center"> was used, instead of <td> + // $cellStart += 4; + $cellStart = strpos($row, ">", $cellStart); + $cellStart = $cellStart + 1; + $cellStop = strpos($row, "</td>", $cellStart); + if ($cellStop !== false) + { + $cell = substr($row, $cellStart, $cellStop - $cellStart); + if (is_numeric($cell)) + { + if (!$gotError) + { + $compileErrors += $cell; + $gotError = true; + } + else if (!$gotWarning) + { + $compileWarnings += $cell; + $gotWarning = true; + } + } + } + // this parsing logic got a bit more complicated in M2_33 basebuild, as the + // tag <td align="center"> was used, instead of <td> + $cellStart = strpos($row, "<td", $cellStop); + } + } + $rowStart = strpos($compileInfo, "<tr>", $rowStop); + } + } + } + $results = array($compileErrors, $compileWarnings, $junitFailures); + return $results; + } + + function parse($filename, $key) + { + if (!is_readable($filename)) + { + return 0; + } + $value; + $handle = @fopen($filename, "r"); + if (!$handle) + { + return 0; + } + $size = filesize($filename); + $content = fread($handle, $size); + fclose($handle); + $start = strpos($content, $key); + while ($start !== false) + { + $start += strlen($key); + $stop = strpos($content, "\"", $start); + if ($stop !== false) + { + $value += substr($content, $start, $stop - $start); + } + $start = strpos($content, $key, $stop); + } + return $value; + } +?> diff --git a/downloadsites/webtools/downloads/report2.php b/downloadsites/webtools/downloads/report2.php new file mode 100644 index 000000000..0859c0d1b --- /dev/null +++ b/downloadsites/webtools/downloads/report2.php @@ -0,0 +1,127 @@ + + <?php + +function parse2_testResults($filename) +{ + $junitFailures = -1; + if (is_file($filename)) { + $handle = @fopen($filename, "r"); + if ($handle) + { + $junitFailures = 0; + $size = filesize($filename); + $content = fread($handle, $size); + fclose($handle); + $junitStart = strpos($content, "Errors & Failures"); + $junitEnd = strpos($content, "</table>", $junitStart); + $junitInfo = substr($content, $junitStart, $junitEnd - $junitStart); + $start = strpos($junitInfo, "<td><b><font color=\"#ff0000\">"); + while ($start !== false) + { + $start += 29; + $stop = strpos($junitInfo, "</font></b></td>", $start); + if ($stop !== false) + { + $result = substr($junitInfo, $start, $stop - $start); + if (is_numeric($result)) + { + $junitFailures += $result; + } + else if (strcmp($result, "DNF") == 0) + { + $junitFailures++; + } + } + $start = strpos($junitInfo, "<td><b><font color=\"#ff0000\">", $stop); + } + $results = array($junitFailures); + return $results; + } + } +} + +function parse2_compileResults($filename) +{ + $compileErrors = 0; + $compileAccessWarnings = 0; + $compileOtherWarnings = 0; + if (is_file($filename)) { + //echo "$filename<br />"; + $handle = @fopen($filename, "r"); + if ($handle) + { + $size = filesize($filename); + //echo "size: $size<br />"; + $content = fread($handle, $size); + fclose($handle); + + //echo "$content"; + $compileStart = strpos($content, "<table id=tabledata"); + $compileEnd = strpos($content, "</table", $compileStart); + $compileInfo = substr($content, $compileStart, $compileEnd - $compileStart); + //echo "compileInfo: $compileInfo<br />"; + $rowStart = strpos($compileInfo, "<tr>"); + $rowStart = strpos($compileInfo, "<tr>"); + $start = $rowStart+4; + while ($rowStart !== false) + { + + $start += 4; + $rowStop = strpos($compileInfo, "</tr>", $rowStart); + //if ($rowStop !== false) + //{ + $row = substr($compileInfo, $rowStart, $rowStop - $rowStart); + //echo "$row"; + //while ($cellStart !== false) + //{ + // this parsing logic got a bit more complicated in M5_33 basebuild, as the + // a whole different structure was used. + // we'll try to quick fix this, but need our own index task + $cellStart = strpos($row, "#ERROR"); + $cellStart = strpos($row, ">", $cellStart); + $cellStart = $cellStart + 1; + $cellStop = strpos($row, "<", $cellStart); + if ($cellStop !== false) + { + $cell = substr($row, $cellStart, $cellStop - $cellStart); + if (is_numeric($cell)) + { + $compileErrors += $cell; + } + $cellStart = strpos($row, "#ACCESSRULES_WARNINGS"); + $cellStart = strpos($row, ">", $cellStart); + $cellStart = $cellStart + 1; + $cellStop = strpos($row, "<", $cellStart); + $cell = substr($row, $cellStart, $cellStop - $cellStart); + if (is_numeric($cell)) + { + $compileAccessWarnings += $cell; + } + $cellStart = strpos($row, "#OTHER_WARNINGS"); + $cellStart = strpos($row, ">", $cellStart); + $cellStart = $cellStart + 1; + $cellStop = strpos($row, "<", $cellStart); + $cell = substr($row, $cellStart, $cellStop - $cellStart); + if (is_numeric($cell)) + { + $compileOtherWarnings += $cell; + } + } + // look for next row. + //$cellStart = strpos($row, "<tr", $cellStop); + //} + //} + $rowStart = strpos($compileInfo, "<tr>", $rowStop); + } + } + } + + $results = array($compileErrors, $compileAccessWarnings, $compileOtherWarnings); + return $results; +} + + + +?> + + -- GitLab