From 97207cf28c688e3af47b3e56c3a1e687add4790c Mon Sep 17 00:00:00 2001
From: Robert Loehning <robert.loehning@nokia.com>
Date: Thu, 6 Oct 2011 16:46:03 +0200
Subject: [PATCH] Squish: Improved function checkCompile()

Change-Id: Ib1b0dada442dc58f1e56343cf4ae602650291fcf
Reviewed-on: http://codereview.qt-project.org/6167
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Christian Stenger <christian.stenger@nokia.com>
---
 tests/system/shared/build_utils.py                   |  6 ++++--
 .../suite_qtquick/tst_qtquick_creation/test.py       | 12 +++++++-----
 .../suite_qtquick/tst_qtquick_creation2/test.py      | 12 +++++++-----
 3 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py
index 0f9908205dc..58728bcb0b2 100644
--- a/tests/system/shared/build_utils.py
+++ b/tests/system/shared/build_utils.py
@@ -91,10 +91,12 @@ def checkCompile():
     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:
+    success = str(output.plainText).lower().find("error")==-1
+    if success:
         test.log("Compile Output:\n%s" % output.plainText)
     else:
-        test.fatal("Compile Output:\n%s" % output.plainText)
+        test.fail("Compile Output:\n%s" % output.plainText)
+    return success
 
 # helper method that parses the Issues output and writes a tasks file
 def createTasksFile(list):
diff --git a/tests/system/suite_qtquick/tst_qtquick_creation/test.py b/tests/system/suite_qtquick/tst_qtquick_creation/test.py
index f3ec8439f75..f92d57ee4b8 100644
--- a/tests/system/suite_qtquick/tst_qtquick_creation/test.py
+++ b/tests/system/suite_qtquick/tst_qtquick_creation/test.py
@@ -13,11 +13,13 @@ def main():
     test.log("Building project")
     invokeMenuItem("Build","Build All")
     waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
-    checkCompile()
-    checkLastBuild()
-    test.log("Running project (includes build)")
-    if runAndCloseApp():
-        logApplicationOutput()
+    if not checkCompile():
+        test.fatal("Compile failed")
+    else:
+        checkLastBuild()
+        test.log("Running project (includes build)")
+        if runAndCloseApp():
+            logApplicationOutput()
     invokeMenuItem("File", "Exit")
 
 def createNewQtQuickApplication():
diff --git a/tests/system/suite_qtquick/tst_qtquick_creation2/test.py b/tests/system/suite_qtquick/tst_qtquick_creation2/test.py
index 9a4923abcbb..1e70ab4299a 100644
--- a/tests/system/suite_qtquick/tst_qtquick_creation2/test.py
+++ b/tests/system/suite_qtquick/tst_qtquick_creation2/test.py
@@ -18,11 +18,13 @@ def main():
     test.log("Building project")
     invokeMenuItem("Build","Build All")
     waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
-    checkCompile()
-    checkLastBuild()
-    test.log("Running project (includes build)")
-    if runAndCloseApp():
-        logApplicationOutput()
+    if not checkCompile():
+        test.fatal("Compile failed")
+    else:
+        checkLastBuild()
+        test.log("Running project (includes build)")
+        if runAndCloseApp():
+            logApplicationOutput()
     invokeMenuItem("File", "Exit")
 
 def prepareTemplate(sourceExample):
-- 
GitLab