From 525cf2353e3a4d2957f0992a8078175c640aa1f4 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 3 May 2012 11:47:35 +0200 Subject: Squish: Support more than one breakpoint per file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic33e039fe5aea9caed5a3e992a74938e331e2a4b Reviewed-by: Robert Löhning --- tests/system/shared/debugger.py | 21 +++++++++-------- tests/system/shared/utils.py | 27 ++++++++++++---------- .../system/suite_debugger/tst_simple_debug/test.py | 8 +++---- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/tests/system/shared/debugger.py b/tests/system/shared/debugger.py index cfe40bfaeb..dc173ad20a 100644 --- a/tests/system/shared/debugger.py +++ b/tests/system/shared/debugger.py @@ -35,7 +35,7 @@ def takeDebuggerLog(): return debuggerLog # function to set breakpoints for the current project -# on the given file,line pairs inside the given dict +# on the given file,line pairs inside the given list of dicts # the lines are treated as regular expression def setBreakpointsForCurrentProject(filesAndLines): # internal helper for setBreakpointsForCurrentProject @@ -52,18 +52,19 @@ def setBreakpointsForCurrentProject(filesAndLines): switchViewTo(ViewConstants.DEBUG) removeOldBreakpoints() - if not filesAndLines or not isinstance(filesAndLines, dict): - test.fatal("This function only takes a non-empty dict.") + if not filesAndLines or not isinstance(filesAndLines, (list,tuple)): + test.fatal("This function only takes a non-empty list/tuple holding dicts.") return False navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' " "window=':Qt Creator_Core::Internal::MainWindow'}", 20000) - for curFile,curLine in filesAndLines.iteritems(): - fName = __doubleClickFile__(navTree, curFile) - editor = getEditorForFileSuffix(curFile) - if not placeCursorToLine(editor, curLine, True): - return False - invokeMenuItem("Debug", "Toggle Breakpoint") - test.log('Set breakpoint in %s' % fName, curLine) + for current in filesAndLines: + for curFile,curLine in current.iteritems(): + fName = __doubleClickFile__(navTree, curFile) + editor = getEditorForFileSuffix(curFile) + if not placeCursorToLine(editor, curLine, True): + return False + invokeMenuItem("Debug", "Toggle Breakpoint") + test.log('Set breakpoint in %s' % fName, curLine) try: breakPointTreeView = waitForObject("{type='Debugger::Internal::BreakWindow' visible='1' " "windowTitle='Breakpoints' name='Debugger.Docks.Break'}") diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 9809b6f00d..ca971c6842 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -375,7 +375,8 @@ def checkDebuggingLibrary(targVersion, targets): # param keepOptionsOpen set to True if the Options dialog should stay open when # leaving this function # param additionalFunction pass a function or name of a defined function to execute -# for each item on the list of Qt versions +# for each correctly configured item on the list of Qt versions +# (Qt versions having no assigned toolchain, failing qmake,... will be skipped) # this function must take at least 2 parameters - the first is the target name # and the second the version of the current selected Qt version item # param argsForAdditionalFunc you can specify as much parameters as you want to pass @@ -411,17 +412,19 @@ def iterateQtVersions(keepOptionsOpen=False, additionalFunction=None, *argsForAd target = matches.group("target").strip() version = matches.group("version").strip() result.append({target:version}) - if additionalFunction: - try: - if isinstance(additionalFunction, (str, unicode)): - currResult = globals()[additionalFunction](target, version, *argsForAdditionalFunc) - else: - currResult = additionalFunction(target, version, *argsForAdditionalFunc) - except: - currResult = None - test.fatal("Function to additionally execute on Options Dialog could not be found or " - "an exception occured while executing it.") - additionalResult.append(currResult) + if additionalFunction: + try: + if isinstance(additionalFunction, (str, unicode)): + currResult = globals()[additionalFunction](target, version, *argsForAdditionalFunc) + else: + currResult = additionalFunction(target, version, *argsForAdditionalFunc) + except: + import sys + t,v,tb = sys.exc_info() + currResult = None + test.fatal("Function to additionally execute on Options Dialog could not be found or " + "an exception occured while executing it.", "%s(%s)" % (str(t), str(v))) + additionalResult.append(currResult) if not keepOptionsOpen: clickButton(waitForObject(":Options.Cancel_QPushButton")) if additionalFunction: diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py index 69f40d5936..b7c818aa2e 100644 --- a/tests/system/suite_debugger/tst_simple_debug/test.py +++ b/tests/system/suite_debugger/tst_simple_debug/test.py @@ -25,10 +25,10 @@ def main(): 'running: true', 'onTriggered: console.log("Break here")']) invokeMenuItem("File", "Save All") - filesAndLines = { - "%s.QML.qml/%s.main\\.qml" % (projectName,projectName) : 'onTriggered:.*', - "%s.Sources.main\\.cpp" % projectName : "viewer.setOrientation\\(.+\\);" - } + filesAndLines = [ + { "%s.QML.qml/%s.main\\.qml" % (projectName,projectName) : 'onTriggered.*' }, + { "%s.Sources.main\\.cpp" % projectName : "viewer.setOrientation\\(.+\\);" } + ] test.log("Setting breakpoints") result = setBreakpointsForCurrentProject(filesAndLines) if result: -- cgit v1.2.3