summaryrefslogtreecommitdiffstats
path: root/non-puppet
diff options
context:
space:
mode:
authorJuha Sippola <juhasippola@outlook.com>2015-07-01 16:27:38 +0300
committerTony Sarajärvi <tony.sarajarvi@theqtcompany.com>2015-09-16 07:32:13 +0000
commit58ce8abda57dec8843b14273a6261ae52dcfcc04 (patch)
tree604413e6948f0b7cbe8ed9feb58d5464a3fe7545 /non-puppet
parent64a14e09f7d3a73f58758f67fe35a779f56f580b (diff)
Qt Metrics 2 (v0.8): Platform pages
Implemented the platform views into build project page by filtering the confs based on the target os. Buttons indicate the selection and can be used to change between the platforms. Home page buttons activated. Change-Id: Id175ff4279091d886d779307ccdf8dd795ffe456 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
Diffstat (limited to 'non-puppet')
-rw-r--r--non-puppet/qtmetrics2/index.php149
-rw-r--r--non-puppet/qtmetrics2/src/Database.php117
-rw-r--r--non-puppet/qtmetrics2/src/Factory.php14
-rw-r--r--non-puppet/qtmetrics2/src/test/DatabaseTest.php142
-rw-r--r--non-puppet/qtmetrics2/src/test/FactoryTest.php56
-rw-r--r--non-puppet/qtmetrics2/templates/about.html6
-rw-r--r--non-puppet/qtmetrics2/templates/build_project.html54
-rw-r--r--non-puppet/qtmetrics2/templates/home.html44
-rw-r--r--non-puppet/qtmetrics2/templates/overview.html16
9 files changed, 476 insertions, 122 deletions
diff --git a/non-puppet/qtmetrics2/index.php b/non-puppet/qtmetrics2/index.php
index 811c126..e183991 100644
--- a/non-puppet/qtmetrics2/index.php
+++ b/non-puppet/qtmetrics2/index.php
@@ -34,8 +34,8 @@
/**
* Qt Metrics API
- * @version 0.7
- * @since 30-06-2015
+ * @version 0.8
+ * @since 01-07-2015
* @author Juha Sippola
*/
@@ -60,17 +60,18 @@ $app = new Slim\Slim(array(
$app->get('/', function() use($app)
{
$ini = Factory::conf();
+ $platformRoute = str_replace('/:targetOs', '', Slim\Slim::getInstance()->urlFor('buildproject_platform'));
$app->render('home.html', array(
'root' => Slim\Slim::getInstance()->urlFor('root'),
- 'overviewRoute' => Slim\Slim::getInstance()->urlFor('root') . 'overview',
- 'branchRoute' => Slim\Slim::getInstance()->urlFor('root') . 'branch',
- 'platformRoute' => Slim\Slim::getInstance()->urlFor('root') . 'platform',
- 'testRoute' => Slim\Slim::getInstance()->urlFor('root') . 'test',
+ 'overviewRoute' => Slim\Slim::getInstance()->urlFor('overview'),
+ 'platformRoute' => $platformRoute,
+ 'topRoute' => Slim\Slim::getInstance()->urlFor('top'),
+ 'flakyRoute' => Slim\Slim::getInstance()->urlFor('flaky'),
'refreshed' => Factory::db()->getDbRefreshed() . ' (GMT)',
'masterProject' => $ini['master_build_project'],
'masterState' => $ini['master_build_state'],
'branches' => Factory::db()->getBranches(),
- 'platforms' => Factory::db()->getTargetPlatforms()
+ 'platforms' => Factory::db()->getTargetPlatformOs()
));
})->name('root');
@@ -84,11 +85,13 @@ $app->get('/overview', function() use($app)
$breadcrumb = array(
array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root'))
);
+ $buildProjectRoute = Slim\Slim::getInstance()->urlFor('buildproject');
+ $testsetProjectRoute = str_replace('/:project', '', Slim\Slim::getInstance()->urlFor('testsetproject'));
$app->render('overview.html', array(
'root' => Slim\Slim::getInstance()->urlFor('root'),
'breadcrumb' => $breadcrumb,
- 'buildProjectRoute' => Slim\Slim::getInstance()->urlFor('root') . 'buildproject',
- 'testsetProjectRoute' => Slim\Slim::getInstance()->urlFor('root') . 'testsetproject',
+ 'buildProjectRoute' => $buildProjectRoute,
+ 'testsetProjectRoute' => $testsetProjectRoute,
'refreshed' => Factory::db()->getDbRefreshed() . ' (GMT)',
'masterProject' => $ini['master_build_project'],
'masterState' => $ini['master_build_state'],
@@ -99,40 +102,141 @@ $app->get('/overview', function() use($app)
$ini['master_build_project'],
$ini['master_build_state'])
));
-});
+})->name('overview');
/**
* UI route: /buildproject (GET)
*/
-$app->get('/buildproject/:project', function($project) use($app)
+$app->get('/buildproject', function() use($app)
{
- $project = strip_tags($project);
$ini = Factory::conf();
$breadcrumb = array(
- array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root'))
+ array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root')),
+ array('name' => 'overview', 'link' => Slim\Slim::getInstance()->urlFor('overview'))
);
+ $platformRoute = str_replace('/:targetOs', '', Slim\Slim::getInstance()->urlFor('buildproject_platform'));
+ $confRoute = str_replace('/:conf', '', Slim\Slim::getInstance()->urlFor('buildproject_conf'));
$app->render('build_project.html', array(
'root' => Slim\Slim::getInstance()->urlFor('root'),
'breadcrumb' => $breadcrumb,
+ 'platformRoute' => $platformRoute,
+ 'confRoute' => $confRoute,
'refreshed' => Factory::db()->getDbRefreshed() . ' (GMT)',
'masterProject' => $ini['master_build_project'],
'masterState' => $ini['master_build_state'],
+ 'platforms' => Factory::db()->getTargetPlatformOs(),
+ 'targetOs' => '',
+ 'conf' => '',
'latestProjectRuns' => Factory::db()->getLatestProjectBranchBuildResults(
- $project,
+ $ini['master_build_project'],
$ini['master_build_state']),
'projectBuilds' => Factory::db()->getProjectBuildsByBranch(
$ini['master_build_project'],
$ini['master_build_state']),
'project' => Factory::createProject(
- $project,
+ $ini['master_build_project'],
$ini['master_build_project'],
$ini['master_build_state']), // managed as object
'confRuns' => Factory::createConfRuns(
$ini['master_build_project'],
- $ini['master_build_state']) // managed as objects
+ $ini['master_build_state'],
+ '',
+ '') // managed as objects
));
-});
+})->name('buildproject');
+
+/**
+ * UI route: /buildproject/:project/platform (GET)
+ * Similar to /buildproject but filtered with os
+ */
+
+$app->get('/buildproject/platform/:targetOs', function($targetOs) use($app)
+{
+ $targetOs = strip_tags($targetOs);
+ $ini = Factory::conf();
+ $buildProjectRoute = str_replace('/:project', '', Slim\Slim::getInstance()->urlFor('buildproject'));
+ $breadcrumb = array(
+ array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root')),
+ array('name' => 'overview', 'link' => Slim\Slim::getInstance()->urlFor('overview')),
+ array('name' => $ini['master_build_project'], 'link' => $buildProjectRoute)
+ );
+ $platformRoute = str_replace('/:targetOs', '', Slim\Slim::getInstance()->urlFor('buildproject_platform'));
+ $confRoute = str_replace('/:conf', '', Slim\Slim::getInstance()->urlFor('buildproject_conf'));
+ $app->render('build_project.html', array(
+ 'root' => Slim\Slim::getInstance()->urlFor('root'),
+ 'breadcrumb' => $breadcrumb,
+ 'platformRoute' => $platformRoute,
+ 'confRoute' => $confRoute,
+ 'refreshed' => Factory::db()->getDbRefreshed() . ' (GMT)',
+ 'masterProject' => $ini['master_build_project'],
+ 'masterState' => $ini['master_build_state'],
+ 'platforms' => Factory::db()->getTargetPlatformOs(),
+ 'targetOs' => $targetOs,
+ 'conf' => '',
+ 'latestProjectRuns' => Factory::db()->getLatestProjectBranchBuildResults(
+ $ini['master_build_project'],
+ $ini['master_build_state']),
+ 'projectBuilds' => Factory::db()->getProjectBuildsByBranch(
+ $ini['master_build_project'],
+ $ini['master_build_state']),
+ 'project' => Factory::createProject(
+ $ini['master_build_project'],
+ $ini['master_build_project'],
+ $ini['master_build_state']), // managed as object
+ 'confRuns' => Factory::createConfRuns(
+ $ini['master_build_project'],
+ $ini['master_build_state'],
+ $targetOs,
+ '') // managed as objects
+ ));
+})->name('buildproject_platform');
+
+/**
+ * UI route: /buildproject/:project/conf (GET)
+ * Similar to /buildproject but filtered with conf
+ */
+
+$app->get('/buildproject/conf/:conf', function($conf) use($app)
+{
+ $conf = strip_tags($conf);
+ $ini = Factory::conf();
+ $buildProjectRoute = str_replace('/:project', '', Slim\Slim::getInstance()->urlFor('buildproject'));
+ $breadcrumb = array(
+ array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root')),
+ array('name' => 'overview', 'link' => Slim\Slim::getInstance()->urlFor('overview')),
+ array('name' => $ini['master_build_project'], 'link' => $buildProjectRoute)
+ );
+ $platformRoute = str_replace('/:targetOs', '', Slim\Slim::getInstance()->urlFor('buildproject_platform'));
+ $confRoute = str_replace('/:conf', '', Slim\Slim::getInstance()->urlFor('buildproject_conf'));
+ $app->render('build_project.html', array(
+ 'root' => Slim\Slim::getInstance()->urlFor('root'),
+ 'breadcrumb' => $breadcrumb,
+ 'platformRoute' => $platformRoute,
+ 'confRoute' => $confRoute,
+ 'refreshed' => Factory::db()->getDbRefreshed() . ' (GMT)',
+ 'masterProject' => $ini['master_build_project'],
+ 'masterState' => $ini['master_build_state'],
+ 'platforms' => Factory::db()->getTargetPlatformOs(),
+ 'targetOs' => '',
+ 'conf' => $conf,
+ 'latestProjectRuns' => Factory::db()->getLatestProjectBranchBuildResults(
+ $ini['master_build_project'],
+ $ini['master_build_state']),
+ 'projectBuilds' => Factory::db()->getProjectBuildsByBranch(
+ $ini['master_build_project'],
+ $ini['master_build_state']),
+ 'project' => Factory::createProject(
+ $ini['master_build_project'],
+ $ini['master_build_project'],
+ $ini['master_build_state']), // managed as object
+ 'confRuns' => Factory::createConfRuns(
+ $ini['master_build_project'],
+ $ini['master_build_state'],
+ '',
+ $conf) // managed as objects
+ ));
+})->name('buildproject_conf');
/**
* UI route: /testsetproject (GET)
@@ -143,7 +247,8 @@ $app->get('/testsetproject/:project', function($project) use($app)
$project = strip_tags($project);
$ini = Factory::conf();
$breadcrumb = array(
- array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root'))
+ array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root')),
+ array('name' => 'overview', 'link' => Slim\Slim::getInstance()->urlFor('overview'))
);
$app->render('testset_project.html', array(
'root' => Slim\Slim::getInstance()->urlFor('root'),
@@ -164,7 +269,7 @@ $app->get('/testsetproject/:project', function($project) use($app)
$ini['master_build_project'],
$ini['master_build_state'])
));
-});
+})->name('testsetproject');
/**
* UI route: /test/top (GET)
@@ -193,7 +298,7 @@ $app->get('/test/top', function() use($app)
$ini['master_build_project'],
$ini['master_build_state']) // managed as objects
));
-});
+})->name('top');
/**
* UI route: /test/flaky (GET)
@@ -220,7 +325,7 @@ $app->get('/test/flaky', function() use($app)
null,
null) // managed as objects
));
-});
+})->name('flaky');
/**
* UI route: /testset/:testset/:project (GET)
@@ -266,7 +371,7 @@ $app->get('/testset/:testset/:project', function($testset, $project) use($app)
));
$app->response()->status(404);
}
-})->name('testsetProject');
+})->name('testset');
$app->run();
diff --git a/non-puppet/qtmetrics2/src/Database.php b/non-puppet/qtmetrics2/src/Database.php
index 5ebf6e1..92bc163 100644
--- a/non-puppet/qtmetrics2/src/Database.php
+++ b/non-puppet/qtmetrics2/src/Database.php
@@ -34,8 +34,8 @@
/**
* Database class
- * @version 0.6
- * @since 30-06-2015
+ * @version 0.7
+ * @since 01-07-2015
* @author Juha Sippola
*/
@@ -186,23 +186,22 @@ class Database {
}
/**
- * Get list of target platform os's and versions
- * @return array (string os, string os_version)
+ * Get list of target platform os's
+ * @return array (string os)
*/
- public function getTargetPlatforms()
+ public function getTargetPlatformOs()
{
$result = array();
$query = $this->db->prepare("
- SELECT platform.os, platform.os_version
+ SELECT DISTINCT platform.os
FROM conf
INNER JOIN platform ON conf.target_id = platform.id
- GROUP BY os_version;
+ ORDER BY platform.os;
");
$query->execute(array());
while($row = $query->fetch(PDO::FETCH_ASSOC)) {
$result[] = array(
- 'os' => $row['os'],
- 'os_version' => $row['os_version']
+ 'os' => $row['os']
);
}
return $result;
@@ -731,6 +730,106 @@ class Database {
}
/**
+ * Get conf run data for selected target os by branch
+ * @param string $runProject
+ * @param string $runState
+ * @param string $targetOs
+ * @return array (string branch, string conf, string build_key, bool forcesuccess, bool insignificant, string result, string timestamp, string duration)
+ */
+ public function getConfOsBuildsByBranch($runProject, $runState, $targetOs)
+ {
+ $result = array();
+ $query = $this->db->prepare("
+ SELECT
+ branch.name AS branch,
+ conf.name AS conf,
+ project_run.build_key,
+ conf_run.forcesuccess,
+ conf_run.insignificant,
+ conf_run.result,
+ conf_run.timestamp,
+ conf_run.duration
+ FROM conf_run
+ INNER JOIN conf ON conf_run.conf_id = conf.id
+ INNER JOIN project_run ON conf_run.project_run_id = project_run.id
+ INNER JOIN branch ON project_run.branch_id = branch.id
+ WHERE
+ project_run.project_id = (SELECT id FROM project WHERE name = ?) AND
+ project_run.state_id = (SELECT id FROM state WHERE name = ?) AND
+ conf.target_id IN (SELECT id FROM platform WHERE os = ?)
+ ORDER BY branch.name, conf, project_run.timestamp DESC;
+ ");
+ $query->execute(array(
+ $runProject,
+ $runState,
+ $targetOs
+ ));
+ while($row = $query->fetch(PDO::FETCH_ASSOC)) {
+ $result[] = array(
+ 'branch' => $row['branch'],
+ 'conf' => $row['conf'],
+ 'buildKey' => $row['build_key'],
+ 'forcesuccess' => $row['forcesuccess'],
+ 'insignificant' => $row['insignificant'],
+ 'result' => $row['result'],
+ 'timestamp' => $row['timestamp'],
+ 'duration' => $row['duration']
+ );
+ }
+ return $result;
+ }
+
+ /**
+ * Get conf run data for selected conf by branch
+ * @param string $runProject
+ * @param string $runState
+ * @param string $conf
+ * @return array (string branch, string conf, string build_key, bool forcesuccess, bool insignificant, string result, string timestamp, string duration)
+ */
+ public function getConfBuildByBranch($runProject, $runState, $conf)
+ {
+ $result = array();
+ $query = $this->db->prepare("
+ SELECT
+ branch.name AS branch,
+ conf.name AS conf,
+ project_run.build_key,
+ conf_run.forcesuccess,
+ conf_run.insignificant,
+ conf_run.result,
+ conf_run.timestamp,
+ conf_run.duration
+ FROM conf_run
+ INNER JOIN conf ON conf_run.conf_id = conf.id
+ INNER JOIN project_run ON conf_run.project_run_id = project_run.id
+ INNER JOIN branch ON project_run.branch_id = branch.id
+ WHERE
+ project_run.project_id = (SELECT id FROM project WHERE name = ?) AND
+ project_run.state_id = (SELECT id FROM state WHERE name = ?) AND
+ conf.name = ?
+ ORDER BY branch.name, conf, project_run.timestamp DESC;
+ ");
+ $query->execute(array(
+ $runProject,
+ $runState,
+ $conf
+ ));
+ while($row = $query->fetch(PDO::FETCH_ASSOC)) {
+ $result[] = array(
+ 'branch' => $row['branch'],
+ 'conf' => $row['conf'],
+ 'buildKey' => $row['build_key'],
+ 'forcesuccess' => $row['forcesuccess'],
+ 'insignificant' => $row['insignificant'],
+ 'result' => $row['result'],
+ 'timestamp' => $row['timestamp'],
+ 'duration' => $row['duration']
+ );
+ }
+ return $result;
+ }
+
+ /**
* Get run results for a testset in specified builds by branch and configuration
* @param string $testset
* @param $testsetProject
diff --git a/non-puppet/qtmetrics2/src/Factory.php b/non-puppet/qtmetrics2/src/Factory.php
index f8e0378..3712013 100644
--- a/non-puppet/qtmetrics2/src/Factory.php
+++ b/non-puppet/qtmetrics2/src/Factory.php
@@ -34,8 +34,8 @@
/**
* Factory class
- * @version 0.4
- * @since 30-06-2015
+ * @version 0.5
+ * @since 01-07-2015
* @author Juha Sippola
*/
@@ -239,12 +239,18 @@ class Factory {
* Create ConfRun objects for those in database
* @param string $runProject
* @param string $runState
+ * @param string $targetOs
* @return array ConfRun objects
*/
- public static function createConfRuns($runProject, $runState)
+ public static function createConfRuns($runProject, $runState, $targetOs, $conf)
{
$objects = array();
- $dbEntries = self::db()->getConfBuildsByBranch($runProject, $runState);
+ if (empty($targetOs) and empty($conf))
+ $dbEntries = self::db()->getConfBuildsByBranch($runProject, $runState);
+ else if (!empty($targetOs))
+ $dbEntries = self::db()->getConfOsBuildsByBranch($runProject, $runState, $targetOs);
+ else
+ $dbEntries = self::db()->getConfBuildByBranch($runProject, $runState, $conf);
foreach($dbEntries as $entry) {
$obj = new ConfRun(
$entry['conf'],
diff --git a/non-puppet/qtmetrics2/src/test/DatabaseTest.php b/non-puppet/qtmetrics2/src/test/DatabaseTest.php
index e15157f..00a0d9d 100644
--- a/non-puppet/qtmetrics2/src/test/DatabaseTest.php
+++ b/non-puppet/qtmetrics2/src/test/DatabaseTest.php
@@ -38,8 +38,8 @@ require_once(__DIR__.'/../Factory.php');
* Database unit test class
* Some of the tests require the test data as inserted into database with qtmetrics_insert.sql
* @example To run (in qtmetrics root directory): php <path-to-phpunit>/phpunit.phar ./src/test
- * @version 0.6
- * @since 30-06-2015
+ * @version 0.7
+ * @since 01-07-2015
* @author Juha Sippola
*/
@@ -50,7 +50,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
* Test getProjects
* @dataProvider testGetProjectsData
*/
- public function testGetProjects($project)
+ public function testGetProjects($exp_project)
{
$items = array();
$db = Factory::db();
@@ -60,7 +60,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
$this->assertArrayHasKey('name', $row);
$items[] = $row['name'];
}
- $this->assertContains($project, $items);
+ $this->assertContains($exp_project, $items);
}
public function testGetProjectsData()
{
@@ -74,7 +74,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
* Test getBranches
* @dataProvider testGetBranchesData
*/
- public function testGetBranches($branch)
+ public function testGetBranches($exp_branch)
{
$items = array();
$db = Factory::db();
@@ -84,7 +84,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
$this->assertArrayHasKey('name', $row);
$items[] = $row['name'];
}
- $this->assertContains($branch, $items);
+ $this->assertContains($exp_branch, $items);
}
public function testGetBranchesData()
{
@@ -97,7 +97,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
* Test getStates
* @dataProvider testGetStateData
*/
- public function testGetStates($state)
+ public function testGetStates($exp_state)
{
$items = array();
$db = Factory::db();
@@ -107,7 +107,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
$this->assertArrayHasKey('name', $row);
$items[] = $row['name'];
}
- $this->assertContains($state, $items);
+ $this->assertContains($exp_state, $items);
}
public function testGetStateData()
{
@@ -194,33 +194,28 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
}
/**
- * Test getTargetPlatforms
- * @dataProvider testGetTargetPlatformsData
+ * Test getTargetPlatformOs
+ * @dataProvider testGetTargetPlatformOsData
*/
- public function testGetTargetPlatforms($exp_os, $exp_os_version, $exp_count_min)
+ public function testGetTargetPlatformOs($exp_os, $exp_count)
{
$db = Factory::db();
- $result = $db->getTargetPlatforms();
+ $result = $db->getTargetPlatformOs();
$this->assertNotEmpty($result);
$osCount = 0;
- $versionCount = 0;
foreach($result as $row) {
$this->assertArrayHasKey('os', $row);
- $this->assertArrayHasKey('os_version', $row);
if ($row['os'] === $exp_os)
$osCount++;
- if ($row['os_version'] === $exp_os_version)
- $versionCount++;
}
- $this->assertGreaterThanOrEqual($exp_count_min, $osCount);
- $this->assertGreaterThanOrEqual($exp_count_min, $versionCount);
+ $this->assertGreaterThanOrEqual($exp_count, $osCount);
}
- public function testGetTargetPlatformsData()
+ public function testGetTargetPlatformOsData()
{
return array(
- array('linux', 'android', 1),
- array('windows', 'win64', 1),
- array('windows', 'invalid', 0)
+ array('linux', 1),
+ array('windows', 1),
+ array('invalid', 0)
);
}
@@ -618,13 +613,114 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
array('Qt5', 'state', 'dev', 'linux-g++_developer-build_qtnamespace_qtlibinfix_Ubuntu_11.10_x64', '1023', 'FAILURE', 1),
array('Qt5', 'state', 'stable', 'win32-msvc2010_developer-build_angle_Windows_7', '1348', 'SUCCESS', 1),
array('Qt5', 'state', 'stable', 'macx-clang_developer-build_OSX_10.8', '1348', 'SUCCESS', 1),
- array('Qt5', 'state', 'stable', 'win32-msvc2010_developer-build_angle_Windows_7', '1348', 'SUCCESS', 1),
array('Qt5', 'state', 'dev', 'linux-g++-32_developer-build_Ubuntu_10.04_x86', 'BuildKeyInStringFormat12345', 'FAILURE', 1),
array('Qt5', 'invalid', '', '', '', '', 0)
);
}
/**
+ * Test getConfOsBuildsByBranch
+ * @dataProvider testGetConfOsBuildsByBranchData
+ */
+ public function testGetConfOsBuildsByBranch($runProject, $runState, $targetOs, $exp_branch, $exp_conf, $exp_key, $exp_result, $has_data, $has_conf)
+ {
+ $branches = array();
+ $confs = array();
+ $keys = array();
+ $results = array();
+ $db = Factory::db();
+ $result = $db->getConfOsBuildsByBranch($runProject, $runState, $targetOs);
+ foreach($result as $row) {
+ $this->assertArrayHasKey('branch', $row);
+ $this->assertArrayHasKey('conf', $row);
+ $this->assertArrayHasKey('buildKey', $row);
+ $this->assertArrayHasKey('forcesuccess', $row);
+ $this->assertArrayHasKey('insignificant', $row);
+ $this->assertArrayHasKey('result', $row);
+ $this->assertArrayHasKey('timestamp', $row);
+ $this->assertArrayHasKey('duration', $row);
+ $branches[] = $row['branch'];
+ $confs[] = $row['conf'];
+ $keys[] = $row['buildKey'];
+ $results[] = $row['result'];
+ }
+ if ($has_data) {
+ $this->assertNotEmpty($result);
+ $this->assertContains($exp_branch, $branches);
+ if ($has_conf)
+ $this->assertContains($exp_conf, $confs);
+ else
+ $this->assertNotContains($exp_conf, $confs);
+ $this->assertContains($exp_key, $keys);
+ $this->assertContains($exp_result, $results);
+ } else {
+ $this->assertEmpty($result);
+ }
+ }
+ public function testGetConfOsBuildsByBranchData()
+ {
+ return array(
+ array('Qt5', 'state', 'linux', 'dev', 'linux-g++_developer-build_qtnamespace_qtlibinfix_Ubuntu_11.10_x64', '1023', 'FAILURE', 1, 1),
+ array('Qt5', 'state', 'linux', 'dev', 'linux-g++-32_developer-build_Ubuntu_10.04_x86', 'BuildKeyInStringFormat12345', 'FAILURE', 1, 1),
+ array('Qt5', 'state', 'windows', 'stable', 'win32-msvc2010_developer-build_angle_Windows_7', '1348', 'SUCCESS', 1, 1),
+ array('Qt5', 'state', 'osx', 'stable', 'macx-clang_developer-build_OSX_10.8', '1348', 'SUCCESS', 1, 1),
+ array('Qt5', 'state', 'linux', 'stable', 'macx-clang_developer-build_OSX_10.8', '1348', 'SUCCESS', 1, 0),
+ array('Qt5', 'state', 'invalid', '', '', '', '', 0, 0)
+ );
+ }
+
+ /**
+ * Test getConfBuildByBranch
+ * @dataProvider testGetConfBuildByBranchData
+ */
+ public function testGetConfBuildByBranch($runProject, $runState, $conf, $exp_branch, $exp_conf, $exp_key, $exp_result, $has_data, $has_conf)
+ {
+ $branches = array();
+ $confs = array();
+ $keys = array();
+ $results = array();
+ $db = Factory::db();
+ $result = $db->getConfBuildByBranch($runProject, $runState, $conf);
+ foreach($result as $row) {
+ $this->assertArrayHasKey('branch', $row);
+ $this->assertArrayHasKey('conf', $row);
+ $this->assertArrayHasKey('buildKey', $row);
+ $this->assertArrayHasKey('forcesuccess', $row);
+ $this->assertArrayHasKey('insignificant', $row);
+ $this->assertArrayHasKey('result', $row);
+ $this->assertArrayHasKey('timestamp', $row);
+ $this->assertArrayHasKey('duration', $row);
+ $branches[] = $row['branch'];
+ $confs[] = $row['conf'];
+ $keys[] = $row['buildKey'];
+ $results[] = $row['result'];
+ }
+ if ($has_data) {
+ $this->assertNotEmpty($result);
+ $this->assertContains($exp_branch, $branches);
+ if ($has_conf)
+ $this->assertContains($exp_conf, $confs);
+ else
+ $this->assertNotContains($exp_conf, $confs);
+ $this->assertContains($exp_key, $keys);
+ $this->assertContains($exp_result, $results);
+ } else {
+ $this->assertEmpty($result);
+ }
+ }
+ public function testGetConfBuildByBranchData()
+ {
+ return array(
+ array('Qt5', 'state', 'linux-g++_developer-build_qtnamespace_qtlibinfix_Ubuntu_11.10_x64', 'dev', 'linux-g++_developer-build_qtnamespace_qtlibinfix_Ubuntu_11.10_x64', '1023', 'FAILURE', 1, 1),
+ array('Qt5', 'state', 'linux-g++-32_developer-build_Ubuntu_10.04_x86', 'dev', 'linux-g++-32_developer-build_Ubuntu_10.04_x86', 'BuildKeyInStringFormat12345', 'FAILURE', 1, 1),
+ array('Qt5', 'state', 'win32-msvc2010_developer-build_angle_Windows_7', 'stable', 'win32-msvc2010_developer-build_angle_Windows_7', '1348', 'SUCCESS', 1, 1),
+ array('Qt5', 'state', 'macx-clang_developer-build_OSX_10.8', 'stable', 'macx-clang_developer-build_OSX_10.8', '1348', 'SUCCESS', 1, 1),
+ array('Qt5', 'state', 'win32-msvc2010_developer-build_angle_Windows_7', 'stable', 'macx-clang_developer-build_OSX_10.8', '1348', 'SUCCESS', 1, 0),
+ array('Qt5', 'state', 'invalid', '', '', '', '', 0, 0)
+ );
+ }
+
+ /**
* Test getTestsetResultsByBranchConf
* @dataProvider testGetTestsetResultsByBranchConfData
*/
diff --git a/non-puppet/qtmetrics2/src/test/FactoryTest.php b/non-puppet/qtmetrics2/src/test/FactoryTest.php
index aa852a6..6508397 100644
--- a/non-puppet/qtmetrics2/src/test/FactoryTest.php
+++ b/non-puppet/qtmetrics2/src/test/FactoryTest.php
@@ -37,8 +37,8 @@ require_once(__DIR__.'/../Factory.php');
/**
* Factory unit test class
* @example To run (in qtmetrics root directory): php <path-to-phpunit>/phpunit.phar ./src/test
- * @version 0.4
- * @since 30-06-2015
+ * @version 0.5
+ * @since 01-07-2015
* @author Juha Sippola
*/
@@ -244,18 +244,39 @@ class FactoryTest extends PHPUnit_Framework_TestCase
* Test createConfRuns
* @dataProvider testCreateConfRunsData
*/
- public function testCreateConfRuns($name, $projectName, $branchName, $stateName, $buildKey, $result, $insignificant, $forcesuccess, $timestamp, $duration)
+ public function testCreateConfRuns($runProject, $runState, $targetOs, $conf, $exp_branch, $exp_buildKey, $exp_conf, $has_data)
{
- $runs = Factory::createConfRuns($name, $projectName, $branchName, $stateName, $buildKey, $result, $insignificant, $forcesuccess, $timestamp, $duration);
+ $branches = array();
+ $buildKeys = array();
+ $confs = array();
+ $runs = Factory::createConfRuns($runProject, $runState, $targetOs, $conf);
foreach($runs as $run) {
$this->assertTrue($run instanceof ConfRun);
+ $branches[] = $run->getBranchName();
+ $buildKeys[] = $run->getBuildKey();
+ $confs[] = $run->getName();
+ }
+ if ($has_data) {
+ $this->assertContains($exp_branch, $branches);
+ $this->assertContains($exp_buildKey, $buildKeys);
+ $this->assertContains($exp_conf, $confs);
+ } else {
+ $this->assertEmpty($runs);
}
}
public function testCreateConfRunsData()
{
return array(
- array('win64-msvc2012_developer-build_qtnamespace_Windows_8', 'Qt5', 'stable', 'state', '1348', 'failed', true, false, '28.5.2013 0:54', 8130),
- array('linux-g++-32_developer-build_Ubuntu_10.04_x86', 'Qt5', 'dev', 'state', 'BuildKeyInStringFormat12345', 'failed', false, true, '28.5.2013 0:54', 8130)
+ array('Qt5', 'state', '', '', 'stable', '1348', 'win64-msvc2012_developer-build_qtnamespace_Windows_8', 1),
+ array('Qt5', 'state', '', '', 'stable', '1348', 'linux-g++-32_developer-build_Ubuntu_10.04_x86', 1),
+ array('Qt5', 'state', 'windows', '', 'stable', '1348', 'win64-msvc2012_developer-build_qtnamespace_Windows_8', 1),
+ array('Qt5', 'state', 'linux', '', 'stable', '1348', 'linux-g++-32_developer-build_Ubuntu_10.04_x86', 1),
+ array('Qt5', 'state', 'linux', '', 'dev', 'BuildKeyInStringFormat12345', 'linux-g++-32_developer-build_Ubuntu_10.04_x86', 1),
+ array('Qt5', 'state', 'invalid', '', '', '', '', 0),
+ array('Qt5', 'state', '', 'win64-msvc2012_developer-build_qtnamespace_Windows_8', 'stable', '1348', 'win64-msvc2012_developer-build_qtnamespace_Windows_8', 1),
+ array('Qt5', 'state', '', 'linux-g++-32_developer-build_Ubuntu_10.04_x86', 'stable', '1348', 'linux-g++-32_developer-build_Ubuntu_10.04_x86', 1),
+ array('Qt5', 'state', '', 'linux-g++-32_developer-build_Ubuntu_10.04_x86', 'dev', 'BuildKeyInStringFormat12345', 'linux-g++-32_developer-build_Ubuntu_10.04_x86', 1),
+ array('Qt5', 'state', '', 'invalid', '', '', '', 0),
);
}
@@ -263,18 +284,33 @@ class FactoryTest extends PHPUnit_Framework_TestCase
* Test createTestsetRuns
* @dataProvider testCreateTestsetRunsData
*/
- public function testCreateTestsetRuns($name, $testsetProject, $projectName, $branchName, $stateName, $buildKey, $confName, $run, $result, $insignificant, $timestamp, $duration)
+ public function testCreateTestsetRuns($name, $testsetProject, $runProject, $runState, $exp_branch, $exp_buildKey, $exp_conf, $has_data)
{
- $runs = Factory::createTestsetRuns($name, $testsetProject, $projectName, $branchName, $stateName, $buildKey, $confName, $run, $result, $insignificant, $timestamp, $duration);
+ $branches = array();
+ $buildKeys = array();
+ $confs = array();
+ $runs = Factory::createTestsetRuns($name, $testsetProject, $runProject, $runState);
foreach($runs as $run) {
$this->assertTrue($run instanceof TestsetRun);
+ $branches[] = $run->getBranchName();
+ $buildKeys[] = $run->getBuildKey();
+ $confs[] = $run->getConfName();
+ }
+ if ($has_data) {
+ $this->assertContains($exp_branch, $branches);
+ $this->assertContains($exp_buildKey, $buildKeys);
+ $this->assertContains($exp_conf, $confs);
+ } else {
+ $this->assertEmpty($runs);
}
}
public function testCreateTestsetRunsData()
{
return array(
- array('tst_qftp', 'qtbase', 'Qt5', 'stable', 'state', '1348', 'win64-msvc2012_developer-build_qtnamespace_Windows_8', 5, 'failed', true, '28.5.2013 0:54', 8130),
- array('tst_qfont', 'qtbase', 'Qt5', 'dev', 'state', 'BuildKeyInStringFormat12345', 'linux-g++-32_developer-build_Ubuntu_10.04_x86', 1, 'failed', false, '28.5.2013 0:54', 8130)
+ array('tst_qftp', 'qtbase', 'Qt5', 'state', 'stable', '1348', 'win64-msvc2012_developer-build_qtnamespace_Windows_8', 1),
+ array('tst_qfont', 'qtbase', 'Qt5', 'state', 'dev', 'BuildKeyInStringFormat12345', 'linux-g++-32_developer-build_Ubuntu_10.04_x86', 1),
+ array('invalid', 'qtbase', 'Qt5', 'state', '', '', '', 0),
+ array('tst_qftp', 'invalid', 'Qt5', 'state', '', '', '', 0),
);
}
diff --git a/non-puppet/qtmetrics2/templates/about.html b/non-puppet/qtmetrics2/templates/about.html
index 6e2ca7d..72ac523 100644
--- a/non-puppet/qtmetrics2/templates/about.html
+++ b/non-puppet/qtmetrics2/templates/about.html
@@ -34,8 +34,8 @@
/**
* About window content
- * @version 0.7
- * @since 30-06-2015
+ * @version 0.8
+ * @since 01-07-2015
* @author Juha Sippola
*/
@@ -44,4 +44,4 @@
<p>This is Qt Metrics revision 2 with redesigned UI and database.</p>
<p>These pages are still <strong>under construction</strong> and therefore the views and functionality is limited.</p>
<p>See the <a href="https://wiki.qt.io/Qt_Metrics_2_Backlog" target="_blank">backlog</a> for development items currently identified or in progress.</p>
-<p><small>Version 0.7 (30-Jun-2015)</small></p>
+<p><small>Version 0.8 (01-Jul-2015)</small></p>
diff --git a/non-puppet/qtmetrics2/templates/build_project.html b/non-puppet/qtmetrics2/templates/build_project.html
index c400e28..e264493 100644
--- a/non-puppet/qtmetrics2/templates/build_project.html
+++ b/non-puppet/qtmetrics2/templates/build_project.html
@@ -34,8 +34,8 @@
/**
* Build project page
- * @version 0.1
- * @since 30-06-2015
+ * @version 0.2
+ * @since 01-07-2015
* @author Juha Sippola
*/
@@ -62,7 +62,13 @@
{% for link in breadcrumb %}
<li><a href="{{ link.link }}">{{ link.name }}</a></li>
{% endfor %}
- <li class="active">{{ project.getName }}</li>
+ {% if targetOs == '' and conf == '' %}
+ <li class="active">{{ project.getName }}</li>
+ {% elseif targetOs != '' %}
+ <li class="active">{{ targetOs }}</li>
+ {% elseif conf != '' %}
+ <li class="active">{{ conf }}</li>
+ {% endif %}
</ol>
<div class="container-fluid">
@@ -86,6 +92,28 @@
<small>{{ refreshed }}</small>
</h1>
+ {##### Platform buttons #####}
+
+ <div>
+ {% for platform in platforms %}
+ {% if platform.os == targetOs %}
+ {% set buttonStyle = 'btn-primary' %}
+ {% else %}
+ {% set buttonStyle = 'btn-default' %}
+ {% endif %}
+ <div class="btn-group">
+ <a class="btn {{ buttonStyle }} btn-xs" href="{{ platformRoute }}/{{ platform.os }}" role="button">{{ platform.os }}</a>
+ </div>
+ {% endfor %}
+ {% if conf != '' %}
+ {% set link = confRoute ~ '/' ~ conf|url_encode %}
+ <div class="btn-group">
+ <a class="btn btn-info btn-xs" href="{{ link }}" role="button">{{ conf }}</a>
+ </div>
+ {% endif %}
+ </div>
+ <hr>
+
{##### Info well #####}
<div class="collapse" id="info">
@@ -256,7 +284,25 @@
</tr>
{% endif %}
<tr>
- <td class="rightBorder"><small>{{ run.getName }}</small></td>
+ {% if conf == '' %}
+ {% set link = confRoute ~ '/' ~ run.getName|url_encode %}
+ {% set tooltip = 'click to filter this configuration' %}
+ <td class="rightBorder">
+ <a href="{{ link }}">
+ <small>
+ <span data-toggle="tooltip" data-placement="top" title="{{ tooltip }}">
+ {{ run.getName }}
+ </span>
+ </small>
+ </a>
+ </td>
+ {% else %}
+ <td class="rightBorder">
+ <small>
+ {{ run.getName }}
+ </small>
+ </td>
+ {% endif %}
{% set buildKeyIndexPrinted = -1 %}
{% endif %}
diff --git a/non-puppet/qtmetrics2/templates/home.html b/non-puppet/qtmetrics2/templates/home.html
index b9d3486..2896242 100644
--- a/non-puppet/qtmetrics2/templates/home.html
+++ b/non-puppet/qtmetrics2/templates/home.html
@@ -34,8 +34,8 @@
/**
* Home page
- * @version 0.4
- * @since 30-06-2015
+ * @version 0.5
+ * @since 01-07-2015
* @author Juha Sippola
*/
@@ -79,31 +79,9 @@
<h2>Platforms</h2>
<p>See target platform status:</p>
<div>
- {% set all_os = [] %}
{% for platform in platforms %}
- {% set all_os = all_os|merge([platform.os]) %}
- {% endfor %}
- {# Remove duplicates #}
- {% set os = [] %}
- {% for name in all_os %}
- {% if name not in os %}
- {% set os = os|merge([name]) %}
- {% endif %}
- {% endfor %}
- {% for name in os %}
<div class="btn-group">
- <button type="button" class="btn btn-primary btn-xs dropdown-toggle" disabled="disabled"
- data-toggle="dropdown" aria-expanded="false">{{ name }}<span class="caret"></span>
- </button>
- <ul class="dropdown-menu textSmall" role="menu">
- {% for platform in platforms %}
- {% if platform.os == name %}
- <li><a href="{{ platformRoute }}/{{ os_name }}/{{ platform.os_version }}">
- {{ (platform.os_version is empty) ? '(no version)' : platform.os_version }}
- </a></li>
- {% endif %}
- {% endfor %}
- </ul>
+ <a class="btn btn-primary btn-xs" href="{{ platformRoute }}/{{ platform.os }}" role="button">{{ platform.os }}</a>
</div>
{% endfor %}
</div>
@@ -152,8 +130,8 @@
<br>
<p>See testset lists:</p>
<div>
- <a class="btn btn-primary btn-xs" href="{{ testRoute }}/top" role="button">top failures</a>
- <a class="btn btn-primary btn-xs" href="{{ testRoute }}/flaky" role="button">flaky testsets</a>
+ <a class="btn btn-primary btn-xs" href="{{ topRoute }}" role="button">top failures</a>
+ <a class="btn btn-primary btn-xs" href="{{ flakyRoute }}" role="button">flaky testsets</a>
</div>
</div>
@@ -166,13 +144,6 @@
<div class="col-md-4">
<hr>
- <h2>Branches</h2>
- <p>See branch status:</p>
- <div>
- {% for branch in branches %}
- <a class="btn btn-primary btn-xs" disabled="disabled" href="{{ branchRoute }}/{{ branch.name }}" role="button">{{ branch.name }}</a>
- {% endfor %}
- </div>
</div>
<div class="col-md-1">
@@ -184,11 +155,6 @@
</div>
-<br>
-<div class="alert alert-danger" role="alert">
- <strong>Under construction!</strong> Only few subpages implemented at the moment (those buttons enabled).
-</div>
-
{% include "footer.html" %}
{# Local scripts for this page #}
diff --git a/non-puppet/qtmetrics2/templates/overview.html b/non-puppet/qtmetrics2/templates/overview.html
index 8ccb955..6b45757 100644
--- a/non-puppet/qtmetrics2/templates/overview.html
+++ b/non-puppet/qtmetrics2/templates/overview.html
@@ -34,8 +34,8 @@
/**
* Overview page
- * @version 0.1
- * @since 30-06-2015
+ * @version 0.2
+ * @since 01-07-2015
* @author Juha Sippola
*/
@@ -61,7 +61,7 @@
{##### Title #####}
<h1 class="page-header">
- Overview: {{ masterProject }} {{ masterState }}
+ Overview
<button type="button" class="btn btn-xs btn-info" data-toggle="collapse" data-target="#info" aria-expanded="false" aria-controls="info">
<span class="glyphicon glyphicon-info-sign"></span>
</button>
@@ -77,9 +77,9 @@
<li><strong>Latest {{ masterProject }} {{ masterState }} Build Status</strong> shows
the overall result of the latest <strong>{{ masterProject }} {{ masterState }}</strong>
builds themselves by branch; details on the runs are available as tooltip on result icon.</li>
- <li><strong>Latest Testing Status</strong> shows the status based on testset results
- in the latest <strong>{{ masterProject }} {{ masterState }}</strong> builds in any
- configuration by testset project across all branches.</li>
+ <li><strong>Latest {{ masterProject }} {{ masterState }} Testing Status</strong> shows
+ the status based on testset results in the latest <strong>{{ masterProject }}
+ {{ masterState }}</strong> builds in any configuration by testset project across all branches.</li>
</ul>
</div>
</div>
@@ -104,7 +104,7 @@
<tbody>
<tr>
{# Project name #}
- <td class="rightBorder"><a href="{{ buildProjectRoute }}/{{ masterProject }}">{{ masterProject }}</a></td>
+ <td class="rightBorder"><a href="{{ buildProjectRoute }}">{{ masterProject }}</a></td>
{# Result (by branch) #}
{% for run in latestProjectRuns %}
@@ -140,7 +140,7 @@
<div class="panel panel-primary">
<div class="panel-heading">
- <h4 class="panel-title bold">Latest Testing Status</h4>
+ <h4 class="panel-title bold">Latest {{ masterProject }} {{ masterState }} Testing Status</h4>
</div>
{# Get branches and projects #}