Attached Files | 0001-BUG-Handle-0-builds-and-0-failed-tests-cases-properl.patch [^] (3,827 bytes) 2013-09-14 12:26 [Show Content] [Hide Content]From 886302bef9de9348747d12beab9517990bcbffb8 Mon Sep 17 00:00:00 2001
From: Igor Murzov <e-mail@date.by>
Date: Mon, 9 Sep 2013 20:40:58 +0400
Subject: [PATCH] BUG: Handle '0 builds' and '0 failed tests' cases properly.
This commit fixes the following error:
ERROR: syntax error at or near ")" at character 1
STATEMENT: ) AND build2test.testid=test.id AND build2test.status NOT LIKE 'passed'
---
testOverview.php | 88 +++++++++++++++++++++++++++++-------------------------
1 file changed, 47 insertions(+), 41 deletions(-)
diff --git a/testOverview.php b/testOverview.php
index 4ba577f..86254c2 100644
--- a/testOverview.php
+++ b/testOverview.php
@@ -125,24 +125,30 @@ while($buildRow = pdo_fetch_array($buildResult))
//find all the tests that were performed for this project on this date
//skip tests that passed on all builds
-$firstTime = TRUE;
-$testQuery = "";
-foreach($builds as $id)
-{
-if($firstTime)
+if(count($builds) > 0)
{
- $testQuery =
- "SELECT DISTINCT test.name FROM test,build2test WHERE (build2test.buildid='$id'";
- $firstTime = FALSE;
+ $testQuery = "SELECT DISTINCT test.name FROM test,build2test WHERE (";
+ $firstTime = TRUE;
+ foreach($builds as $id)
+ {
+ if($firstTime)
+ {
+ $testQuery .= "build2test.buildid='$id'";
+ $firstTime = FALSE;
+ }
+ else
+ {
+ $testQuery .= " OR build2test.buildid='$id'";
+ }
+ }
+ $testQuery .= ") AND build2test.testid=test.id AND build2test.status NOT LIKE 'passed'";
+ @$testResult = pdo_query($testQuery);
}
else
{
- $testQuery .= " OR build2test.buildid='$id'";
+ $testResult = FALSE;
}
-}
-$testQuery .= ") AND build2test.testid=test.id AND build2test.status NOT LIKE 'passed'";
-@$testResult = pdo_query($testQuery);
if($testResult !== FALSE)
{
$tests = array();
@@ -150,42 +156,42 @@ if($testResult !== FALSE)
{
array_push($tests, $testRow["name"]);
}
- natcasesort($tests);
-
- //now generate some XML
- $xml .= "<tests>\n";
- $previousLetter = "";
- $firstSection = TRUE;
- foreach($tests as $testName)
+
+ if(count($tests) > 0)
{
- $letter = strtolower(substr($testName, 0, 1));
- if($letter != $previousLetter)
+ natcasesort($tests);
+
+ //now generate some XML
+ $xml .= "<tests>\n";
+ $previousLetter = "";
+ $firstSection = TRUE;
+ foreach($tests as $testName)
{
- if($firstSection)
- {
- $xml .= "<section>\n";
- $firstSection = FALSE;
- }
- else
+ $letter = strtolower(substr($testName, 0, 1));
+ if($letter != $previousLetter)
{
- $xml .= "</section>\n<section>";
+ if($firstSection)
+ {
+ $xml .= "<section>\n";
+ $firstSection = FALSE;
+ }
+ else
+ {
+ $xml .= "</section>\n<section>";
+ }
+ $xml .= add_XML_value("sectionName", $letter) . "\n";
+ $previousLetter = $letter;
}
- $xml .= add_XML_value("sectionName", $letter) . "\n";
- $previousLetter = $letter;
+ $xml .= "<test>\n";
+ $xml .= add_XML_value("testName", $testName) . "\n";
+ $summaryLink = "testSummary.php?project=$projectid&name=$testName&date=$today";
+ $xml .= add_XML_value("summaryLink", $summaryLink) . "\n";
+ $xml .= "</test>\n";
}
- $xml .= "<test>\n";
- $xml .= add_XML_value("testName", $testName) . "\n";
- $summaryLink = "testSummary.php?project=$projectid&name=$testName&date=$today";
- $xml .= add_XML_value("summaryLink", $summaryLink) . "\n";
- $xml .= "</test>\n";
- }
-
- if(count($tests)>0)
- {
$xml .= "</section>\n";
+ $xml .= "</tests>\n";
}
- $xml .= "</tests>\n";
- }
+ }
$xml .= "</cdash>";
generate_XSLT($xml, "testOverview");
--
1.7.9.5
|