summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-11-05 15:16:38 (GMT)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-11-05 15:16:38 (GMT)
commit0c4c54d9796c8fd710318908cc73c1a64402efe1 (patch)
treebbd1754c2c6234e1bb029e52ebb3d7c94023145d
parent348a256194b27a55c75b83c4de60ff78909aabbd (diff)
downloadbuildroot-test-0c4c54d9796c8fd710318908cc73c1a64402efe1.tar.gz
buildroot-test-0c4c54d9796c8fd710318908cc73c1a64402efe1.tar.bz2
graph.php, stats.php: add support for viewing different branches
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-rw-r--r--web/graph.php7
-rw-r--r--web/stats.php35
-rw-r--r--web/stylesheet.css4
3 files changed, 41 insertions, 5 deletions
diff --git a/web/graph.php b/web/graph.php
index 5e860a1..46ab12f 100644
--- a/web/graph.php
+++ b/web/graph.php
@@ -3,13 +3,18 @@ include("../externals/pchart/class/pDraw.class.php");
include("../externals/pchart/class/pImage.class.php");
include("../externals/pchart/class/pData.class.php");
+if (isset($_GET['branch']) && preg_match("/^[a-z0-9_\.]*$/", $_GET['branch']))
+ $branch = $_GET['branch'];
+else
+ $branch = "master";
+
include("funcs.inc.php");
$myData = new pData();
$db = new db();
-$sql = "select * from (select sum(status=0) as success,sum(status=1) as failures,sum(status=2) as timeouts,count(*) as total,date(builddate) as day from results where branch='master' group by date(builddate) order by date(builddate) desc limit 180) as foo order by day;";
+$sql = "select * from (select sum(status=0) as success,sum(status=1) as failures,sum(status=2) as timeouts,count(*) as total,date(builddate) as day from results where branch='$branch' group by date(builddate) order by date(builddate) desc limit 180) as foo order by day;";
$ret = $db->query($sql);
if ($ret == FALSE) {
diff --git a/web/stats.php b/web/stats.php
index 31a590d..378f56a 100644
--- a/web/stats.php
+++ b/web/stats.php
@@ -1,11 +1,38 @@
<?php
include("funcs.inc.php");
-bab_header("Buildroot <i>master</i> tests statistics");
+if (isset($_GET['branch']) && preg_match("/^[a-z0-9_\.]*$/", $_GET['branch']))
+ $branch = $_GET['branch'];
+else
+ $branch = "master";
+
+bab_header("Buildroot '$branch' tests statistics");
+
+echo "<h2>Branches: ";
+
+$csv = fopen("branches", "r");
+if ($csv !== FALSE) {
+ $first = true;
+ while (($data = fgetcsv($csv, 128, ",")) !== FALSE) {
+ if (!$first) {
+ echo "&nbsp;|&nbsp;";
+ }
+ if ($data[0] == $branch) {
+ echo "<i><a href=\"?branch=$data[0]\">$data[0]</a></i>";
+ } else {
+ echo "<a href=\"?branch=$data[0]\">$data[0]</a>";
+ }
+ $first = false;
+ }
+} else {
+ echo "master";
+}
+
+echo "</h2>\n";
$db = new db();
-$sql = "select sum(status=0) as success,sum(status=1) as failures,sum(status=2) as timeouts,count(*) as total,date(builddate) as day from results where branch='master' group by date(builddate) order by date(builddate) desc limit 30;";
+$sql = "select sum(status=0) as success,sum(status=1) as failures,sum(status=2) as timeouts,count(*) as total,date(builddate) as day from results where branch='$branch' group by date(builddate) order by date(builddate) desc limit 30;";
$ret = $db->query($sql);
if ($ret == FALSE) {
@@ -62,7 +89,7 @@ echo " <td>$timeoutrate%</td>\n";
echo " <td>$total</td>\n";
echo " </tr>\n";
-$sql = "select sum(status=0) as success,sum(status=1) as failures,sum(status=2) as timeouts,count(*) as total from results where branch='master';";
+$sql = "select sum(status=0) as success,sum(status=1) as failures,sum(status=2) as timeouts,count(*) as total from results where branch='$branch';";
$ret = $db->query($sql);
if ($ret == FALSE) {
@@ -91,7 +118,7 @@ echo " </tr>\n";
echo "</table>\n";
echo "<p></p>";
-echo "<center><img src=\"graph.php\"/></center>";
+echo "<center><img src=\"graph.php?branch=$branch\"/></center>";
bab_footer();
?>
diff --git a/web/stylesheet.css b/web/stylesheet.css
index a17c825..f2b5ac1 100644
--- a/web/stylesheet.css
+++ b/web/stylesheet.css
@@ -7,6 +7,10 @@ h1 {
margin-bottom: 10px;
}
+h2 {
+ text-align: center;
+}
+
table {
width: 90%;
margin: auto;