summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Loehning <robert.loehning@digia.com>2014-01-21 17:29:35 +0100
committerRobert Loehning <robert.loehning@digia.com>2014-01-22 10:13:02 +0100
commit52bff97cfa3b91d88a48f76ca7cd0584407594d4 (patch)
treed53e4ea1917065c58f9aa6280874e104e5e07eec
parentfb114e38826585b8d1b0202be5923789839a7c93 (diff)
downloadqt-creator-52bff97cfa3b91d88a48f76ca7cd0584407594d4.tar.gz
Squish: Replaced lot of signal code by one simple function
Change-Id: Idb6b663a8b2be217d8769fab5e2f6f9290f37990 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
-rw-r--r--tests/system/shared/build_utils.py35
-rw-r--r--tests/system/shared/project.py2
-rw-r--r--tests/system/shared/utils.py37
-rwxr-xr-xtests/system/suite_CCOM/tst_CCOM01/test.py2
-rw-r--r--tests/system/suite_SCOM/tst_SCOM01/test.py2
-rw-r--r--tests/system/suite_SCOM/tst_SCOM04/test.py2
-rw-r--r--tests/system/suite_SCOM/tst_SCOM05/test.py2
-rw-r--r--tests/system/suite_debugger/tst_debug_empty_main/test.py2
-rw-r--r--tests/system/suite_debugger/tst_simple_analyze/test.py3
-rw-r--r--tests/system/suite_debugger/tst_simple_debug/test.py3
-rw-r--r--tests/system/suite_editors/tst_qml_editor/test.py4
-rw-r--r--tests/system/suite_general/tst_build_speedcrunch/test.py4
-rw-r--r--tests/system/suite_general/tst_cmake_speedcrunch/test.py2
-rw-r--r--tests/system/suite_qtquick/tst_qtquick_creation/test.py2
-rw-r--r--tests/system/suite_qtquick/tst_qtquick_creation4/test.py2
15 files changed, 19 insertions, 85 deletions
diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py
index 83188d5ed7..b4b091b63c 100644
--- a/tests/system/shared/build_utils.py
+++ b/tests/system/shared/build_utils.py
@@ -29,38 +29,9 @@
import re;
-# dictionary to hold a list of all installed handler functions for all object-signalSignature pairs
-installedSignalHandlers = {}
-# flag to indicate whether overrideInstallLazySignalHandler() has been called already
-overridenInstallLazySignalHandlers = False
# flag to indicate whether a tasks file should be created when building ends with errors
createTasksFileOnError = True
-# call this function to override installLazySignalHandler()
-def overrideInstallLazySignalHandler():
- global overridenInstallLazySignalHandlers
- if overridenInstallLazySignalHandlers:
- return
- overridenInstallLazySignalHandlers = True
- global installLazySignalHandler
- installLazySignalHandler = __addSignalHandlerDict__(installLazySignalHandler)
-
-# avoids adding a handler to a signal twice or more often
-# do not call this function directly - use overrideInstallLazySignalHandler() instead
-def __addSignalHandlerDict__(lazySignalHandlerFunction):
- global installedSignalHandlers
- def wrappedFunction(name, signalSignature, handlerFunctionName):
- handlers = installedSignalHandlers.get("%s____%s" % (name,signalSignature))
- if handlers == None:
- lazySignalHandlerFunction(name, signalSignature, handlerFunctionName)
- installedSignalHandlers.setdefault("%s____%s" % (name,signalSignature), [handlerFunctionName])
- else:
- if not handlerFunctionName in handlers:
- lazySignalHandlerFunction(name, signalSignature, handlerFunctionName)
- handlers.append(handlerFunctionName)
- installedSignalHandlers.setdefault("%s____%s" % (name,signalSignature), handlers)
- return wrappedFunction
-
# this method checks the last build (if there's one) and logs the number of errors, warnings and
# lines within the Issues output
# optional parameter can be used to tell this function if the build was expected to fail or not
@@ -105,6 +76,12 @@ def compileSucceeded(compileOutput):
return None != re.match(".*exited normally\.\n\d\d:\d\d:\d\d: Elapsed time: "
"(\d:)?\d{2}:\d\d\.$", str(compileOutput), re.S)
+def waitForCompile(timeout=60000):
+ ensureChecked(":Qt Creator_CompileOutput_Core::Internal::OutputPaneToggleButton")
+ output = waitForObject(":Qt Creator.Compile Output_Core::OutputWindow")
+ if not waitFor("re.match('.*Elapsed time: (\d:)?\d{2}:\d\d\.$', str(output.plainText), re.S)", timeout):
+ test.warning("Waiting for compile timed out after %d s." % (timeout / 1000))
+
def dumpBuildIssues(listModel):
issueDump = []
for row in range(listModel.rowCount()):
diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py
index 9fdd1491b4..7979e05a2b 100644
--- a/tests/system/shared/project.py
+++ b/tests/system/shared/project.py
@@ -401,7 +401,7 @@ def runAndCloseApp(withHookInto=False, executable=None, port=None, function=None
runButton = waitForObject(":*Qt Creator.Run_Core::Internal::FancyToolButton")
clickButton(runButton)
if sType != SubprocessType.QT_QUICK_UI:
- waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
+ waitForCompile(300000)
buildSucceeded = checkLastBuild()
ensureChecked(waitForObject(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton"))
if not buildSucceeded:
diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py
index 0d7c5f2050..09d5a74c1e 100644
--- a/tests/system/shared/utils.py
+++ b/tests/system/shared/utils.py
@@ -169,43 +169,6 @@ def which(program):
return cf
return None
-signalObjects = {}
-
-# do not call this function directly - it's only a helper
-def __callbackFunction__(object, *args):
- global signalObjects
-# test.log("__callbackFunction__: "+objectMap.realName(object))
- signalObjects[objectMap.realName(object)] += 1
-
-def waitForSignal(object, signal, timeout=30000):
- global signalObjects
- realName = prepareForSignal(object, signal)
- beforeCount = signalObjects[realName]
- waitFor("signalObjects[realName] > beforeCount", timeout)
-
-handledSignal = {}
-
-def prepareForSignal(object, signal):
- global signalObjects
- global handledSignal
- overrideInstallLazySignalHandler()
- realName = objectMap.realName(object)
-# test.log("waitForSignal: "+realName)
- if realName in handledSignal.keys():
- if handledSignal[realName] != signal:
- # The current implementation does not support this.
- # When an object has two different handled signals, waitForSignal() will only wait
- # for the first of them to be emitted.
- test.warning("You are trying to handle two different signals from the same object.",
- "Adding %s to object %s, which already has handled signal %s. "
- "This can lead to unexpected results." % (signal, realName, handledSignal[realName]))
- else:
- handledSignal[realName] = signal
- if not (realName in signalObjects):
- signalObjects[realName] = 0
- installLazySignalHandler(object, signal, "__callbackFunction__")
- return realName
-
# this function removes the user files of given pro file(s)
# can be called with a single string object or a list of strings holding path(s) to
# the pro file(s) returns False if it could not remove all user files or has been
diff --git a/tests/system/suite_CCOM/tst_CCOM01/test.py b/tests/system/suite_CCOM/tst_CCOM01/test.py
index b8a02903f0..e65bfd737b 100755
--- a/tests/system/suite_CCOM/tst_CCOM01/test.py
+++ b/tests/system/suite_CCOM/tst_CCOM01/test.py
@@ -59,7 +59,7 @@ def main():
# try to build project
test.log("Testing build configuration: " + config)
invokeMenuItem("Build", "Build All")
- waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
+ waitForCompile()
# verify build successful
ensureChecked(waitForObject(":Qt Creator_CompileOutput_Core::Internal::OutputPaneToggleButton"))
compileOutput = waitForObject(":Qt Creator.Compile Output_Core::OutputWindow")
diff --git a/tests/system/suite_SCOM/tst_SCOM01/test.py b/tests/system/suite_SCOM/tst_SCOM01/test.py
index 7749cf516d..caf82c42e4 100644
--- a/tests/system/suite_SCOM/tst_SCOM01/test.py
+++ b/tests/system/suite_SCOM/tst_SCOM01/test.py
@@ -46,7 +46,7 @@ def main():
# try to compile
test.log("Testing build configuration: " + config)
clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton"))
- waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
+ waitForCompile()
# check output if build successful
ensureChecked(waitForObject(":Qt Creator_CompileOutput_Core::Internal::OutputPaneToggleButton"))
waitFor("object.exists(':*Qt Creator.Cancel Build_QToolButton')", 20000)
diff --git a/tests/system/suite_SCOM/tst_SCOM04/test.py b/tests/system/suite_SCOM/tst_SCOM04/test.py
index 2d502edad9..7cea5b1c73 100644
--- a/tests/system/suite_SCOM/tst_SCOM04/test.py
+++ b/tests/system/suite_SCOM/tst_SCOM04/test.py
@@ -58,7 +58,7 @@ def main():
test.log("Testing build configuration: " + config)
clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton"))
# wait until build finished
- waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
+ waitForCompile()
# open issues list view
ensureChecked(waitForObject(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton"))
issuesView = waitForObject(":Qt Creator.Issues_QListView")
diff --git a/tests/system/suite_SCOM/tst_SCOM05/test.py b/tests/system/suite_SCOM/tst_SCOM05/test.py
index 39f2a3489e..4161697a7a 100644
--- a/tests/system/suite_SCOM/tst_SCOM05/test.py
+++ b/tests/system/suite_SCOM/tst_SCOM05/test.py
@@ -54,7 +54,7 @@ def main():
# build project 2
clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton"))
# wait for build to complete
- waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
+ waitForCompile()
# check output if build successful
ensureChecked(waitForObject(":Qt Creator_CompileOutput_Core::Internal::OutputPaneToggleButton"))
outputLog = str(waitForObject(":Qt Creator.Compile Output_Core::OutputWindow").plainText)
diff --git a/tests/system/suite_debugger/tst_debug_empty_main/test.py b/tests/system/suite_debugger/tst_debug_empty_main/test.py
index ab5eceea28..0d5c68a260 100644
--- a/tests/system/suite_debugger/tst_debug_empty_main/test.py
+++ b/tests/system/suite_debugger/tst_debug_empty_main/test.py
@@ -103,7 +103,7 @@ def performDebugging(workingDir, projectName, checkedTargets):
verifyBuildConfig(len(checkedTargets), kit, True)
progressBarWait(10000)
invokeMenuItem("Build", "Rebuild All")
- waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
+ waitForCompile()
isMsvc = isMsvcConfig(len(checkedTargets), kit)
allowAppThroughWinFW(workingDir, projectName, False)
clickButton(waitForObject(":*Qt Creator.Start Debugging_Core::Internal::FancyToolButton"))
diff --git a/tests/system/suite_debugger/tst_simple_analyze/test.py b/tests/system/suite_debugger/tst_simple_analyze/test.py
index 2eeface8a4..d3a5a155db 100644
--- a/tests/system/suite_debugger/tst_simple_analyze/test.py
+++ b/tests/system/suite_debugger/tst_simple_analyze/test.py
@@ -75,8 +75,7 @@ def performTest(workingDir, projectName, targetCount, availableConfigs, disableO
switchViewTo(ViewConstants.EDIT)
# explicitly build before start debugging for adding the executable as allowed program to WinFW
invokeMenuItem("Build", "Rebuild All")
- waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}",
- "buildQueueFinished(bool)")
+ waitForCompile()
if not checkCompile():
test.fatal("Compile had errors... Skipping current build config")
continue
diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py
index 6b17cd3a38..e8ac618f07 100644
--- a/tests/system/suite_debugger/tst_simple_debug/test.py
+++ b/tests/system/suite_debugger/tst_simple_debug/test.py
@@ -70,8 +70,7 @@ def main():
verifyBuildConfig(len(checkedTargets), kit, True, enableQmlDebug=True)
# explicitly build before start debugging for adding the executable as allowed program to WinFW
invokeMenuItem("Build", "Rebuild All")
- waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}",
- "buildQueueFinished(bool)", 300000)
+ waitForCompile(300000)
if not checkCompile():
test.fatal("Compile had errors... Skipping current build config")
continue
diff --git a/tests/system/suite_editors/tst_qml_editor/test.py b/tests/system/suite_editors/tst_qml_editor/test.py
index 4c42760532..7a24659d05 100644
--- a/tests/system/suite_editors/tst_qml_editor/test.py
+++ b/tests/system/suite_editors/tst_qml_editor/test.py
@@ -60,10 +60,6 @@ def testRenameId():
files = ["Core.ContextMenu\\.qml", "Core.GridMenu\\.qml", "Core.ListMenu\\.qml", "focus\\.qml"]
originalTexts = {}
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
- # temporarily store editor content for synchronizing purpose
- # usage of formerTxt is done because I couldn't get waitForSignal() to work
- # it always stored a different object into the signalObjects map as it looked up afterwards
- # although used objectMap.realName() for both
formerTxt = editor.plainText
for file in files:
openDocument("focus.QML.qml.%s" % file)
diff --git a/tests/system/suite_general/tst_build_speedcrunch/test.py b/tests/system/suite_general/tst_build_speedcrunch/test.py
index e5f42d75bc..ec1baab897 100644
--- a/tests/system/suite_general/tst_build_speedcrunch/test.py
+++ b/tests/system/suite_general/tst_build_speedcrunch/test.py
@@ -65,9 +65,9 @@ def main():
continue
test.log("Testing build configuration: " + config)
invokeMenuItem("Build", "Run qmake")
- waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
+ waitForCompile()
invokeMenuItem("Build", "Rebuild All")
- waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
+ waitForCompile(300000)
checkCompile()
checkLastBuild()
diff --git a/tests/system/suite_general/tst_cmake_speedcrunch/test.py b/tests/system/suite_general/tst_cmake_speedcrunch/test.py
index 345fe370e6..6fd6fc94fb 100644
--- a/tests/system/suite_general/tst_cmake_speedcrunch/test.py
+++ b/tests/system/suite_general/tst_cmake_speedcrunch/test.py
@@ -56,7 +56,7 @@ def main():
invokeMenuItem("Build", "Rebuild All")
# Wait for, and test if the build succeeded
- waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
+ waitForCompile(300000)
checkCompile()
checkLastBuild()
diff --git a/tests/system/suite_qtquick/tst_qtquick_creation/test.py b/tests/system/suite_qtquick/tst_qtquick_creation/test.py
index 48ba6fb469..9604148773 100644
--- a/tests/system/suite_qtquick/tst_qtquick_creation/test.py
+++ b/tests/system/suite_qtquick/tst_qtquick_creation/test.py
@@ -42,7 +42,7 @@ def main():
% (qVer, Targets.getStringForTarget(targ)))
result = modifyRunSettingsForHookInto(projectName, len(checkedTargets), 11223)
invokeMenuItem("Build", "Build All")
- waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
+ waitForCompile()
if not checkCompile():
test.fatal("Compile failed")
else:
diff --git a/tests/system/suite_qtquick/tst_qtquick_creation4/test.py b/tests/system/suite_qtquick/tst_qtquick_creation4/test.py
index 570d38c643..d9ee75ee9a 100644
--- a/tests/system/suite_qtquick/tst_qtquick_creation4/test.py
+++ b/tests/system/suite_qtquick/tst_qtquick_creation4/test.py
@@ -41,7 +41,7 @@ def main():
test.log("Building project Qt Quick %d Extension Plugin (%s)"
% (quickVer, Targets.getStringForTarget(targ)))
invokeMenuItem("Build","Build All")
- waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
+ waitForCompile()
checkCompile()
checkLastBuild()
invokeMenuItem("File", "Close All Projects and Editors")