Commit 991e19b4 authored by Christian Stenger's avatar Christian Stenger Committed by Bill King
Browse files

Refactoring build functions, enhancing signal handlers

Added functionality to remove the need to clean settings by yourself

Change-Id: If2d95618d5e77e30480d0ca763ad7ce632f2d094
Reviewed-on: http://codereview.qt.nokia.com/3984

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarBill King <bill.king@nokia.com>
parent 507d260b
......@@ -2,23 +2,34 @@ import platform;
import shutil;
import os;
import glob;
import atexit;
SDKPath = ''
SettingsPath = ''
tmpSettingsDir = ''
testSettings.logScreenshotOnFail = True
source("../../shared/utils.py")
source("../../shared/build_utils.py")
source("../../shared/mainwin.py")
def removeTmpSettingsDir():
snooze(5)
deleteDirIfExists(os.path.dirname(tmpSettingsDir))
if platform.system() in ('Windows', 'Microsoft'):
SDKPath = "C:/QtSDK/src"
cwd = os.getcwd() # current dir is directory holding qtcreator.py
cwd+="/../../settings/windows"
cwd = os.path.abspath(cwd)
SettingsPath = " -settingspath %s" % cwd
else:
SDKPath = os.path.expanduser("~/QtSDK/src")
cwd = os.getcwd() # current dir is directory holding qtcreator.py
cwd+="/../../settings/unix"
cwd = os.path.abspath(cwd)
SettingsPath = " -settingspath %s" % cwd
cwd = os.path.abspath(cwd)
tmpSettingsDir = tempDir()
tmpSettingsDir = os.path.abspath(tmpSettingsDir+"/settings")
shutil.copytree(cwd, tmpSettingsDir)
# the following only doesn't work if the test ends in an exception
atexit.register(removeTmpSettingsDir)
SettingsPath = " -settingspath %s" % tmpSettingsDir
......@@ -62,37 +62,3 @@ def which(program):
return None
def checkLastBuild(expectedToFail=False):
try:
# can't use waitForObject() 'cause visible is always 0
buildProg = findObject("{type='ProjectExplorer::Internal::BuildProgress' unnamed='1' }")
except LookupError:
test.log("checkLastBuild called without a build")
return
# get labels for errors and warnings
children = object.children(buildProg)
if len(children)<4:
test.fatal("Leaving checkLastBuild()", "Referred code seems to have changed - method has to get adjusted")
return
errors = children[2].text
if errors == "":
errors = "none"
warnings = children[4].text
if warnings == "":
warnings = "none"
gotErrors = errors != "none" and errors != "0"
if (gotErrors and expectedToFail) or (not expectedToFail and not gotErrors):
test.passes("Errors: %s" % errors)
test.passes("Warnings: %s" % warnings)
else:
test.fail("Errors: %s" % errors)
test.fail("Warnings: %s" % warnings)
# additional stuff - could be removed... or improved :)
toggleBuildIssues = waitForObject("{type='Core::Internal::OutputPaneToggleButton' unnamed='1' "
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
if not toggleBuildIssues.checked:
clickButton(toggleBuildIssues)
list=waitForObject("{type='QListView' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Build Issues'}", 20000)
model = list.model()
test.log("Rows inside build-issues: %d" % model.rowCount())
......@@ -2,24 +2,12 @@ source("../../shared/qtcreator.py")
import re;
SpeedCrunchPath = ""
buildSucceeded = 0
buildFinished = False
buildSucceeded = False
refreshFinishedCount = 0
def handleBuildFinished(object, success):
global buildFinished, buildSucceeded
buildFinished = True
buildSucceeded = success
def handleRefreshFinished(object, fileList):
global refreshFinishedCount
refreshFinishedCount += 1
def main():
global buildFinished, buildSucceeded
test.verify(os.path.exists(SpeedCrunchPath))
global buildSucceeded, buildFinished
startApplication("qtcreator" + SettingsPath)
openQmakeProject(SpeedCrunchPath)
......@@ -29,19 +17,14 @@ def main():
value = testData.field(record, "value")
test.compare(waitForObject(node).text, value)
# Invoke a rebuild of the application
installLazySignalHandler("{type='CppTools::Internal::CppModelManager'}", "sourceFilesRefreshed(QStringList)", "handleRefreshFinished")
clickButton(waitForObject(":*Qt Creator_Core::Internal::FancyToolButton"))
buildCombo = waitForObject(":Build:_QComboBox")
installLazySignalHandler("{type='ProjectExplorer::BuildManager'}", "buildQueueFinished(bool)", "handleBuildFinished")
sendEvent("QMouseEvent", waitForObject(":QtCreator.MenuBar_ProjectExplorer::Internal::MiniProjectTargetSelector"), QEvent.MouseButtonPress, -5, 5, Qt.LeftButton, 0)
prog = re.compile("Qt.*Release")
for row in range(buildCombo.count):
if prog.match(str(buildCombo.itemText(row))):
clickButton(waitForObject(":*Qt Creator_Core::Internal::FancyToolButton"))
refreshFinishedCount = 0
itemText = buildCombo.itemText(row);
test.log("Testing build configuration: "+str(itemText))
if str(itemText) != str(buildCombo.currentText):
......@@ -50,10 +33,7 @@ def main():
buildSucceeded = 0
buildFinished = False
invokeMenuItem("Build", "Rebuild All")
# Wait for, and test if the build succeeded
waitFor("buildFinished == True", 300000)
test.verify(buildSucceeded == 1) # buildSucceeded is True for me - even on failed builds; remove this check at all?
checkLastBuild()
waitForBuildFinished(300000)
# Add a new run configuration
......
source("../../shared/qtcreator.py")
SpeedCrunchPath = ""
buildFinished = False
buildSucceeded = False
def handleBuildFinished(object, success):
global buildFinished, buildSucceeded
buildFinished = True
buildSucceeded = success
def main():
if(which("cmake") == None):
......@@ -29,13 +22,10 @@ def main():
test.compare(findObject(node).text, value)
# Invoke a rebuild of the application
installLazySignalHandler("{type='ProjectExplorer::BuildManager'}", "buildQueueFinished(bool)", "handleBuildFinished")
invokeMenuItem("Build", "Rebuild All")
# Wait for, and test if the build succeeded
waitFor("buildFinished == True", 300000)
test.verify(buildSucceeded == 1) # buildSucceeded is True for me - even on failed builds; remove this check at all?
checkLastBuild()
waitForBuildFinished(300000)
invokeMenuItem("File", "Exit")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment