From 2d6842e62d5ab8a4f67175366abfb4d832282548 Mon Sep 17 00:00:00 2001
From: Christian Stenger <christian.stenger@nokia.com>
Date: Mon, 5 Sep 2011 11:00:32 +0200
Subject: [PATCH] Improved build handling when build fails without errors
 inside build issues

Change-Id: I0958a9a8e644c245fb0930f5d165e0aac4a74ce8
Reviewed-on: http://codereview.qt.nokia.com/4184
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Bill King <bill.king@nokia.com>
---
 tests/system/shared/build_utils.py | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py
index ade94200fe4..8b02d2e6497 100644
--- a/tests/system/shared/build_utils.py
+++ b/tests/system/shared/build_utils.py
@@ -92,7 +92,27 @@ def checkLastBuild(expectedToFail=False):
 def handleBuildFinished(object, success):
     global buildFinished, buildSucceeded
     buildFinished = True
-    buildSucceeded = checkLastBuild()
+    if success:
+        buildSucceeded = checkLastBuild()
+    else:
+        test.fatal("Build failed")
+        buildSucceeded = success
+        checkCompile()
+        checkLastBuild()
+
+# helper function to check the compilation when build wasn't successful
+def checkCompile():
+    toggleCompOutput = waitForObject("{type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' "
+                                      "window=':Qt Creator_Core::Internal::MainWindow' occurrence='4'}", 20000)
+    if not toggleCompOutput.checked:
+        clickButton(toggleCompOutput)
+    output = waitForObject("{type='Core::OutputWindow' unnamed='1' visible='1' windowTitle='Compile Output'"
+                                 " window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
+    waitFor("len(str(output.plainText))>0",5000)
+    if str(output.plainText).lower().find("error")==-1:
+        test.log("Compile Output:\n%s" % output.plainText)
+    else:
+        test.fatal("Compile Output:\n%s" % output.plainText)
 
 # after starting to build an application this function can be used to synchronize the following tests
 # make sure to set global variable buildFinished to False before starting to build
-- 
GitLab